From 52b43ac90344823b69d62ea0505baba7fb4b77fc Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 29 Jan 2024 11:30:10 +0700 Subject: [PATCH 01/12] migrate Expensify.js to typescript --- src/{Expensify.js => Expensify.tsx} | 170 ++++++++---------- .../subscribePushNotification/index.ts | 25 +-- 2 files changed, 87 insertions(+), 108 deletions(-) rename src/{Expensify.js => Expensify.tsx} (65%) diff --git a/src/Expensify.js b/src/Expensify.tsx similarity index 65% rename from src/Expensify.js rename to src/Expensify.tsx index 0707ba069241..bb87d79deaf6 100644 --- a/src/Expensify.js +++ b/src/Expensify.tsx @@ -1,9 +1,8 @@ -import lodashGet from 'lodash/get'; -import PropTypes from 'prop-types'; import React, {useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState} from 'react'; +import type {NativeEventSubscription} from 'react-native'; import {AppState, Linking} from 'react-native'; +import type {OnyxEntry} from 'react-native-onyx'; import Onyx, {withOnyx} from 'react-native-onyx'; -import _ from 'underscore'; import ConfirmModal from './components/ConfirmModal'; import DeeplinkWrapper from './components/DeeplinkWrapper'; import EmojiPicker from './components/EmojiPicker/EmojiPicker'; @@ -12,13 +11,12 @@ import GrowlNotification from './components/GrowlNotification'; import AppleAuthWrapper from './components/SignInButtons/AppleAuthWrapper'; import SplashScreenHider from './components/SplashScreenHider'; import UpdateAppModal from './components/UpdateAppModal'; -import withLocalize, {withLocalizePropTypes} from './components/withLocalize'; +import useLocalize from './hooks/useLocalize'; import * as EmojiPickerAction from './libs/actions/EmojiPickerAction'; import * as Report from './libs/actions/Report'; import * as User from './libs/actions/User'; import * as ActiveClientManager from './libs/ActiveClientManager'; import BootSplash from './libs/BootSplash'; -import compose from './libs/compose'; import * as Growl from './libs/Growl'; import Log from './libs/Log'; import migrateOnyx from './libs/migrateOnyx'; @@ -26,16 +24,17 @@ import Navigation from './libs/Navigation/Navigation'; import NavigationRoot from './libs/Navigation/NavigationRoot'; import NetworkConnection from './libs/NetworkConnection'; import PushNotification from './libs/Notification/PushNotification'; -// eslint-disable-next-line no-unused-vars +// eslint-disable-next-line @typescript-eslint/no-unused-vars import subscribePushNotification from './libs/Notification/PushNotification/subscribePushNotification'; import StartupTimer from './libs/StartupTimer'; // This lib needs to be imported, but it has nothing to export since all it contains is an Onyx connection -// eslint-disable-next-line no-unused-vars +// eslint-disable-next-line @typescript-eslint/no-unused-vars import UnreadIndicatorUpdater from './libs/UnreadIndicatorUpdater'; import Visibility from './libs/Visibility'; import ONYXKEYS from './ONYXKEYS'; import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/PopoverReportActionContextMenu'; import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu'; +import type {ScreenShareRequest, Session} from './types/onyx'; Onyx.registerLogger(({level, message}) => { if (level === 'alert') { @@ -46,72 +45,46 @@ Onyx.registerLogger(({level, message}) => { } }); -const propTypes = { - /* Onyx Props */ - - /** Session info for the currently logged in user. */ - session: PropTypes.shape({ - /** Currently logged in user authToken */ - authToken: PropTypes.string, - - /** Currently logged in user accountID */ - accountID: PropTypes.number, - }), - - /** Whether a new update is available and ready to install. */ - updateAvailable: PropTypes.bool, - - /** Tells us if the sidebar has rendered */ - isSidebarLoaded: PropTypes.bool, - - /** Information about a screen share call requested by a GuidesPlus agent */ - screenShareRequest: PropTypes.shape({ - /** Access token required to join a screen share room, generated by the backend */ - accessToken: PropTypes.string, - - /** Name of the screen share room to join */ - roomName: PropTypes.string, - }), - - /** Whether the app is waiting for the server's response to determine if a room is public */ - isCheckingPublicRoom: PropTypes.bool, - - /** Whether we should display the notification alerting the user that focus mode has been auto-enabled */ - focusModeNotification: PropTypes.bool, - - ...withLocalizePropTypes, +type ExpensifyOnyxProps = { + isCheckingPublicRoom: OnyxEntry; + session: OnyxEntry; + updateAvailable: OnyxEntry; + isSidebarLoaded: OnyxEntry; + screenShareRequest: OnyxEntry; + focusModeNotification: OnyxEntry; }; -const defaultProps = { - session: { - authToken: null, - accountID: null, - }, - updateAvailable: false, - isSidebarLoaded: false, - screenShareRequest: null, - isCheckingPublicRoom: true, - focusModeNotification: false, -}; +type ExpensifyProps = ExpensifyOnyxProps; const SplashScreenHiddenContext = React.createContext({}); -function Expensify(props) { - const appStateChangeListener = useRef(null); +function Expensify({ + isCheckingPublicRoom = true, + session = { + authToken: undefined, + accountID: undefined, + }, + updateAvailable = false, + isSidebarLoaded = false, + screenShareRequest = null, + focusModeNotification = false, +}: ExpensifyProps) { + const appStateChangeListener = useRef(null); const [isNavigationReady, setIsNavigationReady] = useState(false); const [isOnyxMigrated, setIsOnyxMigrated] = useState(false); const [isSplashHidden, setIsSplashHidden] = useState(false); const [hasAttemptedToOpenPublicRoom, setAttemptedToOpenPublicRoom] = useState(false); + const {translate} = useLocalize(); useEffect(() => { - if (props.isCheckingPublicRoom) { + if (isCheckingPublicRoom) { return; } setAttemptedToOpenPublicRoom(true); - }, [props.isCheckingPublicRoom]); + }, [isCheckingPublicRoom]); - const isAuthenticated = useMemo(() => Boolean(lodashGet(props.session, 'authToken', null)), [props.session]); - const autoAuthState = useMemo(() => lodashGet(props.session, 'autoAuthState', ''), [props.session]); + const isAuthenticated = useMemo(() => !!(session?.authToken ?? null), [session]); + const autoAuthState = useMemo(() => session?.autoAuthState ?? '', [session]); const contextValue = useMemo( () => ({ @@ -120,7 +93,7 @@ function Expensify(props) { [isSplashHidden], ); - const shouldInit = isNavigationReady && (!isAuthenticated || props.isSidebarLoaded) && hasAttemptedToOpenPublicRoom; + const shouldInit = isNavigationReady && (!isAuthenticated || isSidebarLoaded) && hasAttemptedToOpenPublicRoom; const shouldHideSplash = shouldInit && !isSplashHidden; const initializeClient = () => { @@ -157,8 +130,14 @@ function Expensify(props) { Log.info('[BootSplash] splash screen status', false, {appState, status}); if (status === 'visible') { - const propsToLog = _.omit(props, ['children', 'session']); - propsToLog.isAuthenticated = isAuthenticated; + const propsToLog = { + isCheckingPublicRoom, + updateAvailable, + isSidebarLoaded, + screenShareRequest, + focusModeNotification, + isAuthenticated, + }; Log.alert('[BootSplash] splash screen is still visible', {propsToLog}, false); } }); @@ -182,7 +161,7 @@ function Expensify(props) { // If the app is opened from a deep link, get the reportID (if exists) from the deep link and navigate to the chat report Linking.getInitialURL().then((url) => { - Report.openReportFromDeepLink(url, isAuthenticated); + Report.openReportFromDeepLink(url ?? '', isAuthenticated); }); // Open chat report from a deep link (only mobile native) @@ -215,19 +194,19 @@ function Expensify(props) { {/* We include the modal for showing a new update at the top level so the option is always present. */} - {props.updateAvailable ? : null} - {props.screenShareRequest ? ( + {updateAvailable ? : null} + {screenShareRequest ? ( User.joinScreenShare(props.screenShareRequest.accessToken, props.screenShareRequest.roomName)} + title={translate('guides.screenShare')} + onConfirm={() => User.joinScreenShare(screenShareRequest.accessToken, screenShareRequest.roomName)} onCancel={User.clearScreenShareRequest} - prompt={props.translate('guides.screenShareRequest')} - confirmText={props.translate('common.join')} - cancelText={props.translate('common.decline')} + prompt={translate('guides.screenShareRequest')} + confirmText={translate('common.join')} + cancelText={translate('common.decline')} isVisible /> ) : null} - {props.focusModeNotification ? : null} + {focusModeNotification ? : null} )} @@ -246,33 +225,28 @@ function Expensify(props) { ); } -Expensify.propTypes = propTypes; -Expensify.defaultProps = defaultProps; -export default compose( - withLocalize, - withOnyx({ - isCheckingPublicRoom: { - key: ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, - initWithStoredValues: false, - }, - session: { - key: ONYXKEYS.SESSION, - }, - updateAvailable: { - key: ONYXKEYS.UPDATE_AVAILABLE, - initWithStoredValues: false, - }, - isSidebarLoaded: { - key: ONYXKEYS.IS_SIDEBAR_LOADED, - }, - screenShareRequest: { - key: ONYXKEYS.SCREEN_SHARE_REQUEST, - }, - focusModeNotification: { - key: ONYXKEYS.FOCUS_MODE_NOTIFICATION, - initWithStoredValues: false, - }, - }), -)(Expensify); +export default withOnyx({ + isCheckingPublicRoom: { + key: ONYXKEYS.IS_CHECKING_PUBLIC_ROOM, + initWithStoredValues: false, + }, + session: { + key: ONYXKEYS.SESSION, + }, + updateAvailable: { + key: ONYXKEYS.UPDATE_AVAILABLE, + initWithStoredValues: false, + }, + isSidebarLoaded: { + key: ONYXKEYS.IS_SIDEBAR_LOADED, + }, + screenShareRequest: { + key: ONYXKEYS.SCREEN_SHARE_REQUEST, + }, + focusModeNotification: { + key: ONYXKEYS.FOCUS_MODE_NOTIFICATION, + initWithStoredValues: false, + }, +})(Expensify); export {SplashScreenHiddenContext}; diff --git a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts index c5519b42dc09..9fb83561c8b6 100644 --- a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts +++ b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts @@ -1,8 +1,22 @@ +import type {OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import subscribeToReportCommentPushNotifications from '@libs/Notification/PushNotification/subscribeToReportCommentPushNotifications'; import ONYXKEYS from '@src/ONYXKEYS'; import PushNotification from '..'; +export default function subscribePushNotification(notificationID: OnyxEntry) { + if (notificationID) { + PushNotification.register(notificationID); + + // Prevent issue where report linking fails after users switch accounts without closing the app + PushNotification.init(); + subscribeToReportCommentPushNotifications(); + } else { + PushNotification.deregister(); + PushNotification.clearNotifications(); + } +} + /** * Manage push notification subscriptions on sign-in/sign-out. * @@ -12,15 +26,6 @@ import PushNotification from '..'; Onyx.connect({ key: ONYXKEYS.NVP_PRIVATE_PUSH_NOTIFICATION_ID, callback: (notificationID) => { - if (notificationID) { - PushNotification.register(notificationID); - - // Prevent issue where report linking fails after users switch accounts without closing the app - PushNotification.init(); - subscribeToReportCommentPushNotifications(); - } else { - PushNotification.deregister(); - PushNotification.clearNotifications(); - } + subscribePushNotification(notificationID); }, }); From b5d14c28197f96f98a138bc87b07d15813209eea Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Mon, 29 Jan 2024 14:59:43 +0700 Subject: [PATCH 02/12] use unknow type instead of never --- .../home/report/ContextMenu/PopoverReportActionContextMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx index b28374fae04a..7cd10e2d84c1 100644 --- a/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx +++ b/src/pages/home/report/ContextMenu/PopoverReportActionContextMenu.tsx @@ -31,7 +31,7 @@ function extractPointerEvent(event: GestureResponderEvent | MouseEvent): MouseEv } // eslint-disable-next-line @typescript-eslint/naming-convention -function PopoverReportActionContextMenu(_props: never, ref: ForwardedRef) { +function PopoverReportActionContextMenu(_props: unknown, ref: ForwardedRef) { const {translate} = useLocalize(); const reportIDRef = useRef('0'); const typeRef = useRef(); From 03ecd78e97c955c30b54ad2d84ca777ee659879b Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 31 Jan 2024 11:24:39 +0700 Subject: [PATCH 03/12] merge main and add suggestion --- src/Expensify.tsx | 15 ++++++++++-- .../subscribePushNotification/index.ts | 24 ++++++++----------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index bb87d79deaf6..33d2327e2b63 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -25,7 +25,7 @@ import NavigationRoot from './libs/Navigation/NavigationRoot'; import NetworkConnection from './libs/NetworkConnection'; import PushNotification from './libs/Notification/PushNotification'; // eslint-disable-next-line @typescript-eslint/no-unused-vars -import subscribePushNotification from './libs/Notification/PushNotification/subscribePushNotification'; +import './libs/Notification/PushNotification/subscribePushNotification'; import StartupTimer from './libs/StartupTimer'; // This lib needs to be imported, but it has nothing to export since all it contains is an Onyx connection // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -46,11 +46,22 @@ Onyx.registerLogger(({level, message}) => { }); type ExpensifyOnyxProps = { + /** Whether the app is waiting for the server's response to determine if a room is public */ isCheckingPublicRoom: OnyxEntry; + + /** Session info for the currently logged in user. */ session: OnyxEntry; + + /** Whether a new update is available and ready to install. */ updateAvailable: OnyxEntry; + + /** Tells us if the sidebar has rendered */ isSidebarLoaded: OnyxEntry; + + /** Information about a screen share call requested by a GuidesPlus agent */ screenShareRequest: OnyxEntry; + + /** Whether we should display the notification alerting the user that focus mode has been auto-enabled */ focusModeNotification: OnyxEntry; }; @@ -130,7 +141,7 @@ function Expensify({ Log.info('[BootSplash] splash screen status', false, {appState, status}); if (status === 'visible') { - const propsToLog = { + const propsToLog: Omit = { isCheckingPublicRoom, updateAvailable, isSidebarLoaded, diff --git a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts index 9fb83561c8b6..598f3878424a 100644 --- a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts +++ b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts @@ -4,19 +4,6 @@ import subscribeToReportCommentPushNotifications from '@libs/Notification/PushNo import ONYXKEYS from '@src/ONYXKEYS'; import PushNotification from '..'; -export default function subscribePushNotification(notificationID: OnyxEntry) { - if (notificationID) { - PushNotification.register(notificationID); - - // Prevent issue where report linking fails after users switch accounts without closing the app - PushNotification.init(); - subscribeToReportCommentPushNotifications(); - } else { - PushNotification.deregister(); - PushNotification.clearNotifications(); - } -} - /** * Manage push notification subscriptions on sign-in/sign-out. * @@ -26,6 +13,15 @@ export default function subscribePushNotification(notificationID: OnyxEntry { - subscribePushNotification(notificationID); + if (notificationID) { + PushNotification.register(notificationID); + + // Prevent issue where report linking fails after users switch accounts without closing the app + PushNotification.init(); + subscribeToReportCommentPushNotifications(); + } else { + PushNotification.deregister(); + PushNotification.clearNotifications(); + } }, }); From 4311f861beb63cf1818e0f5266661fded8087b5a Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 31 Jan 2024 11:25:24 +0700 Subject: [PATCH 04/12] fix lint --- .../PushNotification/subscribePushNotification/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts index 598f3878424a..c5519b42dc09 100644 --- a/src/libs/Notification/PushNotification/subscribePushNotification/index.ts +++ b/src/libs/Notification/PushNotification/subscribePushNotification/index.ts @@ -1,4 +1,3 @@ -import type {OnyxEntry} from 'react-native-onyx'; import Onyx from 'react-native-onyx'; import subscribeToReportCommentPushNotifications from '@libs/Notification/PushNotification/subscribeToReportCommentPushNotifications'; import ONYXKEYS from '@src/ONYXKEYS'; From caf60b803d6d1fef10bd909cce21132175760aaf Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Wed, 31 Jan 2024 11:37:06 +0700 Subject: [PATCH 05/12] fix lint --- src/Expensify.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 00550aab2ebb..23621fedea17 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -11,6 +11,7 @@ import GrowlNotification from './components/GrowlNotification'; import AppleAuthWrapper from './components/SignInButtons/AppleAuthWrapper'; import SplashScreenHider from './components/SplashScreenHider'; import UpdateAppModal from './components/UpdateAppModal'; +import CONST from './CONST'; import useLocalize from './hooks/useLocalize'; import * as EmojiPickerAction from './libs/actions/EmojiPickerAction'; import * as Report from './libs/actions/Report'; @@ -35,7 +36,6 @@ import ONYXKEYS from './ONYXKEYS'; import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/PopoverReportActionContextMenu'; import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu'; import type {ScreenShareRequest, Session} from './types/onyx'; -import CONST from './CONST'; Onyx.registerLogger(({level, message}) => { if (level === 'alert') { @@ -63,7 +63,7 @@ type ExpensifyOnyxProps = { screenShareRequest: OnyxEntry; /** True when the user must update to the latest minimum version of the app */ - updateRequired: OnyxEntry, + updateRequired: OnyxEntry; /** Whether we should display the notification alerting the user that focus mode has been auto-enabled */ focusModeNotification: OnyxEntry; From 6832b59298de51b2986ca5ba9b04428056f1f243 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Fri, 2 Feb 2024 11:31:39 +0700 Subject: [PATCH 06/12] fix lint --- src/Expensify.tsx | 6 ++---- src/libs/Navigation/NavigationRoot.tsx | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 6b91816efebe..e24f3a25fefb 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -36,8 +36,6 @@ import ONYXKEYS from './ONYXKEYS'; import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/PopoverReportActionContextMenu'; import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu'; import type {ScreenShareRequest, Session} from './types/onyx'; -import type {Route} from '@src/ROUTES'; - Onyx.registerLogger(({level, message}) => { if (level === 'alert') { @@ -71,7 +69,7 @@ type ExpensifyOnyxProps = { focusModeNotification: OnyxEntry; /** Last visited path in the app */ - lastVisitedPath: OnyxEntry; + lastVisitedPath: OnyxEntry; }; type ExpensifyProps = ExpensifyOnyxProps; @@ -158,7 +156,7 @@ function Expensify({ screenShareRequest, focusModeNotification, isAuthenticated, - lastVisitedPath + lastVisitedPath, }; Log.alert('[BootSplash] splash screen is still visible', {propsToLog}, false); } diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 8948a3c835c0..3dd515ff25ae 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -9,7 +9,6 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; import Log from '@libs/Log'; import {getPathFromURL} from '@libs/Url'; import {updateLastVisitedPath} from '@userActions/App'; -import type {Route} from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import AppNavigator from './AppNavigator'; import getPolicyIDFromState from './getPolicyIDFromState'; @@ -24,7 +23,7 @@ type NavigationRootProps = { authenticated: boolean; /** Stores path of last visited page */ - lastVisitedPath: string | null; + lastVisitedPath: string | undefined | null; /** Initial url */ initialUrl: string | null; From fb222e6f5e7a295b5c975c3c9989f1b4885e1229 Mon Sep 17 00:00:00 2001 From: dukenv0307 <129500732+dukenv0307@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:09:13 +0700 Subject: [PATCH 07/12] Update src/libs/Navigation/NavigationRoot.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fábio Henriques --- src/libs/Navigation/NavigationRoot.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 3dd515ff25ae..0906f8871a6e 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -23,7 +23,7 @@ type NavigationRootProps = { authenticated: boolean; /** Stores path of last visited page */ - lastVisitedPath: string | undefined | null; + lastVisitedPath: Route; /** Initial url */ initialUrl: string | null; From 2893050b7bd2154d2fa5a7347729f9f06f4a8b22 Mon Sep 17 00:00:00 2001 From: dukenv0307 <129500732+dukenv0307@users.noreply.github.com> Date: Tue, 6 Feb 2024 00:09:20 +0700 Subject: [PATCH 08/12] Update src/Expensify.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fábio Henriques --- src/Expensify.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index e24f3a25fefb..2cb5aa8e5d02 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -241,7 +241,7 @@ function Expensify({ From d13efa74c8cb6a8508b4e4ee3b08496058f67967 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 6 Feb 2024 00:30:48 +0700 Subject: [PATCH 09/12] fix lint --- src/Expensify.tsx | 1 + src/libs/Navigation/NavigationRoot.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 2cb5aa8e5d02..0136b2039fc6 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -3,6 +3,7 @@ import type {NativeEventSubscription} from 'react-native'; import {AppState, Linking} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Onyx, {withOnyx} from 'react-native-onyx'; +import type {Route} from '@src/ROUTES'; import ConfirmModal from './components/ConfirmModal'; import DeeplinkWrapper from './components/DeeplinkWrapper'; import EmojiPicker from './components/EmojiPicker/EmojiPicker'; diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 0906f8871a6e..20c426a74c71 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -9,6 +9,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions'; import Log from '@libs/Log'; import {getPathFromURL} from '@libs/Url'; import {updateLastVisitedPath} from '@userActions/App'; +import type {Route} from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; import AppNavigator from './AppNavigator'; import getPolicyIDFromState from './getPolicyIDFromState'; From ff2b86ec902d4ac36252796b99e209b32f0cee7f Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 6 Feb 2024 01:03:06 +0700 Subject: [PATCH 10/12] fix ts error --- src/Expensify.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index 0136b2039fc6..a7225cb67230 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -3,7 +3,7 @@ import type {NativeEventSubscription} from 'react-native'; import {AppState, Linking} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Onyx, {withOnyx} from 'react-native-onyx'; -import type {Route} from '@src/ROUTES'; +import type {Route} from './ROUTES'; import ConfirmModal from './components/ConfirmModal'; import DeeplinkWrapper from './components/DeeplinkWrapper'; import EmojiPicker from './components/EmojiPicker/EmojiPicker'; From 254a1145a77ab8e686f0852f428eff82f27878c8 Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 6 Feb 2024 01:10:48 +0700 Subject: [PATCH 11/12] fix lint --- src/Expensify.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Expensify.tsx b/src/Expensify.tsx index a7225cb67230..f822862ec434 100644 --- a/src/Expensify.tsx +++ b/src/Expensify.tsx @@ -3,7 +3,6 @@ import type {NativeEventSubscription} from 'react-native'; import {AppState, Linking} from 'react-native'; import type {OnyxEntry} from 'react-native-onyx'; import Onyx, {withOnyx} from 'react-native-onyx'; -import type {Route} from './ROUTES'; import ConfirmModal from './components/ConfirmModal'; import DeeplinkWrapper from './components/DeeplinkWrapper'; import EmojiPicker from './components/EmojiPicker/EmojiPicker'; @@ -36,6 +35,7 @@ import Visibility from './libs/Visibility'; import ONYXKEYS from './ONYXKEYS'; import PopoverReportActionContextMenu from './pages/home/report/ContextMenu/PopoverReportActionContextMenu'; import * as ReportActionContextMenu from './pages/home/report/ContextMenu/ReportActionContextMenu'; +import type {Route} from './ROUTES'; import type {ScreenShareRequest, Session} from './types/onyx'; Onyx.registerLogger(({level, message}) => { From 2749c456cb81c77dbff72f9394cec4052d4e4a2c Mon Sep 17 00:00:00 2001 From: dukenv0307 Date: Tue, 27 Feb 2024 10:22:10 +0700 Subject: [PATCH 12/12] remove unused ts-expect-error --- src/App.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/App.tsx b/src/App.tsx index cbe5948f8d4e..0e247d5faa53 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -83,7 +83,6 @@ function App({url}: AppProps) { - {/* @ts-expect-error TODO: Remove this once Expensify (https://github.com/Expensify/App/issues/25231) is migrated to TypeScript. */}