Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/RoomView/List/components/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const List = ({ listRef, jumpToBottom, isThread, ...props }: IListProps)
keyExtractor={item => item.id}
contentContainerStyle={styles.contentContainer}
style={styles.list}
inverted={isIOS}
inverted
removeClippedSubviews={isIOS}
initialNumToRender={7}
onEndReachedThreshold={0.5}
Expand Down
12 changes: 2 additions & 10 deletions app/views/RoomView/List/components/NavBottomFAB.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { StyleSheet, View, Platform } from 'react-native';
import { StyleSheet, View } from 'react-native';

import { CustomIcon } from '../../../../containers/CustomIcon';
import { useTheme } from '../../../../theme';
Expand Down Expand Up @@ -43,15 +43,7 @@ const NavBottomFAB = ({
style={[
styles.container,
{
...Platform.select({
ios: {
bottom: 100 + (isThread ? 40 : 0)
},
android: {
top: 15,
scaleY: -1
}
})
bottom: 100 + (isThread ? 40 : 0)
}
]}
testID='nav-jump-to-bottom'
Expand Down
38 changes: 0 additions & 38 deletions app/views/RoomView/List/components/RefreshControl.tsx

This file was deleted.

1 change: 0 additions & 1 deletion app/views/RoomView/List/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './NavBottomFAB';
export * from './RefreshControl';
Comment thread
diegolmello marked this conversation as resolved.
export * from './EmptyRoom';
export * from './List';
49 changes: 20 additions & 29 deletions app/views/RoomView/List/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import React, { forwardRef, useImperativeHandle } from 'react';
import { View, Platform, StyleSheet } from 'react-native';
import { RefreshControl } from 'react-native';

import ActivityIndicator from '../../../containers/ActivityIndicator';
import { useMessages, useRefresh, useScroll } from './hooks';
import { useDebounce } from '../../../lib/methods/helpers';
import { RefreshControl, EmptyRoom, List } from './components';
import { isIOS, useDebounce } from '../../../lib/methods/helpers';
import { EmptyRoom, List } from './components';
import { IListContainerProps, IListContainerRef, IListProps } from './definitions';

const styles = StyleSheet.create({
inverted: {
...Platform.select({
android: {
scaleY: -1
}
})
}
});
import { useTheme } from '../../../theme';

const ListContainer = forwardRef<IListContainerRef, IListContainerProps>(
({ rid, tmid, renderRow, showMessageInMainThread, serverVersion, hideSystemMessages, listRef, loading }, ref) => {
Expand All @@ -26,6 +17,7 @@ const ListContainer = forwardRef<IListContainerRef, IListContainerProps>(
serverVersion,
hideSystemMessages
});
const { colors } = useTheme();
const [refreshing, refresh] = useRefresh({ rid, tmid, messagesLength: messages.length });
const {
jumpToBottom,
Expand All @@ -52,26 +44,25 @@ const ListContainer = forwardRef<IListContainerRef, IListContainerProps>(
return null;
};

const renderItem: IListProps['renderItem'] = ({ item, index }) => (
<View style={styles.inverted}>{renderRow(item, messages[index + 1], highlightedMessageId)}</View>
);
const renderItem: IListProps['renderItem'] = ({ item, index }) => renderRow(item, messages[index + 1], highlightedMessageId);

return (
<>
<EmptyRoom rid={rid} length={messages.length} />
<RefreshControl refreshing={refreshing} onRefresh={refresh}>
<List
listRef={listRef}
data={messages}
renderItem={renderItem}
onEndReached={onEndReached}
ListFooterComponent={renderFooter}
onScrollToIndexFailed={handleScrollToIndexFailed}
viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current}
jumpToBottom={jumpToBottom}
isThread={!!tmid}
/>
</RefreshControl>
<List
listRef={listRef}
data={messages}
renderItem={renderItem}
onEndReached={onEndReached}
ListFooterComponent={renderFooter}
onScrollToIndexFailed={handleScrollToIndexFailed}
viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current}
jumpToBottom={jumpToBottom}
isThread={!!tmid}
refreshControl={
isIOS ? <RefreshControl refreshing={refreshing} onRefresh={refresh} tintColor={colors.auxiliaryText} /> : undefined
}
/>
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion app/views/RoomView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1361,8 +1361,8 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
if (showUnreadSeparator || dateSeparator) {
return (
<>
<Separator ts={dateSeparator} unread={showUnreadSeparator} />
{content}
<Separator ts={dateSeparator} unread={showUnreadSeparator} />
Comment thread
diegolmello marked this conversation as resolved.
</>
);
}
Expand Down