Browse Source

call onHeightUpdated when height is valid

iou90 8 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
 
48
 
49
     handleNavigationStateChange(navState) {
49
     handleNavigationStateChange(navState) {
50
         const height = Number(navState.title);
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
 {
1
 {
2
   "name": "react-native-autoheightwebview",
2
   "name": "react-native-autoheightwebview",
3
-  "version": "0.0.5",
3
+  "version": "0.0.6",
4
   "description": "An auto height webview for React Native",
4
   "description": "An auto height webview for React Native",
5
   "main": "autoHeightWebView",
5
   "main": "autoHeightWebView",
6
   "scripts": {
6
   "scripts": {