mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
PlatformColor lazy fallback: honor a raw-color fallback on Android (native) (#57655)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/57655 An implementation for the RFC in https://github.com/react-native-community/discussions-and-proposals/pull/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
This commit is contained in:
1 parent
26eb36c657
commit
00e27b7322
8 files changed
+104
-39
No files matched your search
@@ -7562,6 +7562,7 @@ struct facebook::react::NativeDrawable::Ripple {
|
||||
public std::optional<facebook::react::Float> alpha;
|
||||
public std::optional<facebook::react::Float> rippleRadius;
|
||||
public std::optional<facebook::react::SharedColor> color;
|
||||
public std::optional<std::string> colorFallback;
|
||||
public std::optional<std::vector<std::string>> colorResourcePaths;
|
||||
}
|
||||
|
||||
|
||||
@@ -7323,6 +7323,7 @@ struct facebook::react::NativeDrawable::Ripple {
|
||||
public std::optional<facebook::react::Float> alpha;
|
||||
public std::optional<facebook::react::Float> rippleRadius;
|
||||
public std::optional<facebook::react::SharedColor> color;
|
||||
public std::optional<std::string> colorFallback;
|
||||
public std::optional<std::vector<std::string>> colorResourcePaths;
|
||||
}
|
||||
|
||||
|
||||
@@ -7553,6 +7553,7 @@ struct facebook::react::NativeDrawable::Ripple {
|
||||
public std::optional<facebook::react::Float> alpha;
|
||||
public std::optional<facebook::react::Float> rippleRadius;
|
||||
public std::optional<facebook::react::SharedColor> color;
|
||||
public std::optional<std::string> colorFallback;
|
||||
public std::optional<std::vector<std::string>> colorResourcePaths;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user