react-native-action-button icon indicating copy to clipboard operation
react-native-action-button copied to clipboard

Prevent default behaviour of opening menu when pressed?

Open follower opened this issue 8 years ago • 2 comments

I wanted to prevent the default behaviour of opening the menu when onPress is triggered (when child items are present) but it seems the code does not allow for this functionality:

          onPress={() => {
            this.props.onPress()
            if (this.props.children) this.animateButton()
          }}>

My goal was to have a short press activate one action but have a long press open the menu.

One approach to implement this could be to allow onPress to return true to prevent the default action.

I realise this functionality isn't how the FAB is supposed to work, so, from that point of it's reasonable not to support it but I thought I'd at least mention it. :)

Thanks for your work on the project!

follower avatar Jun 22 '17 10:06 follower

maybe it’s better to introduce a new prop for it, like openOnPress which is default to true, so it doesn’t break anyones code, who is already using it.

Also, if you think others would benefit from it, we should create a gist and reference it in the readme.

mastermoo avatar Jun 22 '17 11:06 mastermoo

+1 I think it would be better to have just some inner method of the component f.e. openActionMenu() to give the developer all control for the opening behavior

NXTaar avatar Sep 09 '17 11:09 NXTaar