mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 04:50:59 +00:00
5baffa03fd
- [ReactNative] Use deprecated ix in TabBarExample | Amjad Masad - [ReactNative] Expanded license on obj-c files | Christopher Chedeau - [ReactNative] Expanded license on js files | Christopher Chedeau - [ReactNative] Fix React Devtools integration | Alex Kotliarskyi - [Text] Account for font leading so descenders are not clipped | James Ide - [ReactNative] Expanded license on js packager files | Christopher Chedeau - more UIExplorer flow | Basil Hosmer - [react-packager] Pick up package changes while running | Amjad Masad - Added a graph view and a ReactNative metric that displays current queue and execution time for the JS thread. | Bryce Redd - [ReactNative] Add NativeModules and DeviceEventEmitter to react-native exports | Alex Kotliarskyi
95 lines
2.1 KiB
JavaScript
95 lines
2.1 KiB
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @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;
|