M. Mufti
M. Mufti

Reputation: 113

"Cannot add a child that doesn't have YogaNode to a parent without a measure function "

While building a react-native application for Android I am getting the error

Cannot add a child that doesn't have Yoga Node to a parent without a measure function

I tried with both remote debugger on and off but the problem persists.

Pasting my Component function as below.

import React, { Component } from 'react'; 
import { Text, TouchableWithoutFeedback, View } from 'react-native';
import { connect } from 'react-redux';
import { CardSection } from './common';
import * as actions from '../actions';
class ListItem extends Component {
 render() {
     const { title, id } = this.props.library;
     const { titleStyle } = styles;
     return (
         <TouchableWithoutFeedback
             onPress ={() => this.props.selectLibrary(id)}
         >
             <View> /* Using View as more then one card section is used */
                 <CardSection>
                     <Text style={titleStyle} >
                         {title}
                     </Text>
                 </CardSection>
             </View>
         </TouchableWithoutFeedback>
     )
 }
}
 const styles = {
 titleStyle: {
     fontSize:18,
     paddingLeft:10
 }
};
export default connect(null, actions)(ListItem);

Upvotes: 2

Views: 547

Answers (1)

M. Mufti
M. Mufti

Reputation: 113

The problem is resolved once I moved my comments in front of the View tag to other location ( for example, before return statement)

Upvotes: 1

Related Questions