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

Add useLayoutAnimation #213

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JoniVR
Copy link

@JoniVR JoniVR commented Nov 11, 2020

Summary

This allows you to use LayoutAnimation in a more convenient hook api. It's mainly useful because it removes the need to explicitly enable it on Android everywhere. If necessary, I can also add a function that allows to manually enable/disable this because it would still end up with an easier to use api.

I've added a default animation to the api, which you can override with the same parameters LayoutAnimation.configureNext uses.

Test Plan

example gif

example gif

What's required for testing (prerequisites)?

  • The expo snack or an iOS/Android simulator.

What are the steps to reproduce (after prerequisites)?

  1. Open the snack link at the bottom of this PR.
  2. Use Android or iOS (doesn't work on web afaik).
  3. Remove an item and see the animation.

You can optionally also set some of the parameters in animateNext.

Compatibility

OS Implemented
iOS
Android
Web

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I updated the typed files (TS and Flow) --> Couldn't find these?
  • I've created a snack to demonstrate the changes: https://snack.expo.io/@jonivr/uselayoutanimation

@JoniVR JoniVR changed the title Add useLayoutAnimation.ts Add useLayoutAnimation Nov 11, 2020
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

Successfully merging this pull request may close these issues.

None yet

1 participant