mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Animated: Restore AnimatedNode.prototype.toJSON (#46498)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46498 Looks like this is still necessary because we still run into this error when using the Components tab when using React DevTools: > TypeError: cyclical structure in JSON object This effectively reverts https://github.com/facebook/react-native/pull/46382. Changelog: [General][Changed] - AnimatedNode (and its subclasses) once again implement `toJSON()`. Reviewed By: javache Differential Revision: D62690380 fbshipit-source-id: d5b7c1d156b49838abefe48a7d7b61471cc3488a
This commit is contained in:
committed by
Riccardo Cipolleschi
parent
3b44182c1d
commit
83eb95e72a
@@ -203,4 +203,12 @@ export default class AnimatedNode {
|
||||
__setPlatformConfig(platformConfig: ?PlatformConfig) {
|
||||
this._platformConfig = platformConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* NOTE: This is intended to prevent `JSON.stringify` from throwing "cyclic
|
||||
* structure" errors in React DevTools. Avoid depending on this!
|
||||
*/
|
||||
toJSON(): mixed {
|
||||
return this.__getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -930,6 +930,7 @@ exports[`public API should not change unintentionally Libraries/Animated/nodes/A
|
||||
toJSON(): any;
|
||||
__getPlatformConfig(): ?PlatformConfig;
|
||||
__setPlatformConfig(platformConfig: ?PlatformConfig): void;
|
||||
toJSON(): mixed;
|
||||
}
|
||||
"
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user