1. 程式人生 > >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