Browse Source

call onHeightUpdated when height is valid

iou90 7 years ago
parent
commit
58d756f9ae
2 changed files with 6 additions and 4 deletions
  1. 5
    3
      autoHeightWebView/index.ios.js
  2. 1
    1
      package.json

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

@@ -48,9 +48,11 @@ export default class AutoHeightWebView extends Component {
48 48
 
49 49
     handleNavigationStateChange(navState) {
50 50
         const height = Number(navState.title);
51
-        this.setState({ height });
52
-        if (this.props.onHeightUpdated) {
53
-            this.props.onHeightUpdated(height);
51
+        if (height) {
52
+            this.setState({ height });
53
+            if (this.props.onHeightUpdated) {
54
+                this.props.onHeightUpdated(height);
55
+            }
54 56
         }
55 57
     }
56 58
 

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
1 1
 {
2 2
   "name": "react-native-autoheightwebview",
3
-  "version": "0.0.5",
3
+  "version": "0.0.6",
4 4
   "description": "An auto height webview for React Native",
5 5
   "main": "autoHeightWebView",
6 6
   "scripts": {