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

后端 未结 14 2209
忘掉有多难
忘掉有多难 2021-02-01 02:22

Just started learning react-native,

I have created one separate file flexdemo.js and created component as below:

import React, { Component } from \'react         


        
14条回答
  •  心在旅途
    2021-02-01 02:31

            
                 
                 
                 
            
    
    1. Make use Component hierarchy should be maintain, for example all components like Text, ListView, TextInput etc should be wrapped inside the parent component that is View. lets see the below example :

      < View >
      < Text >
      CORRECT
      < / Text >
      < / View >

    2. Make sure all the Component tag should be closed properly.

    3. Make sure unnecessary semicolons should be removed from the react native layout components & functions.

    https://www.skptricks.com/2018/08/react-native-cannot-add-child-that.html

提交回复
热议问题