Prevent layout animation after the message has already rendered
This commit is contained in:
parent
976753c08b
commit
2683976d21
|
@ -184,9 +184,11 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.mounted) {
|
if (this.mounted) {
|
||||||
|
const { messages: prevMessages } = this.state;
|
||||||
this.setState({ messages: data });
|
this.setState({ messages: data });
|
||||||
|
|
||||||
if (this.animated && this.viewableItems?.[0]?.index === 0) {
|
// animates only for new messages
|
||||||
|
if (this.animated && this.viewableItems?.[0]?.index === 0 && prevMessages[0]?.id !== data[0]?.id) {
|
||||||
listRef.current?.prepareForLayoutAnimationRender();
|
listRef.current?.prepareForLayoutAnimationRender();
|
||||||
animateNextTransition();
|
animateNextTransition();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue