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

onOk and onCancel

Open midenarif opened this issue 5 years ago • 4 comments

Please provide onOk and onCancel as optional and developer will select any one of them. Because sometimes we need an option to close dialog when user clicks only OK button

midenarif avatar Jul 29 '18 07:07 midenarif

Hi @midenarif,

This is something that has been requested in the past and it wasn't really recommended in the Material Design guidelines.

The guidelines now cover this so if you wanna come up with an implementation that matches the specification I'd happily accept a PR for it 🙂

hectahertz avatar Jul 31 '18 12:07 hectahertz

There are cases where only a single button is needed. For example, my app pops up a dialog to notify the user if the internet connection has dropped. The only button needed is an acknowledgement.

Indeed, Google's Material Design guidelines state the same thing about acknowledgement actions.

Acknowledgement actions When user acknowledgement is required to proceed, a single action may be presented. Alternatively, use a snackbar to communicate this type of information.

https://material.io/design/components/dialogs.html#actions

I think it's important to note Google's choice of name: Material Design guidelines, and not laws. Guidelines are a starting point and cover general cases, but not every single case. Thus it would be better to treat the guidelines less rigidly. There are obvious use cases for a single button dialog regardless of what Google explicitly states. There may even be oddball cases where 3 buttons are needed (I would discourage that, but could see it needed in rare cases).

peacechen avatar Aug 27 '18 15:08 peacechen

I opened a Pull Request #59 for this, is quite simple, please review it! @hectahertz

rafucisneros avatar Sep 19 '19 01:09 rafucisneros

There are cases where no button is also acceptable.

  1. Touch a button to show a list
  2. Select from the list
  3. Profit

This is the exact sequence that happens in a Picker/Dropdown. They don't ask you to confirm the selection. It should be perfectly fine to have cases where it is not necessary to have any confirmation.

paulpv avatar Oct 22 '20 21:10 paulpv