在抽屉本机内部的按钮之间切换

时间:2019-02-14 18:36:39

标签: react-native native-base

我使用此代码创建抽屉导航,但是我不知道如何从抽屉内的按钮切换屏幕?

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>
    )
  }
}

0 个答案:

没有答案