Cannot add a child that doesn't have a YogaNode to a parent without a measure function! (Trying to add a 'ReactVirtualTextShadowNode' to a 'NativeViewWrapper')
See original GitHub issueI add code below to use yoga-node,but got an error,what‘s wrong?
@Override
protected UIImplementationProvider getUIImplementationProvider() {
return new FlatUIImplementationProvider();
}
"react-native": "0.43.3"
java.lang.RuntimeException: Cannot add a child that doesn't have a YogaNode to a parent without a measure function! (Trying to add a 'ReactVirtualTextShadowNode' to a 'NativeViewWrapper')
at com.facebook.react.uimanager.ReactShadowNode.addChildAt(ReactShadowNode.java:173)
at com.facebook.react.flat.FlatShadowNode.addChildAt(FlatShadowNode.java:217)
at com.facebook.react.flat.NativeViewWrapper.addChildAt(NativeViewWrapper.java:98)
at com.facebook.react.flat.FlatUIImplementation.addChildAt(FlatUIImplementation.java:510)
at com.facebook.react.flat.FlatUIImplementation.setChildren(FlatUIImplementation.java:190)
at com.facebook.react.uimanager.UIManagerModule.setChildren(UIManagerModule.java:326)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:141)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Error: Cannot add a child that doesn't have a YogaNode to a ...
I am using the latest React Native version. Cannot add a child that doesn't have a YogaNode to a parent without a measure...
Read more >React native: Cannot add a child that doesn't have a ...
Now if I try to run the code by adding flexdemo.js code into App.js then everything works fine. Changed The App.js like this:...
Read more >React native: Cannot add a child that does not have a ...
React native : Cannot add a child that doesn't have a YogaNode or parent without a measure function. While working with react native...
Read more >Cannot add a child that doesn't have a YogaNode to a parent ...
Coding example for the question Cannot add a child that doesn't have a YogaNode to a parent without measure node-React Native.
Read more >Cannot add a child that doesn't have a YogaNode to a ... - 简书
Cannot add a child that doesn't have a YogaNode to a parent without a measure function! (Trying to add a 'ReactRawTextShadowNode' to a ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This happens if you have space like mentioned above, or if you have conditional rendering, that is checking a non boolean variable, that can be undefined or an empty string. Example:
This returns an error if
myCheck
isundefined
, or an empty string, because if its a falsy value, it’s going to be the value returned in the expression, and so, React will try to render it, but React cannot render undefined or empty string values inside non-Text
elements, throwing the error above.The solution is to cast the variable to a boolean:
Since false is correctly ignored on JSX.
This seems to be a problem with something that parses what your component returns from render().
in my case i had the following code:
and the fix was removing the semicolon: