fix: portal content disappearing when mounted and relayouted#3417
Merged
isekovanic merged 1 commit intodevelopfrom Feb 22, 2026
Merged
fix: portal content disappearing when mounted and relayouted#3417isekovanic merged 1 commit intodevelopfrom
isekovanic merged 1 commit intodevelopfrom
Conversation
Contributor
SDK Size
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Goal
This PR fixes a really weird issue with
Portalcomponents oniOS, where if thePortalcomponent is mounted (with a fixedhostName) and then immediately re-layouted (this does not implyonLayoutbeing called necessarily, but rather it changing position - like for example padding being added to its parent view, like aFlatListfor example orflex: 1forcing the parent to change its layout) the content of thatPortalwould 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
Viewunmounted. I'll invest some more time into this when I have more of it. For now, benchmarks show that having the top/bottom itemPortals mounted at all times (but with nochildrennorhostName) adds no overhead whatsoever and so the short-term fix is this. I'm not 100% certain whether it's a bug inreact-native-teleportor in our own handling, but will get to the bottom of it at some point. This does NOT happen onAndroid.The reproduction steps are quite convoluted too:
ChannelcontentSizeof the underlyingFlatList), around 30-40 extra messages will domessagewe've been looking at🛠 Implementation details
🎨 UI Changes
iOS
Android
🧪 Testing
☑️ Checklist
developbranch