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

DynamicColorMacOS fixes #1028

Merged
merged 2 commits into from
Feb 18, 2022
Merged

Conversation

Saadnajmi
Copy link
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 facebook#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 Saadnajmi requested a review from a team as a code owner February 17, 2022 23:02
React/Base/RCTConvert.m Outdated Show resolved Hide resolved
@Saadnajmi Saadnajmi merged commit 5851f61 into microsoft:main Feb 18, 2022
@Saadnajmi Saadnajmi deleted the dynamic-color-fix branch February 18, 2022 22:04
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
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>
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:
Fixes facebook/yoga#850

facebook/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 facebook/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: facebook/yoga#1201

Reviewed By: yungsters

Differential Revision: D42282358

Pulled By: NickGerleman

fbshipit-source-id: 57c0dd9b0f1c47cb9335ff6e13d44b4646e5fa58
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.

3 participants