React Native FlatList nested inside FlatList with same orientation

Aharon Vishinsky picture Aharon Vishinsky · Apr 5, 2018 · Viewed 9k times · Source

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>
        );
    }
}

enter image description here

Has anyone run into this same problem? ( And I can't use scrollView )

Answer