Skip to content

Remove AlertMacOS in favor of Alert & promptMacOS #1548

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 2 commits into from
Dec 9, 2022

Conversation

Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Dec 6, 2022

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

Copy of #662 to try and land this change.

RN Core once had a separate Alert and AlertIOS, but have since deprecated and removed the latter. We had forked AlertIOS into AlertMacOS. It's been deprecated for a while, let's just remove it to get rid of unnecessary diffs.

To this effect, I found some unnecessary example code in RN Core that we can cleanup for even less diffs. Soo overall, the order of operations is..

  1. Remove AlertMacOS, and replace it's uses with Alert.PromptMacOS (this PR)
  2. Move the examples to the AlertIOSExample page (this PR)
  3. Made an upstream change to move AlertIOSExamples into AlertExamples ([RNTester] Merge AlertIOSExample page into AlertExample page facebook/react-native#35586)
  4. Once we merge up to that commit, sync that commit and move our macOS specific examples also into AlertExmaples. (Some future PR).

Changelog

[macOS] [Deprecated] - Deprecate AlertMacOS in favor of Alert

Test Plan

Existing RNTester tests still work.

Screen.Recording.2022-12-08.at.3.08.34.PM.mov
Microsoft Reviewers: Open in CodeFlow

@Saadnajmi Saadnajmi requested a review from a team as a code owner December 6, 2022 17:52
@Saadnajmi Saadnajmi changed the title Deprecate AlertMacOS in favor of Alert Remove AlertMacOS in favor of Alert Dec 7, 2022
@Saadnajmi Saadnajmi changed the title Remove AlertMacOS in favor of Alert Remove AlertMacOS in favor of Alert & promptMacOS Dec 7, 2022
@Saadnajmi Saadnajmi marked this pull request as draft December 7, 2022 18:22
@Saadnajmi Saadnajmi marked this pull request as ready for review December 7, 2022 23:48
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Dec 8, 2022
Summary:
`AlertIOS` was deprecated and removed long ago (e2bd7db) but there continues to be a test page with the name `AlertIOS` in RN-Tester. `AlertIOSExample.js` contains valid examples of how to use `Alert.prompt()` so it's worth keeping them around. Let's move those into `AlertExample.js` and remove `AlertIOSExample.js`. While we're here, let's do some extra fixes to the test page:

- Remove `showsIndividualExamples = true`. For whatever reason, I needed to remove this to show the examples properly...
- Convert all uses of `<TouchableHighlight>` with `<Pressable>`. The latter replaces the former, so I thought that made sense..

Some extra context:

In React Native macOS, we had forked `AlertIOS` into `AlertMacOS`, with a corresponding example page. This PR was made while working on removing those (microsoft#1548).

## Changelog

[INTERNAL] [CHANGED] - Moved `Alert.prompt` examples into common rn-tester test page

Pull Request resolved: #35586

Test Plan:
Test page shows up fine on iOS .

![Simulator Screen Recording - iPhone 14 Pro - 2022-12-07 at 15 15 40](https://user-images.githubusercontent.com/6722175/206318170-1893c8f6-0596-4825-8312-f45e45557095.gif)

Reviewed By: lunaleaps

Differential Revision: D41825889

Pulled By: NickGerleman

fbshipit-source-id: 82e4405b1f3a1ccb558b5a5038a90416e7a32c29
@Saadnajmi Saadnajmi requested a review from amgleitman December 9, 2022 01:06
@Saadnajmi Saadnajmi dismissed amgleitman’s stale review December 9, 2022 01:06

addressed feedback

@harrieshin
Copy link

test Sheets?

@harrieshin
Copy link

wait in your Video sheet doesn't look like sheets?

@Saadnajmi
Copy link
Collaborator Author

wait in your Video sheet doesn't look like sheets?

I think Ventura made them floating windows

@harrieshin
Copy link

wait in your Video sheet doesn't look like sheets?

I think Ventura made them floating windows

if that's really the case, we should document expected behaviors?

@Saadnajmi
Copy link
Collaborator Author

wait in your Video sheet doesn't look like sheets?

I think Ventura made them floating windows

if that's really the case, we should document expected behaviors?

Once we merge to 0.71, we will have typescript types for files. When there, we can update the documentation in our repo. You can see I updated the iOS documentation in Alert.d.ts in my upstream PR here: facebook#35586

@Saadnajmi Saadnajmi enabled auto-merge (squash) December 9, 2022 04:20
@Saadnajmi Saadnajmi disabled auto-merge December 9, 2022 04:21
thymikee and others added 2 commits December 9, 2022 09:52
Deprecate AlertMacOS in favor of Alert

move UIAlertController define to RCTAlertController.h

define only on macos target

revert podfile.lock
Fix merge issue

Get rid of workaround maybe?

Better type?

Fix codegen error

Remove AlertMacOS altogether

Space

Refactor test page logic

Delete AlertIOS

Make promptMacOS work

make example load

Fix Alert.prompt()

Move examples to AlertIOSExample

Remove changes to AlertExample

Remove more

fix error

More fixed
@Saadnajmi Saadnajmi enabled auto-merge (rebase) December 9, 2022 17:54
@Saadnajmi Saadnajmi merged commit f688596 into microsoft:main Dec 9, 2022
@Saadnajmi Saadnajmi deleted the alert-redo branch December 9, 2022 19:16
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
`AlertIOS` was deprecated and removed long ago (facebook@e2bd7db) but there continues to be a test page with the name `AlertIOS` in RN-Tester. `AlertIOSExample.js` contains valid examples of how to use `Alert.prompt()` so it's worth keeping them around. Let's move those into `AlertExample.js` and remove `AlertIOSExample.js`. While we're here, let's do some extra fixes to the test page:

- Remove `showsIndividualExamples = true`. For whatever reason, I needed to remove this to show the examples properly...
- Convert all uses of `<TouchableHighlight>` with `<Pressable>`. The latter replaces the former, so I thought that made sense..

Some extra context:

In React Native macOS, we had forked `AlertIOS` into `AlertMacOS`, with a corresponding example page. This PR was made while working on removing those (microsoft#1548).

## Changelog

[INTERNAL] [CHANGED] - Moved `Alert.prompt` examples into common rn-tester test page

Pull Request resolved: facebook#35586

Test Plan:
Test page shows up fine on iOS .

![Simulator Screen Recording - iPhone 14 Pro - 2022-12-07 at 15 15 40](https://user-images.githubusercontent.com/6722175/206318170-1893c8f6-0596-4825-8312-f45e45557095.gif)

Reviewed By: lunaleaps

Differential Revision: D41825889

Pulled By: NickGerleman

fbshipit-source-id: 82e4405b1f3a1ccb558b5a5038a90416e7a32c29
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.

4 participants