Layout Animation with flatlist numColumns > 1
See original GitHub issueDescription
Hey i was trying to make layout animation with flatlist it works just fine with numColumns 1 but if i try 2 or more than 1 it doesn’t work anymore when i delete item or add new one the whole item re render which not happening when numColumns set to 1
Expected behavior
when add new item or delete it should animate the other item to re order them not re render the whole list again!.
Actual behavior & steps to reproduce
Snack or minimal code example
Flatlist -:
<Animated.FlatList
key={columns ? "oneRow" : "twoRow"}
data={Tasks.data}
numColumns={columns ? 1 : 2}
showsVerticalScrollIndicator={false}
itemLayoutAnimation={Layout}
style={styles.Wrapper}
renderItem={({ item, index }) => (
<List
key={index}
index={index}
item={item}
DeleteHanlder={DeleteHanlder}
/>
)}
/>
item itself -:
<Animated.View
entering={FadeInDown.springify().delay(index * 150)}
exiting={FadeOutUp.springify()}
.....
Package versions
- React Native: 0.64.3
- React Native Reanimated: ~2.3.1
Affected platforms
- [✅] iOS
Issue Analytics
- State:
- Created 2 years ago
- Reactions:5
- Comments:7
Top Results From Across the Web
How to animate a single item from Flatlist array in React Native
What you need to do is isolated the item and animation state in another component then each item will have your own animation...
Read more >FlatList - React Native
FlatList. A performant interface for rendering basic, flat lists, supporting the most handy features: Fully cross-platform.
Read more >Usage | FlashList
If you are familiar with FlatList, you already know how to use ... when you have grid layouts (numColumns > 1) and you...
Read more >Multi-width Flatlist leaving empty spaces when numColumns ...
I define what width the component should be using a prop called 'layout' and it can be either 1 for full width, or...
Read more >Example of GridView using FlatList in React Native
1 To Import FlatList in Code · 2 Render Using · 3 To Make a React Native App · 4 Code. 4.1 App.js...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
i found work around if anyone interesting i’ll show you guys when i’m back home…
anyway the solution was to replace flatlist with scrolllist and make the width of the content half of the screen so it will be two columns and add the layout prop to animated view for the item.