No Description

propTypes.js 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import PropTypes from 'prop-types';
  2. import { ViewPropTypes, WebView } from 'react-native';
  3. export const commonPropTypes = {
  4. style: ViewPropTypes.style,
  5. onNavigationStateChange: PropTypes.func,
  6. customScript: PropTypes.string,
  7. customStyle: PropTypes.string,
  8. enableAnimation: PropTypes.bool,
  9. // only works on enable animation
  10. animationDuration: PropTypes.number,
  11. // offset of rn webView margin
  12. heightOffset: PropTypes.number,
  13. // either height or width updated will trigger this
  14. // no support auto width and height will triggered by source changing only on android 6.0 or below version
  15. onSizeUpdated: PropTypes.func,
  16. // 'file:///android_asset/web/' by default on android,
  17. // web/' by default on iOS
  18. baseUrl: PropTypes.string,
  19. // add baseUrl/files... to android/app/src/assets/ on android
  20. // add baseUrl/files... to project root on iOS
  21. files: PropTypes.arrayOf(
  22. PropTypes.shape({
  23. href: PropTypes.string,
  24. type: PropTypes.string,
  25. rel: PropTypes.string
  26. })
  27. ),
  28. // if set to true may cause some layout issues (smaller font size) on iOS
  29. // if set to false may cause some layout issues (width of container will be than width of screen) on android
  30. scalesPageToFit: PropTypes.bool,
  31. // other rn webview props
  32. source: WebView.propTypes.source,
  33. originWhitelist: PropTypes.arrayOf(PropTypes.string),
  34. mediaPlaybackRequiresUserAction: PropTypes.bool,
  35. renderError: PropTypes.func,
  36. onError: PropTypes.func,
  37. onMessage: PropTypes.func,
  38. onLoad: PropTypes.func,
  39. onLoadStart: PropTypes.func,
  40. onLoadEnd: PropTypes.func
  41. };
  42. export const androidPropTypes = {
  43. ...commonPropTypes,
  44. domStorageEnabled: PropTypes.bool,
  45. thirdPartyCookiesEnabled: PropTypes.bool,
  46. userAgent: PropTypes.string,
  47. geolocationEnabled: PropTypes.string,
  48. allowUniversalAccessFromFileURLs: PropTypes.bool,
  49. mixedContentMode: PropTypes.oneOf(['never', 'always', 'compatibility'])
  50. };