Я создаю приложение React Native с использованием последней версии React Native (v0.59) и response-native-navigation@2.18.5.Мне бы хотелось, чтобы реализовать ту же функцию, что и switchToTab
в реагирующей нативной навигации v1.
Я уже пробовал Navigation.mergeOptions, но не повезло.
Здесьмои фрагменты кода для справки:
Navigation.setRoot({
root: {
sideMenu: {
left: {
component: {
name: 'sidedrawer',
id: 'leftSideDrawer',
passProps: {
text: 'This is side menu'
}
}
},
center: {
bottomTabs: {
id: 'bottomTabs',
children: [
{
stack: {
children: [
{
component: {
name: 'Screen1',
passProps: {
text: 'This is tab 1'
},
options: {
topBar: {
title: {
text: 'Text1'
},
leftButtons: [
{
id: 'sideDrawerToggle',
title: 'Menu',
icon: sources[2]
}
]
}
}
}
}
],
options: {
bottomTab: {
id: 'bottom_tab_find_place',
text: 'Text1',
icon: sources[0],
testID: 'FIRST_TAB_BAR_BUTTON'
}
}
}
},
{
stack: {
children: [
{
component: {
name: 'Screen2',
passProps: {
text: 'This is tab 2'
},
options: {
topBar: {
title: {
text: 'Text2'
},
leftButtons: [
{
id: 'sideDrawerToggle',
title: 'Menu',
icon: sources[2]
}
]
}
}
}
}
],
options: {
bottomTab: {
id: 'bottom_tab_share_place',
text: 'Text2',
icon: sources[1],
testID: 'SECOND_TAB_BAR_BUTTON'
}
}
}
}
]
}
}
}
}
});
Я бы хотел иметь возможность программно переключаться с Screen 2
на Screen 1
.