我花了超过 si 个小时尝试将 DrawerNavigator 的背景更改为透明,但没有成功。当我在主要组件中更改它时写入它可以工作
const MainTabBarDrawer = DrawerNavigator({
Home:{
screen:MainTabNavigator,
},
},{
drawerWidth: 200,
drawerPosition: 'right',
// contentComponent: props => <Text style={{color:'white'}} >text
</Text>,
drawerBackgroundColor: 'yellow',
//backgroundColor:'transparent',
// style: {
// //backgroundColor: 'transparent',
// flex: 1
// },
// contentOptions: {
// style: {
// backgroundColor: 'transparent',
// flex: 1
// }
},
{
style: {
backgroundColor: 'transparent',
flex:1
}
}
)
class App extends Component{
render()
{
return(<MainTabBarDrawer style={{backgroundColor: 'transparent'}}/>)
//return(<Login/>)
}
}
Run Code Online (Sandbox Code Playgroud)
虽然上述方法可行,但我的布局非常复杂,我不希望抽屉出现在我的所有视图中。那么有人知道我是否可以直接更改 DrawerNavigator 的背景而不将其渲染为组件吗?
react-native react-native-ios react-native-navigation react-navigation