Explorar el Código

add stopLoading function for ios

Hleb Barylskyi hace 7 años
padre
commit
d34995b786
No account linked to committer's email address
Se han modificado 1 ficheros con 6 adiciones y 3 borrados
  1. 6
    3
      autoHeightWebView/index.ios.js

+ 6
- 3
autoHeightWebView/index.ios.js Ver fichero

@@ -34,7 +34,6 @@ export default class AutoHeightWebView extends PureComponent {
34 34
         onLoadStart: PropTypes.func,
35 35
         onLoadEnd: PropTypes.func,
36 36
         onShouldStartLoadWithRequest: PropTypes.func,
37
-        _ref: PropTypes.func,
38 37
         // add web/files... to project root
39 38
         files: PropTypes.arrayOf(PropTypes.shape({
40 39
             href: PropTypes.string,
@@ -135,9 +134,13 @@ export default class AutoHeightWebView extends PureComponent {
135 134
         }
136 135
     }
137 136
 
137
+    stopLoading() {
138
+        this.webview.stopLoading();   
139
+    }
140
+
138 141
     render() {
139 142
         const { height, script } = this.state;
140
-        const { _ref, onError, onLoad, onLoadStart, onLoadEnd, onShouldStartLoadWithRequest, scalesPageToFit, enableAnimation, source, heightOffset, customScript, style } = this.props;
143
+        const { onError, onLoad, onLoadStart, onLoadEnd, onShouldStartLoadWithRequest, scalesPageToFit, enableAnimation, source, heightOffset, customScript, style } = this.props;
141 144
         const webViewSource = Object.assign({}, source, { baseUrl: 'web/' });
142 145
         return (
143 146
             <Animated.View style={[Styles.container, {
@@ -145,7 +148,7 @@ export default class AutoHeightWebView extends PureComponent {
145 148
                 height: height + heightOffset,
146 149
             }, style]}>
147 150
                 <WebView
148
-                    ref={_ref}
151
+                    ref={webview => this.webview = webview}
149 152
                     onError={onError}
150 153
                     onLoad={onLoad}
151 154
                     onLoadStart={onLoadStart}