mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add support to diff Point props (#51650)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51650 This diff adds support to diff props with Point type changelog: [internal] internal Reviewed By: mlord93 Differential Revision: D75469451 fbshipit-source-id: a6844b691d8e32326d04c2bd51e6509980feb611
This commit is contained in:
committed by
Facebook GitHub Bot
parent
508610865b
commit
ad0ea17ae9
+12
@@ -745,6 +745,12 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
result[\\"thumbTintColor\\"] = *thumbTintColor;
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -888,6 +894,12 @@ folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
+12
@@ -745,6 +745,12 @@ folly::dynamic MultiNativePropNativeComponentViewProps::getDiffProps(
|
||||
result[\\"thumbTintColor\\"] = *thumbTintColor;
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -888,6 +894,12 @@ folly::dynamic PointPropNativeComponentViewProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
+9
-1
@@ -102,13 +102,21 @@ function generatePropsDiffString(
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
result["${prop.name}"] = *${prop.name};
|
||||
}`;
|
||||
case 'ImageSourcePrimitive':
|
||||
return '';
|
||||
case 'ImageRequestPrimitive':
|
||||
// Shouldn't be used in props
|
||||
throw new Error(
|
||||
'ImageRequestPrimitive should not be used in Props',
|
||||
);
|
||||
case 'ImageSourcePrimitive':
|
||||
case 'PointPrimitive':
|
||||
return `
|
||||
if (${prop.name} != oldProps->${prop.name}) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult["x"] = ${prop.name}.x;
|
||||
pointResult["y"] = ${prop.name}.y;
|
||||
result["${prop.name}"] = pointResult;
|
||||
}`;
|
||||
case 'EdgeInsetsPrimitive':
|
||||
case 'DimensionPrimitive':
|
||||
// TODO: Implement diffProps for complex types
|
||||
|
||||
+12
@@ -1157,6 +1157,12 @@ folly::dynamic ImageColorPropNativeComponentProps::getDiffProps(
|
||||
result[\\"thumbTintColor\\"] = *thumbTintColor;
|
||||
}
|
||||
|
||||
if (point != oldProps->point) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = point.x;
|
||||
pointResult[\\"y\\"] = point.y;
|
||||
result[\\"point\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
@@ -1296,6 +1302,12 @@ folly::dynamic PointPropNativeComponentProps::getDiffProps(
|
||||
}
|
||||
folly::dynamic result = HostPlatformViewProps::getDiffProps(prevProps);
|
||||
|
||||
if (startPoint != oldProps->startPoint) {
|
||||
folly::dynamic pointResult = folly::dynamic::object();
|
||||
pointResult[\\"x\\"] = startPoint.x;
|
||||
pointResult[\\"y\\"] = startPoint.y;
|
||||
result[\\"startPoint\\"] = pointResult;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user