Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Implement cancelable option for Alerts #8652

Closed
wants to merge 1 commit into from

Conversation

kraffslol
Copy link
Contributor

Motivation
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method setCancelable

Usage example

Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);

Test plan (required)

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting cancelable works as it should.

@ghost
Copy link

ghost commented Jul 8, 2016

By analyzing the blame information on this pull request, we identified @mkonicek and @foghina to be potential reviewers.

@ghost ghost added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Jul 8, 2016
@kraffslol kraffslol changed the title Android: Implement canceable option for Alerts Android: Implement cancelable option for Alerts Jul 8, 2016
@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 12, 2016
@ghost
Copy link

ghost commented Aug 7, 2016

It's been a while since the last commit was reviewed and the labels show this pull request needs review. Based on the blame information for the files in this pull request we identified @mkonicek as a potential reviewer. Could you take a look please or cc someone with more context?

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 7, 2016
@satya164
Copy link
Contributor

satya164 commented Aug 8, 2016

LGTM

cc @dmmiller

@satya164
Copy link
Contributor

satya164 commented Aug 8, 2016

Can you please rebase this against master?

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 8, 2016
@dmmiller
Copy link

dmmiller commented Aug 8, 2016

Seems good. Looks like it might need a rebase, but then let's do it.

@mmazzarolo
Copy link

Sounds awesome, looking forward to it!

@ghost
Copy link

ghost commented Aug 8, 2016

@kraffslol updated the pull request.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 8, 2016
@satya164
Copy link
Contributor

satya164 commented Aug 9, 2016

@facebook-github-bot shipit

@ghost ghost added GH Review: accepted Import Started This pull request has been imported. This does not imply the PR has been approved. and removed GH Review: review-needed labels Aug 9, 2016
@ghost
Copy link

ghost commented Aug 9, 2016

Thanks for importing.If you are an FB employee go to Phabricator to review internal test results.

@ghost ghost added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 9, 2016
@ghost ghost closed this in 8e2906a Aug 9, 2016
ultragtx pushed a commit to ultragtx/react-native that referenced this pull request Aug 10, 2016
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes facebook#8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
cmcewen pushed a commit to cmcewen/react-native that referenced this pull request Aug 15, 2016
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes facebook#8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
mpretty-cyro pushed a commit to HomePass/react-native that referenced this pull request Aug 25, 2016
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes facebook#8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
rozele pushed a commit to microsoft/react-native-windows that referenced this pull request Aug 25, 2016
Summary:
**Motivation**
In iOS you cannot dismiss alerts by clicking outside of their box, while on Android you can. This can create some inconsistency if you want to have identical behavior on both platforms. This change makes it possible for Android apps to have irremovable/required alert boxes just like in iOS.

This adds an additional parameter to the Alert method. The way to use it is by providing an object with the cancelable property. The cancelable property accepts a boolean value.

This utilizes the Android DialogFragment method [setCancelable](https://developer.android.com/reference/android/app/DialogFragment.html#setCancelable(boolean))

**Usage example**
```js
Alert.alert(
   'Alert Title',
   null,
   [
     {text: 'OK', onPress: () => console.log('OK Pressed!')},
   ],
   {
     cancelable: false
   }
);
```

**Test plan (required)**

I added an additional alert to the UIExplorer project where it can be tested. I also added a part in the Dialog Module test to make sure setting canc
Closes facebook/react-native#8652

Differential Revision: D3690093

fbshipit-source-id: 4cf6cfc56f464b37ce88451acf33413393454721
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Import Started This pull request has been imported. This does not imply the PR has been approved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants