SHISME / react-native-draggable-grid

A draggable and sortable grid of react-native
315 stars 95 forks source link

FlatList causes corruption after item is dragged #87

Open mronline opened 1 year ago

mronline commented 1 year ago

After dragging the item, FlatList onViewableItemsChanged no longer triggers.

react-native@0.72.5 react-native-draggable-grid@2.1.8

I noticed that when it happens like this there is this bug:

<ScrollView scrollEnabled={this.state.scrollEnabled}>
    <DraggableGrid
        numColumns={3}
        renderItem={this.render_item}
        data={this.state.data}
        onDragStart={() => {
            this.setState({scrollEnabled: false})
        }}
        onDragRelease={(data) => {
            this.setState({data, scrollEnabled: true});
        }}
    />
</ScrollView>
mronline commented 1 year ago

When I did it as mentioned here https://github.com/SHISME/react-native-draggable-grid/issues/84#issuecomment-1751964058 the problem was solved. I think updating it as state causes such a problem.