From d04515c35ab1cefa27bf730bd97e337b8a3257db Mon Sep 17 00:00:00 2001 From: Calinteodor Date: Wed, 20 Sep 2023 11:40:28 +0300 Subject: [PATCH] feat(prejoin/native): fixed screen header hooks warning (#13845) * feat(prejoin/native): fixed screen header hooks warning --- .../prejoin/components/native/Prejoin.tsx | 22 +++++++++++-- .../components/native/UnsafeRoomWarning.tsx | 31 ++++++++++++++++--- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/react/features/prejoin/components/native/Prejoin.tsx b/react/features/prejoin/components/native/Prejoin.tsx index 0119717815..63a09c9950 100644 --- a/react/features/prejoin/components/native/Prejoin.tsx +++ b/react/features/prejoin/components/native/Prejoin.tsx @@ -3,6 +3,7 @@ import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react' import { useTranslation } from 'react-i18next'; import { BackHandler, + Platform, StyleProp, Text, TextStyle, @@ -18,6 +19,7 @@ import { getConferenceName } from '../../../base/conference/functions'; import { connect } from '../../../base/connection/actions.native'; import { PREJOIN_PAGE_HIDE_DISPLAY_NAME } from '../../../base/flags/constants'; import { getFeatureFlag } from '../../../base/flags/functions'; +import { IconCloseLarge } from '../../../base/icons/svg'; import JitsiScreen from '../../../base/modal/components/JitsiScreen'; import { getLocalParticipant } from '../../../base/participants/functions'; import { getFieldValue } from '../../../base/react/functions'; @@ -28,7 +30,7 @@ import Input from '../../../base/ui/components/native/Input'; import { BUTTON_TYPES } from '../../../base/ui/constants.native'; import BrandingImageBackground from '../../../dynamic-branding/components/native/BrandingImageBackground'; import LargeVideo from '../../../large-video/components/LargeVideo.native'; -import { screenHeaderCloseButton } from '../../../mobile/navigation/functions'; +import HeaderNavigationButton from '../../../mobile/navigation/components/HeaderNavigationButton'; import { navigateRoot } from '../../../mobile/navigation/rootNavigationContainerRef'; import { screen } from '../../../mobile/navigation/routes'; import AudioMuteButton from '../../../toolbox/components/native/AudioMuteButton'; @@ -92,9 +94,25 @@ const Prejoin: React.FC = ({ navigation }: IPrejoinProps) => { }, []); + const headerLeft = () => { + if (Platform.OS === 'ios') { + return ( + + ); + } + + return ( + + ); + }; + useLayoutEffect(() => { navigation.setOptions({ - headerLeft: () => screenHeaderCloseButton(goBack), + headerLeft, headerTitle: t('prejoin.joinMeeting') }); }, [ navigation ]); diff --git a/react/features/prejoin/components/native/UnsafeRoomWarning.tsx b/react/features/prejoin/components/native/UnsafeRoomWarning.tsx index dbe7d6d3f1..fb2ac462e4 100644 --- a/react/features/prejoin/components/native/UnsafeRoomWarning.tsx +++ b/react/features/prejoin/components/native/UnsafeRoomWarning.tsx @@ -1,19 +1,26 @@ import React, { useCallback, useLayoutEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import { StyleProp, Text, TextStyle, View, ViewStyle } from 'react-native'; +import { + Platform, + StyleProp, + Text, + TextStyle, + View, + ViewStyle +} from 'react-native'; import { useDispatch, useSelector } from 'react-redux'; import { appNavigate } from '../../../app/actions.native'; import { IReduxState } from '../../../app/types'; import { getConferenceName } from '../../../base/conference/functions'; import Icon from '../../../base/icons/components/Icon'; -import { IconWarning } from '../../../base/icons/svg'; +import { IconCloseLarge, IconWarning } from '../../../base/icons/svg'; import JitsiScreen from '../../../base/modal/components/JitsiScreen'; import { ASPECT_RATIO_NARROW } from '../../../base/responsive-ui/constants'; import Button from '../../../base/ui/components/native/Button'; import { BUTTON_TYPES } from '../../../base/ui/constants.native'; import getUnsafeRoomText from '../../../base/util/getUnsafeRoomText.native'; -import { screenHeaderCloseButton } from '../../../mobile/navigation/functions'; +import HeaderNavigationButton from '../../../mobile/navigation/components/HeaderNavigationButton'; import { navigateRoot } from '../../../mobile/navigation/rootNavigationContainerRef'; import { screen } from '../../../mobile/navigation/routes'; import { IPrejoinProps } from '../../types'; @@ -42,9 +49,25 @@ const UnsafeRoomWarning: React.FC = ({ navigation }: IPrejoinProp return true; }, [ dispatch ]); + const headerLeft = () => { + if (Platform.OS === 'ios') { + return ( + + ); + } + + return ( + + ); + }; + useLayoutEffect(() => { navigation.setOptions({ - headerLeft: () => screenHeaderCloseButton(goBack), + headerLeft, headerTitle: t('prejoin.joinMeeting') }); }, [ navigation ]);