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

feat(iOS): migrate deprecated UIMenuController to UIEditMenuInteraction #41125

Closed

Conversation

okwasniewski
Copy link
Contributor

Summary:

The goal of this PR is to migrate deprecated UIMenuController to UIEditMenuInteraction. UIMenuController has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

Recording

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-10-20.at.17.10.28.mp4

Changelog:

[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Test Plan:

Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Oct 20, 2023
@@ -16,6 +16,14 @@

#import <QuartzCore/QuartzCore.h>

#if __IPHONE_16_0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be changed as it will only work for iOS 16.

Do you know any better way to conditionally conform to delegate?

Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look at the types of checks in this change, and the ones linked in the notes: #39549

Copy link
Contributor

Choose a reason for hiding this comment

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

the availability header has some good macros to use and patterns. I deleted some examples in an earlier commit since we bumped minimum OS, hence the links to commits :P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found that #ifdef __IPHONE_16_0 works best as its also true for iOS 17

@analysis-bot
Copy link

analysis-bot commented Oct 20, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,653,257 +17
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 21,035,028 +11
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 3f621df
Branch: main

@okwasniewski okwasniewski force-pushed the okwasniewski/RCTTextView branch from 52976f1 to c12cd0d Compare October 22, 2023 08:35
Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

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

I left a nit for readability of the code, but it looks good to me.

if (_editMenuInteraction) {
[_editMenuInteraction presentEditMenuWithConfiguration:config];
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can we do something like

if (@available(iOS 16.0, *)) {
  // your code
  return
}
// old code

a part from me, preferring early returns when reading code, it will also make the diff more readable as the body of the now non-existing else will not be indented and github will not highlight it as changed code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! I've applied your suggestion. I saw that linter step failed - I'm curious what do you use to format Objective-C code in Xcode?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's... a complicated question.
We use the same tool we have in OSS, but:

  • the version we use internally have been modified by some other Meta engineer
  • the set of rules we use internally are different and spread in different places, so they are very hard to retrieve.

We already tried several times to align the internal and external signals, but it is a harder problem than it look... :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah okay I get it, thanks for the explanation

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@okwasniewski okwasniewski force-pushed the okwasniewski/RCTTextView branch from ff86246 to adabfb9 Compare October 27, 2023 08:16
@okwasniewski
Copy link
Contributor Author

Hey @cipolleschi is there any further action needed to merge this PR? I've rebased the PR (I saw that you reverted the asset removal PR that made windows build fail)

@cipolleschi
Copy link
Contributor

@okwasniewski no, I just created the PR to see if it was fixing but then closed without merging because it wasn't the cause.
So that commit is still in main.

No other things on your side, I'll reimport it and try to land it.

@facebook-github-bot
Copy link
Contributor

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@cipolleschi merged this pull request in e08a197.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Oct 27, 2023
Othinn pushed a commit to Othinn/react-native that referenced this pull request Oct 30, 2023
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

## Recording

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 10, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 14, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
Saadnajmi pushed a commit to Saadnajmi/react-native-macos that referenced this pull request Jan 15, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
okwasniewski added a commit to callstack/react-native-visionos that referenced this pull request Jan 31, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

## Recording

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
okwasniewski added a commit to callstack/react-native-visionos that referenced this pull request Feb 6, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

## Recording

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
okwasniewski added a commit to callstack/react-native-visionos that referenced this pull request Apr 5, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

## Recording

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
okwasniewski added a commit to callstack/react-native-visionos that referenced this pull request Jun 24, 2024
…on (facebook#41125)

Summary:
The goal of this PR is to migrate deprecated `UIMenuController` to `UIEditMenuInteraction`. `UIMenuController` has been deprecated in iOS 16 and for that reason it's not available for VisionOS.

## Recording

https://github.com/facebook/react-native/assets/52801365/fed994be-d444-462a-9ed0-39b50531425d

bypass-github-export-checks

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [CHANGED] - Migrate RCTTextView to UIEditMenuInteraction

Pull Request resolved: facebook#41125

Test Plan: Launch RNTester and check for "Selectable Text" example and check that it works for iOS 16/17.

Reviewed By: javache

Differential Revision: D50551016

Pulled By: cipolleschi

fbshipit-source-id: 558ecc5a04a5daa9c4360fabddcab28fba72a323
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. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants