react-native-swipeable icon indicating copy to clipboard operation
react-native-swipeable copied to clipboard

Animation when removing swipeable item from list.

Open bataevvlad opened this issue 5 years ago • 1 comments

Hello, everybody!

Using swipeable in conjunction with SectionList.

My implementation is as follows, I make a pile to the left, the button moves out, and when I click, I can remove the item from the list. I want it to be removed with the animation, how do I achieve this? Has anybody done something like that?

I'd love all the help I can get!

bataevvlad avatar Apr 22 '20 13:04 bataevvlad

Hey @bataevvlad!

You probably need something like: https://reactnative.dev/docs/layoutanimation.

Example:

const handleTrash = (item) => {
  LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
  // code to trigger remove...
  // ...
}

In order this to work on Android you should do this:

if (Platform.OS === 'android') {
  if (UIManager.setLayoutAnimationEnabledExperimental) {
    UIManager.setLayoutAnimationEnabledExperimental(true);
  }
}

BojanRatkovic avatar Aug 27 '20 22:08 BojanRatkovic