Use default OK on buttonPositive to prevent showing an alert without any buttons#25033
Use default OK on buttonPositive to prevent showing an alert without any buttons#25033Mookiies wants to merge 1 commit into
Conversation
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
cpojer
left a comment
There was a problem hiding this comment.
Sounds good! Thank you :)
facebook-github-bot
left a comment
There was a problem hiding this comment.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
This pull request was successfully merged by @MalcolmScruggs in fa97b23. When will my fix make it into a release? | Upcoming Releases |
…any buttons (facebook#25033) Summary: Solve facebook#25016 Use `OK` as default text for the affirmative button if no text is specified. When setting an alert on android with button configuration, and no `text` field specified no button is shown on the alert. This makes it impossible to dismiss. An example of how this can happen is creating a simple button where a `onPress` callback is used but no text is specified: ``` Alert.alert( 'title', 'message', [ { onPress: () => console.log('onPress') } ], ) ``` Does not change the current behavior of no text button configurations on iOS. On iOS at least one button is always shown, and buttons with no text can be displayed. Behavior on setting multiple buttons is a little wonky, but this PR does not aim to solve it. I did test these cases and included some examples below. ## Changelog [Android] [Fixed] - Use OK as default text on Android Alert if button configuration specified without text Pull Request resolved: facebook#25033 Differential Revision: D15502780 Pulled By: cpojer fbshipit-source-id: 505a9940f4588f4c10e25b67bfed8b8a1e610c69
|
this shows an this shows 2 ok buttons ok the alert for android |
Summary
Solve #25016
Use
OKas default text for the affirmative button if no text is specified. When setting an alert on android with button configuration, and notextfield specified no button is shown on the alert. This makes it impossible to dismiss. An example of how this can happen is creating a simple button where aonPresscallback is used but no text is specified:Does not change the current behavior of no text button configurations on iOS. On iOS at least one button is always shown, and buttons with no text can be displayed.
Behavior on setting multiple buttons is a little wonky, but this PR does not aim to solve it. I did test these cases and included some examples below.
Changelog
[Android] [Fixed] - Use OK as default text on Android Alert if button configuration specified without text
Test Plan
Tested alerts with varying configurations set
Configuration without text, one button:
Configuration without text, two button:
Configuration without text, three buttons
Custom text for two of three buttons:
Custom text for first button only:
No button configuration: