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

PlatformColor and DynamicColorIOS don't work #1391

Closed
jacobp100 opened this issue Jun 2, 2020 · 6 comments · Fixed by #1561
Closed

PlatformColor and DynamicColorIOS don't work #1391

jacobp100 opened this issue Jun 2, 2020 · 6 comments · Fixed by #1561

Comments

@jacobp100
Copy link

#930 Bug

React Native 0.63 has PlatformColor and DynamicColorIOS color modes (see https://medium.com/@jacobp100/dark-mode-in-react-native-a4ac55a2a0e5)

I tried setting it on fill, color and tintColor using one of these. However, these new colors don't work

Unexpected behavior

Explained above

Environment info

Run react-native info in your terminal and copy the results here. Also, include the precise version number of this library that you are using in the project

React native info output:

System:
    OS: macOS 10.15.5
    CPU: (4) x64 Intel(R) Core(TM) i5-7287U CPU @ 3.30GHz
    Memory: 807.58 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.3.0 - /usr/local/bin/node
    Yarn: 1.19.2 - /usr/local/bin/yarn
    npm: 6.14.5 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /Users/jacobparker/.rvm/gems/ruby-2.4.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK:
      API Levels: 23, 25, 27, 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5977832
    Xcode: 11.5/11E608c - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_232 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.0-rc.1 => 0.63.0-rc.1 
  npmGlobalPackages:
    *react-native*: Not Found

Library version: 12.1.0

Steps To Reproduce

No expo link due to requiring RN 0.63

Short, Self Contained, Correct (Compilable), Example

No expo link due to requiring RN 0.63

Extra Info

I think tintColor should be easy to support on iOS. RCTConvert handles the new color styles, so I think we just need to remove the JS logic here. Android shouldn't be too much harder

I suspect handling this for stuff like fill will be harder

@stale
Copy link

stale bot commented Aug 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

@stale stale bot added the stale label Aug 1, 2020
@Guuz
Copy link

Guuz commented Aug 3, 2020

Please don't close this Mr. Stale Bot ;-) I would like to know if this is considered a bug and will be fixed or if this will stay this way so we know how to deal with this in our code-base.

@stale stale bot removed the stale label Aug 3, 2020
@truongpham17
Copy link

I got the same problem

@henrysipp
Copy link

Same problem here, anyone have a workaround?

@iamandiradu
Copy link

Same here. Expected DynamicColorIOS({ dark: 'lightskyblue', light: 'midnightblue', }) to return 'midnightblue' or 'lightskyblue'.
It returns an object instead.
dynamic: { light: "midnightblue", dark: "lightskyblue" }

@jacobp100
Copy link
Author

jacobp100 commented Sep 28, 2020

iamandiradu

I think that return type is expected. You can import { useColorScheme } from 'react-native' if you need to read the current value of dark mode.

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 a pull request may close this issue.

5 participants