Reenable LayoutAnimation on RoomView, but only for new messages

This commit is contained in:
Diego Mello 2022-12-07 10:32:54 -03:00
parent ae7398233a
commit 2c62d9cb46
1 changed files with 7 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import { Observable, Subscription } from 'rxjs';
import ActivityIndicator from '../../../containers/ActivityIndicator';
import { MessageType, TAnyMessage, TMessageModel, TThreadMessageModel, TThreadModel } from '../../../definitions';
import database from '../../../lib/database';
import { compareServerVersion, debounce } from '../../../lib/methods/helpers';
import { animateNextTransition, compareServerVersion, debounce } from '../../../lib/methods/helpers';
// import { animateNextTransition } from '../../../lib/methods/helpers/layoutAnimation';
import log from '../../../lib/methods/helpers/log';
import EmptyRoom from '../EmptyRoom';
@ -123,7 +123,7 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
query = async () => {
this.count += QUERY_SIZE;
const { rid, tmid, showMessageInMainThread, serverVersion } = this.props;
const { rid, tmid, showMessageInMainThread, serverVersion, listRef } = this.props;
const db = database.active;
// handle servers with version < 3.0.0
@ -185,10 +185,11 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
if (this.mounted) {
this.setState({ messages: data });
// if (this.animated) {
// listRef.current?.prepareForLayoutAnimationRender();
// animateNextTransition();
// }
if (this.animated && this.viewableItems?.[0].index === 0) {
listRef.current?.prepareForLayoutAnimationRender();
animateNextTransition();
}
} else {
// @ts-ignore
this.state.messages = data;