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:
wusuopu 2016-05-08 01:08:32 -07:00 коммит произвёл Facebook Github Bot 9
Родитель 0cd2904b23
Коммит 17f08070e8
2 изменённых файлов: 4 добавлений и 0 удалений

Просмотреть файл

@ -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');
});
});