You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

JitsiScreen.tsx 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import React from 'react';
  2. import { View } from 'react-native';
  3. import { Edge, SafeAreaView } from 'react-native-safe-area-context';
  4. import { StyleType } from '../../styles/functions.any';
  5. import JitsiKeyboardAvoidingView from './JitsiKeyboardAvoidingView';
  6. import styles from './styles';
  7. interface IProps {
  8. /**
  9. * Adds bottom padding.
  10. */
  11. addBottomPadding?: boolean;
  12. /**
  13. * The children component(s) of the Modal, to be rendered.
  14. */
  15. children: React.ReactNode;
  16. /**
  17. * Additional style to be appended to the KeyboardAvoidingView content container.
  18. */
  19. contentContainerStyle?: StyleType;
  20. /**
  21. * Disabled forced keyboard dismiss?
  22. */
  23. disableForcedKeyboardDismiss?: boolean;
  24. /**
  25. * Optional function that renders a footer component, if needed.
  26. */
  27. footerComponent?: Function;
  28. /**
  29. * Is a text input rendered at the bottom of the screen?
  30. */
  31. hasBottomTextInput?: boolean;
  32. /**
  33. * Is the screen rendering a tab navigator?
  34. */
  35. hasTabNavigator?: boolean;
  36. /**
  37. * Insets for the SafeAreaView.
  38. */
  39. safeAreaInsets?: Edge[];
  40. /**
  41. * Additional style to be appended to the KeyboardAvoidingView containing the content of the modal.
  42. */
  43. style?: StyleType;
  44. }
  45. const JitsiScreen = ({
  46. addBottomPadding,
  47. contentContainerStyle,
  48. children,
  49. disableForcedKeyboardDismiss = false,
  50. footerComponent,
  51. hasTabNavigator = false,
  52. hasBottomTextInput = false,
  53. safeAreaInsets = [ 'left', 'right' ],
  54. style
  55. }: IProps) => {
  56. const renderContent = () => (
  57. <JitsiKeyboardAvoidingView
  58. addBottomPadding = { addBottomPadding }
  59. contentContainerStyle = { contentContainerStyle }
  60. disableForcedKeyboardDismiss = { disableForcedKeyboardDismiss }
  61. hasBottomTextInput = { hasBottomTextInput }
  62. hasTabNavigator = { hasTabNavigator }
  63. style = { style }>
  64. <SafeAreaView
  65. edges = { safeAreaInsets }
  66. style = { styles.safeArea }>
  67. { children }
  68. </SafeAreaView>
  69. { footerComponent?.() }
  70. </JitsiKeyboardAvoidingView>
  71. );
  72. return (
  73. <View style = { styles.jitsiScreenContainer }>
  74. { renderContent() }
  75. </View>
  76. );
  77. };
  78. export default JitsiScreen;