react-native-flatlist - React Native Draggable Flatlist 仅适用于 ScrollView 但错误?
问题描述
我使用 React Native Draggable Flatlist:
https://github.com/computerjazz/react-native-draggable-flatlist
此代码有效,但出现错误:
const MyComponent = ({ items }) => {
const renderItem = ({ item, index, drag, isActive }) => {
return (
<View style={{ flexDirection: "row" }}>
<TouchableOpacity
style={{
backgroundColor: isActive ? "blue" : "gold",
marginBottom: 10
}}
onPressIn={drag}
>
<Text>Move</Text>
</TouchableOpacity>
<InputText index={index} text={item} />
</View>
);
};
return (
<ScrollView>
<DraggableFlatList
data={items}
renderItem={renderItem}
keyExtractor={(item, index) => `${index}`}
onDragEnd={(e) => console.log(e)}
/>
</ScrollView>
);
};
VirtualizedLists 永远不应该嵌套在具有相同方向的普通 ScrollViews 中 - 请改用另一个 VirtualizedList 支持的容器。
如果我更改ScrollView
为,View
则错误消失,但是现在我看不到任何项目。
解决方案
推荐阅读
- elasticsearch - 连接到远程 Elastic 搜索服务器并在 Drupal 中显示结果的最佳方式
- javascript - 为什么我的 React App 中的图片会压缩?
- python - 使用“pip install twilio”时出错
- python - 尝试连接到出租车服务器,但我无法导入任何内容
- laravel - Laravel 多态与自定义列一对一
- jsp - 在 bucle 中按行分组两个不同名称的收音机?
- c - 与以前的定义错误混淆
- python - 在钩子 gitlab api 上推送事件
- ethereum - web3j - 带有字符串参数的事件的 TypeReference
- build - 下一个构建错误:连接 ECONNREFUSED 127.0.0.1:80