mirror of
https://github.com/status-im/react-native.git
synced 2025-02-27 00:20:31 +00:00
Animated: Implement toJSON method of Animated
Summary: Fix issue https://github.com/facebook/react-native/issues/7441 Closes https://github.com/facebook/react-native/pull/7442 Differential Revision: D3274594 fb-gh-sync-id: 720d7dcdaa97a2ee5235547bad6ba020398b57d2 fbshipit-source-id: 720d7dcdaa97a2ee5235547bad6ba020398b57d2
This commit is contained in:
parent
0cd2904b23
commit
17f08070e8
@ -69,6 +69,7 @@ class Animated {
|
||||
__getNativeConfig(): Object {
|
||||
throw new Error('This JS animated node type cannot be used as native animated node');
|
||||
}
|
||||
toJSON(): any { return this.__getValue(); }
|
||||
}
|
||||
|
||||
type AnimationConfig = {
|
||||
|
@ -142,6 +142,9 @@ describe('Animated', () => {
|
||||
expect(anim.__getValue()).toBe(15);
|
||||
});
|
||||
|
||||
it('convert to JSON', () => {
|
||||
expect(JSON.stringify(new Animated.Value(10))).toBe('10');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user