feat(welcome) blur room name input onListContainerPress

This commit is contained in:
Calin Chitu 2022-01-27 12:46:49 +02:00 committed by Calinteodor
parent 96c977a8ed
commit 40f5f4cd0d
4 changed files with 60 additions and 27 deletions

View File

@ -1,7 +1,12 @@
// @flow
import React from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import {
Text,
TouchableOpacity,
TouchableWithoutFeedback,
View
} from 'react-native';
import { translate } from '../../base/i18n';
import { AbstractPage } from '../../base/react';
@ -27,6 +32,11 @@ type Props = {
*/
disabled: boolean,
/**
* Callback to be invoked when pressing the list container.
*/
onListContainerPress?: boolean,
/**
* The translate function.
*/
@ -71,20 +81,23 @@ class CalendarList extends AbstractPage<Props> {
* @inheritdoc
*/
render() {
const { disabled } = this.props;
const { disabled, onListContainerPress } = this.props;
return (
CalendarListContent
? <View
style = {
disabled
? styles.calendarSyncDisabled
: styles.calendarSync }>
<CalendarListContent
disabled = { disabled }
listEmptyComponent
= { this._getRenderListEmptyComponent() } />
</View>
? <TouchableWithoutFeedback
onPress = { onListContainerPress }>
<View
style = {
disabled
? styles.calendarSyncDisabled
: styles.calendarSync }>
<CalendarListContent
disabled = { disabled }
listEmptyComponent
= { this._getRenderListEmptyComponent() } />
</View>
</TouchableWithoutFeedback>
: null
);
}

View File

@ -23,18 +23,27 @@ type Props = {
/**
* Renders the lists disabled.
*/
disabled: boolean
disabled: boolean,
/**
* Callback to be invoked when pressing the list container.
*/
onListContainerPress?: Function
};
const WelcomePageTabs = ({ disabled }: Props) => {
const WelcomePageTabs = ({ disabled, onListContainerPress }: Props) => {
const RecentListScreen = useCallback(() =>
<RecentList disabled = { disabled } />
(<RecentList
disabled = { disabled }
onListContainerPress = { onListContainerPress } />)
);
const calendarEnabled = useSelector(isCalendarEnabled);
const CalendarListScreen = useCallback(() =>
<CalendarList disabled = { disabled } />
(<CalendarList
disabled = { disabled }
onListContainerPress = { onListContainerPress } />)
);
return (

View File

@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { View } from 'react-native';
import { TouchableWithoutFeedback, View } from 'react-native';
import type { Dispatch } from 'redux';
import { getDefaultURL } from '../../app/functions';
@ -30,6 +30,11 @@ type Props = {
*/
dispatch: Dispatch<any>,
/**
* Callback to be invoked when pressing the list container.
*/
onListContainerPress?: Function,
/**
* The translate function.
*/
@ -77,6 +82,7 @@ class RecentList extends AbstractRecentList<Props> {
}
const {
disabled,
onListContainerPress,
t,
_defaultServerURL,
_recentList
@ -84,15 +90,18 @@ class RecentList extends AbstractRecentList<Props> {
const recentList = toDisplayableList(_recentList, t, _defaultServerURL);
return (
<View style = { disabled ? styles.recentListDisabled : styles.recentList }>
<NavigateSectionList
disabled = { disabled }
onLongPress = { this._onLongPress }
onPress = { this._onPress }
renderListEmptyComponent
= { this._getRenderListEmptyComponent() }
sections = { recentList } />
</View>
<TouchableWithoutFeedback
onPress = { onListContainerPress }>
<View style = { disabled ? styles.recentListDisabled : styles.recentList }>
<NavigateSectionList
disabled = { disabled }
onLongPress = { this._onLongPress }
onPress = { this._onPress }
renderListEmptyComponent
= { this._getRenderListEmptyComponent() }
sections = { recentList } />
</View>
</TouchableWithoutFeedback>
);
}

View File

@ -369,7 +369,9 @@ class WelcomePage extends AbstractWelcomePage<*> {
</View>
</SafeAreaView>
{/* // $FlowExpectedError*/}
<WelcomePageTabs disabled = { this.state._fieldFocused } />
<WelcomePageTabs
disabled = { this.state._fieldFocused }
onListContainerPress = { this._onFieldBlur } />
</View>
</>
);