This commit is contained in:
Diego Mello 2022-09-19 18:09:30 -03:00
parent 86d5529cfd
commit 6bb7db9993
4 changed files with 8 additions and 16 deletions

View File

@ -5,15 +5,11 @@ import { FlatListProps, StyleSheet } from 'react-native';
import { FlashList } from '@shopify/flash-list';
import Animated from 'react-native-reanimated';
import { isIOS } from '../../../lib/methods/helpers';
import scrollPersistTaps from '../../../lib/methods/helpers/scrollPersistTaps';
const AnimatedFlatList = Animated.createAnimatedComponent(FlashList);
const styles = StyleSheet.create({
list: {
flex: 1
},
contentContainer: {
paddingTop: 10
}
@ -23,11 +19,13 @@ const styles = StyleSheet.create({
export type IListProps = FlatListProps<any>;
// @ts-ignore
const List = ({ listRef, ...props }: IListProps) => (
<AnimatedFlatList
testID='room-view-messages'
ref={listRef}
keyExtractor={(item: any) => item.id}
// @ts-ignore
contentContainerStyle={styles.contentContainer}
// style={styles.list}
inverted

View File

@ -15,6 +15,7 @@ import { compareServerVersion, debounce } from '../../../lib/methods/helpers';
import { animateNextTransition } from '../../../lib/methods/helpers/layoutAnimation';
import log from '../../../lib/methods/helpers/log';
import EmptyRoom from '../EmptyRoom';
// @ts-ignore
import List, { IListProps, TListRef } from './List';
import NavBottomFAB from './NavBottomFAB';
import { loadMissedMessages, loadThreadMessages } from '../../../lib/methods';

View File

@ -78,7 +78,7 @@ import {
ICustomEmojis
} from '../../definitions';
import { E2E_MESSAGE_TYPE, E2E_STATUS, MESSAGE_TYPE_ANY_LOAD, MessageTypeLoad, themes } from '../../lib/constants';
import { TListRef } from './List/List';
// import { TListRef } from './List/List';
import { ModalStackParamList } from '../../stacks/MasterDetailStack/types';
import {
callJitsi,
@ -215,7 +215,7 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
private messagebox: React.RefObject<MessageBoxType>;
private list: React.RefObject<ListContainerType>;
private joinCode: React.RefObject<IJoinCode>;
private flatList: TListRef;
private flatList: any;
private mounted: boolean;
private offset = 0;
private subObserveQuery?: Subscription;

View File

@ -62,7 +62,6 @@ import {
hasPermission,
isRead,
debounce,
isIOS,
isTablet
} from '../../lib/methods/helpers';
import { E2E_BANNER_TYPE, DisplayMode, SortBy, MAX_SIDEBAR_WIDTH, themes } from '../../lib/constants';
@ -118,7 +117,6 @@ interface IRoomItem extends ISubscription {
outside?: boolean;
}
const INITIAL_NUM_TO_RENDER = isTablet ? 20 : 12;
const CHATS_HEADER = 'Chats';
const UNREAD_HEADER = 'Unread';
const FAVORITES_HEADER = 'Favorites';
@ -159,11 +157,6 @@ const sortPreferencesShouldUpdate = ['sortBy', 'groupByType', 'showFavorites', '
const displayPropsShouldUpdate = ['showAvatar', 'displayMode'];
const getItemLayout = (data: ISubscription[] | null | undefined, index: number, height: number) => ({
length: height,
offset: height * index,
index
});
const keyExtractor = (item: ISubscription) => item.rid;
class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewState> {
@ -176,7 +169,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
private shouldUpdate?: boolean;
private backHandler?: NativeEventSubscription;
private querySubscription?: Subscription;
private scroll?: FlatList;
private scroll?: any;
private useRealName?: boolean;
constructor(props: IRoomsListViewProps) {
@ -897,7 +890,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
}
};
getScrollRef = (ref: FlatList) => (this.scroll = ref);
getScrollRef = (ref: any) => (this.scroll = ref);
renderListHeader = () => {
const { searching } = this.state;
@ -1012,7 +1005,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
render = () => {
console.count(`${this.constructor.name}.render calls`);
const { loading, chats, search, searching } = this.state;
const { chats, search, searching } = this.state;
const { showServerDropdown, theme, navigation, displayMode, refreshing } = this.props;
const height = displayMode === DisplayMode.Condensed ? ROW_HEIGHT_CONDENSED : ROW_HEIGHT;