react-native-svg icon indicating copy to clipboard operation
react-native-svg copied to clipboard

PlatformColor and DynamicColorIOS don't work

Open jacobp100 opened this issue 6 years ago • 6 comments

#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

jacobp100 avatar Jun 02 '20 18:06 jacobp100

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[bot] avatar Aug 01 '20 19:08 stale[bot]

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.

Guuz avatar Aug 03 '20 08:08 Guuz

I got the same problem

truongpham17 avatar Sep 12 '20 11:09 truongpham17

Same problem here, anyone have a workaround?

henrysipp avatar Sep 25 '20 17:09 henrysipp

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

iamandiradu avatar Sep 28 '20 10:09 iamandiradu

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.

jacobp100 avatar Sep 28 '20 10:09 jacobp100