VirtualizedLists should never be nested inside plain ScrollViews React Native.

huangapple go评论55阅读模式
英文:

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."

VirtualizedLists should never be nested inside plain ScrollViews React Native.

my code

return (
    &lt;View style={{flex: 1}}&gt;
      &lt;SwipeListView
        data={listData}
        renderItem={renderItem}
        renderHiddenItem={renderHiddenItem}
      
      /&gt;
    &lt;/View&gt;
  );

答案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 &quot;react-native-virtualized-view&quot;; and use it like you would a nomral ScrollView

huangapple
  • 本文由 发表于 2023年2月18日 02:32:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75488076.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定