React-native-draggable-flatlist: list disappear after drag n drop with some error

Created on 21 Jul 2018  路  7Comments  路  Source: computerjazz/react-native-draggable-flatlist

"react-native": "0.55.4",
"react-native-draggable-flatlist": "^1.1.2",

listerror

this is what i done:

<DraggableFlatList
          data={this.state.rowData}
          renderItem={this.renderRowItem}
          scrollPercent={5}
          keyExtractor={(item, index) => `draggable-item-${index}`}
          onMoveEnd={({ rowData }) => this.setState({ rowData })}
    />

renderRowItem = ({ item, index, move, moveEnd, isActive }) => {
    return (
      <TouchableOpacity
        onLongPress={move}
        onPressOut={moveEnd}
        style={{
          height: 100,
          alignItems: 'center',
          justifyContent: 'center'
        }}
      >
      <Text>{item.name}</Text>
      {/*   <Row data={item} active={active} columnSchema={this.state.columnSchema} searchValue={this.state.searchValue} />; */}
      </TouchableOpacity>
    )
  }

i m getting list successfully. but after drag it just disappear.

Most helpful comment

On onMoveEnd method the name parameter must be 'data' like in the example:

onMoveEnd={({ data }) => this.setState({ data })}

All 7 comments

I am having the same problem. Did you get any solution?

@Sakthimalar no i simply give up on this lib.

@ZeroCool00 Can you able to show the list in Flatlist

We can show the flatlists for that we have to change the name of data.
For example, change From this
data={this.state.rowData}
To this
data={this.state.data}

@Sakthimalar can you able to drag and drop the data in the screen

I had a somewhat similar issue but my error was something about 'measure cannot find view with tag xxxx'. When i debugged it i noticed that after the moveEnd function was called my data object (this.state.myData) was undefined. However I also noticed that 'this.state' was undefined, it appears to be a strange context issue so this;

const self = this;

Then i used the self.state.myObject and the issue appears to be fixed. Hope this helps someone else.

On onMoveEnd method the name parameter must be 'data' like in the example:

onMoveEnd={({ data }) => this.setState({ data })}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rassemdev picture rassemdev  路  11Comments

ARDcode picture ARDcode  路  9Comments

ymohdriz picture ymohdriz  路  7Comments

DavidFlores91 picture DavidFlores91  路  10Comments

chriszwickerocteris picture chriszwickerocteris  路  9Comments