Fix animation bug in 32bit when fromValue is double.

Summary:
Now `RCTAnimationExperimentalManager` is not working on 32bit devices.

```
NSValue *fromValue = [view.layer.presentationLayer valueForKeyPath:keypath];
CGFloat fromFields[count];
[fromValue getValue:fromFields];
```

If the fromValue is kind of double value which needs two bytes in 32bit device and the count is 1, the fromFileds array will go wrong.
Closes https://github.com/facebook/react-native/pull/1725
Github Author: =?UTF-8?q?=E9=9A=90=E9=A3=8E?= <yinfeng.fcx@alibaba-inc.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
This commit is contained in:
=?UTF-8?q?=E9=9A=90=E9=A3=8E?= 2015-06-25 06:00:48 -07:00
parent 648c2b48c2
commit b09f3eaf26
1 changed files with 5 additions and 0 deletions

View File

@ -217,6 +217,11 @@ RCT_EXPORT_METHOD(startAnimation:(NSNumber *)reactTag
} }
NSValue *fromValue = [view.layer.presentationLayer valueForKeyPath:keypath]; NSValue *fromValue = [view.layer.presentationLayer valueForKeyPath:keypath];
#if !CGFLOAT_IS_DOUBLE
if ([fromValue isKindOfClass:[NSNumber class]]) {
fromValue = [NSNumber numberWithFloat:[(NSNumber *)fromValue doubleValue]];
}
#endif
CGFloat fromFields[count]; CGFloat fromFields[count];
[fromValue getValue:fromFields]; [fromValue getValue:fromFields];