I am new to react native and have tried everything and keep getting the following error
JSX expressions must have one parent element.ts(2657)
I am trying to display information from json in a flatlist.
Here is my code.
render() {
if (this.state.isLoading) {
return (
<View style={{flex: 1, paddingTop: 20}}>
<ActivityIndicator />
</View>
);
}
return (
<View>
<View style={{backgroundColor: '#808080'}}>
<Text style={styles.MainText}>Sermons</Text>
</View>
<FlatList style={{paddingTop: 30}}
data={ DATA }
ItemSeparatorComponent = {this.FlatListItemSeparator}
renderItem={this._renderItem} />
</View>
);
}
_renderItem = ({item}) => {
return(
<View style={{flex:1, flexDirection: 'row', paddingLeft: 10}}>
<Image source={require('./church.png')} style={{width: '100%', height: '25%'}} />
</View>
<View style={{flex: 1, paddingLeft: 20}}>
<Text>{item.title}</Text>
</View>
);
}
}
line 33 ); seems to be causing the problem but I don't know why.