You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When popToTopOnBlur: true is set on a Tab.Screen whose component is a createNativeStackNavigator, switching away from that tab crashes on Android with
a fatal IndexOutOfBoundsException if the stack has 4 or more screens pushed.
The crash does NOT occur when the stack depth is 3 or fewer screens.
Expected behavior
popToTopOnBlur pops the nested stack to its first screen (as documented),
regardless of stack depth.
Actual behavior
Fatal crash on Android:
```
java.lang.IndexOutOfBoundsException: index 3 out of bounds for length 0
```
or
```
java.lang.IndexOutOfBoundsException: index 2 out of bounds for length 0
```
The index in the error corresponds to the number of screens minus one. With
≤3 screens, no crash occurs.
Screen_Recording_20260329_192534_Champagne.mp4
Root cause hypothesis
popToTopOnBlur internally dispatches StackActions.popToTop() during the tab
blur event. On Android, this triggers a native fragment transaction that attempts
to pop N-1 fragments simultaneously. The fragment manager's backstack array
appears to be emptied before the pop count is resolved, causing the OOB crash.
Workaround
The only crash-free workaround found is to avoid popToTopOnBlur and instead
manually call navigateToTab (a simple CommonActions.navigate tab switch,
no stack manipulation), accepting that the previous stack state is preserved
until the user next navigates to that tab.
Environment
react-native: 0.83.1
react-native-screens: 4.24.0
@react-navigation/bottom-tabs: 7.15.8
@react-navigation/native-stack: 7.14.9
Platform: Android only (iOS works correctly)
Architecture: Old Architecture (Bridge)
Steps to reproduce
Set up a bottom tab navigator with a tab whose component is a native stack:
Description
When
popToTopOnBlur: trueis set on aTab.Screenwhose component is acreateNativeStackNavigator, switching away from that tab crashes on Android witha fatal
IndexOutOfBoundsExceptionif the stack has 4 or more screens pushed.The crash does NOT occur when the stack depth is 3 or fewer screens.
Expected behavior
popToTopOnBlurpops the nested stack to its first screen (as documented),regardless of stack depth.
Actual behavior
Fatal crash on Android:
```
java.lang.IndexOutOfBoundsException: index 3 out of bounds for length 0
```
or
```
java.lang.IndexOutOfBoundsException: index 2 out of bounds for length 0
```
The index in the error corresponds to the number of screens minus one. With
≤3 screens, no crash occurs.
Screen_Recording_20260329_192534_Champagne.mp4
Root cause hypothesis
popToTopOnBlurinternally dispatchesStackActions.popToTop()during the tabblur event. On Android, this triggers a native fragment transaction that attempts
to pop N-1 fragments simultaneously. The fragment manager's backstack array
appears to be emptied before the pop count is resolved, causing the OOB crash.
Workaround
The only crash-free workaround found is to avoid
popToTopOnBlurand insteadmanually call
navigateToTab(a simpleCommonActions.navigatetab switch,no stack manipulation), accepting that the previous stack state is preserved
until the user next navigates to that tab.
Environment
react-native: 0.83.1react-native-screens: 4.24.0@react-navigation/bottom-tabs: 7.15.8@react-navigation/native-stack: 7.14.9Steps to reproduce
```jsx
<Tab.Screen
name="MyTab"
component={MyStackNavigator}
options={{ popToTopOnBlur: true }}
/>
```
```js
navigation.navigate('Screen1');
navigation.navigate('Screen2');
navigation.navigate('Screen3');
navigation.navigate('Screen4'); // <-- 4th screen
```
CommonActions.navigate:```js
navigationRef.dispatch(
CommonActions.navigate({ name: 'OtherTab' })
);
```
Snack or a link to a repository
1
Screens version
4.24.0
React Native version
0.83.1
Platforms
Android
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
Samsung Galaxy S25
Acknowledgements
Yes