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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰] Heavy re-rendering of MessageList #2568

Open
3 of 6 tasks
arekkubaczkowski opened this issue Jun 25, 2024 · 0 comments
Open
3 of 6 tasks

[馃悰] Heavy re-rendering of MessageList #2568

arekkubaczkowski opened this issue Jun 25, 2024 · 0 comments

Comments

@arekkubaczkowski
Copy link

arekkubaczkowski commented Jun 25, 2024

In our app, the MessageList is rendered within a bottom sheet (by Gorhom). To display it properly, we need to calculate the available height within the bottom sheet content and apply this to the list's container. This is necessary because by default, the bottom sheet renders its children without limiting their height, causing them to extend out of the viewport.

The issue arises when resizing the bottom sheet containing multiple messages. This action triggers numerous re-renders, which are not optimized effectively on Getstream's end. Consequently, after a few snap point movements, the app becomes unresponsive and hangs. A quick investigation revealed that the MessageList component and the renderItem method do not adhere to optimization principles, causing unnecessary re-renders.

        // animated height
        <Animated.View style={list.styles}>
          <MessageList
            {...messageListProps}
            additionalFlatListProps={{
              getItemLayout(_, index) {
                return {
                  index,
                  length: 62,
                  offset: 62 * index,
                };
              },
            }}
          />
        </Animated.View>
        <KeyboardStickyView
          style={keyboardView.styles}
          offset={keyboardView.offset}
        >
          <MessageInput
            ShowThreadMessageInChannelButton={() => null}
            Input={props => <GetStreamInput {...props} />}
          />
        </KeyboardStickyView>

Expected behavior

I would find it very helpful to get the MessageList and Message components more optimized so it doesn't affect smooth re-rendering.

Project Related Information

Environment

Click To Expand

package.json:

"stream-chat": "8.31.0",
"stream-chat-expo": "^5.31.1",

# N/A

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • stream-chat-react-native version you're using that has this issue:
    • e.g. 5.4.3
  • Device/Emulator info:
    • I am using a physical device
    • OS version: e.g. Android 10
    • Device/Emulator: e.g. iPhone 11

Additional context

Screenshots

Click To Expand


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

No branches or pull requests

1 participant