mirror of
https://github.com/status-im/react-native.git
synced 2025-02-12 17:36:27 +00:00
- [ReactNative] Add AsyncStorageTest | Spencer Ahrens - [ReactNative] Add timers integration test | Spencer Ahrens - [ReactNative] Remove ExpandingText | Tadeu Zagallo - [TouchableHighlight] Preserve underlay style when restoring inactive props | Christopher Chedeau - clean flow errors in react-native-github | Basil Hosmer - [ReactNative] Sort React Native exports into two groups, Components and APIs | Christopher Chedeau - [ReactNative] Rename Slider to SliderIOS | Tadeu Zagallo - [react_native] JS files from D1919491: Improve JS logging | Martin Kosiba - [ReactNative] Add TimerExample | Spencer Ahrens - [RFC][ReactNative] increase timer resolution | Spencer Ahrens - [ReactNative] Strip prefixes from NativeModules keys | Spencer Ahrens - [ReactNative] Small docs cleanup in ActivityIndicatorIOS and DatePickerIOS | Christopher Chedeau - [ReactNative] Improvements on perf measurement output | Jing Chen - [ReactNative] Clean up Touchable PropTypes | Christopher Chedeau - [ReactKit] Fail tests when redbox shows up | Alex Kotliarskyi
90 lines
1.9 KiB
JavaScript
90 lines
1.9 KiB
JavaScript
/**
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
*
|
|
* @providesModule LayoutAnimation
|
|
*/
|
|
'use strict';
|
|
|
|
var PropTypes = require('ReactPropTypes');
|
|
var RCTUIManager = require('NativeModules').UIManager;
|
|
|
|
var createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
|
|
var keyMirror = require('keyMirror');
|
|
|
|
var Types = keyMirror({
|
|
spring: true,
|
|
linear: true,
|
|
easeInEaseOut: true,
|
|
easeIn: true,
|
|
easeOut: true,
|
|
});
|
|
|
|
var Properties = keyMirror({
|
|
opacity: true,
|
|
scaleXY: true,
|
|
});
|
|
|
|
var animChecker = createStrictShapeTypeChecker({
|
|
duration: PropTypes.number,
|
|
delay: PropTypes.number,
|
|
springDamping: PropTypes.number,
|
|
initialVelocity: PropTypes.number,
|
|
type: PropTypes.oneOf(
|
|
Object.keys(Types)
|
|
),
|
|
property: PropTypes.oneOf( // Only applies to create/delete
|
|
Object.keys(Properties)
|
|
),
|
|
});
|
|
|
|
var configChecker = createStrictShapeTypeChecker({
|
|
duration: PropTypes.number.isRequired,
|
|
create: animChecker,
|
|
update: animChecker,
|
|
delete: animChecker,
|
|
});
|
|
|
|
var LayoutAnimation = {
|
|
configureNext(config, onAnimationDidEnd, onError) {
|
|
configChecker({config}, 'config', 'LayoutAnimation.configureNext');
|
|
RCTUIManager.configureNextLayoutAnimation(config, onAnimationDidEnd, onError);
|
|
},
|
|
create(duration, type, creationProp) {
|
|
return {
|
|
duration,
|
|
create: {
|
|
type,
|
|
property: creationProp,
|
|
},
|
|
update: {
|
|
type,
|
|
},
|
|
};
|
|
},
|
|
Types: Types,
|
|
Properties: Properties,
|
|
configChecker: configChecker,
|
|
};
|
|
|
|
LayoutAnimation.Presets = {
|
|
easeInEaseOut: LayoutAnimation.create(
|
|
0.3, Types.easeInEaseOut, Properties.opacity
|
|
),
|
|
linear: LayoutAnimation.create(
|
|
0.5, Types.linear, Properties.opacity
|
|
),
|
|
spring: {
|
|
duration: 0.7,
|
|
create: {
|
|
type: Types.linear,
|
|
property: Properties.opacity,
|
|
},
|
|
update: {
|
|
type: Types.spring,
|
|
springDamping: 0.4,
|
|
},
|
|
},
|
|
};
|
|
|
|
module.exports = LayoutAnimation;
|