【发布时间】:2026-01-17 22:45:02
【问题描述】:
如何使用 wix react native navigation v2 通过单击基于选项卡的应用程序的底部选项卡来打开模式/操作表?
目前,我正在使用以下包和版本:
- 反应原生:“0.59.8”
- 反应:“16.8.3”
- react-native-navigation : "^2.13.2"
- react-native-image-crop-picker: "^0.24.1"
这是我的路线/导航文件
Promise.all([
Foundation.getImageSource("home", 40),
FontAwesome5.getImageSource("user",30),
Feather.getImageSource("camera",25),
]).then(sources => {
Navigation.setRoot({
root: {
sideMenu: {
center: {
bottomTabs: {
options: {
bottomTabs: {
backgroundColor: 'white',
titleDisplayMode: 'alwaysHide'
},
},
children: [
{
stack: {
children: [{
component: {
name: 'HomeScreen',
passProps: {
text: 'This is tab 1'
}
}
}],
options: {
bottomTab: {
testID: 'HOME_TAB',
icon: sources[0],
},
topBar: {
title: {
text: 'MyReactApp',
}
}
}
}
},
{
component: {
name: 'Camera',
passProps: {
text: 'This is tab 2'
},
options: {
bottomTab: {
testID: 'CAMERA_TAB',
icon: sources[2]
}
}
}
},
{
stack: {
children: [{
component: {
name: 'ProfileScreen',
passProps: {
text: 'Profile Screen'
}
}
}],
options: {
bottomTab: {
testID: 'PROFILE_TAB',
icon: sources[1],
},
topBar: {
title: {
text: 'John Doe',
}
}
}
}
}
]
},
},
},
}
});
});
我想要的是,当用户单击camera 选项卡时,它应该打开一个模式/操作表,其中将显示他应该从相机胶卷中选择图像还是应该打开相机的选项。为此,我想使用react-native-image-crop-picker。但是我怎样才能做到这一点,或者我怎样才能自定义按钮标签按下操作?
我在谷歌上查看过,但除了这些对我没有多大帮助的链接之外,没有找到任何其他内容
https://github.com/wix/react-native-navigation/issues/3238
【问题讨论】:
-
使用导航事件在选项卡上显示和隐藏模式/操作表。
-
怎么样?我希望它打开一个模式而不是新页面我该怎么做你能分享一个例子或其他东西。
-
Navigation events 参考此链接。你必须使用模态,当组件可见时可见,屏幕不可见时隐藏。
标签: javascript reactjs react-native wix-react-native-navigation