原生基地的抽屉不起作用

时间:2017-10-11 20:50:37

标签: android react-native drawer native-base

import React, { Component } from "react";
import { Drawer, Container, Header, Left, Button, Icon } from "native-base";
import {
  AppRegistry,
  Text,
  View,
  TouchableHighlight,
  Image,
  TouchableWithoutFeedback,
  Navigator,
  BackHandler
} from "react-native";

// var PayPal = require('react-native-paypal');
import profileStyle from "./Styles/profileStyle";
import images from "./images";
import OriDash from "./ori_dashboard";

export default class Menu extends Component {
  constructor(props) {
    super(props);
    this.state = {
      modalVisible: false
    };
    this.closeDrawer = this.closeDrawer.bind(this);
    this.openDrawer = this.openDrawer.bind(this);
  }
  closeDrawer = () => {
    this._drawer._root.close();
  };
  openDrawer = () => {
    // alert("here");
    this._drawer._root.open();
  };

  render() {
    return (
      <View>
        <Drawer
          ref={ref => {
            this._drawer = ref;
          }}
          content={<OriDash navigator={this._navigator} />}
          onClose={() => this.closeDrawer()}
        >
          <Container>
            <Header>
              <Left>
                <Button
                  transparent
                  onPress={() => {
                    this.openDrawer();
                  }}
                >
                  <Icon
                    name={"ios-home"}
                    style={{ fontSize: 20, color: "#00c497" }}
                  />
                </Button>
              </Left>
            </Header>
          </Container>
        </Drawer>
      </View>
    );
  }
}

一旦Drawer标签被移除,容器就会显示,否则容器内容也不会显示。任何人都可以帮我解决Drawer组件以及如何打开菜单点击它。我已经创建了一个组件OriDash其中的内容将显示菜单,点击ios-home图标菜单应分别打开和关闭。

0 个答案:

没有答案