NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

BUG Drawer Component

Open abdulsemiu-atanda opened this issue 9 years ago • 3 comments

Toggling Drawer Side from left to right causes rendering of just overlay when it tries to open from the right after it has previously opened from the left

react-native, react and native-base version

  • React-Native v0.46.0
  • React v16.0.0-alpha.12
  • Native-Base v2.3.1

Expected behavior

  • Drawer should open from whichever side it toggles to

Actual behavior

  • Drawer content does not render when opening from the right after it has been opened from the left

Steps to reproduce (code snippet or screenshot)

import React, { Component } from "react";
import { StyleSheet, Dimensions, View, ImageBackground } from "react-native";
import { Button, Container, Content, Icon, Drawer, Text } from "native-base";
import Sidebar from "./sidebar";

class HomeScreen extends Component {
  constructor(props) {
    super(props);

    this.state = {
      left: false
    }
    this.closeDrawer = this.closeDrawer.bind(this);
    this.openDrawer = this.openDrawer.bind(this);
    this.onSwitch = this.onSwitch.bind(this);
  }

  closeDrawer() {
    this.drawer._root.close()
  }
  openDrawer() {
    this.drawer._root.open()
  }

  onSwitch() {
    this.setState((prevState) => {
      return { left: !prevState.left }
    });
  }

  render() {
    return (
      <Drawer
        type="displace"
        key={this.state.left}
        ref={(ref) => this.drawer = ref }
        content={<Sidebar />}
        side={this.state.left ? "left" : "right" }
        relativeDrag={false}
        onClose={this.closeDrawer}
      >
        <Text onPress={this.openDrawer} style={{ fontSize: 50, color: "blue", marginTop: 40 }}>Wait for text here man</Text>
        <Text style={{ fontSize: 50, color: "blue", marginTop: 40 }} onPress={this.onSwitch}>Switch</Text>
      </Drawer>
    );
  }
}

Screenshot of emulator/device

simulator screen shot 21 sep 2017 12 50 35 pm

Is the bug present in both ios and android or in any one of them?

I've only tested with iOS

abdulsemiu-atanda avatar Sep 21 '17 11:09 abdulsemiu-atanda

Not present in the latest version(native-base:2.3.7 & RN:52.2)

Gif

drawer

akhil-ga avatar Feb 07 '18 10:02 akhil-ga

@akhil-geekyants Thanks for this update

abdulsemiu-atanda avatar Feb 07 '18 21:02 abdulsemiu-atanda

I am having the same issue in "native-base": "^2.12.1", "react": "16.6.3", "react-native": "0.58.4",

HOW can i update to native base 2.3.7 , as the latest version is this 2.12.1

ahmad6242 avatar Apr 11 '19 11:04 ahmad6242