React Native 第二个 ScrollView 不工作

React Native second ScrollView not working

我的应用是由react-native(0.62.2)开发的,依赖于react-native-elements(2.0.0)。应用程序的屏幕必须包含两个 ScrollView 元素。第一个 ScrollView 将用于页面滚动,第二个 ScrollView 将用于现有单词卡片。第一个 ScrollView 元素正在工作,但第二个 ScrollView 元素没有在卡片元素中滚动。我尝试使用样式 {flex:1} 包装视图元素,但没有结果。

<ScrollView>
            // other items ...
            {
            wordSetObject.words.length == 0 ? null :
                <Card  title="Existing Words" dividerStyle={{marginBottom:0}} containerStyle={{maxHeight:300}}>
                    <ScrollView>
                            {
                            wordSetObject.words.map((item, index) => {
                                return(
                                <ListItem
                                    key={index}
                                    title={item.word} 
                                    subtitle={item.meaning}
                                    bottomDivider
                                    rightIcon={
                                        <View style={{flexDirection:'row'}}>
                                            <MCIcon
                                            name="pencil"
                                            size={22}
                                            />
                                            <MCIcon
                                            name="delete"
                                            size={22}
                                            color="red"
                                            onPress={() => onPressDeleteWordButton(index)}
                                        />
                                        </View>
                                    }
                                    />)
                                 })    
                            }
                    </ScrollView>
                </Card>
            }
        </ScrollView>

这可以通过在子 Scrollview 上使用 nestedScrollEnabled={true} 属性来解决,如下所示:

<ScrollView>
  <ScrollView nestedScrollEnabled={true}>
  </ScrollView>
</ScrollView>