Search code examples
javascriptreact-nativeuser-interfacereact-native-flatlistreact-native-draggable-flatlist

Logically disable Drag on react-native-draggable-flatlist


I'm trying to disable the drag feature based on some props change, not sure how to disable/enable it on 'react-native-draggable-flatlist', please find below the code

import DraggableFlatList from 'react-native-draggable-flatlist'
    <DraggableFlatList
      scrollPercent={5}
      data={this.state.data}
      renderItem={this.renderItem}
      keyExtractor={(item: any) => `draggable-item-${item}`}
      onMoveEnd={({ data }: any) => {
        this.setState({ data })
      }}
    />

Solution

  • As per my requirement, I have totally disabled the parent component and it worked, but still not sure if there are any ways to disable it by passing a particular prop