I am generating a list with List item in React native, and for a specific reason I want the first item to navigate to a different screen and all other item to a different screen.
I am putting the condition with ternary operator for the same but there is no success
<View style={{flex: 1, backgroundColor: '#fff'}}>
<List containerStyle={{ borderTopWidth: 0, borderBottomWidth: 0 }}>
<FlatList
data={this.state.schools}
renderItem={({ item }) => ({
item.school_name == "all" ?
<ListItem
title={item.school_name}
onPress={()=>this.props.navigation.navigate('DepartmentSchools', {
school_name: item.school_name,
school_id : item.school_id
})}
/> :
<ListItem
title={item.school_name}
onPress={()=>this.props.navigation.navigate('DepartmentIndividual', {
school_name: item.school_name,
school_id : item.school_id
})}
/>
})}
keyExtractor={item => item.school_name}
ItemSeparatorComponent={this.renderSeparator}
/>
</List>
</View>
Please help in resolve this or you can point out my mistake.
Thanks in advance.