Nav apraksta

WKWebView.ios.js 992B

12345678910111213141516171819202122232425262728293031323334353637
  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. const RCTWKWebView = requireNativeComponent('RCTWKWebView');
  14. class WKWebView extends React.Component {
  15. componentWillReceiveProps(nextProps) {
  16. this.showRedboxOnPropChanges(nextProps, 'allowsInlineMediaPlayback');
  17. this.showRedboxOnPropChanges(nextProps, 'mediaPlaybackRequiresUserAction');
  18. this.showRedboxOnPropChanges(nextProps, 'dataDetectorTypes');
  19. }
  20. showRedboxOnPropChanges(nextProps, propName) {
  21. if (this.props[propName] !== nextProps[propName]) {
  22. console.error(`Changes to property ${propName} do nothing after the initial render.`);
  23. }
  24. }
  25. render() {
  26. return <RCTWKWebView {...this.props} />;
  27. }
  28. }
  29. module.exports = WKWebView;