react-native-side-menu icon indicating copy to clipboard operation
react-native-side-menu copied to clipboard

Changing sidemenu width (openMenuOffset)

Open KBepo opened this issue 7 years ago • 8 comments

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?

KBepo avatar Mar 08 '17 14:03 KBepo

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?

carlesnunez avatar Jun 27 '17 16:06 carlesnunez

The same problem here. Anybody has solved the problem? I need side bar different widths depending on mobile orientation

DavitVosk avatar Sep 19 '17 20:09 DavitVosk

no answer still :(

JulioOrellana avatar Sep 30 '17 00:09 JulioOrellana

+1

tnguven avatar Oct 02 '17 22:10 tnguven

+1

tybro0103 avatar Jul 11 '18 12:07 tybro0103

openMenuOffset={Dimensions.get('window').width*0.8} You can try it

thinhkhang97 avatar Nov 20 '18 15:11 thinhkhang97

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.

bmwertman avatar Mar 30 '19 15:03 bmwertman

hi any one solve this issue.

sundersaithani avatar Sep 20 '19 10:09 sundersaithani