У меня есть нижняя вкладка, которая содержит домашний экран, и я хочу, чтобы при нажатии на кнопку можно было перейти к другому экрану, который не включен в стек.
Вот мои screens.js где я зарегистрировал свои три экрана
export const registerScreens = (Provider, store) => {
Navigation.registerComponent('app.Drawer',() => Drawer, Provider, store);
Navigation.registerComponent('app.Home',() => Home, Provider, store);
Navigation.registerComponent('app.About', () => About, Provider, store);
};
Вот мой navigator.js , где я установил рут для навигации. Я в основном создал sideMenu с выдвижными и нижними вкладками
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
name: 'app.Drawer',
},
},
center: {
bottomTabs: {
children: [
{
component: {
name: 'app.Home',
options: {
bottomTab: {
text: 'Tab 1',
icon: require('../assets/icons/account.png'),
},
},
},
}],
},
},
},
});
и Home.js
export default class Home extends Component {
render() {
return (
<View style={{
backgroundColor: 'white', flex: 1, justifyContent: 'center', alignItems: 'center',
}}
>
<Text>Home page</Text>
<Button
onPress={() => {
Navigation.push(this.props.componentId, { <-- doesn't work
component: {
name: 'app.About',
}
});
}}
title="CLick to go to about page"
/>
</View>
);
}
}