Açıklama Yok

WKWebView.ios.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow
  9. * @providesModule WKWebView
  10. */
  11. import React from 'react';
  12. import { requireNativeComponent } from 'react-native';
  13. import type {DataDetectorTypes} from './WebViewTypes';
  14. const RCTWKWebView = requireNativeComponent('RCTWKWebView');
  15. type RCTWKWebViewProps = $ReadOnly<{|
  16. allowsInlineMediaPlayback?: ?boolean,
  17. mediaPlaybackRequiresUserAction?: ?boolean,
  18. dataDetectorTypes?:
  19. | ?DataDetectorTypes
  20. | $ReadOnlyArray<DataDetectorTypes>,
  21. |}>;
  22. class WKWebView extends React.Component<RCTWKWebViewProps> {
  23. componentWillReceiveProps(nextProps: RCTWKWebViewProps) {
  24. this.showRedboxOnPropChanges(nextProps, 'allowsInlineMediaPlayback');
  25. this.showRedboxOnPropChanges(nextProps, 'mediaPlaybackRequiresUserAction');
  26. this.showRedboxOnPropChanges(nextProps, 'dataDetectorTypes');
  27. }
  28. showRedboxOnPropChanges(nextProps: RCTWKWebViewProps, propName: string) {
  29. if (this.props[propName] !== nextProps[propName]) {
  30. console.error(`Changes to property ${propName} do nothing after the initial render.`);
  31. }
  32. }
  33. render() {
  34. return <RCTWKWebView {...this.props} />;
  35. }
  36. }
  37. module.exports = WKWebView;