You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PlatformColor lazy fallback: honor a raw-color fallback on Android (native) (#57655)
Summary:
Pull Request resolved: #57655
An implementation for the RFC in react-native-community/discussions-and-proposals#1008
Wires up the Android native color resolver (Fabric) to honor the lazy `{fallback}` carried by `PlatformColor(...)`. A later diff adds the JS argument that emits it, so on its own this change is a no-op for existing call sites.
To tell a genuine miss apart from a token that resolves to transparent black (ARGB 0):
- `FabricUIManager.getColor` now returns a boxed `Nullable Integer` — `null` means no resource path resolved. The Fabric C++ `PlatformColorParser.h` reads that boxed result over JNI, caches the explicit-miss signal, and on a miss parses the raw fallback string with the shared CSS color parser (`parseCSSProperty<CSSColor>`), matching the iOS Fabric path. The color object is now read as a `map<string, RawValue>` because it mixes an array (`resource_paths`) with an optional string (`fallback`).
- `NativeDrawable` carries an optional `colorFallback` alongside `resource_paths` so ripple drawables degrade to the fallback too.
Generated files (`ReactAndroid.api` and the `ReactAndroid*Cxx.api` snapshots) are regenerated to match the new public signatures.
Changelog:
[Internal] - PlatformColor: Android native support for a lazy raw-color fallback
Reviewed By: mdvacca, javache
Differential Revision: D113329136
fbshipit-source-id: ee15aea8dfed66364e99d427825e1b9ebcbdc483
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/HostPlatformViewProps.cpp
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view/NativeDrawable.h
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h
0 commit comments