【发布时间】:2020-09-08 13:57:53
【问题描述】:
我有一个带有 react-navigation 的应用程序,我想在导航栏上进行绘制。我的 app.js 看起来像这样:
export default class App extends React.Component {
render() {
return (
<Provider store={store}>
<StatusBar barStyle='dark-content'></StatusBar>
<Navigation />
</Provider>
)
}
}
...
const AppNavigator = createStackNavigator({
Home: HomeView,
Detail: DetailView
},
let Navigation = createAppContainer(AppNavigator)
在作为根组件的 HomeView 中,我的渲染方法如下所示:
render() {
return (
<View style={{ flex: 1, backgroundColor: colors.backgroundColor }}>
{isModalVisible && <View style={styles.overlay}>
... Modal content
</View>}
... Other views
</View>
)
}
overlay: {
position: 'absolute',
zIndex: 1,
top: 0,
left: 0,
width: Dimensions.get('screen').width,
bottom: 0,
backgroundColor: '#000000A0',
},
我的问题是,模态视图不会在导航栏上呈现,即导航栏不在覆盖层之下。我不能使用内置模态或 react-native-modal,有什么方法可以使用常规视图在导航栏上呈现?
【问题讨论】:
标签: reactjs react-native react-navigation