react-native-side-menu
react-native-side-menu copied to clipboard
Changing sidemenu width (openMenuOffset)
Using react native 0.41.2.
On change of orientation I would like to change width of sidemenu when opened but i can't seem to make it work. First tried to change variable when rerendering depending on device orientation, but couldn't change width of sidemenu. Next tried by changing state and using it on openMenuOffset, but didn't make it work. Thirdly tried to render completely two different sidemenus on change of orientation with diffrent openMenuOffset. But even that didn't work.
How to make this work? I mean how are you supposed to change width of sidemenu?
openMenuOffset is a number that remains on the state of the component. This means that the INIT value for this variable would determinate how the sideMenu width will be.
I couldn't find on the code a clear way to update that width. Maybe making one feature that allow us to set the width on props updates or something like that.
Maybe here:
componentWillReceiveProps(props) {
if (typeof props.isOpen !== 'undefined' && this.isOpen !== props.isOpen && (props.autoClosing || this.isOpen === false)) {
this.openMenu(props.isOpen);
}
}
¿@Kureev do you know any alternative to that?
The same problem here. Anybody has solved the problem? I need side bar different widths depending on mobile orientation
no answer still :(
+1
+1
openMenuOffset={Dimensions.get('window').width*0.8} You can try it
I have a similar problem. I have set a state variable that gets updated. But the offset doesn't change after I call setState
to update the state of the variable passed to openMenuOffset
.
hi any one solve this issue.