2021-10-20 19:29:21 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
2022-10-06 13:52:45 +00:00
|
|
|
import { ScrollView, View } from 'react-native';
|
2021-10-20 19:29:21 +00:00
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
|
|
|
|
|
|
import { StyleType } from '../../styles';
|
|
|
|
|
|
|
|
import JitsiKeyboardAvoidingView from './JitsiKeyboardAvoidingView';
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Additional style to be appended to the KeyboardAvoidingView content container.
|
|
|
|
*/
|
|
|
|
contentContainerStyle?: StyleType,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The children component(s) of the Modal, to be rendered.
|
|
|
|
*/
|
|
|
|
children: React$Node,
|
|
|
|
|
2022-08-01 09:16:13 +00:00
|
|
|
/**
|
|
|
|
* Disabled forced keyboard dismiss?
|
|
|
|
*/
|
|
|
|
disableForcedKeyboardDismiss?: boolean,
|
|
|
|
|
2021-10-20 19:29:21 +00:00
|
|
|
/**
|
|
|
|
* Optional function that renders a footer component, if needed.
|
|
|
|
*/
|
|
|
|
footerComponent?: Function,
|
|
|
|
|
2021-12-08 14:35:20 +00:00
|
|
|
/**
|
|
|
|
* Is a text input rendered at the bottom of the screen?
|
|
|
|
*/
|
|
|
|
hasBottomTextInput?: boolean,
|
|
|
|
|
2021-10-20 19:29:21 +00:00
|
|
|
/**
|
|
|
|
* Is the screen rendering a tab navigator?
|
|
|
|
*/
|
2021-11-11 14:32:56 +00:00
|
|
|
hasTabNavigator?: boolean,
|
2021-10-20 19:29:21 +00:00
|
|
|
|
2022-04-26 10:15:31 +00:00
|
|
|
/**
|
|
|
|
* Insets for the SafeAreaView.
|
|
|
|
*/
|
|
|
|
safeAreaInsets?: Array,
|
|
|
|
|
2022-10-06 13:52:45 +00:00
|
|
|
/**
|
|
|
|
* Enable scroll for JitsiScreen.
|
|
|
|
*/
|
|
|
|
scrollEnabled?: boolean,
|
|
|
|
|
2021-10-20 19:29:21 +00:00
|
|
|
/**
|
|
|
|
* Additional style to be appended to the KeyboardAvoidingView containing the content of the modal.
|
|
|
|
*/
|
|
|
|
style?: StyleType
|
|
|
|
}
|
|
|
|
|
|
|
|
const JitsiScreen = ({
|
|
|
|
contentContainerStyle,
|
|
|
|
children,
|
|
|
|
footerComponent,
|
2021-11-11 14:32:56 +00:00
|
|
|
hasTabNavigator = false,
|
2021-12-08 14:35:20 +00:00
|
|
|
hasBottomTextInput = false,
|
2022-08-01 09:16:13 +00:00
|
|
|
disableForcedKeyboardDismiss = false,
|
2022-06-16 09:49:53 +00:00
|
|
|
safeAreaInsets = [ 'left', 'right' ],
|
2022-10-06 13:52:45 +00:00
|
|
|
scrollEnabled = false,
|
2021-10-20 19:29:21 +00:00
|
|
|
style
|
2022-10-06 13:52:45 +00:00
|
|
|
}: Props) => {
|
|
|
|
const renderContent = () => (
|
2021-10-20 19:29:21 +00:00
|
|
|
<JitsiKeyboardAvoidingView
|
|
|
|
contentContainerStyle = { contentContainerStyle }
|
2022-08-01 09:16:13 +00:00
|
|
|
disableForcedKeyboardDismiss = { disableForcedKeyboardDismiss }
|
2021-12-08 14:35:20 +00:00
|
|
|
hasBottomTextInput = { hasBottomTextInput }
|
2021-10-20 19:29:21 +00:00
|
|
|
hasTabNavigator = { hasTabNavigator }
|
|
|
|
style = { style }>
|
|
|
|
<SafeAreaView
|
2022-04-26 10:15:31 +00:00
|
|
|
edges = { safeAreaInsets }
|
2021-10-20 19:29:21 +00:00
|
|
|
style = { styles.safeArea }>
|
2022-10-06 13:52:45 +00:00
|
|
|
{ children }
|
2021-10-20 19:29:21 +00:00
|
|
|
</SafeAreaView>
|
2022-07-20 08:33:00 +00:00
|
|
|
{ footerComponent && footerComponent() }
|
2021-10-20 19:29:21 +00:00
|
|
|
</JitsiKeyboardAvoidingView>
|
2022-10-06 13:52:45 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
if (scrollEnabled) {
|
|
|
|
return (
|
|
|
|
<ScrollView
|
|
|
|
bounces = { false }
|
|
|
|
style = { styles.jitsiScreenContainer }>
|
|
|
|
{ renderContent() }
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style = { styles.jitsiScreenContainer }>
|
|
|
|
{ renderContent() }
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
2021-10-20 19:29:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
export default JitsiScreen;
|