当我将 Flex=1 设置为最顶层视图时,FlatList 不可见

FlatList is not being visible when i set Flex=1 to the top most view

我有一个 FlatList 如下。我无法使内容可滚动,因此,我为视图添加了一种样式,如 flex=1.

我给视图添加样式后,FlatList 根本不可见。

如有任何帮助,我们将不胜感激

<View style={{ flex: 1 }}>
                <FlatList
                    data={this.state.data}
                   // style={{ flex: 1 }}
                    onScroll={this.handleScroll}
                    ref='flatlist1'
                    showsVerticalScrollIndicator
                    onEndReachedThreshold={0.05}
                    ItemSeparatorComponent={this.FlatListItemSeparator}
                    renderItem={({ item, index }) => (
  <View key={index} style={{ backgroundColor: index % 2 === 0 ? 'white' : '#f1f1f1' }}>      
                            <Text style={styles.text}>
                                    {item.playername}</Text> 
                           <Text style={styles.text1}>{item.score}</Text>
                           </View>
                    )
                    }
                    keyExtractor={(item, index) => index.toString()}
                />
            </View>        

我找到了答案

而不是给视图 flex: 1, 设置高度并将其提供给视图 风格={{身高}}