feat(base/modal): enable scroll for jitsi screen component

This commit is contained in:
Calin-Teodor 2022-10-06 16:52:45 +03:00 committed by Calinteodor
parent 66769136ed
commit f2b2b02029
2 changed files with 170 additions and 151 deletions

View File

@ -1,7 +1,7 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { View } from 'react-native'; import { ScrollView, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
import { StyleType } from '../../styles'; import { StyleType } from '../../styles';
@ -47,6 +47,11 @@ type Props = {
*/ */
safeAreaInsets?: Array, safeAreaInsets?: Array,
/**
* Enable scroll for JitsiScreen.
*/
scrollEnabled?: boolean,
/** /**
* Additional style to be appended to the KeyboardAvoidingView containing the content of the modal. * Additional style to be appended to the KeyboardAvoidingView containing the content of the modal.
*/ */
@ -61,10 +66,10 @@ const JitsiScreen = ({
hasBottomTextInput = false, hasBottomTextInput = false,
disableForcedKeyboardDismiss = false, disableForcedKeyboardDismiss = false,
safeAreaInsets = [ 'left', 'right' ], safeAreaInsets = [ 'left', 'right' ],
scrollEnabled = false,
style style
}: Props) => ( }: Props) => {
<View const renderContent = () => (
style = { styles.jitsiScreenContainer }>
<JitsiKeyboardAvoidingView <JitsiKeyboardAvoidingView
contentContainerStyle = { contentContainerStyle } contentContainerStyle = { contentContainerStyle }
disableForcedKeyboardDismiss = { disableForcedKeyboardDismiss } disableForcedKeyboardDismiss = { disableForcedKeyboardDismiss }
@ -74,12 +79,28 @@ const JitsiScreen = ({
<SafeAreaView <SafeAreaView
edges = { safeAreaInsets } edges = { safeAreaInsets }
style = { styles.safeArea }> style = { styles.safeArea }>
{children} { children }
</SafeAreaView> </SafeAreaView>
{ footerComponent && footerComponent() } { footerComponent && footerComponent() }
</JitsiKeyboardAvoidingView> </JitsiKeyboardAvoidingView>
);
if (scrollEnabled) {
return (
<ScrollView
bounces = { false }
style = { styles.jitsiScreenContainer }>
{ renderContent() }
</ScrollView>
);
}
return (
<View style = { styles.jitsiScreenContainer }>
{ renderContent() }
</View> </View>
); );
};
export default JitsiScreen; export default JitsiScreen;

View File

@ -8,7 +8,6 @@ import {
Alert, Alert,
NativeModules, NativeModules,
Platform, Platform,
ScrollView,
Text, Text,
View View
} from 'react-native'; } from 'react-native';
@ -275,8 +274,8 @@ class SettingsView extends Component<Props, State> {
return ( return (
<JitsiScreen <JitsiScreen
safeAreaInsets = { [ 'bottom', 'left', 'right' ] } safeAreaInsets = { [ 'bottom', 'left', 'right' ] }
scrollEnabled = { true }
style = { styles.settingsViewContainer }> style = { styles.settingsViewContainer }>
<ScrollView>
<View style = { styles.avatarContainer }> <View style = { styles.avatarContainer }>
<Avatar <Avatar
participantId = { this.props._localParticipantId } participantId = { this.props._localParticipantId }
@ -425,7 +424,6 @@ class SettingsView extends Component<Props, State> {
</FormRow> </FormRow>
)} )}
</FormSectionAccordion> </FormSectionAccordion>
</ScrollView>
</JitsiScreen> </JitsiScreen>
); );
} }