react-native icon indicating copy to clipboard operation
react-native copied to clipboard

fix: return the correct default trait collection

Open alanjhughes opened this issue 1 year ago • 1 comments

Summary:

Currently, when the _currentColorScheme is nil the default comes from [UITraitCollection currentTraitCollection] which provides the trait collection of the context it was called in. Generally, this will work but in some cases the context can be different and this will return the wrong value also if the Appearance property is set in the plist, then initially that value is returned, regardless of if you have overridden it. Seen as the userInterfaceStyle of the window is overridden when the value is changed, then the default should be whatever the current style of the window is and not dependent on the calling context.

BeforeAfter

Changelog:

[IOS] [FIXED] - Fix the default trait collection to always return the value of the window

Test Plan:

Tested on rn-tester and verified the current behaviour is unaffected and also in our own repo to make sure it addresses the problem. Video provided above

alanjhughes avatar Jul 06 '23 09:07 alanjhughes

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 9,061,546 +4
android hermes armeabi-v7a 8,310,881 +3
android hermes x86 9,577,764 +2
android hermes x86_64 9,420,185 +3
android jsc arm64-v8a 9,613,324 +5
android jsc armeabi-v7a 8,739,959 +5
android jsc x86 9,700,289 +2
android jsc x86_64 9,946,838 -1

Base commit: 41477c898cf5726eae9edbb1596366a6eea2b01e Branch: main

analysis-bot avatar Jul 06 '23 09:07 analysis-bot

Thanks for the review @cipolleschi Sorry for the delay. I've made the changes

alanjhughes avatar Sep 09 '23 23:09 alanjhughes

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

facebook-github-bot avatar Sep 12 '23 11:09 facebook-github-bot

This pull request was successfully merged by @alanjhughes in 94fea182d6cf19e96a8a87760017bd69ad0a9e0c.

When will my fix make it into a release? | Upcoming Releases

github-actions[bot] avatar Sep 13 '23 11:09 github-actions[bot]

This pull request has been reverted by 7888338295476f4d4f00733309e54b8d22318e1e.

facebook-github-bot avatar Sep 20 '23 08:09 facebook-github-bot

#39439

alanjhughes avatar Sep 20 '23 08:09 alanjhughes