Browse Source

set showsVertical/HorizontalScrollIndicator to false; add rnwebview methods

iou90 5 years ago
parent
commit
e26f9e3bb2
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      autoHeightWebView/index.js

+ 8
- 2
autoHeightWebView/index.js View File

13
 const AutoHeightWebView = forwardRef((props, ref) => {
13
 const AutoHeightWebView = forwardRef((props, ref) => {
14
   let webView = useRef();
14
   let webView = useRef();
15
   useImperativeHandle(ref, () => ({
15
   useImperativeHandle(ref, () => ({
16
-    stopLoading: () => webView.current.stopLoading()
16
+    stopLoading: () => webView.current.stopLoading(),
17
+    goForward: () => webView.current.goForward(),
18
+    goBack: () => webView.current.goBack(),
19
+    reload: () => webView.current.reload(),
20
+    injectJavaScript: script => webView.current.injectJavaScript(script)
17
   }));
21
   }));
18
 
22
 
19
   const { style, onMessage, onSizeUpdated } = props;
23
   const { style, onMessage, onSizeUpdated } = props;
20
 
24
 
21
   const [size, setSize] = useState(() => ({
25
   const [size, setSize] = useState(() => ({
22
-    height: style && style.height ? style.height : 1,
26
+    height: style && style.height ? style.height : 0,
23
     width: getWidth(style)
27
     width: getWidth(style)
24
   }));
28
   }));
25
   const hanldeMessage = event => {
29
   const hanldeMessage = event => {
98
 };
102
 };
99
 
103
 
100
 let defaultProps = {
104
 let defaultProps = {
105
+  showsVerticalScrollIndicator: false,
106
+  showsHorizontalScrollIndicator: false,
101
   originWhitelist: ['*'],
107
   originWhitelist: ['*'],
102
   baseUrl: 'web/'
108
   baseUrl: 'web/'
103
 };
109
 };