mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Fix TypeError when serializing arbitrary transform operation (#55445)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
1 parent
08d1764530
commit
8067f7b353
1 file changed
+3
-2
@@ -76,8 +76,9 @@ inline void updateTransformProps(
|
||||
serializeTransformAxis(operation, "perspective", 0, resultTranslateArray);
|
||||
return;
|
||||
case TransformOperationType::Arbitrary: {
|
||||
operationName = "matrix";
|
||||
resultTranslateArray[operationName] = transform;
|
||||
folly::dynamic result = folly::dynamic::object();
|
||||
result["matrix"] = transform;
|
||||
resultTranslateArray.push_back(std::move(result));
|
||||
return;
|
||||
}
|
||||
case TransformOperationType::Identity:
|
||||
|
||||
Reference in new issue
Block a user