feat(base/modal): addBottomPadding default prop for extra padding on JitsiScreen

This commit is contained in:
Calin-Teodor 2022-11-10 16:48:53 +02:00 committed by Calinteodor
parent b2c864cbba
commit c0f0803f01
4 changed files with 23 additions and 7 deletions

View File

@ -1,7 +1,5 @@
// @flow
import { useHeaderHeight } from '@react-navigation/elements'; import { useHeaderHeight } from '@react-navigation/elements';
import React, { useCallback, useEffect, useState } from 'react'; import React, { ReactElement, useCallback, useEffect, useState } from 'react';
import { import {
Keyboard, Keyboard,
KeyboardAvoidingView, KeyboardAvoidingView,
@ -14,10 +12,15 @@ import { StyleType } from '../../styles';
type Props = { type Props = {
/**
* Adds bottom padding.
*/
addBottomPadding?: boolean,
/** /**
* The children component(s) of the Modal, to be rendered. * The children component(s) of the Modal, to be rendered.
*/ */
children: React$Node, children: ReactElement,
/** /**
* Additional style to be appended to the KeyboardAvoidingView content container. * Additional style to be appended to the KeyboardAvoidingView content container.
@ -47,6 +50,7 @@ type Props = {
const JitsiKeyboardAvoidingView = ( const JitsiKeyboardAvoidingView = (
{ {
addBottomPadding = true,
children, children,
contentContainerStyle, contentContainerStyle,
hasTabNavigator, hasTabNavigator,
@ -67,7 +71,9 @@ const JitsiKeyboardAvoidingView = (
const tabNavigatorPadding const tabNavigatorPadding
= hasTabNavigator ? headerHeight : 0; = hasTabNavigator ? headerHeight : 0;
const noNotchDevicePadding = bottomPadding || 10; const extraBottomPadding
= addBottomPadding ? bottomPadding : 0;
const noNotchDevicePadding = extraBottomPadding || 10;
const iosVerticalOffset const iosVerticalOffset
= headerHeight + noNotchDevicePadding + tabNavigatorPadding; = headerHeight + noNotchDevicePadding + tabNavigatorPadding;
const androidVerticalOffset = hasBottomTextInput const androidVerticalOffset = hasBottomTextInput

View File

@ -1,4 +1,3 @@
import React from 'react'; import React from 'react';
import { View } from 'react-native'; import { View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context'; import { SafeAreaView } from 'react-native-safe-area-context';
@ -11,6 +10,11 @@ import styles from './styles';
type Props = { type Props = {
/**
* Adds bottom padding.
*/
addBottomPadding: boolean,
/** /**
* Additional style to be appended to the KeyboardAvoidingView content container. * Additional style to be appended to the KeyboardAvoidingView content container.
*/ */
@ -53,6 +57,7 @@ type Props = {
} }
const JitsiScreen = ({ const JitsiScreen = ({
addBottomPadding,
contentContainerStyle, contentContainerStyle,
children, children,
footerComponent, footerComponent,
@ -64,6 +69,7 @@ const JitsiScreen = ({
}: Props) => { }: Props) => {
const renderContent = () => ( const renderContent = () => (
<JitsiKeyboardAvoidingView <JitsiKeyboardAvoidingView
addBottomPadding = { addBottomPadding }
contentContainerStyle = { contentContainerStyle } contentContainerStyle = { contentContainerStyle }
disableForcedKeyboardDismiss = { disableForcedKeyboardDismiss } disableForcedKeyboardDismiss = { disableForcedKeyboardDismiss }
hasBottomTextInput = { hasBottomTextInput } hasBottomTextInput = { hasBottomTextInput }

View File

@ -1,3 +1,4 @@
// @ts-ignore
import React from 'react'; import React from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {

View File

@ -1,6 +1,7 @@
/* eslint-disable lines-around-comment */ /* eslint-disable lines-around-comment */
import { useIsFocused } from '@react-navigation/native'; import { useIsFocused } from '@react-navigation/native';
// @ts-ignore
import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react'; import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
@ -139,9 +140,9 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
toolboxContainerStyles = styles.toolboxContainerWide; toolboxContainerStyles = styles.toolboxContainerWide;
} }
return ( return (
<JitsiScreen <JitsiScreen
addBottomPadding = { false }
safeAreaInsets = { [ 'left' ] } safeAreaInsets = { [ 'left' ] }
style = { contentWrapperStyles }> style = { contentWrapperStyles }>
<BrandingImageBackground /> <BrandingImageBackground />
@ -161,8 +162,10 @@ const Prejoin: React.FC<IPrejoinProps> = ({ navigation }: IPrejoinProps) => {
<View style = { contentContainerStyles }> <View style = { contentContainerStyles }>
<View style = { toolboxContainerStyles }> <View style = { toolboxContainerStyles }>
<AudioMuteButton <AudioMuteButton
// @ts-ignore
styles = { styles.buttonStylesBorderless } /> styles = { styles.buttonStylesBorderless } />
<VideoMuteButton <VideoMuteButton
// @ts-ignore
styles = { styles.buttonStylesBorderless } /> styles = { styles.buttonStylesBorderless } />
</View> </View>
<View style = { styles.formWrapper as StyleProp<ViewStyle> }> <View style = { styles.formWrapper as StyleProp<ViewStyle> }>