Skip to content

DynamicColorMacOS fixes - #1028

Merged
Saad Najmi (Saadnajmi) merged 2 commits into
microsoft:mainfrom
Saadnajmi:dynamic-color-fix
Feb 18, 2022
Merged

DynamicColorMacOS fixes#1028
Saad Najmi (Saadnajmi) merged 2 commits into
microsoft:mainfrom
Saadnajmi:dynamic-color-fix

Conversation

@Saadnajmi

Copy link
Copy Markdown
Collaborator

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

This should resolve part of #511 .

Previously, we had a custom class called RCTDynamicColor to implement DynamicColorMacOS. That is because at the time, there was no macOS equivalent to UIColor's initWithDynamicProvider constructor. RCTDynamicColor had the issue that it used [NSAppearance currentAppearance], which is deprecated and is a UI Thread only method. We actually did create RCTDynamicColor's on background threads often, leading to the above mentioned bug.

Nowadays, there is an NSColor equivalent:-> init(name:dynamicProvider:). We also raised our minimum OS to 10.15 so we can just use this and delete RCTDynamicColor altogether. Additionally, Upstream DynamicColorIOS added High Contrast support with react#31651 , so let's also implement that in DynamicColorMacOS

Changelog

[macOS] [Fixed] - Fixed DynamicColorMacOS violating main thread checker + added High Contrast support.

Test Plan

I updated the test page for PlatformColor in RN-Tester. I should also add this change upstream, since there isn't a DynamicColorIOS example of High Contrast there.

Screen.Recording.2022-02-17.at.11.31.48.AM.mov

@Saadnajmi
Saad Najmi (Saadnajmi) requested a review from a team as a code ownerFebruary 17, 2022 23:02
Comment threadReact/Base/RCTConvert.m Outdated
@Saadnajmi
Saad Najmi (Saadnajmi) merged commit 5851f61 into microsoft:mainFeb 18, 2022
@Saadnajmi
Saad Najmi (Saadnajmi) deleted the dynamic-color-fix branch February 18, 2022 22:04
Saad Najmi (Saadnajmi) added a commit to Saadnajmi/react-native-macos that referenced this pull request Feb 18, 2022
* Use initWithDynamicProvider + Add HC Support
* Update log error
Saad Najmi (Saadnajmi) added a commit that referenced this pull request Feb 19, 2022
* RCTSwitch: Use NSSwitch instead of NSButton (#924)
* add pull yml
* match handleOpenURLNotification event payload with iOS (#755) (#2)
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
* [pull] master from microsoft:master (#11)
* Deprecated api (#853)
* Remove deprecated/unused context param
* Update a few Mac deprecated APIs
* Packing RN dependencies, hermes and ignoring javadoc failure, (#852)
* Ignore javadoc failure
* Bringing few more changes from 0.63-stable
* Fixing a patch in engine selection
* Fixing a patch in nuget spec
* Fixing the output directory of nuget pack
* Packaging dependencies in the nuget
* Fix onMouseEnter/onMouseLeave callbacks not firing on Pressable (#855)
* add pull yml
* match handleOpenURLNotification event payload with iOS (#755) (#2)
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
* fix mouse evetns on pressable
* delete extra yml from this branch
* Add macOS tags
* reorder props to have onMouseEnter/onMouseLeave always be before onPress
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
* Grammar fixes. (#856)
Updates simple grammar issues.
Co-authored-by: Nick Trescases <42704557+ntre@users.noreply.github.com>
Co-authored-by: Anandraj <anandrag@microsoft.com>
Co-authored-by: Saad Najmi <saadnajmi2@gmail.com>
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
Co-authored-by: Muhammad Hamza Zaman <mh.zaman.4069@gmail.com>
* Use NSSwitch
* remove change from my fork
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
Co-authored-by: Nick Trescases <42704557+ntre@users.noreply.github.com>
Co-authored-by: Anandraj <anandrag@microsoft.com>
Co-authored-by: Muhammad Hamza Zaman <mh.zaman.4069@gmail.com>
* DynamicColorMacOS fixes (#1028)
* Use initWithDynamicProvider + Add HC Support
* Update log error
* replace all references to 10.14 (#938)
* Replace currentAppearance with currentDrawingAppearance on macOS 11+ (#1029)
* Manually cherry-pick #1012
Co-authored-by: pull[bot] <39814207+pull[bot]@users.noreply.github.com>
Co-authored-by: Ryan Linton <ryanlntn@gmail.com>
Co-authored-by: Nick Trescases <42704557+ntre@users.noreply.github.com>
Co-authored-by: Anandraj <anandrag@microsoft.com>
Co-authored-by: Muhammad Hamza Zaman <mh.zaman.4069@gmail.com>
Christoph Purrer (christophpurrer) pushed a commit to christophpurrer/react-native-macos that referenced this pull request Jan 15, 2023
…h web" behind experimental feature (microsoft#1028) (microsoft#1201)
Summary:
Fixesreact/yoga#850react/yoga#850 describes a conformance issue where positioning of an absolute child using percentages is not calculated against the correct box size.
This takes the fix for that in react/yoga#1028, regenerates tests, and fixes tests so that the experimental feature can be enabled. Goal is to run this as an experiment internally to see if we can enable by default.
Changelog:
[Internal]
X-link: react/yoga#1201
Reviewed By: yungsters
Differential Revision: D42282358
Pulled By: NickGerleman
fbshipit-source-id: 57c0dd9b0f1c47cb9335ff6e13d44b4646e5fa58
Sign up for freeto 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.

3 participants

@Saadnajmi@harrieshin@HeyImChris