react-native-router-flux: Problem with redux state and Switch after upgrading RN to v0.24
- react-native-router-flux v3.24.0
- react-native v0.24.1
After upgrading to RN v0.24 and the the latest RNRF something doesn’t work very well using Switch
and Redux. Everything was working fine with RN v0.22. I’m using the built-in reducer for the router.
I have something like that
const selectorCheck = (auth) => {
if (auth && !auth.token) {
return 'isGuest'
}
return 'isAuthenticated'
}
to switch from one group of scenes to the other if an auth.token
is available.
Expected behaviour
Using the Redux debugger or a button to reset the state it should “switch” to the guest group of scenes (like it was doing with RN v0.22)
Actual behaviour
Doesn’t switch to the guest scene, the only way to do that is reloading the app using cmd+R
Steps to reproduce
- change the state in order to load the “isAuthenticated” group of scenes
- reset the state using the redux debugger or a button (tried both)
This is how my scenes look like:
const scenes = Actions.create(
<Scene key="modal" component={ Modal } >
<Scene
key="root"
tabs
component={ connect(({ auth }) => ({ auth }))(Switch) }
selector={ ({ auth }) => selectorCheck(auth) }
>
<Scene key="isGuest" style={ bgColor('red', 'base') }>
<Scene key="launch" component={ Launch } title="Launch" initial />
</Scene>
<Scene key="isAuthenticated">
<Scene key="onboarding" component={ OnBoarding } title="OnBoarding" initial />
</Scene>
</Scene>
</Scene>
)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (9 by maintainers)
Commits related to this issue
- V4 announcement, v3 is obsolete now; closes #1,#2,#3,#4,#5,#6,#7,#8,#9,#10,#11,#12,#13,#14,#15,#16,#17,#18,#19,#20,#21,#22,#23,#24,#25,#26,#27,#28,#29,#30,#31,#32,#33,#34,#35,#36,#37,#38,#39,#40,#41,#... — committed to aksonov/react-native-router-flux by aksonov 7 years ago
- V4 docs; closes #1,closes #2,closes #3,closes #4,closes #5,closes #6,closes #7,closes #8,closes #9,closes #10,closes #11,closes #12,closes #13,closes #14,closes #15,closes #16,closes #17,closes #18,cl... — committed to aksonov/react-native-router-flux by aksonov 7 years ago
@aksonov Just updated to RN 0.26 and latest version of RNRF (3.26.1). The problem is still present.
Switching back to RN 0.22 and RNRF 3.22 everything works fine