From 4d817af060061c9d49e46ee16e9a3799149fd184 Mon Sep 17 00:00:00 2001 From: Calinteodor Date: Mon, 17 Oct 2022 18:14:40 +0300 Subject: [PATCH] feat(settings/native): fixed scroll inside screen (#12395) * feat(settings): fixed scroll, bottom insets and bounce --- .../base/modal/components/JitsiScreen.js | 21 +- .../features/base/modal/components/styles.js | 10 - .../components/SettingsNavigationContainer.js | 15 +- .../components/native/SettingsView.tsx | 313 +++++++++--------- 4 files changed, 179 insertions(+), 180 deletions(-) diff --git a/react/features/base/modal/components/JitsiScreen.js b/react/features/base/modal/components/JitsiScreen.js index ce9aff3f8..1e5aec679 100644 --- a/react/features/base/modal/components/JitsiScreen.js +++ b/react/features/base/modal/components/JitsiScreen.js @@ -1,7 +1,6 @@ -// @flow import React from 'react'; -import { ScrollView, View } from 'react-native'; +import { View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { StyleType } from '../../styles'; @@ -20,7 +19,7 @@ type Props = { /** * The children component(s) of the Modal, to be rendered. */ - children: React$Node, + children: React.ReactNode, /** * Disabled forced keyboard dismiss? @@ -47,11 +46,6 @@ type Props = { */ safeAreaInsets?: Array, - /** - * Enable scroll for JitsiScreen. - */ - scrollEnabled?: boolean, - /** * Additional style to be appended to the KeyboardAvoidingView containing the content of the modal. */ @@ -66,7 +60,6 @@ const JitsiScreen = ({ hasBottomTextInput = false, disableForcedKeyboardDismiss = false, safeAreaInsets = [ 'left', 'right' ], - scrollEnabled = false, style }: Props) => { const renderContent = () => ( @@ -85,16 +78,6 @@ const JitsiScreen = ({ ); - if (scrollEnabled) { - return ( - - { renderContent() } - - ); - } - return ( { renderContent() } diff --git a/react/features/base/modal/components/styles.js b/react/features/base/modal/components/styles.js index c07b91cc7..91c88e390 100644 --- a/react/features/base/modal/components/styles.js +++ b/react/features/base/modal/components/styles.js @@ -1,6 +1,3 @@ -// @flow - -import { ColorSchemeRegistry, schemeColor } from '../../color-scheme'; export default { @@ -12,10 +9,3 @@ export default { flex: 1 } }; - -ColorSchemeRegistry.register('Modal', { - page: { - alignItems: 'stretch', - backgroundColor: schemeColor('background') - } -}); diff --git a/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js b/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js index 0882d4bb0..81b57c1dd 100644 --- a/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js +++ b/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js @@ -1,6 +1,6 @@ import { NavigationContainer } from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; -import React from 'react'; +import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import HelpView from '../../../../../settings/components/native/HelpView'; @@ -38,6 +38,14 @@ const SettingsNavigationContainer = ({ isInWelcomePage }: Props) => { const baseSettingsScreenOptions = isInWelcomePage ? welcomeScreenOptions : settingsScreenOptions; const { t } = useTranslation(); + const SettingsScreen = useCallback(() => + ( + + ) + ); + return ( { + }}> + { SettingsScreen } + { startWithVideoMuted } = this.state; - const { t } = this.props; + const { + addBottomInset = false, + scrollBounces = false, + t + } = this.props; const textInputTheme = { colors: { @@ -272,157 +287,159 @@ class SettingsView extends Component { return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { t('settingsView.help') } - - - - { t('settingsView.terms') } - - - - { t('settingsView.privacy') } - - - - - - {`${AppInfo.version} build ${AppInfo.buildNumber}`} - - - - - { Platform.OS === 'android' && ( - <> - - - - - - )} - - - - - {AppInfo.GOOGLE_SERVICES_ENABLED && ( - + + + + + + + + + + + + + + onChange = { this._onStartCarmodeInLowBandwidthMode } /> - )} - + + + + + + + + + + + + + + + + { t('settingsView.help') } + + + + { t('settingsView.terms') } + + + + { t('settingsView.privacy') } + + + + + + {`${AppInfo.version} build ${AppInfo.buildNumber}`} + + + + + { Platform.OS === 'android' && ( + <> + + + + + + )} + + + + + {AppInfo.GOOGLE_SERVICES_ENABLED && ( + + + + )} + + ); }