Skip to content

Comments

fix: portal content disappearing when mounted and relayouted#3417

Merged
isekovanic merged 1 commit intodevelopfrom
fix/portal-content-disappearing-relayout-ios
Feb 22, 2026
Merged

fix: portal content disappearing when mounted and relayouted#3417
isekovanic merged 1 commit intodevelopfrom
fix/portal-content-disappearing-relayout-ios

Conversation

@isekovanic
Copy link
Contributor

🎯 Goal

This PR fixes a really weird issue with Portal components on iOS, where if the Portal component is mounted (with a fixed hostName) and then immediately re-layouted (this does not imply onLayout being called necessarily, but rather it changing position - like for example padding being added to its parent view, like a FlatList for example or flex: 1 forcing the parent to change its layout) the content of that Portal would disappear from the reparented view and its reference would be lost.

Through some debugging, I've confirmed its not any animated values causing this issue nor is the View unmounted. I'll invest some more time into this when I have more of it. For now, benchmarks show that having the top/bottom item Portals mounted at all times (but with no children nor hostName) adds no overhead whatsoever and so the short-term fix is this. I'm not 100% certain whether it's a bug in react-native-teleport or in our own handling, but will get to the bottom of it at some point. This does NOT happen on Android.

The reproduction steps are quite convoluted too:

  • Open a Channel
  • Long-press a message (any in the viewport) and close the overlay after
  • Open the keyboard (or attachment picker), then long press on a message and then close the overlay after
  • Paginate a few pages (I assume something messes with the contentSize of the underlying FlatList), around 30-40 extra messages will do
  • Go to the same message we've been looking at
  • Press and hold the message (normally) and close the overlay
  • Immediately after, open the keyboard (or attachment picker), press and hold the same message
  • Observe how the top and bottom item in the context menu disappear after the overlay is fully opened

🛠 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

@Stream-SDK-Bot
Copy link
Contributor

SDK Size

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

@isekovanic isekovanic merged commit 0ffbc66 into develop Feb 22, 2026
5 checks passed
@isekovanic isekovanic deleted the fix/portal-content-disappearing-relayout-ios branch February 22, 2026 18:14
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