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