diff --git a/app/definitions/IMessage.ts b/app/definitions/IMessage.ts index 1e2449932..4a86621d6 100644 --- a/app/definitions/IMessage.ts +++ b/app/definitions/IMessage.ts @@ -8,7 +8,15 @@ import { TThreadMessageModel } from './IThreadMessage'; import { TThreadModel } from './IThread'; import { IUrl, IUrlFromServer } from './IUrl'; -export type MessageType = 'jitsi_call_started' | 'discussion-created' | 'e2e' | 'load_more' | 'rm' | 'uj' | MessageTypeLoad | MessageTypesValues; +export type MessageType = + | 'jitsi_call_started' + | 'discussion-created' + | 'e2e' + | 'load_more' + | 'rm' + | 'uj' + | MessageTypeLoad + | MessageTypesValues; export interface IUserMessage { _id: string; diff --git a/app/views/RoomView/List/RefreshControl.tsx b/app/views/RoomView/List/RefreshControl.tsx deleted file mode 100644 index c26416435..000000000 --- a/app/views/RoomView/List/RefreshControl.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import { RefreshControl as RNRefreshControl, RefreshControlProps, StyleSheet } from 'react-native'; - -import { useTheme } from '../../../theme'; -import { isAndroid } from '../../../lib/methods/helpers'; - -const style = StyleSheet.create({ - container: { - flex: 1 - }, - inverted: { - scaleY: -1 - } -}); - -interface IRefreshControl extends RefreshControlProps { - children: React.ReactElement; -} - -const RefreshControl = ({ children, onRefresh, refreshing }: IRefreshControl): React.ReactElement => { - const { colors } = useTheme(); - // if (isAndroid) { - // return ( - // - // {children} - // - // ); - // } - - const refreshControl = ; - - return React.cloneElement(children, { refreshControl }); -}; - -export default RefreshControl; diff --git a/app/views/RoomView/List/index.tsx b/app/views/RoomView/List/index.tsx index 041c02e63..78183449b 100644 --- a/app/views/RoomView/List/index.tsx +++ b/app/views/RoomView/List/index.tsx @@ -2,7 +2,7 @@ import { Q } from '@nozbe/watermelondb'; import { dequal } from 'dequal'; import moment from 'moment'; import React from 'react'; -import { FlatListProps, View, ViewToken, StyleSheet, Platform } from 'react-native'; +import { FlatListProps, ViewToken, RefreshControl } from 'react-native'; import { event, Value } from 'react-native-reanimated'; import { Observable, Subscription } from 'rxjs'; @@ -18,20 +18,11 @@ import List, { IListProps, TListRef } from './List'; import NavBottomFAB from './NavBottomFAB'; import { loadMissedMessages, loadThreadMessages } from '../../../lib/methods'; import { Services } from '../../../lib/services'; -import RefreshControl from './RefreshControl'; +import { TSupportedThemes, withTheme } from '../../../theme'; +import { themes } from '../../../lib/constants'; const QUERY_SIZE = 50; -const styles = StyleSheet.create({ - // inverted: { - // ...Platform.select({ - // android: { - // scaleY: -1 - // } - // }) - // } -}); - const onScroll = ({ y }: { y: Value }) => event( [ @@ -58,6 +49,7 @@ export interface IListContainerProps { navigation: any; // TODO: type me showMessageInMainThread: boolean; serverVersion: string | null; + theme?: TSupportedThemes; } interface IListContainerState { @@ -354,7 +346,7 @@ class ListContainer extends React.Component['renderItem'] = ({ item, index }) => { const { messages, highlightedMessage } = this.state; const { renderRow } = this.props; - return {renderRow(item, messages[index + 1], highlightedMessage)}; + return renderRow(item, messages[index + 1], highlightedMessage); }; onViewableItemsChanged: FlatListProps['onViewableItemsChanged'] = ({ viewableItems }) => { @@ -363,26 +355,27 @@ class ListContainer extends React.Component - - - + + } + /> ); @@ -391,4 +384,4 @@ class ListContainer extends React.Component {