Compare commits

...

2 Commits

Author SHA1 Message Date
Reinaldo Neto 7d28758fe7 flex for the flatlist 2023-03-06 19:10:06 -03:00
Reinaldo Neto 5c75be6ac5 [FIX] Scroll the pages Directory, New Message, Search for Rooms, Messages and Threads 2023-03-06 16:48:33 -03:00
7 changed files with 92 additions and 76 deletions

View File

@ -6,7 +6,7 @@ import scrollPersistTaps from '../lib/methods/helpers/scrollPersistTaps';
interface IKeyboardViewProps extends KeyboardAwareScrollViewProps { interface IKeyboardViewProps extends KeyboardAwareScrollViewProps {
keyboardVerticalOffset?: number; keyboardVerticalOffset?: number;
scrollEnabled?: boolean; scrollEnabled?: boolean;
children: React.ReactElement[] | React.ReactElement; children: React.ReactElement[] | React.ReactElement | null | (React.ReactElement | null)[];
} }
const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children }: IKeyboardViewProps) => ( const KeyboardView = ({ style, contentContainerStyle, scrollEnabled, keyboardVerticalOffset, children }: IKeyboardViewProps) => (

View File

@ -27,6 +27,7 @@ import { IApplicationState, IServerRoom, IUser, SubscriptionType } from '../../d
import styles from './styles'; import styles from './styles';
import Options from './Options'; import Options from './Options';
import { Services } from '../../lib/services'; import { Services } from '../../lib/services';
import KeyboardView from '../../containers/KeyboardView';
interface IDirectoryViewProps { interface IDirectoryViewProps {
navigation: CompositeNavigationProp< navigation: CompositeNavigationProp<
@ -290,6 +291,7 @@ class DirectoryView extends React.Component<IDirectoryViewProps, IDirectoryViewS
const { isFederationEnabled, theme } = this.props; const { isFederationEnabled, theme } = this.props;
return ( return (
<SafeAreaView style={{ backgroundColor: themes[theme].backgroundColor }} testID='directory-view'> <SafeAreaView style={{ backgroundColor: themes[theme].backgroundColor }} testID='directory-view'>
<KeyboardView>
<StatusBar /> <StatusBar />
<FlatList <FlatList
data={data} data={data}
@ -315,6 +317,7 @@ class DirectoryView extends React.Component<IDirectoryViewProps, IDirectoryViewS
isFederationEnabled={isFederationEnabled} isFederationEnabled={isFederationEnabled}
/> />
) : null} ) : null}
</KeyboardView>
</SafeAreaView> </SafeAreaView>
); );
}; };

View File

@ -5,6 +5,7 @@ import { FlatList } from 'react-native';
import { shallowEqual } from 'react-redux'; import { shallowEqual } from 'react-redux';
import { useNavigation } from '@react-navigation/native'; import { useNavigation } from '@react-navigation/native';
import KeyboardView from '../../containers/KeyboardView';
import * as HeaderButton from '../../containers/HeaderButton'; import * as HeaderButton from '../../containers/HeaderButton';
import * as List from '../../containers/List'; import * as List from '../../containers/List';
import SafeAreaView from '../../containers/SafeAreaView'; import SafeAreaView from '../../containers/SafeAreaView';
@ -82,6 +83,7 @@ const NewMessageView = () => {
return ( return (
<SafeAreaView testID='new-message-view'> <SafeAreaView testID='new-message-view'>
<KeyboardView>
<StatusBar /> <StatusBar />
<FlatList <FlatList
data={search.length > 0 ? search : chats} data={search.length > 0 ? search : chats}
@ -105,6 +107,7 @@ const NewMessageView = () => {
contentContainerStyle={{ backgroundColor: colors.backgroundColor }} contentContainerStyle={{ backgroundColor: colors.backgroundColor }}
keyboardShouldPersistTaps='always' keyboardShouldPersistTaps='always'
/> />
</KeyboardView>
</SafeAreaView> </SafeAreaView>
); );
}; };

View File

@ -11,6 +11,7 @@ import { Header } from '@react-navigation/elements';
import { CompositeNavigationProp, RouteProp } from '@react-navigation/native'; import { CompositeNavigationProp, RouteProp } from '@react-navigation/native';
import { Dispatch } from 'redux'; import { Dispatch } from 'redux';
import KeyboardView from '../../containers/KeyboardView';
import database from '../../lib/database'; import database from '../../lib/database';
import RoomItem, { ROW_HEIGHT, ROW_HEIGHT_CONDENSED } from '../../containers/RoomItem'; import RoomItem, { ROW_HEIGHT, ROW_HEIGHT_CONDENSED } from '../../containers/RoomItem';
import log, { logEvent, events } from '../../lib/methods/helpers/log'; import log, { logEvent, events } from '../../lib/methods/helpers/log';
@ -1025,12 +1026,14 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
return ( return (
<SafeAreaView testID='rooms-list-view' style={{ backgroundColor: themes[theme].backgroundColor }}> <SafeAreaView testID='rooms-list-view' style={{ backgroundColor: themes[theme].backgroundColor }}>
<KeyboardView>
<StatusBar /> <StatusBar />
{this.renderHeader()} {this.renderHeader()}
{this.renderScroll()} {this.renderScroll()}
{/* TODO - this ts-ignore is here because the route props, on IBaseScreen*/} {/* TODO - this ts-ignore is here because the route props, on IBaseScreen*/}
{/* @ts-ignore*/} {/* @ts-ignore*/}
{showServerDropdown ? <ServerDropdown navigation={navigation} theme={theme} /> : null} {showServerDropdown ? <ServerDropdown navigation={navigation} theme={theme} /> : null}
</KeyboardView>
</SafeAreaView> </SafeAreaView>
); );
}; };

View File

@ -7,7 +7,8 @@ export default StyleSheet.create({
flex: 1 flex: 1
}, },
list: { list: {
width: '100%' width: '100%',
flex: 1
}, },
dropdownContainerHeader: { dropdownContainerHeader: {
height: 41, height: 41,

View File

@ -39,6 +39,7 @@ import {
ICustomEmoji ICustomEmoji
} from '../../definitions'; } from '../../definitions';
import { Services } from '../../lib/services'; import { Services } from '../../lib/services';
import KeyboardView from '../../containers/KeyboardView';
const QUERY_SIZE = 50; const QUERY_SIZE = 50;
@ -327,6 +328,7 @@ class SearchMessagesView extends React.Component<ISearchMessagesViewProps, ISear
return ( return (
<SafeAreaView style={{ backgroundColor: themes[theme].backgroundColor }} testID='search-messages-view'> <SafeAreaView style={{ backgroundColor: themes[theme].backgroundColor }} testID='search-messages-view'>
<StatusBar /> <StatusBar />
<KeyboardView>
<View style={styles.searchContainer}> <View style={styles.searchContainer}>
<FormTextInput <FormTextInput
autoFocus autoFocus
@ -339,6 +341,7 @@ class SearchMessagesView extends React.Component<ISearchMessagesViewProps, ISear
<View style={[styles.divider, { backgroundColor: themes[theme].separatorColor }]} /> <View style={[styles.divider, { backgroundColor: themes[theme].separatorColor }]} />
</View> </View>
{this.renderList()} {this.renderList()}
</KeyboardView>
</SafeAreaView> </SafeAreaView>
); );
} }

View File

@ -35,6 +35,7 @@ import styles from './styles';
import { IApplicationState, IBaseScreen, IMessage, SubscriptionType, TSubscriptionModel, TThreadModel } from '../../definitions'; import { IApplicationState, IBaseScreen, IMessage, SubscriptionType, TSubscriptionModel, TThreadModel } from '../../definitions';
import { getUidDirectMessage, debounce, isIOS } from '../../lib/methods/helpers'; import { getUidDirectMessage, debounce, isIOS } from '../../lib/methods/helpers';
import { Services } from '../../lib/services'; import { Services } from '../../lib/services';
import KeyboardView from '../../containers/KeyboardView';
const API_FETCH_COUNT = 50; const API_FETCH_COUNT = 50;
@ -516,6 +517,7 @@ class ThreadMessagesView extends React.Component<IThreadMessagesViewProps, IThre
return ( return (
<SafeAreaView testID='thread-messages-view'> <SafeAreaView testID='thread-messages-view'>
<KeyboardView>
<StatusBar /> <StatusBar />
{this.renderContent()} {this.renderContent()}
{showFilterDropdown ? ( {showFilterDropdown ? (
@ -526,6 +528,7 @@ class ThreadMessagesView extends React.Component<IThreadMessagesViewProps, IThre
theme={theme} theme={theme}
/> />
) : null} ) : null}
</KeyboardView>
</SafeAreaView> </SafeAreaView>
); );
} }