Javascript 平面列表向所有方向移动/拖动
当我点击我的平面列表时,我可以向各个方向(上/下/右/左)拖动和移动它。虽然列表看起来是垂直的(可能是因为样式),但滚动条仍然水平显示。如何禁用此拖动 以下是我使用平面列表的方式:Javascript 平面列表向所有方向移动/拖动,javascript,reactjs,typescript,react-native,react-native-flatlist,Javascript,Reactjs,Typescript,React Native,React Native Flatlist,当我点击我的平面列表时,我可以向各个方向(上/下/右/左)拖动和移动它。虽然列表看起来是垂直的(可能是因为样式),但滚动条仍然水平显示。如何禁用此拖动 以下是我使用平面列表的方式: <FlatList data={data.me.friends.nodes} //horizontal={false} //scrollEnabled={false} renderItem={({ i
<FlatList
data={data.me.friends.nodes}
//horizontal={false}
//scrollEnabled={false}
renderItem={({ item }) => (
<FriendItem friend={item} originatorId={data.me.id}/>
)}
keyExtractor={(item) => item.id.toString()}
ListEmptyComponent={NoFriendsContainer}
/>
我也尝试过删除TouchableOpacity,但没有效果。你可以尝试什么。详情如下: 更新:
<Flatlist
bounces={false}/>
请在此处尝试,或者在顶部滚动视图中添加bounces={false}(如果有)
希望能有帮助。不要怀疑不起作用。如果我使用这个,我就不能再上下移动物品,但我仍然可以左右移动它们。我应该能够垂直向下滚动。目前我不能这样做,滚动条也是水平的。如果我使用这个,我就不能再上下移动物品了,但我仍然可以左右移动它们(不像以前那样自由,只是一点点)。我应该能够垂直向下滚动。目前我不能这样做,滚动条也是水平的
export const styles = StyleSheet.create({
item: {
backgroundColor: 'white',
borderRadius: moderateScale(20),
padding: moderateScale(20),
marginVertical: moderateScale(8),
marginHorizontal: 16,
height: moderateScale(110),
width: moderateScale(360),
justifyContent: 'space-between',
flexDirection: 'row',
},
userName: {
paddingRight: 55,
paddingLeft: 10,
paddingTop: 20,
},
deleteButton: {
backgroundColor: '#31C283',
width: moderateScale(45),
justifyContent: 'center',
},
deleteButtonContainer: {
paddingTop: 12,
marginRight: 2,
},
thumbnail: {
height: 85,
width: 85,
marginLeft: 2,
paddingRight: 0,
position: 'relative',
},
nameContainer: {
flexDirection: 'row',
},
});
<Flatlist
bounces={false}/>