相关疑难解决方法(0)

React native:是否可以在webview中获得html内容的高度?

我从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高,这是我的填充.是否有一种聪明的方法来获得内容的高度?

scrollview webview react-native

10
推荐指数
2
解决办法
1万
查看次数

标签 统计

react-native ×1

scrollview ×1

webview ×1