2021-10-20 19:29:21 +00:00
|
|
|
import React from 'react';
|
2022-10-17 15:14:40 +00:00
|
|
|
import { 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 = {
|
|
|
|
|
2022-11-10 14:48:53 +00:00
|
|
|
/**
|
|
|
|
* Adds bottom padding.
|
|
|
|
*/
|
|
|
|
addBottomPadding: boolean,
|
|
|
|
|
2021-10-20 19:29:21 +00:00
|
|
|
/**
|
|
|
|
* Additional style to be appended to the KeyboardAvoidingView content container.
|
|
|
|
*/
|
|
|
|
contentContainerStyle?: StyleType,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The children component(s) of the Modal, to be rendered.
|
|
|
|
*/
|
2022-10-17 15:14:40 +00:00
|
|
|
children: React.ReactNode,
|
2021-10-20 19:29:21 +00:00
|
|
|
|
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,
|
|
|
|
|
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 = ({
|
2022-11-10 14:48:53 +00:00
|
|
|
addBottomPadding,
|
2021-10-20 19:29:21 +00:00
|
|
|
contentContainerStyle,
|
|
|
|
children,
|
2022-11-22 16:13:36 +00:00
|
|
|
disableForcedKeyboardDismiss = false,
|
2021-10-20 19:29:21 +00:00
|
|
|
footerComponent,
|
2021-11-11 14:32:56 +00:00
|
|
|
hasTabNavigator = false,
|
2021-12-08 14:35:20 +00:00
|
|
|
hasBottomTextInput = false,
|
2022-06-16 09:49:53 +00:00
|
|
|
safeAreaInsets = [ 'left', 'right' ],
|
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
|
2022-11-10 14:48:53 +00:00
|
|
|
addBottomPadding = { addBottomPadding }
|
2021-10-20 19:29:21 +00:00
|
|
|
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
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<View style = { styles.jitsiScreenContainer }>
|
|
|
|
{ renderContent() }
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
2021-10-20 19:29:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
export default JitsiScreen;
|