我从api获取html内容,我想在我的应用程序中将其呈现为Web视图.
webview组件嵌套在scrollview中,因为它在我的渲染函数上面有一些其他内容是这样的:
render() {
var html = '<!DOCTYPE html><html><body>' + this.state.pushEvent.Description + '</body></html>';
return (
<ScrollView>
<View style={styles.recipe}>
<Image source={{uri: this.state.pushEvent.ImageUrl}}
style={styles.imgFull} />
<Text style={styles.title}>{this.state.pushEvent.Title}</Text>
<WebView style={{padding: 20}}
automaticallyAdjustContentInsets={false}
scrollEnabled={false}
html={html}>
</WebView>
</View>
</ScrollView>
);
}Run Code Online (Sandbox Code Playgroud)
问题是我的html只有20pt高,这是我的填充.是否有一种聪明的方法来获得内容的高度?