RN WebView Cannot Add a child that doesn’t have a YogaNode to a parent with out a measure function

版权声明:本文为博主原创文章,转载请附原博客地址。侵权必究 https://blog.csdn.net/wapchief/article/details/79917190

这里写图片描述

解决方案1:

检查 return 方法内是否存在注释,如果有全部删除。

解决方案2:

如果使用了WebView,那么请删除外层的View视图,否则在Android上可能出现这种错误。

  render() {
    const { params } = this.props.navigation.state;
    const title = params ? params.title : null;
    const newsUrl = params ? params.url : null;

    return (
        <WebView
          style={{width:screenWidth,height:'100%'}}
          source={{uri:newsUrl}}
          startInLoadingState={true}
          domStorageEnabled={true}
          javaScriptEnabled={true}
          onError={(e)=> DetailsScreen._loadError.bind(this,e)}/>

    );
  }

ReactNative 版本 0.55

参考文档:

React native: Cannot add a child that doesn’t have a YogaNode or parent node

http://www.sunqizheng.com/blog/655.html

猜你喜欢

转载自blog.csdn.net/wapchief/article/details/79917190