Skip to content

fix: translated into viewport PortalWhileClosingView#3512

Merged
isekovanic merged 2 commits intodevelopfrom
fix/non-native-navigation-portalwhileclosing
Mar 25, 2026
Merged

fix: translated into viewport PortalWhileClosingView#3512
isekovanic merged 2 commits intodevelopfrom
fix/non-native-navigation-portalwhileclosing

Conversation

@isekovanic
Copy link
Contributor

🎯 Goal

THis PR addresses a very peculiar issue we have with our PortalWhileClosingView. Namely, any time the PortalWhileClosingView is rendered some place else than the actual viewport (a common example would be the JS stack version of react-navigation, where the entire screen is first rendered offscreen and then translated into view) our previous setup would take layout measurements wrong (as it would do it on mount initially, while the view is completely offset).

This would of course resolve itself if onLayout is ever invoked again on the children property of PortalWhileClosingView, however this is in no way guaranteed (as even the initial onLayout happens offscreen). Instead, we change the logic to only measure when:

  • The overlay actually opens
  • onLayout is invoked while the overlay is open

We don't particularly care about any other scenario anyway. This is additionally a slight performance boost as well, as for example children with very heavy layout animations (for example animating scale directly on some interpolation, or basically anything which calls onLayout very often). We do pay the cost on initial teleport, but it's negligible and does not at all stress any of the threads out.

🛠 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

@isekovanic isekovanic requested a review from oliverlaz March 25, 2026 10:50
@Stream-SDK-Bot
Copy link
Contributor

SDK Size

title develop branch diff status
js_bundle_size 374 KB 374 KB +236 B 🟢

@isekovanic isekovanic merged commit efb686c into develop Mar 25, 2026
5 of 6 checks passed
@isekovanic isekovanic deleted the fix/non-native-navigation-portalwhileclosing branch March 25, 2026 12:32
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