Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when performing an update on the content, this does not reflect for the listing #31

Closed
henriqueweiand opened this issue Nov 12, 2018 · 5 comments

Comments

@henriqueweiand
Copy link

I am updating the content of DraggableFlatList, in the data attribute via redux, but I noticed that when updating in the variable that is defined in the date, it does not update the listing, this only occurs when the drag drop

Example with DraggableFlatList:

com draggableflatlist

code:

<DraggableFlatList
        data={data}
        renderItem={this.renderItem}
        keyExtractor={item => `key-${item.interno}`}
        scrollPercent={5}
        onMoveEnd={({ data }) => this.props.ordenacaoActions.setOrderUnidadesRequest({ data })}
        contentContainerStyle={{ marginHorizontal: metrics.baseMargin }}
        ItemSeparatorComponent={() => <View style={styles.separator} />}
      />

Example without DraggableFlatList and use original FlatList

flatlist

code:

<FlatList
        data={data}
        renderItem={this.renderItem}
        keyExtractor={item => `key-${item.interno}`}
        scrollPercent={5}
        onMoveEnd={({ data }) => this.props.ordenacaoActions.setOrderUnidadesRequest({ data })}
        contentContainerStyle={{ marginHorizontal: metrics.baseMargin }}
        ItemSeparatorComponent={() => <View style={styles.separator} />}
      />

I believe the lib, is not considering in your shouldComponentUpdate when there is update in the input values, or something of the genre ...

Am I correct about this procedure?

@fattahmuhyiddeen
Copy link

you can refer my pr #33

@bomei
Copy link

bomei commented Dec 19, 2018

FlatList is pureComponent, you should add extraData={data} or something similar in your code.

@LordHaywood
Copy link

Is there any update on this problem as still having this issue

@kelsonic
Copy link

kelsonic commented Aug 12, 2019

I solved this using @bomei's suggestion. Passing the prop extraData with the nested data that can change resolved the issue for me. Check out the docs on this prop here: https://facebook.github.io/react-native/docs/flatlist#extradata

It might be clearer if we added a link in the readme to all the FlatList props you can pass so we avoid confusion in the future: https://facebook.github.io/react-native/docs/flatlist#props

@computerjazz
Copy link
Owner

yep, extraData seems like the answer here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants