React-native-animatable: Duration of 0 is ignored

Created on 11 May 2017  路  2Comments  路  Source: oblador/react-native-animatable

Hi,

I wanted to prepare an element for a later slideInUp() transition, so I tried to apply a slideOutDown(0) transition on it. It seems like a duration of 0 as no effect (you can still see the transition) and I had to use 1 or -1 to achieve that (aka, make the transition immediate). Is that the expected behaviour?

Cheers

Most helpful comment

Thanks for looking into this Mike. I believe that should be fixed.

Imho, a duration of 0 is not an edge case, it's common to use immediate transitions in CSS as well, in conjonction to other "timed" transitions to prepare elements or hide an element immediately after another transition is done. jQuery's transitions also accept durations of 0 so it's common knowledge setting a duration value of 0 will, well, transition for 0 millisecond :-)

Plus, it's far easier to use a duration of 0 rather than to try to replicate the end state manually without a transition component.

All 2 comments

I believe this line code would default the duration to 1000
https://github.com/oblador/react-native-animatable/blob/3c286b0a77f27b0848daaf21b4d76de114e5671f/createAnimatableComponent.js#L106

This would need to be changed from duration || 1000 to duration !== undefined ? duration : 1000

Though, a duration of 0 seems like an edge case when using a transitioning component

Thanks for looking into this Mike. I believe that should be fixed.

Imho, a duration of 0 is not an edge case, it's common to use immediate transitions in CSS as well, in conjonction to other "timed" transitions to prepare elements or hide an element immediately after another transition is done. jQuery's transitions also accept durations of 0 so it's common knowledge setting a duration value of 0 will, well, transition for 0 millisecond :-)

Plus, it's far easier to use a duration of 0 rather than to try to replicate the end state manually without a transition component.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamhaaamed picture iamhaaamed  路  3Comments

julesmoretti picture julesmoretti  路  7Comments

ghost picture ghost  路  3Comments

quangtruong16994 picture quangtruong16994  路  5Comments

zr0n picture zr0n  路  6Comments