Crash with sideMenu and bottomTabs layout as center.
Issue Description
It fatally crash with "App has stopped" since 2.12.0-snapshot.212 up to at least 2.13.1.
No errors in logs using react-native log-android.
It works fine on 2.12.0-snapshot.211 and before. I was trying to upgrade from 2.11.0.
Steps to Reproduce / Code Snippets / Screenshots
Navigation.setRoot({
root: {
sideMenu: {
id: ENavigation.MAIN,
left: {
component: {
id: ENavigation.PROFILE_MENU,
name: ENavigation.PROFILE_MENU
}
},
center: {
bottomTabs: {
children: [
]
}
}
}
}
});
This works:
Navigation.setRoot({
root: {
sideMenu: {
id: ENavigation.MAIN,
left: {
component: {
id: ENavigation.PROFILE_MENU,
name: ENavigation.PROFILE_MENU
}
},
center: {
stack: {
children: [
]
}
}
}
}
});
Environment
- React Native Navigation version: 2.13.1
- React Native version: 0.57.8
- Platform(s) (iOS, Android, or both?): Android
- Device info (Simulator/Device? OS version? Debug/Release?): Simulator, Debug
I am facing the same issue as well.
Experiencing the same issue while upgrading from 2.10.0 to 2.13.1.
Environment React Native Navigation version: 2.13.1 React Native version: 0.57.8 Platform(s) (iOS, Android, or both?): Android Device info (Simulator/Device? OS version? Debug/Release?): Emulator, Debug
Navigation.setRoot({
root: {
sideMenu: {
id: 'sideMenu',
enabled: true,
center: {
bottomTabs: {
animate: true,
id: 'ROOT',
children: tabs,
},
},
right: {
component: {
id: 'MENU',
name: MENU_SCREEN,
},
},
},
},
});
@zainzafar90 @obshksw Did you guys solve this problem?
Hey guys, does this issue reproduce in the playground app? Can anyone push a branch where the issue reproduces?
I don't know about the playground app, but I tried again on 2.16.0 and it still occurs with only the provided code that I posted.
I tested it in an TestApp on my side, and it still crashes, here's the code:
import { Navigation} from "react-native-navigation";
import * as React from 'react';
import { View, Text } from 'react-native';
export default class App {
constructor () {
Navigation.registerComponent("Test", () => TestScreen);
Navigation.registerComponent("TestMenu", () => TestMenu);
Navigation.events().registerAppLaunchedListener(this._onRegisterAppLaunched.bind(this));
}
private _onRegisterAppLaunched() {
Navigation.setRoot({
root: {
sideMenu: {
id: "Main",
left: {
component: {
id: "TestMenu",
name: "TestMenu"
}
},
center: {
bottomTabs: {
children: []
}
}
}
}
});
}
}
class TestScreen extends React.PureComponent {
public render() {
return (
<View>
<Text>Test</Text>
</View>
);
}
}
class TestMenu extends React.PureComponent {
public render() {
return (
<View>
<Text>Test Menu</Text>
</View>
);
}
}
and the package.json:
{
"name": "test",
"version": "1.0.0",
"private": true,
"main": "index.js",
"scripts": {
"restart": "npm start -- --reset-cache",
"start": "react-native start",
"android": "react-native run-android"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-navigation": "2.16.0"
},
"devDependencies": {
"@types/react": "^16.4.14",
"@types/react-native": "^0.56.23",
"metro-react-native-babel-preset": "^0.51.0"
}
}
@obshksw, I had the same issue, but it turns out it was because of the bottom tabs. I was not specifying a title or an icon for those tab as I'm rendering my own tabs. Once I specified dummy icons and label, it stopped crashing
center: {
bottomTabs: {
children: [
{
stack: {
children: [
{
component: {
name: "xxx.Dashboard"
}
}
],
options: { <=== added this
bottomTab: {
text: "Tab 3",
icon: require("../../images/icon/addPain.png")
}
}
}
},
could you have the same issue?
I found the issue by deleting part of my layout until it did not crash anymore
Hi @guyca
In the end, my problem was the one discussed here #4812 . So I manually updated that line in node_modules since the last version of RNN, 2.16.0, doesn't include it.
@otusweb Nope. I actually have a project that was already working with bottomTabs filled in. I just removed that part of the code to remove some noise about the problem. Also, even on 2.12.0, just having an empty bottomTabs is not crashing, like the previous example.
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.