From 5c75be6ac57dd1bf7da7540d4f440f9c84f48a33 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto Date: Mon, 6 Mar 2023 16:48:33 -0300 Subject: [PATCH] [FIX] Scroll the pages Directory, New Message, Search for Rooms, Messages and Threads --- app/containers/KeyboardView.tsx | 2 +- app/views/DirectoryView/index.tsx | 51 ++++++++++++++------------ app/views/NewMessageView/index.tsx | 47 +++++++++++++----------- app/views/RoomsListView/index.tsx | 15 +++++--- app/views/SearchMessagesView/index.tsx | 27 ++++++++------ app/views/ThreadMessagesView/index.tsx | 23 +++++++----- 6 files changed, 90 insertions(+), 75 deletions(-) diff --git a/app/containers/KeyboardView.tsx b/app/containers/KeyboardView.tsx index 99df6f923..8bfd8ce93 100644 --- a/app/containers/KeyboardView.tsx +++ b/app/containers/KeyboardView.tsx @@ -6,7 +6,7 @@ import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps'; interface IKeyboardViewProps extends KeyboardAwareScrollViewProps { keyboardVerticalOffset?: number; scrollEnabled?: boolean; - children: React.ReactElement[] | React.ReactElement; + children: React.ReactElement[] | React.ReactElement | null | (React.ReactElement | null)[]; } const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children }: IKeyboardViewProps) => ( diff --git a/app/views/DirectoryView/index.tsx b/app/views/DirectoryView/index.tsx index 8275f3394..771107b20 100644 --- a/app/views/DirectoryView/index.tsx +++ b/app/views/DirectoryView/index.tsx @@ -27,6 +27,7 @@ import { IApplicationState, IServerRoom, IUser, SubscriptionType } from '../../d import styles from './styles'; import Options from './Options'; import { Services } from '../../lib/services'; +import KeyboardView from '../../containers/KeyboardView'; interface IDirectoryViewProps { navigation: CompositeNavigationProp< @@ -290,31 +291,33 @@ class DirectoryView extends React.Component - - item._id} - ListHeaderComponent={this.renderHeader} - renderItem={this.renderItem} - ItemSeparatorComponent={List.Separator} - keyboardShouldPersistTaps='always' - ListFooterComponent={loading ? : null} - onEndReached={() => this.load({})} - /> - {showOptionsDropdown ? ( - + + item._id} + ListHeaderComponent={this.renderHeader} + renderItem={this.renderItem} + ItemSeparatorComponent={List.Separator} + keyboardShouldPersistTaps='always' + ListFooterComponent={loading ? : null} + onEndReached={() => this.load({})} /> - ) : null} + {showOptionsDropdown ? ( + + ) : null} + ); }; diff --git a/app/views/NewMessageView/index.tsx b/app/views/NewMessageView/index.tsx index f393a9f91..6e91d3ae2 100644 --- a/app/views/NewMessageView/index.tsx +++ b/app/views/NewMessageView/index.tsx @@ -5,6 +5,7 @@ import { FlatList } from 'react-native'; import { shallowEqual } from 'react-redux'; import { useNavigation } from '@react-navigation/native'; +import KeyboardView from '../../containers/KeyboardView'; import * as HeaderButton from '../../containers/HeaderButton'; import * as List from '../../containers/List'; import SafeAreaView from '../../containers/SafeAreaView'; @@ -82,29 +83,31 @@ const NewMessageView = () => { return ( - - 0 ? search : chats} - keyExtractor={item => item._id || item.rid} - ListHeaderComponent={} - renderItem={({ item }) => { - const itemSearch = item as ISearch; - const itemModel = item as TSubscriptionModel; + + + 0 ? search : chats} + keyExtractor={item => item._id || item.rid} + ListHeaderComponent={} + renderItem={({ item }) => { + const itemSearch = item as ISearch; + const itemModel = item as TSubscriptionModel; - return ( - goRoom(itemModel)} - testID={`new-message-view-item-${item.name}`} - /> - ); - }} - ItemSeparatorComponent={List.Separator} - ListFooterComponent={List.Separator} - contentContainerStyle={{ backgroundColor: colors.backgroundColor }} - keyboardShouldPersistTaps='always' - /> + return ( + goRoom(itemModel)} + testID={`new-message-view-item-${item.name}`} + /> + ); + }} + ItemSeparatorComponent={List.Separator} + ListFooterComponent={List.Separator} + contentContainerStyle={{ backgroundColor: colors.backgroundColor }} + keyboardShouldPersistTaps='always' + /> + ); }; diff --git a/app/views/RoomsListView/index.tsx b/app/views/RoomsListView/index.tsx index a204364b3..ca3f704bd 100644 --- a/app/views/RoomsListView/index.tsx +++ b/app/views/RoomsListView/index.tsx @@ -11,6 +11,7 @@ import { Header } from '@react-navigation/elements'; import { CompositeNavigationProp, RouteProp } from '@react-navigation/native'; import { Dispatch } from 'redux'; +import KeyboardView from '../../containers/KeyboardView'; import database from '../../lib/database'; import RoomItem, { ROW_HEIGHT, ROW_HEIGHT_CONDENSED } from '../../containers/RoomItem'; import log, { logEvent, events } from '../../lib/methods/helpers/log'; @@ -1025,12 +1026,14 @@ class RoomsListView extends React.Component - - {this.renderHeader()} - {this.renderScroll()} - {/* TODO - this ts-ignore is here because the route props, on IBaseScreen*/} - {/* @ts-ignore*/} - {showServerDropdown ? : null} + + + {this.renderHeader()} + {this.renderScroll()} + {/* TODO - this ts-ignore is here because the route props, on IBaseScreen*/} + {/* @ts-ignore*/} + {showServerDropdown ? : null} + ); }; diff --git a/app/views/SearchMessagesView/index.tsx b/app/views/SearchMessagesView/index.tsx index b83d07779..3bb5a97af 100644 --- a/app/views/SearchMessagesView/index.tsx +++ b/app/views/SearchMessagesView/index.tsx @@ -39,6 +39,7 @@ import { ICustomEmoji } from '../../definitions'; import { Services } from '../../lib/services'; +import KeyboardView from '../../containers/KeyboardView'; const QUERY_SIZE = 50; @@ -327,18 +328,20 @@ class SearchMessagesView extends React.Component - - - - - - {this.renderList()} + + + + + + + {this.renderList()} + ); } diff --git a/app/views/ThreadMessagesView/index.tsx b/app/views/ThreadMessagesView/index.tsx index 2769b3302..8cfbecb6a 100644 --- a/app/views/ThreadMessagesView/index.tsx +++ b/app/views/ThreadMessagesView/index.tsx @@ -35,6 +35,7 @@ import styles from './styles'; import { IApplicationState, IBaseScreen, IMessage, SubscriptionType, TSubscriptionModel, TThreadModel } from '../../definitions'; import { getUidDirectMessage, debounce, isIOS } from '../../lib/methods/helpers'; import { Services } from '../../lib/services'; +import KeyboardView from '../../containers/KeyboardView'; const API_FETCH_COUNT = 50; @@ -516,16 +517,18 @@ class ThreadMessagesView extends React.Component - - {this.renderContent()} - {showFilterDropdown ? ( - - ) : null} + + + {this.renderContent()} + {showFilterDropdown ? ( + + ) : null} + ); }