Add support for native animations on iOS

Summary:
Currently on iOS animations are being performed on the JS thread. This ports animations over to the native thread and performs them natively. A lot of this work has already been done on Android, but this PR enables a few animation nodes that Android doesn't yet support such as Transform, Multiplication, and Addition nodes.
Also there is a demo of the native animations added to the UIExplorer app.
Closes https://github.com/facebook/react-native/pull/7884

Differential Revision: D3401811

Pulled By: nicklockwood

fbshipit-source-id: c8d750b75e4410923e17eaeb6dcaf079a09942e2
This commit is contained in:
Brandon Withrow
2016-06-07 20:40:54 -07:00
committed by Facebook Github Bot 4
parent 7357ccc370
commit 5ecdb252c3
31 changed files with 1983 additions and 4 deletions

View File

@@ -74,16 +74,22 @@ var API = {
var PROPS_WHITELIST = {
style: {
opacity: true,
transform: true,
/* legacy android transform properties */
scaleX: true,
scaleY: true,
rotation: true,
translateX: true,
translateY: true,
},
};
var TRANSFORM_WHITELIST = {
translateX: true,
translateY: true,
scale: true,
rotate: true,
};
function validateProps(params: Object): void {
for (var key in params) {
if (!PROPS_WHITELIST.hasOwnProperty(key)) {
@@ -92,6 +98,14 @@ function validateProps(params: Object): void {
}
}
function validateTransform(config: Object): void {
for (var key in config) {
if (!TRANSFORM_WHITELIST.hasOwnProperty(key)) {
throw new Error(`Property '${key}' is not supported by native animated module`);
}
}
}
function validateStyles(styles: Object): void {
var STYLES_WHITELIST = PROPS_WHITELIST.style || {};
for (var key in styles) {
@@ -129,6 +143,7 @@ module.exports = {
API,
validateProps,
validateStyles,
validateTransform,
validateInterpolation,
generateNewNodeTag,
generateNewAnimationId,