Skip to content

fix: autoscrolling while ctx menu is active#3617

Merged
isekovanic merged 1 commit into
developfrom
fix/ctx-menu-autoscroll-layout
May 26, 2026
Merged

fix: autoscrolling while ctx menu is active#3617
isekovanic merged 1 commit into
developfrom
fix/ctx-menu-autoscroll-layout

Conversation

@isekovanic
Copy link
Copy Markdown
Contributor

@isekovanic isekovanic commented May 26, 2026

🎯 Goal

This PR addresses an issue with autoscrolling behaviour with our context menu, where view positioning would be offset if we have the context menu open and we receive new messages (and are near the bottom).

Typically, since the Message position would change the context menu would not really have the correct position to crawl back to when we want to animate back. While this can be easily solved through another correction SharedValue (in order to simply adjust positioning), it is in fact not so trivial to solve the fact that if we receive enough messages (i.e anything past the virtualization window of FlatList or even worse, enforcing recycling for FlashList) it is very possible that the Message we have in the context menu would either be unmounted (or again worse, recycled) and the Portal would detach from its host. This is very possible within a livestream scenario, for example - where it's not uncommon to receive 10s or 100s of messages in a relatively short timespan.

Instead, we simply disable autoscrolling when the context menu is opened. This is still performant because internally, even though a prop changed FlatList is going to simply disable autoscrolling native side rather than do heavy rerendering internally (basically just the shell). This works similarly for FlashList as well.

This generally makes sense from a UX perspective as well, as typically when we want to do a message action we don't particularly want to lose the context of that message's surroundings either (this is how Twitch chat does it as well, for example).

🛠 Implementation details

🎨 UI Changes

iOS
Before After
Android
Before After

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

](https://github.com/GetStream/stream-chat-react-native/issues)` `

@isekovanic isekovanic requested review from oliverlaz and szuperaz May 26, 2026 10:19
@Stream-SDK-Bot
Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 368 KB 368 KB 0 B 🟢

@isekovanic isekovanic merged commit ee7cdcb into develop May 26, 2026
5 checks passed
@isekovanic isekovanic deleted the fix/ctx-menu-autoscroll-layout branch May 26, 2026 11:19
@github-actions github-actions Bot mentioned this pull request May 26, 2026
6 tasks
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

Successfully merging this pull request may close these issues.

2 participants