我使用此代码创建抽屉导航,但是我不知道如何从抽屉内的按钮切换屏幕?
import React from 'react';
import { Container, Drawer, Button, Icon, Content, Text } from 'native-base';
import SideBar from './SideBar';
export default class App extends React.Component {
static navigationOptions = {
header: null,
};
closeDrawer = () => {
this.drawer._root.close()
};
openDrawer = () => {
this.drawer._root.open()
};
render() {
return (
<Drawer
ref={(ref) => { this.drawer = ref; }}
content={<Content style={{ backgroundColor: '#FFFFFF' }}>
<Button onPress={() => this.openDrawer()} transparent>
<Icon name='search' />
<Text>Search</Text>
</Button>
</Content>}>
<Button onPress={() => this.openDrawer()} transparent>
<Icon name='menu' />
</Button>
</Drawer>
)
}
}