react-native-navigation
react-native-navigation copied to clipboard
[V2] setStackRoot crash
Issue Description
The application is crashing when try to change the layout with setStackRoot
Steps to Reproduce / Code Snippets / Screenshots
Navigation.setStackRoot(this.props.componentId, {
bottomTabs: {
children: [
{
stack: {
children: [],
options: {
bottomTab: {
text: 'Tab 1',
},
},
},
},
{
component: {
name: 'organization.componentName',
options: {
bottomTab: {
text: 'Tab 2',
},
},
},
},
],
},
});
Environment
- React Native Navigation version: 2.0.2452
- React Native version: 0.56.0
- Platform(s) (iOS, Android, or both?): Android
- Device info (Simulator/Device? OS version? Debug/Release?): Android Emulator v. 27.3.9-4899998 -- 6.0 (Marshmallow) - API 23 (Rev 1)
Here is the logcat:
java.lang.NullPointerException: Attempt to invoke virtual method 'int com.aurelhubert.ahbottomnavigation.AHBottomNavigation.getCurrentItem()' on a null object reference
at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.getCurrentChild(BottomTabsController.java:114)
at com.reactnativenavigation.viewcontrollers.ParentController.resolveCurrentOptions(ParentController.java:45)
at com.reactnativenavigation.viewcontrollers.ParentController.resolveCurrentOptions(ParentController.java:46)
at com.reactnativenavigation.viewcontrollers.ParentController.resolveCurrentOptions(ParentController.java:54)
at com.reactnativenavigation.viewcontrollers.stack.StackController.push(StackController.java:132)
at com.reactnativenavigation.viewcontrollers.stack.StackController.setRoot(StackController.java:166)
at com.reactnativenavigation.viewcontrollers.Navigator.lambda$setStackRoot$2$Navigator(Navigator.java:144)
at com.reactnativenavigation.viewcontrollers.Navigator$$Lambda$2.run(Unknown Source)
at com.reactnativenavigation.viewcontrollers.ViewController.performOnParentStack(ViewController.java:130)
at com.reactnativenavigation.viewcontrollers.Navigator.setStackRoot(Navigator.java:144)
at com.reactnativenavigation.react.NavigationModule.lambda$setStackRoot$5$NavigationModule(NavigationModule.java:95)
at com.reactnativenavigation.react.NavigationModule$$Lambda$5.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
For Android you NEED to specify icons and your tab 1's stack should have some sort of component?
My bad, copy pasted from here: https://wix.github.io/react-native-navigation/v2/#/docs/layout-types
Hi @lean , did it work for you? can you paste your config? it still does not work for me :(