Error of Yoganode

Asked

Viewed 274 times

0

Constantly, I’m making the mistake:

Cannot add a Child that doesn’t have a Yoganode to a Parent without a Measure Function! (Trying to add a 'Reactrawtextshadownode' to a 'Layoutshadownode')

I didn’t understand the logic of the mistake, so I couldn’t correct it.

Follows my code:

import React, { Component } from 'react';
import { ScrollView, Text } from 'react-native';
import { Tile, List, ListItem } from 'react-native-elements';

class UserDetail extends Component {
  render() {
    const { id, title, whatsapp, email, phone, location } = this.props.navigation.state.params;

    return (
      <ScrollView>
        <Tile
          imageSrc={{ uri: `https://buscafree.com.br/assets/img/items/${id}.jpg`}}
          featured
          title={title}
        />
        <List>
          {phone ? (<ListItem title="Telefone" rightTitle={phone} hideChevron />) : ''}
        </List>
      </ScrollView>
    );
  }
}

export default UserDetail;

1 answer

1


This error occurs because there is some "loose" information, that is, it is not within tags.

In my case it’s on the line {phone ? (<ListItem title="Telefone" rightTitle={phone} hideChevron />) : ''}

When phone exists, it generates a ListItem, but when it does not exist, it generates an empty space (this is where the error is). The correct is to use it like this:

{phone ? (<ListItem title="Telefone" rightTitle={phone} hideChevron />) : '<View></View>'}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.