react-native-sortable-list icon indicating copy to clipboard operation
react-native-sortable-list copied to clipboard

I am binding the data source using state value, if the state is updated render row not updating.

Open rammi44 opened this issue 8 years ago • 6 comments

<SortableList style={styles.list} contentContainerStyle={styles.contentContainer} data={this.state.todoItemArray} renderRow={this._renderRow} />

I have given like this. if the "this.state.todoItemArray" is updating but in render row that is not updating, showing previous values only, not happening as we expected..

rammi44 avatar Jan 01 '18 10:01 rammi44

<SortableList style={styles.list} contentContainerStyle={styles.contentContainer} data={this.state.todoItemArray} renderRow={this._renderRow} />


updating state here:

// this.state.todoItemArray.push({ 'Item': item, 'TodoItemstyle': todoItembgStyle });

        this.state.todoItemArray = this.state.todoItemArray.concat({ 'Item': item, 'TodoItemstyle': todoItembgStyle });

Instead of push i am using concat its working....

rammi44 avatar Jan 02 '18 07:01 rammi44

I'm hitting the same issue. If I want to override the state data, the list is not updating.

The list doesn't change if I do this (example):

this.setState({
    data: newData
})

What's the recommended way to work around it?

allanjsx avatar Jan 31 '18 08:01 allanjsx

Have the same issue any update on this issue ?

chaitgoli avatar Apr 07 '18 03:04 chaitgoli

I have the same issue, did you find the solution for that?

AVATAR197 avatar Sep 06 '19 17:09 AVATAR197

Same issue

Nahani avatar Apr 14 '20 16:04 Nahani

@Nahani

Same issue If you are not using expo try this library https://github.com/computerjazz/react-native-draggable-flatlist I had a lot of problems with that functionality in my previous app so I decided to remove it. But hopefully this will help.

AVATAR197 avatar Apr 14 '20 18:04 AVATAR197