NativeBase
NativeBase copied to clipboard
BUG Drawer Component
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

Is the bug present in both ios and android or in any one of them?
I've only tested with iOS
Not present in the latest version(native-base:2.3.7 & RN:52.2)
Gif

@akhil-geekyants Thanks for this update
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