question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Add a child that doesn't have a YogaNode to a parent with out a measure function

See original GitHub issue

I’ve been trying to get React Native up and running for a project I’m working on. It works beautifully for IOS, however on Android every time I try to use a Text component I keep getting the error

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.

my entire code is

import React, { PureComponent } from 'react';
import { Text } from 'react-native';

class App extends PureComponent  {

render() {
    return (
      <Text>Hello World</Text>
    );
  }
}

export default App;

I’m using react native 0.4.3 Any ideas what could be causing this and how I could fix it?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:30
  • Comments:67 (5 by maintainers)

github_iconTop GitHub Comments

133reactions
johngorencommented, Oct 10, 2017

I got this error in RN 0.49.1 in some conditional JSX that relied on a value’s being truthy to decide whether a View shows up or not. I fixed the error using the classic double exclamation !!, i.e. “{!!value” instead of “{value.”

100reactions
parthgandhi7commented, Oct 11, 2017

Aah silly error but still the stack trace is too confusing: I had my button tag like:

  <Button
     transparent
     style={styles.nextContainer}
     onPress={props.onPress}
   >
     NEXT
   </Button>

which was causing the error . This used to work in old react-native. But now, no string values should be without the <Text> tag.

So i resolved it by replacing the above code with

    <Button
      transparent
      style={styles.nextContainer}
      onPress={props.onPress}
    >
      <Text>NEXT</Text>
    </Button>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: 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 exception when Component co-existing in same parent ......
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 or pare…
Aug 27, 2018 - React native: Cannot add a child that doesn't have a YogaNode or parent without a measure function. While working...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found