Pārlūkot izejas kodu

set showsVertical/HorizontalScrollIndicator to false; add rnwebview methods

iou90 5 gadus atpakaļ
vecāks
revīzija
e26f9e3bb2
1 mainītis faili ar 8 papildinājumiem un 2 dzēšanām
  1. 8
    2
      autoHeightWebView/index.js

+ 8
- 2
autoHeightWebView/index.js Parādīt failu

@@ -13,13 +13,17 @@ import { getMemoInputProps, getMemoResult, getWidth, isSizeChanged } from './uti
13 13
 const AutoHeightWebView = forwardRef((props, ref) => {
14 14
   let webView = useRef();
15 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 23
   const { style, onMessage, onSizeUpdated } = props;
20 24
 
21 25
   const [size, setSize] = useState(() => ({
22
-    height: style && style.height ? style.height : 1,
26
+    height: style && style.height ? style.height : 0,
23 27
     width: getWidth(style)
24 28
   }));
25 29
   const hanldeMessage = event => {
@@ -98,6 +102,8 @@ AutoHeightWebView.propTypes = {
98 102
 };
99 103
 
100 104
 let defaultProps = {
105
+  showsVerticalScrollIndicator: false,
106
+  showsHorizontalScrollIndicator: false,
101 107
   originWhitelist: ['*'],
102 108
   baseUrl: 'web/'
103 109
 };