sc12070 / react-native-drag-sort-gridview

A draggable and sortable grid view for react native
22 stars 8 forks source link

how to disable specific items #8

Open IsmailMMR opened 11 months ago

sc12070 commented 7 months ago

Hi @IsmailMMR , if you want to disable dragging of specific item, you may make use of renderOnEditOverlay to render a overlay which covers the drag area. For example, in UsagePage, if the second item is not draggable,

 const renderOnEditOverlay = ({ index }: { index: number }) => {
    if (index === 1) {
      return (
        <View
          style={{
            position: 'absolute',
            top: 0,
            bottom: 0,
            left: 0,
            right: 0
          }}
        />
      )
    }
    return <ItemOverlay onDelPress={onDelPress} index={index} />
  }