diff --git a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap index 6130366ba5c..7612c98f9c0 100644 --- a/packages/react-native-codegen/e2e/deep_imports/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/e2e/deep_imports/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap @@ -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 diff --git a/packages/react-native-codegen/e2e/namespaced/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/e2e/namespaced/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap index 87eda91a5b9..d7065240bd4 100644 --- a/packages/react-native-codegen/e2e/namespaced/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/e2e/namespaced/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap @@ -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 diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index 9dc95ad6eb2..37c0aca020e 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -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 diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap index 58e74ab5386..f419d20424d 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap @@ -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