Browse Source

update demo for demonstrate onHeightUpdated feature

iou90 7 years ago
parent
commit
845d5c71c9
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      demo/explorer.js

+ 6
- 1
demo/explorer.js View File

@@ -26,7 +26,8 @@ export default class Explorer extends Component {
26 26
         this.changeScript = this.changeScript.bind(this);
27 27
         this.state = {
28 28
             html: this.html0,
29
-            script: this.script0
29
+            script: this.script0,
30
+            height: 0
30 31
         };
31 32
     }
32 33
 
@@ -54,6 +55,7 @@ export default class Explorer extends Component {
54 55
                     alignItems: 'center'
55 56
                 }}>
56 57
                 <AutoHeightWebView
58
+                    onHeightUpdated={height => this.setState({ height })}
57 59
                     source={{ html: this.state.html }}
58 60
                     customScript={this.state.script} />
59 61
                 <TouchableOpacity
@@ -66,6 +68,9 @@ export default class Explorer extends Component {
66 68
                     style={Styles.button}>
67 69
                     <Text>change script (have to change source to reload on android)</Text>
68 70
                 </TouchableOpacity>
71
+                <Text style={{ padding: 5 }}>
72
+                    {this.state.height}
73
+                </Text>
69 74
             </ScrollView>
70 75
         );
71 76
     }