software-mansion / software-mansion/react-native-reanimated

No layout animation on last item of list components

Open
#4,597 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Platform: Android Platform: iOS Repro provided Reproducible 🎉
Dominant language
TypeScript
Stars
11k
Forks
1.5k
Avg merge
3d 4h
Merged PRs (30d)
172

Description

Description

When removing the last item in a list component (ScrollView/FlatList) with layout animations, I expect the list to animate and scroll to the new end of the list. Instead, the list simply jumps to the newly computed last end, resulting in a "glitchy" affect for the UX.

So far, I've been able to achieve the desired behavior with regular LayoutAnimations (see below). However, I'd like to switch to reanimated for this affect since LayoutAnimations is unreliable and often unintentionally affects other components.

This is a common usage pattern for paginated lists, especially when displaying loading indicators in the footer.

React Native's Layout Animation:
Snack: https://snack.expo.dev/@jcalem/layout-animation

https://github.com/software-mansion/react-native-reanimated/assets/13872364/a8a077d0-7e51-4509-9850-557d0567ecfc

Reanimated Layout Animation:
Snack: https://snack.expo.dev/@jcalem/layout-animation---reanimated

https://github.com/software-mansion/react-native-reanimated/assets/13872364/01d10092-4828-438f-aa0e-9172c0ab6ac7

Steps to reproduce
  1. Open the snack
  2. Create a bunch of items that extend past the screen height
  3. Scroll to the last item and click to remove it
Snack or a link to a repository

https://snack.expo.dev/@jcalem/layout-animation---reanimated

Reanimated version

3.3.0

React Native version

0.71.3

Platforms

Android, iOS

JavaScript runtime

None

Workflow

Expo managed workflow

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Reanimated Layout Animation Snack and compare its last-item removal behavior with the regular React Native Layout Animation example. Trace the ScrollView/FlatList layout-animation handling, then verify that removing the final item animates to the new list end on Android and iOS.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.