Repository navigation
Register for trait changes instead of overriding -traitCollectionDidChange: on iOS 17+ - #60534
Open
christophpurrer wants to merge 1 commit into
Open
christophpurrer wants to merge 1 commit into
christophpurrer wants to merge 1 commit into
Conversation
…hange: on iOS 17+ Summary: UIKit deprecated `-traitCollectionDidChange:` in iOS 17 in favor of `-registerForTraitChanges:withAction:`. Apps with a deployment target of iOS 17 or later warn about the override with `-Wdeprecated-implementations`. `RCTSurfaceHostingView`, `RCTTextInputComponentView`, `RCTViewComponentView` and `RCTView` now register, on iOS and tvOS 17 and later, for the traits their override checked, with an action that holds the old body. The registration runs in each class's initializer. `RCTTextInputComponentView` compares against `self.traitCollection` rather than the global current trait collection, which UIKit sets only during `-traitCollectionDidChange:`. The override is kept only while the deployment target is below iOS 17; there it returns early on iOS 17 and later and otherwise calls the same action. Behavior per OS: - Before iOS 17: unchanged. - iOS and tvOS 17 and later: the same code runs from the trait registration, for changes to the traits it checks. - Builds with a deployment target of iOS 17 or later no longer contain the deprecated override. Changelog: [Internal] Differential Revision: D133273358
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D133273358. |
Visual regressionNo visual differences at android: no capture |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
UIKit deprecated
-traitCollectionDidChange:in iOS 17 in favor of-registerForTraitChanges:withAction:. Apps with a deployment target of iOS 17 or later warn about the override with-Wdeprecated-implementations.RCTSurfaceHostingView,RCTTextInputComponentView,RCTViewComponentViewandRCTViewnow register, on iOS and tvOS 17 and later, for the traits their override checked, with an action that holds the old body. The registration runs in each class's initializer.RCTTextInputComponentViewcompares againstself.traitCollectionrather than the global current trait collection, which UIKit sets only during-traitCollectionDidChange:. The override is kept only while the deployment target is below iOS 17; there it returns early on iOS 17 and later and otherwise calls the same action.Behavior per OS:
Changelog: [Internal]
Differential Revision: D133273358