@@ -80,10 +80,18 @@ - (instancetype)initWithDuration:(NSTimeInterval)duration dictionary:(NSDictiona
8080 if ((self = [super init ])) {
8181 _property = [RCTConvert NSString: config[@" property" ]];
8282
83- // TODO: this should be provided in ms, not seconds
84- // (this will require changing all call sites to ms as well)
85- _duration = [RCTConvert NSTimeInterval: config[@" duration" ]] * 1000.0 ?: duration;
86- _delay = [RCTConvert NSTimeInterval: config[@" delay" ]] * 1000.0 ;
83+ _duration = [RCTConvert NSTimeInterval: config[@" duration" ]] ?: duration;
84+ if (_duration > 0.0 && _duration < 0.01 ) {
85+ RCTLogError (@" RCTLayoutAnimation expects timings to be in ms, not seconds." );
86+ _duration = _duration * 1000.0 ;
87+ }
88+
89+ _delay = [RCTConvert NSTimeInterval: config[@" delay" ]];
90+ if (_delay > 0.0 && _delay < 0.01 ) {
91+ RCTLogError (@" RCTLayoutAnimation expects timings to be in ms, not seconds." );
92+ _delay = _delay * 1000.0 ;
93+ }
94+
8795 _animationType = [RCTConvert RCTAnimationType: config[@" type" ]];
8896 if (_animationType == RCTAnimationTypeSpring) {
8997 _springDamping = [RCTConvert CGFloat: config[@" springDamping" ]];
@@ -142,9 +150,11 @@ - (instancetype)initWithDictionary:(NSDictionary *)config callback:(RCTResponseS
142150
143151 if ((self = [super init ])) {
144152
145- // TODO: this should be provided in ms, not seconds
146- // (this will require changing all call sites to ms as well)
147- NSTimeInterval duration = [RCTConvert NSTimeInterval: config[@" duration" ]] * 1000.0 ;
153+ NSTimeInterval duration = [RCTConvert NSTimeInterval: config[@" duration" ]];
154+ if (duration > 0.0 && duration < 0.01 ) {
155+ RCTLogError (@" RCTLayoutAnimation expects timings to be in ms, not seconds." );
156+ duration = duration * 1000.0 ;
157+ }
148158
149159 _createAnimation = [[RCTAnimation alloc ] initWithDuration: duration dictionary: config[@" create" ]];
150160 _updateAnimation = [[RCTAnimation alloc ] initWithDuration: duration dictionary: config[@" update" ]];
0 commit comments