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

Can we make the menu fixed at the bottom of the screen?

Open rmscoelho opened this issue 6 years ago • 4 comments

Good evening,

I am trying to make the menu always open in the same position, because I am having trouble with it opening over the last item of a loop, instead of on top of the clicked item.

If there is a solution, I'd be pretty grateful.

Thank you!

rmscoelho avatar Jun 24 '19 15:06 rmscoelho

@rmscoelho at the moment this is not possible. In near future I want rework this component in small one like overlay and menu and you can build own menu from this components and configure them separately (that also close #54).

For temporary fix you can modify that line to set menu position from props (or use hardcoded constants). Like this:

  show = () => {
    this.setState({
      buttonHeight: 0,
      buttonWidth: 0,
      left: this.props.left,
      menuState: STATES.SHOWN,
      top: this.props.top,
    });
  };

Also you need remove padding from constants in render method.

mxck avatar Jun 24 '19 21:06 mxck

@mxck Thanks man! I ended up finding a fork of your work, that worked in a different way and so didn't give me problems with the way I was doing stuff (which is probably very very wrong).

But keep going, this is pretty good stuff, good potencial! I like those ideas of yous ;)

rmscoelho avatar Jun 24 '19 22:06 rmscoelho

@rmscoelho You can try out this package - https://www.npmjs.com/package/react-native-enhanced-popup-menu. It initially was based on this react-native-material-menu, but more flexible in terms of customizations.

I support not only bottom position, but BOTTOM_LEFT, BOTTOM_RIGHT, BOTTOM_CENTER. And on top of that you can add your custom dynamic position shifts (offsets). It allows you to place menu virtually everywhere.

likern avatar Sep 05 '19 13:09 likern

@likern I think we ended up using that one. Not sure now, it was 3 months ago already ahahah But we managed to do it, it's what matters.

Many thanks anyways!

rmscoelho avatar Sep 05 '19 13:09 rmscoelho