Skip to content

How to prevent re-rendering of FlatList #16240

Description

@pgwzzz

Hello.

I'm implementing chatting with FlatList.

Every time there is a new chat message detected, I do the following.

let newItem = {...}; // read a new chat message from server
let nextFlatListData = this.state.flatListData.slice(0); // clone the chat list
nextFlatListData.push(newItem); // add the new chat to the list
this.setState({flatListData: nextFlatListData}); // update FlatList

It seems that it re-renders every row.

I just need the row for newItem is rendered and the others are NOT re-rendered.

Thank you very much.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions