Skip to content

Commit 8067f7b

Browse files
coadometa-codesync[bot]
authored andcommitted
Fix TypeError when serializing arbitrary transform operation (#55445)
Summary: Pull Request resolved: #55445 The `TransformOperationType::Arbitrary` case was incorrectly using the `[]` operator with a string key on a `folly::dynamic` array (`resultTranslateArray`). This throws a `TypeError` at runtime because `folly::dynamic` arrays only support numeric index access - string key access is only valid for objects. The fix creates a `folly::dynamic::object()`, sets the "matrix" key on it, and then pushes the object to the array using `push_back()`. This follows the same pattern already used by `serializeTransformOperationValue()` and other serialization helpers in this file. ## Changelog: [General][Fixed] - fixed TypeError when serializing arbitrary transform operation Reviewed By: cortinico Differential Revision: D92499621 fbshipit-source-id: d91522f0534c5429f27ad2ce423e65ddb1789320
1 parent 08d1764 commit 8067f7b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/react-native/ReactCommon/react/renderer/graphics/TransformUtils.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ inline void updateTransformProps(
7676
serializeTransformAxis(operation, "perspective", 0, resultTranslateArray);
7777
return;
7878
case TransformOperationType::Arbitrary: {
79-
operationName = "matrix";
80-
resultTranslateArray[operationName] = transform;
79+
folly::dynamic result = folly::dynamic::object();
80+
result["matrix"] = transform;
81+
resultTranslateArray.push_back(std::move(result));
8182
return;
8283
}
8384
case TransformOperationType::Identity:

0 commit comments

Comments
 (0)