我使用了抽屉的本机基本代码为我的主页制作了一个侧边栏,该按钮在我按this.openDrawer()时可以正常使用。.我正在使用此代码>
import React, { Component } from 'react';
import { Drawer,Header,Icon,Left,Body,Right } from 'native-base';
import {Text,View,StatusBar} from 'react-native';
import SideBar from '../screens/sidebar';
export default class home extends Component {
closeDrawer = () => {
this.drawer._root.close()
};
openDrawer = () => {
this.drawer._root.open()
};
render() {
return (
<Drawer
ref={(ref) => { this.drawer = ref; }}
content={<SideBar navigator={this.navigator} />}
onClose={() => this.closeDrawer()} >
<Header>
<Left>
<Icon name="menu" style={{color:'#fff'}}
onPress={()=>this.openDrawer()}
/>
</Left>
<Body style={{alignItems:'center'}}>
<Text style={{color:'#fff',fontSize:20,fontWeight:'bold'}}>Welcome to
app!</Text></Body>
<Right></Right>
</Header>
</Drawer>
);
}
}
我想知道为什么它的不透明度更低,我尝试在侧边栏屏幕上给白色提供背景颜色。