Selaa lähdekoodia

add propTypes.js

iou90 5 vuotta sitten
vanhempi
commit
23dfe89c2c
1 muutettua tiedostoa jossa 53 lisäystä ja 0 poistoa
  1. 53
    0
      autoHeightWebView/propTypes.js

+ 53
- 0
autoHeightWebView/propTypes.js Näytä tiedosto

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