I Cant create FlatList nested inside FlatList with same orientation;
the result is that the parent is horizontal but the children are vertical;
this is my code:
renderSlides(question) {
return <View key={question.item.code}
style={{flex: 1,width:350}}>
<FlatList
ref='scrollPick'
data={[{k:'A'},{k:'b'},{k:'c'}}]}
horizontal={true}
renderItem={(rate)=>{return (
<View >
<Text>{rate.item.k}</Text>
</View>);}}
keyExtractor={ (item, index) => index}
/>
</View>;
}
render() {
return (
<View style={CONTAINERS.MAIN_COLUMN_BLUE}>
<View style={[NAV.CONTAINER_GENERAL, NAV.CONTAINER_ASSESSMENT, {flex: 1}]}>
<TopBar barType="ex" title={I18n.t('assessment.title')} navigator={this.props.navigator}
closeFunction={this.handleClose}></TopBar>
</View>
<FlatList
ref={(ref) => { this.flatListRef = ref; }}
horizontal={true}
data={[{k:'1'},{k:'2'},{k:'3'},{k:'4'},{k:'5'},{k:'6'},{k:'q'}]}
renderItem={this.renderSlides}
keyExtractor={(item, index) => index}
horizontal={true}
getItemLayout={this.getItemLayout}
contentContainerStyle={{ flexGrow: 1}}
/>
</View>
);
}
Has anyone run into this same problem? ( And I can't use scrollView )
VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.
SectionList s are like FlatList s, but they can have section headers to separate groups of rows. SectionList s render each item in their input sections using the renderSectionHeader and renderItem prop.
Finally I have found it!
The First FlatList you import from react-native
import {FlatList} from 'react-native'
And the second (inside-FlatList) you can import from react-native-gesture-handler
import {FlatList as FlatList2} from 'react-native-gesture-handler'
Then you can use the same orientation and it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With