brodude
brodude

Reputation: 23

CSS in react-native - syntax error <Text>

I'm new to js, react and css so this is going to be very basic but it's not to me. I have these containers and I'm trying to put a text field inside one of them but I'm getting syntax error at Text. Does it have something to do with < > />? Thank you

    <View style={styles.top}


    />
    <MapView style={styles.map}
    region ={{
    latitude:lat,
    longitude:long,
    latitudeDelta: 0.1,
    longitudeDelta: 0.1,

}} >

    </MapView>
    <View style={styles.bottom} />


  </View>


);

Upvotes: 0

Views: 188

Answers (2)

Pardeep Sharma
Pardeep Sharma

Reputation: 293

The render method can only render a single root node i.e you only define one parent root in render method. You can define multiple child root under one parent.

Upvotes: 0

Rishabh Bhatia
Rishabh Bhatia

Reputation: 1029

Indeed it does. You need to close your jsx View tag.

<View style= {styles.container}>
  <View style={styles.top}>
    <Text> Hi there</Text>
  </View>
</View>

Upvotes: 1

Related Questions