Browse Source

add stopLoading function for ios

Hleb Barylskyi 7 years ago
parent
commit
d34995b786
No account linked to committer's email address
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      autoHeightWebView/index.ios.js

+ 6
- 3
autoHeightWebView/index.ios.js View File

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