天天看點

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

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

解決方案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