【发布时间】:2021-05-20 15:55:33
【问题描述】:
我正在开发一个 react-native 应用程序,我必须将对象列表放在 Scrollview 中,所以我使用 FlatList 组件来做到这一点。这是产生错误的代码:
<ScrollView contentContainerStyle={style}>
Other components
<FlatList
style={style}
data={data}
scrollEnabled={false}
keyExtractor={(item, index) => index.toString()}
renderItem={({ item, index}) => (somethings)}
/>
Other components
</ScrollView>
完整的错误是:VirtualizedLists 不应该嵌套在具有相同方向的普通 ScrollViews 中,因为它可能会破坏窗口和其他功能 - 请改用另一个 VirtualizedList 支持的容器。
【问题讨论】:
-
有时它会禁用触摸,这不是很重要的警告
-
您可以禁用此警告,它不会停用触摸,您不会在生产中遇到这种情况。
-
禁用警告不是解决办法
-
这篇文章说明了为什么会发生这种情况以及如何解决它:nyxo.app/…
-
@Tebo 你附加的文章无效
标签: react-native