mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Implement prop diffing for nativeForegroundAndroid prop (#48834)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48834 Implement prop diffing for nativeForegroundAndroid prop changelog: [internal] internal Reviewed By: rshest Differential Revision: D60001410 fbshipit-source-id: c6b5b71ddb66136f9cf61e2cca5aeb6e1274841e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
48fad21759
commit
2c50e7043b
+1
-1
@@ -114,7 +114,7 @@ public object ReactScrollViewHelper {
|
||||
return
|
||||
}
|
||||
val contentView = scrollView.getChildAt(0) ?: return
|
||||
for (scrollListener in scrollListeners) {
|
||||
for (scrollListener in scrollListeners.toList()) {
|
||||
scrollListener.get()?.onScroll(scrollView, scrollEventType, xVelocity, yVelocity)
|
||||
}
|
||||
val reactContext = scrollView.context as ReactContext
|
||||
|
||||
+43
-1
@@ -336,6 +336,38 @@ static void updateBorderColorsProps(
|
||||
oldBorderColor.blockStart);
|
||||
}
|
||||
|
||||
inline static void updateNativeDrawableProp(
|
||||
folly::dynamic& result,
|
||||
const std::string& propName,
|
||||
const std::optional<NativeDrawable>& nativeDrawable) {
|
||||
folly::dynamic nativeDrawableResult;
|
||||
if (nativeDrawable.has_value()) {
|
||||
nativeDrawableResult = folly::dynamic::object();
|
||||
const auto& nativeDrawableValue = nativeDrawable.value();
|
||||
nativeDrawableResult["attribute"] = nativeDrawableValue.themeAttr;
|
||||
switch (nativeDrawableValue.kind) {
|
||||
case NativeDrawable::Kind::Ripple:
|
||||
nativeDrawableResult["type"] = "RippleAndroid";
|
||||
break;
|
||||
case NativeDrawable::Kind::ThemeAttr:
|
||||
nativeDrawableResult["type"] = "ThemeAttrAndroid";
|
||||
break;
|
||||
}
|
||||
if (nativeDrawableValue.ripple.rippleRadius.has_value()) {
|
||||
nativeDrawableResult["rippleRadius"] =
|
||||
nativeDrawableValue.ripple.rippleRadius.value();
|
||||
}
|
||||
if (nativeDrawableValue.ripple.color.has_value()) {
|
||||
nativeDrawableResult["color"] = nativeDrawableValue.ripple.color.value();
|
||||
}
|
||||
nativeDrawableResult["borderless"] = nativeDrawableValue.ripple.borderless;
|
||||
} else {
|
||||
nativeDrawableResult = folly::dynamic(nullptr);
|
||||
}
|
||||
|
||||
result[propName] = nativeDrawableResult;
|
||||
}
|
||||
|
||||
inline static void updateTransformOperationValue(
|
||||
const std::string& operationName,
|
||||
const ValueUnit& valueUnit,
|
||||
@@ -571,8 +603,18 @@ folly::dynamic HostPlatformViewProps::getDiffProps(
|
||||
}
|
||||
}
|
||||
|
||||
// TODO T212662692: pass events as std::bitset<64> to java
|
||||
if (nativeBackground != oldProps->nativeBackground) {
|
||||
updateNativeDrawableProp(
|
||||
result, "nativeBackgroundAndroid", nativeBackground);
|
||||
}
|
||||
|
||||
if (nativeForeground != oldProps->nativeForeground) {
|
||||
updateNativeDrawableProp(
|
||||
result, "nativeForegroundAndroid", nativeForeground);
|
||||
}
|
||||
|
||||
// Events
|
||||
// TODO T212662692: pass events as std::bitset<64> to java
|
||||
if (events != oldProps->events) {
|
||||
updateEventProp(
|
||||
result,
|
||||
|
||||
Reference in New Issue
Block a user