From d29b661ccc9d60e3857a385a06dd7585dcb4e48b Mon Sep 17 00:00:00 2001 From: AlexAlexandre Date: Tue, 14 Dec 2021 23:56:25 -0300 Subject: [PATCH] minor tweaks --- app/views/RoomView/List/NavBottomFAB.tsx | 4 ++-- app/views/RoomView/List/index.tsx | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/RoomView/List/NavBottomFAB.tsx b/app/views/RoomView/List/NavBottomFAB.tsx index e6728a3b0..4dbf5c871 100644 --- a/app/views/RoomView/List/NavBottomFAB.tsx +++ b/app/views/RoomView/List/NavBottomFAB.tsx @@ -1,6 +1,6 @@ import React, { useCallback, useState } from 'react'; import { StyleSheet, View } from 'react-native'; -import Animated, { call, cond, greaterOrEq, useCode } from 'react-native-reanimated'; +import Animated, { call, cond, greaterOrEq, useCode, Value } from 'react-native-reanimated'; import { themes } from '../../../constants/colors'; import { CustomIcon } from '../../../lib/Icons'; @@ -30,7 +30,7 @@ const styles = StyleSheet.create({ }); interface IRoomNavBottomFAB { - y: number; + y: Value; onPress: Function; isThread: boolean; } diff --git a/app/views/RoomView/List/index.tsx b/app/views/RoomView/List/index.tsx index 687289dfe..a6f9cf828 100644 --- a/app/views/RoomView/List/index.tsx +++ b/app/views/RoomView/List/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { FlatList, RefreshControl } from 'react-native'; +import { FlatList, NativeScrollEvent, NativeSyntheticEvent, RefreshControl, ViewToken } from 'react-native'; import { Q } from '@nozbe/watermelondb'; import moment from 'moment'; import { dequal } from 'dequal'; @@ -25,7 +25,7 @@ import { IThread } from '../../../definitions/IThread'; const QUERY_SIZE = 50; -const onScroll = ({ y }: any) => +const onScroll = ({ y }: { y: Value }) => event( [ { @@ -57,15 +57,15 @@ class ListContainer extends React.Component { private mounted: boolean; private animated: boolean; private jumping: boolean; - private y: any; - private onScroll: (...args: any[]) => void; - private unsubscribeFocus: any; + private y: Value; + private onScroll: (event: NativeSyntheticEvent) => void; + private unsubscribeFocus: () => void; private viewabilityConfig: { itemVisiblePercentThreshold: number }; - private highlightedMessageTimeout: any; + private highlightedMessageTimeout?: ReturnType | false; private thread?: IThread; private messagesObservable?: Observable; private messagesSubscription?: Subscription; - private viewableItems: any; + private viewableItems?: ViewToken[]; constructor(props: IRoomListContainerProps) { super(props); @@ -286,7 +286,7 @@ class ListContainer extends React.Component { if (index > -1) { listRef.current?.scrollToIndex({ index, viewPosition: 0.5, viewOffset: 100 }); await new Promise(res => setTimeout(res, 300)); - if (!this.viewableItems.map((vi: { key: string }) => vi.key).includes(messageId)) { + if (!this.viewableItems?.map((vi: { key: string }) => vi.key).includes(messageId)) { if (!this.jumping) { return resolve(); } @@ -332,7 +332,7 @@ class ListContainer extends React.Component { return renderRow(item, messages[index + 1], highlightedMessage); }; - onViewableItemsChanged = ({ viewableItems }: any) => { + onViewableItemsChanged = ({ viewableItems }: { viewableItems: ViewToken[] }) => { this.viewableItems = viewableItems; };