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

View File

@ -23,18 +23,27 @@ type Props = {
/** /**
* Renders the lists disabled. * 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(() => const RecentListScreen = useCallback(() =>
<RecentList disabled = { disabled } /> (<RecentList
disabled = { disabled }
onListContainerPress = { onListContainerPress } />)
); );
const calendarEnabled = useSelector(isCalendarEnabled); const calendarEnabled = useSelector(isCalendarEnabled);
const CalendarListScreen = useCallback(() => const CalendarListScreen = useCallback(() =>
<CalendarList disabled = { disabled } /> (<CalendarList
disabled = { disabled }
onListContainerPress = { onListContainerPress } />)
); );
return ( return (

View File

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

View File

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