Skip to content

Fix macOS Alert API issues #355

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

Merged
merged 34 commits into from
May 11, 2020
Merged

Conversation

tom-un
Copy link
Collaborator

@tom-un tom-un commented May 8, 2020

Please select one of the following

  • I am removing an existing difference between facebook/react-native and microsoft/react-native-macos 👍
  • I am cherry-picking a change from Facebook's react-native into microsoft/react-native-macos 👍
  • I am making a fix / change for the macOS implementation of react-native
  • I am making a change required for Microsoft usage of react-native

Summary

The Alert API for macOS was broken:

  • All alert calls were showing an input field (only prompts should show an input field)
  • The defaultValue arg of prompt has not being honored
  • The AlertMacOSExample was lost
  • alert and prompt with a single button were not returning a JS callback

The first two issues were recent regressions when merging from upstream. The last issue is old, possible since macOS Alert was first implemented, and discovered as I tested the macOS and iOS RNTester side by side.

Closes #353

In react-native there is the Alert API that works for iOS and Android, but contains an options argument with Android specific options.
There is also an AlertIOS with iOS specific concerns but it is now deprecated.
When macOS was first implemented we made an AlertMacOS with macOS specific concerns. Long term we should deprecate this and add the macOS concerns to the options argument of Alert.

Issue #354 tracks deprecating AlertMacOS.

Changelog

[macOS] [Fixed] - Fix macOS Alert API issues

Test Plan

The RNTester Alert and the newly restored AlertMacOS pages where manually tested.

Microsoft Reviewers: Open in CodeFlow

tom-un and others added 30 commits April 3, 2020 20:53
@tom-un tom-un requested a review from HeyImChris May 8, 2020 21:08
@tom-un tom-un requested a review from alloy May 8, 2020 23:48
{
key: 'AlertMacOSExample',
module: require('../examples/Alert/AlertMacOSExample'),
supportsTVOS: true,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha. That's what it was before it was removed in the .61 merge. This will go away again after issue #354.

} else {
callback(@[buttonKey]);
}
buttonKey = buttons[response - NSAlertFirstButtonReturn].allKeys.firstObject;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this copied from somewhere? We should probably get rid of the dot notation.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same below in this file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it was ported from the ios above years ago it assumed the same dot notation.

@tom-un tom-un merged commit f52e69b into microsoft:master May 11, 2020
@alloy
Copy link
Member

alloy commented May 12, 2020

Nice additions to RNTester 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alert on MacOS includes a TextBox by default
4 participants