-
-
Notifications
You must be signed in to change notification settings - Fork 242
Open
Description
Update: Root cause identified
After extensive debugging, we found the root cause is not the nested SafeAreaProvider itself, but
how it interacts with NativeTabs pre-rendering.
The actual problem
- NativeTabs (expo-router) pre-renders ALL tabs simultaneously when the app loads
- At pre-render time, nested SafeAreaProviders haven't measured yet
- Components get the root provider's value (device safe area only, e.g. 34px)
- When user visits a tab, the nested SafeAreaProvider measures bounded insets (e.g. 83px including tab
bar) - This causes a visible jump as the layout shifts
What we tried
- Context-based caching: Doesn't work because NativeTabs isolates React context between tabs
- Module-level caching: Doesn't help the first tab because all tabs pre-render simultaneously before
any measurement - SafeAreaView: Uses the existing provider's values, doesn't measure bounded insets
- initialMetrics: We don't know the bounded value ahead of time
The fundamental issue
There's no way to get synchronous bounded insets from a nested SafeAreaProvider. The measurement is
always async, but NativeTabs pre-renders tabs before measurement completes.
Current workaround
Accept the flash as a known limitation. It only occurs on first visit to each tab (components stay
mounted after).
Potential library-level fixes
- Option to pass a callback/promise to
initialMetricsthat resolves after first measurement - A
useSafeAreaInsetsSync()hook that blocks render until measurement completes - Better documentation about this interaction with tab navigators that pre-render
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels