[ENTER DESCRIPTION HERE]
app was crashed when using Reactnative navigation v2 bottomTab what is the problum in this code
import {Navigation} from 'react-native-navigation'
Navigation.setRoot({
root:{
sideMenu: {
id:"RootStack",
left: {
component: {
id: 'SideMenu',
name: 'reminder.sideMenu',
}
},
center: {
bottomTabs: {
id:'bottomTab',
options: {
bottomTabs: {
titleDisplayMode: 'alwaysShow',
//testID: testIDs.BOTTOM_TABS_ELEMENT,
backgroundColor: 'white',
currentTabIndex: 0,
},
},
children: [
{
stack: {
id: 'BOTTOM_TAB_SCREENS',
options: {
bottomTab:{
selectedIconColor: 'green',
}
},
children: [{
component: {
name: 'reminder.ContactList',
passProps: {
text: 'This is tab 1',
// myFunction: () => 'Hello from a function!',
},
options: {
bottomTab: {
icon:require('../../Images/home1.png'),
text:'Home',
},
// topBar:{
// // visible:true
// }
},
}
},
]
}
},
{
component: {
name: 'reminder.ContactList',
options: {
bottomTab: {
icon: require('../../Images/contact.png'),
text:'Contact',
selectedIconColor: 'green',
}
}
},
},
{
component: {
name: 'reminder.FeedBack',
options: {
bottomTab: {
icon: require('../../Images/chatbot.png'),
text:'Chatbot',
selectedIconColor: 'green',
}
}
},
},
{
component: {
name: 'reminder.FeedBack',
options: {
bottomTab: {
icon: require('../../Images/feedback.png'),
text:'Feedback',
selectedIconColor: 'green',
}
}
},
},
],
},
}
},
}
})
}
[FILL THIS OUT]
Crashes also. See example: same screen component used...
If used as bottomTabs -> Android crashes
If used just as component -> ok
RN 0.57.8
RNN 2.5.1
export const gotoTab = () => Navigation.setRoot({
root: {
bottomTabs: {
children: [
{
component: {
name: 'Events',
},
}
],
},
}
});
export const gotoAuth = () => Navigation.setRoot({
root: {
component: {
name: 'Auth',
}
}
})
Log from AS
2019-01-08 17:00:21.285 27419-27419/com.flyaway E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.test, PID: 27419
java.lang.RuntimeException: Tried to get null value!
at com.reactnativenavigation.parse.params.Param.get(Param.java:14)
at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.lambda$createTabs$3(BottomTabsController.java:152)
at com.reactnativenavigation.viewcontrollers.bottomtabs.-$$Lambda$BottomTabsController$hVDDSxSvqNX-4DhQHls8ynB4x2w.map(Unknown Source:4)
at com.reactnativenavigation.utils.CollectionUtils.map(CollectionUtils.java:42)
at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.createTabs(BottomTabsController.java:148)
at com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController.createView(BottomTabsController.java:72)
at com.reactnativenavigation.viewcontrollers.ViewController.getView(ViewController.java:155)
at com.reactnativenavigation.viewcontrollers.ParentController.getView(ParentController.java:60)
at com.reactnativenavigation.viewcontrollers.navigator.RootPresenter.setRoot(RootPresenter.java:29)
at com.reactnativenavigation.viewcontrollers.navigator.Navigator.setRoot(Navigator.java:134)
at com.reactnativenavigation.react.NavigationModule.lambda$setRoot$1(NavigationModule.java:70)
at com.reactnativenavigation.react.-$$Lambda$NavigationModule$IfiDeOnYfgJADKZUxIVN9Zforsw.run(Unknown Source:8)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
I have same issue
private List<AHBottomNavigationItem> createTabs() {
if (tabs.size() > 5) throw new RuntimeException("Too many tabs!");
return map(tabs, tab -> {
BottomTabOptions options = tab.resolveCurrentOptions().bottomTabOptions;
return new AHBottomNavigationItem(
options.text.get(""),
imageLoader.loadIcon(getActivity(), options.icon.get()),
options.testId.get("")
);
});
}
when the application reaches this line imageLoader.loadIcon(getActivity(), options.icon.get())
after cannot go ahead @guyca
Same issue here, did you guys find a workaround for this?
@kabus202 see https://github.com/wix/react-native-navigation/issues/4510#issuecomment-453812276
Try to set icon. On adroid it crashes when you didnt give an icon source to bottomTab.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.
The issue has been closed for inactivity.
Most helpful comment
Try to set icon. On adroid it crashes when you didnt give an icon source to bottomTab.