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

Fix PlatformColor parsing on Android when using dark and light theme #7256

Closed
wants to merge 2 commits into from

Conversation

svbutko
Copy link
Collaborator

@svbutko svbutko commented Sep 9, 2021

Fixes: #7255

@svbutko
Copy link
Collaborator Author

svbutko commented Sep 9, 2021

I checked #6618 and it partially exists until this time, like I can't use a primary color like ?attr/colorPrimary if I use material theme (e.g. Theme.MaterialComponents.DayNight) but it might have something to do with this:

facebook/react-native#29763

@svbutko
Copy link
Collaborator Author

svbutko commented Sep 9, 2021

Maybe it would be better to completely change this behaviour and always put JSONParser.convert(color) because under the hood the value expects to be of ReadableMap type?

@yogevbd
Copy link
Collaborator

yogevbd commented Sep 13, 2021

@swabbass wdyt?

swabbass
swabbass previously approved these changes Sep 14, 2021
@swabbass
Copy link
Contributor

swabbass commented Sep 14, 2021

you should not assign PlatformColor value to dark/light, it should replace the whole object since PlatformColor is a native way to achieve dark/light, hence, you define the same value in for example style.xml and style.night.xml and then assign the value to it, not assigning same value for both light and dark which is that what was being done natively.

My original PR: https://github.com/wix/react-native-navigation/pull/7216/files, which demonstrates the usage of the PlatformColor.

@swabbass swabbass closed this Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PlatformColor crashes app when adding it as dark/light color on Android
3 participants