i have a room list, when any room have new message, I sorted this room to top then re-render the flatList with LayoutAnimation(testing from IOS simulator):
const CONFIG = {
duration: 300,
create: {
type: LayoutAnimation.Types.linear,
property: LayoutAnimation.Properties.opacity
},
update: {
type: LayoutAnimation.Types.easeInEaseOut
},
delete: {
type: LayoutAnimation.Types.easeInEaseOut,
property: LayoutAnimation.Properties.opacity
}
}
export function animate () {
LayoutAnimation.configureNext(CONFIG)
}
but when data changed, i didnt see any animation without fade, as video below:
Updated video with transition:
this is updated answer with transition
other information:
"react": "17.0.2",
"react-native": "^0.68.0",
"react-native-gesture-handler": "^2.5.0",
"react-native-reanimated": "^2.9.1",
To Archive that you can use
AnimatedinReact Native, you can check this article that explains how to do it step by step from hereAnd you can achieve that with
FlatListby usingTransitioning Viewfromreact-native-reanimatedlike this example:You can check the demo here.