mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 08:26:23 +00:00
Changed LayoutAnimation to use ms instead of seconds for consistency
This commit is contained in:
parent
57d0a5a628
commit
a2cfc5feca
@ -226,9 +226,9 @@ var styles = StyleSheet.create({
|
|||||||
var animations = {
|
var animations = {
|
||||||
layout: {
|
layout: {
|
||||||
spring: {
|
spring: {
|
||||||
duration: 0.75,
|
duration: 750,
|
||||||
create: {
|
create: {
|
||||||
duration: 0.3,
|
duration: 300,
|
||||||
type: LayoutAnimation.Types.easeInEaseOut,
|
type: LayoutAnimation.Types.easeInEaseOut,
|
||||||
property: LayoutAnimation.Properties.opacity,
|
property: LayoutAnimation.Properties.opacity,
|
||||||
},
|
},
|
||||||
@ -238,13 +238,13 @@ var animations = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
easeInEaseOut: {
|
easeInEaseOut: {
|
||||||
duration: 0.3,
|
duration: 300,
|
||||||
create: {
|
create: {
|
||||||
type: LayoutAnimation.Types.easeInEaseOut,
|
type: LayoutAnimation.Types.easeInEaseOut,
|
||||||
property: LayoutAnimation.Properties.scaleXY,
|
property: LayoutAnimation.Properties.scaleXY,
|
||||||
},
|
},
|
||||||
update: {
|
update: {
|
||||||
delay: 0.1,
|
delay: 100,
|
||||||
type: LayoutAnimation.Types.easeInEaseOut,
|
type: LayoutAnimation.Types.easeInEaseOut,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -92,13 +92,13 @@ var LayoutAnimation = {
|
|||||||
configChecker: configChecker,
|
configChecker: configChecker,
|
||||||
Presets: {
|
Presets: {
|
||||||
easeInEaseOut: create(
|
easeInEaseOut: create(
|
||||||
0.3, Types.easeInEaseOut, Properties.opacity
|
300, Types.easeInEaseOut, Properties.opacity
|
||||||
),
|
),
|
||||||
linear: create(
|
linear: create(
|
||||||
0.5, Types.linear, Properties.opacity
|
500, Types.linear, Properties.opacity
|
||||||
),
|
),
|
||||||
spring: {
|
spring: {
|
||||||
duration: 0.7,
|
duration: 700,
|
||||||
create: {
|
create: {
|
||||||
type: Types.linear,
|
type: Types.linear,
|
||||||
property: Properties.opacity,
|
property: Properties.opacity,
|
||||||
|
@ -80,10 +80,18 @@ static UIViewAnimationCurve UIViewAnimationCurveFromRCTAnimationType(RCTAnimatio
|
|||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
_property = [RCTConvert NSString:config[@"property"]];
|
_property = [RCTConvert NSString:config[@"property"]];
|
||||||
|
|
||||||
// TODO: this should be provided in ms, not seconds
|
_duration = [RCTConvert NSTimeInterval:config[@"duration"]] ?: duration;
|
||||||
// (this will require changing all call sites to ms as well)
|
if (_duration > 0.0 && _duration < 0.01) {
|
||||||
_duration = [RCTConvert NSTimeInterval:config[@"duration"]] * 1000.0 ?: duration;
|
RCTLogError(@"RCTLayoutAnimation expects timings to be in ms, not seconds.");
|
||||||
_delay = [RCTConvert NSTimeInterval:config[@"delay"]] * 1000.0;
|
_duration = _duration * 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_delay = [RCTConvert NSTimeInterval:config[@"delay"]];
|
||||||
|
if (_delay > 0.0 && _delay < 0.01) {
|
||||||
|
RCTLogError(@"RCTLayoutAnimation expects timings to be in ms, not seconds.");
|
||||||
|
_delay = _delay * 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
_animationType = [RCTConvert RCTAnimationType:config[@"type"]];
|
_animationType = [RCTConvert RCTAnimationType:config[@"type"]];
|
||||||
if (_animationType == RCTAnimationTypeSpring) {
|
if (_animationType == RCTAnimationTypeSpring) {
|
||||||
_springDamping = [RCTConvert CGFloat:config[@"springDamping"]];
|
_springDamping = [RCTConvert CGFloat:config[@"springDamping"]];
|
||||||
@ -142,9 +150,11 @@ static UIViewAnimationCurve UIViewAnimationCurveFromRCTAnimationType(RCTAnimatio
|
|||||||
|
|
||||||
if ((self = [super init])) {
|
if ((self = [super init])) {
|
||||||
|
|
||||||
// TODO: this should be provided in ms, not seconds
|
NSTimeInterval duration = [RCTConvert NSTimeInterval:config[@"duration"]];
|
||||||
// (this will require changing all call sites to ms as well)
|
if (duration > 0.0 && duration < 0.01) {
|
||||||
NSTimeInterval duration = [RCTConvert NSTimeInterval:config[@"duration"]] * 1000.0;
|
RCTLogError(@"RCTLayoutAnimation expects timings to be in ms, not seconds.");
|
||||||
|
duration = duration * 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
_createAnimation = [[RCTAnimation alloc] initWithDuration:duration dictionary:config[@"create"]];
|
_createAnimation = [[RCTAnimation alloc] initWithDuration:duration dictionary:config[@"create"]];
|
||||||
_updateAnimation = [[RCTAnimation alloc] initWithDuration:duration dictionary:config[@"update"]];
|
_updateAnimation = [[RCTAnimation alloc] initWithDuration:duration dictionary:config[@"update"]];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user