Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation when removing swipeable item from list. #97

Open
bataevvlad opened this issue Apr 22, 2020 · 1 comment
Open

Animation when removing swipeable item from list. #97

bataevvlad opened this issue Apr 22, 2020 · 1 comment

Comments

@bataevvlad
Copy link

bataevvlad commented Apr 22, 2020

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 bataevvlad changed the title Animation for delete of swipeable item. Animation when removing swipeable item from list. Apr 22, 2020
@BojanRatkovic
Copy link

BojanRatkovic commented Aug 27, 2020

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);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants