diff --git a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx index 154689df4ce8..d2a622bf7d8d 100644 --- a/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx +++ b/src/components/DeeplinkWrapper/DeeplinkRedirectLoadingIndicator.tsx @@ -1,7 +1,6 @@ import React from 'react'; import {View} from 'react-native'; -import type {OnyxEntry} from 'react-native-onyx'; -import {withOnyx} from 'react-native-onyx'; +import {useOnyx} from 'react-native-onyx'; import Icon from '@components/Icon'; import * as Expensicons from '@components/Icon/Expensicons'; import * as Illustrations from '@components/Icon/Illustrations'; @@ -12,23 +11,17 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import Navigation from '@libs/Navigation/Navigation'; import ONYXKEYS from '@src/ONYXKEYS'; -import type * as OnyxTypes from '@src/types/onyx'; -type DeeplinkRedirectLoadingIndicatorOnyxProps = { - /** Current user session */ - session: OnyxEntry; -}; - -type DeeplinkRedirectLoadingIndicatorProps = DeeplinkRedirectLoadingIndicatorOnyxProps & { +type DeeplinkRedirectLoadingIndicatorProps = { /** Opens the link in the browser */ openLinkInBrowser: (value: boolean) => void; }; -function DeeplinkRedirectLoadingIndicator({openLinkInBrowser, session}: DeeplinkRedirectLoadingIndicatorProps) { +function DeeplinkRedirectLoadingIndicator({openLinkInBrowser}: DeeplinkRedirectLoadingIndicatorProps) { const {translate} = useLocalize(); const theme = useTheme(); const styles = useThemeStyles(); - + const [currentUserLogin] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.email}); return ( @@ -41,7 +34,7 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser, session}: Deeplink {translate('deeplinkWrapper.launching')} - {translate('deeplinkWrapper.loggedInAs', {email: session?.email ?? ''})} + {translate('deeplinkWrapper.loggedInAs', {email: currentUserLogin ?? ''})} {translate('deeplinkWrapper.doNotSeePrompt')} openLinkInBrowser(true)}>{translate('deeplinkWrapper.tryAgain')} {translate('deeplinkWrapper.or')} Navigation.goBack()}>{translate('deeplinkWrapper.continueInWeb')}. @@ -62,8 +55,4 @@ function DeeplinkRedirectLoadingIndicator({openLinkInBrowser, session}: Deeplink DeeplinkRedirectLoadingIndicator.displayName = 'DeeplinkRedirectLoadingIndicator'; -export default withOnyx({ - session: { - key: ONYXKEYS.SESSION, - }, -})(DeeplinkRedirectLoadingIndicator); +export default DeeplinkRedirectLoadingIndicator;