代码之家  ›  专栏  ›  技术社区  ›  Hoàng VÅ© Anh

Modal中的FlatList未加载所有数据

  •  0
  • Hoàng VÅ© Anh  · 技术社区  · 8 年前

    我在模态中显示了一个平面列表,但它并没有加载所有数据,只有42项(从0到41)。我尝试了ListView,但还是一样,我不明白为什么?在这种情况下,有些人可以帮助我,非常感谢。这是我的FlatList代码:

    <ScrollView>
                   <FlatList
                     data={this.state.dataSource}
                     renderItem={({ item, index }) => (
                       <CountryItem item={item} index={index}/>
                     )}
                     horizontal={false}
                     onEndThreshold={0}
                     keyExtractor={item => ''.concat(Math.random())}
                   />
                 </ScrollView>
    

    它不起作用,试试ListView,它也不起作用

    <StyleModal
        animationType="fade"
        transparent={true}
        visible={this.state.modalVisible}
        onRequestClose={() => { }}>
        <StyleModalView>
            <StyleViewContent>
                <StyleViewHeader>
                    <StyleTextHeader text={this.props.name} />
                    <TouchableOpacity onPress={this.closeModal}>
                        <StyledIcon
                            tintColor={'black'}
                            source={require('../assets/searchbox-clear.png')}
                        />
                    </TouchableOpacity>
                </StyleViewHeader>
    
                <StyleListView
                    dataSource={this.state.dataSource}
                    renderRow={this.renderRow}/>
    
            </StyleViewContent>
        </StyleModalView>
    </StyleModal>
    
    0 回复  |  直到 8 年前