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. customScript: PropTypes.string,
  6. customStyle: PropTypes.string,
  7. enableAnimation: PropTypes.bool,
  8. // only works on enable animation
  9. animationDuration: PropTypes.number,
  10. // offset of rn webView margin
  11. heightOffset: PropTypes.number,
  12. // either height or width updated will trigger this
  13. // no support auto width and height will triggered by source changing only on android 5.1 or below version
  14. onSizeUpdated: PropTypes.func,
  15. // 'file:///android_asset/web/' by default on android,
  16. // web/' by default on iOS
  17. baseUrl: PropTypes.string,
  18. // add baseUrl/files... to android/app/src/assets/ on android
  19. // add baseUrl/files... to project root on iOS
  20. files: PropTypes.arrayOf(
  21. PropTypes.shape({
  22. href: PropTypes.string,
  23. type: PropTypes.string,
  24. rel: PropTypes.string
  25. })
  26. ),
  27. // if set to true may cause some layout issues (smaller font size) on iOS
  28. // if set to false may cause some layout issues (width of container will be than width of screen) on android
  29. scalesPageToFit: PropTypes.bool,
  30. // other rn webview props
  31. source: WebView.propTypes.source,
  32. originWhitelist: PropTypes.arrayOf(PropTypes.string),
  33. mediaPlaybackRequiresUserAction: PropTypes.bool,
  34. renderError: PropTypes.func,
  35. onError: PropTypes.func,
  36. onMessage: PropTypes.func,
  37. onNavigationStateChange: 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. };