Open
Description
🐛 Bug Report
On Android, calling setStackRoot
with a layout containing a component ID that is already in the current stack does not properly send passProps
to the "updated" component.
Have you read the Contributing Guidelines on issues?
Yes.
To Reproduce
- Push a component with a specific ID (
id: 'StackRoot1'
for this example) onto a stack - Call
setStackRoot
on the same stack, passing aLayout[]
containing in the "history" (in other words, not as the current visible component) a component with the same ID (StackRoot1
) and somepassProps
. - Press back or gesture to navigate "back" to
StackRoot1
. - On Android, observe the new
StackRoot1
component does not have the givenpassProps
; on iOS, observe the newStackRoot1
renders correctly.
Expected behavior
StackRoot1
correctly receives the passProps
assigned in the setStackRoot
call.
Actual Behavior
On Android, passProps
are not passed.
Android.mp4
iOS.mp4
Your Environment
- React Native Navigation version: 7.16.0
- React Native version: 0.63.2
- Platform(s) (iOS, Android, or both?): Both
- Device info (Simulator/Device? OS version? Debug/Release?):
- Pixel 3XL running Android 11
- iOS simulator of an iPhone 12 running iOS 14.5
Reproducible Demo
https://github.com/jmcountryman/react-native-navigation/tree/setStackRoot-passProps (diff)
- Launch the app and choose "SideMenu".
- Choose "Open Left".
- In the left menu choose "Push", and observe the
componentId
displayed in the center stack is "StackRoot1". - In the left menu choose "Set center stack root" (which sets the center stack to a layout with 2 components, both with
passProps
) and close the left menu. - Observe the "top" component has a
customProp
value. - Press back or gesture to navigate back once.
- On Android, observe the
StackRoot1
component does not havepassProps
, despite being specified in the call tosetStackRoot
. On iOS, observe thepassProps
appear correctly onStackRoot1
.