diff --git a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js index 354bd521630871..53f2af95717d10 100644 --- a/packages/react-native/Libraries/Animated/__tests__/Animated-test.js +++ b/packages/react-native/Libraries/Animated/__tests__/Animated-test.js @@ -162,6 +162,10 @@ describe('Animated tests', () => { expect(anim.__getValue()).toBe(15); }); + it('convert to JSON', () => { + expect(JSON.stringify(new Animated.Value(10))).toBe('10'); + }); + it('bypasses `setNativeProps` in test environments', async () => { const opacity = new Animated.Value(0); diff --git a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js index 1835d43ec67df4..2859c068b6248e 100644 --- a/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js +++ b/packages/react-native/Libraries/Animated/nodes/AnimatedNode.js @@ -189,4 +189,8 @@ export default class AnimatedNode { __setPlatformConfig(platformConfig: ?PlatformConfig) { this._platformConfig = platformConfig; } + + toJSON(): any { + return this.__getValue(); + } }