英文:
VirtualizedLists should never be nested inside plain ScrollViews React Native
问题
我得到了这个错误,但不知道如何修复它:
错误类型:"VirtualizedLists不应嵌套在具有相同方向的普通ScrollViews中,因为它可能会破坏窗口管理和其他功能 - 请改用另一个VirtualizedList支持的容器。"
我的代码:
return (
<View style={{flex: 1}}>
<SwipeListView
data={listData}
renderItem={renderItem}
renderHiddenItem={renderHiddenItem}
/>
</View>
);
注意:代码部分未进行翻译。
英文:
hi i'm getting this error i don't know how to fix it
error type : "VirtualizedLists should never be nested inside plain
ScrollViews with the same orientation because it can
break windowing and other functionality - use another
VirtualizedList-backed container instead."
my code
return (
<View style={{flex: 1}}>
<SwipeListView
data={listData}
renderItem={renderItem}
renderHiddenItem={renderHiddenItem}
/>
</View>
);
答案1
得分: 2
只返回翻译好的部分:
你可以使用react-native-virtualized-view来替换React Native中的ScrollView:
使用react-native-virtualized-view中的ScrollView,首先安装该包:npm i react-native-virtualized-view
,然后导入它:import { ScrollView } from "react-native-virtualized-view"
,并像使用正常的ScrollView一样使用它。
英文:
Hello just change your react native ScrollView with this one:
Use ScrollView from react-native-virtualized-view install the package: npm i react-native-virtualized-view
import it: import { ScrollView } from "react-native-virtualized-view"
; and use it like you would a nomral ScrollView
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论