platform-colors icon indicating copy to clipboard operation
platform-colors copied to clipboard

[android] colors not reflecting runtime changes to system theme

Open vonovak opened this issue 3 years ago • 4 comments

Hello and thanks for the package!

based on the readme

Using platform colors enables you to change from light/dark mode instantly and without any additional rerenders.

I'm starting with an assumption that colors in the example app should update with the system theme change. However, on device / emulator I tested this on, it is not the case, as seen in the video below (Honor 20 pro, android 10 / Pixel_2_Android_11(AVD)).

https://user-images.githubusercontent.com/1566403/146676782-42e4d6bd-c496-4862-ad96-6095bde9228e.mp4

Is this a bug? I know that this may not be the package where the bug is happening (it probably is in the RN core?) but I wanted to ask anyway. Note that the useColorScheme() hook from rn core does pick up the change (also seen in the video). I have tested this also with RN 67-rc6 with the same result.

The same issue applies to icons not "refreshing" in https://github.com/klarna-incubator/react-native-vector-drawable

The bug goes away if I remove uiMode from https://github.com/klarna-incubator/platform-colors/blob/5716baea984f53d9bc3e87ec9d24f3b75dddf73b/examples/ColorViewerApp/android/app/src/main/AndroidManifest.xml#L16 but that is a workaround - the application is then torn down and recreated with the theme change and we don't want that.

The colors are rendered properly when the app is killed and started again.

Thanks for your thoughts! :)

vonovak avatar Dec 19 '21 13:12 vonovak

I am facing the same issue, however removing uiMode from android:configChanges doesn't resolve it.

a-eid avatar Jan 02 '22 08:01 a-eid

I retried removing uiMode from android:configChanges on a new project and it worked.

a-eid avatar Jan 02 '22 11:01 a-eid

created an issue on react-native repo

https://github.com/facebook/react-native/issues/32823

a-eid avatar Jan 02 '22 11:01 a-eid

seems that platformColor is working correctly with wix navigation on android but not with react-native.

https://user-images.githubusercontent.com/19273413/148926206-944756ce-b78e-4e16-a911-79663e73fa65.mp4

a-eid avatar Jan 11 '22 10:01 a-eid

Any update on this guys?

developerdanx avatar Jun 28 '23 10:06 developerdanx

I believe the activity needs to be recreated for this to have effect. It's the way android is done.

vonovak avatar Jun 28 '23 13:06 vonovak