deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native
MIT License
917 stars 235 forks source link

Reorder with animation #143

Open obetomuniz opened 6 years ago

obetomuniz commented 6 years ago

Is it possible add animation when I update order property value?

I want to aniamate from [0,1,2] to [2,0,1].

ilonashub commented 6 years ago

@obetomuniz did you manage to make it work? I need the same functionality... thanks :)

obetomuniz commented 6 years ago

Hey @ilonashub. Sadly I did not. I used this library to solve my problem

nihgwu commented 6 years ago

I think use can config LayoutAnimation right before you set the new state, I don't test it.

ilonashub commented 6 years ago

@obetomuniz thanks! that's the library I am trying to use as well, just having some flickering issues there.

@nihgwu we use LayoutAnimation today - but it works only on iOS

nihgwu commented 6 years ago

@ilonashub for Android you need add this line UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true); at the very beginning

ilonashub commented 6 years ago

@nihgwu thanks! I know - we have this line and we use LayoutAnimation in Android in many places - but specifically the swapping that works for lists with LayoutAnimation works on iOS and not Android

nihgwu commented 6 years ago

LayoutAnimation.easyInOut is only effective for the next state change, I suspect there is other render consumed that, if the RNTester's LayoutAnimation example works for you then I think it should work on this scenario too

ilonashub commented 6 years ago

@nihgwu now that I think about it.. maybe the order of renders is different between Android and iOS - and what you're saying might be the problem. I'll check that direction. thanks!