[TS migration] Migrate 'AppNavigator' lib to TypeScript#29157
[TS migration] Migrate 'AppNavigator' lib to TypeScript#29157Gonals merged 33 commits intoExpensify:mainfrom
Conversation
# Conflicts: # src/SCREENS.ts
# Conflicts: # src/SCREENS.ts # src/libs/Navigation/AppNavigator/AuthScreens.tsx # src/libs/Navigation/AppNavigator/ModalStackNavigators.js # src/libs/Navigation/AppNavigator/Navigators/CentralPaneNavigator.tsx # src/libs/Navigation/AppNavigator/Navigators/Overlay.tsx # src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx # src/libs/Navigation/AppNavigator/PublicScreens.tsx # src/libs/Navigation/AppNavigator/RHPScreenOptions.ts # src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts # src/libs/Navigation/AppNavigator/ReportScreenWrapper.js # src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts # src/libs/Navigation/AppNavigator/createCustomStackNavigator/index.js # src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts # src/libs/Navigation/AppNavigator/index.tsx # src/libs/Navigation/AppNavigator/modalCardStyleInterpolator.ts # src/styles/cardStyles/types.ts # src/types/onyx/Report.ts
# Conflicts: # src/SCREENS.ts # src/libs/actions/App.ts
# Conflicts: # src/SCREENS.ts # src/libs/Navigation/AppNavigator/AuthScreens.tsx # src/libs/Navigation/AppNavigator/ModalStackNavigators.js # src/libs/Navigation/AppNavigator/Navigators/Overlay.tsx # src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx # src/libs/Navigation/Navigation.js # src/types/onyx/Report.ts
# Conflicts: # src/libs/Navigation/AppNavigator/ModalStackNavigators.js # src/libs/Navigation/AppNavigator/Navigators/RightModalNavigator.tsx # src/libs/Navigation/AppNavigator/RHPScreenOptions.ts # src/libs/Navigation/AppNavigator/getRootNavigatorScreenOptions.ts
# Conflicts: # src/libs/Navigation/AppNavigator/ReportScreenIDSetter.ts
rezkiy37
left a comment
There was a problem hiding this comment.
Left comments. Overall, LGTM!
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2023-12-06.at.4.31.32.AM.movAndroid: mWeb ChromeScreen.Recording.2023-12-06.at.4.30.03.AM.moviOS: NativeScreen.Recording.2023-12-06.at.4.28.37.AM.moviOS: mWeb SafariScreen.Recording.2023-12-06.at.4.27.23.AM.movMacOS: Chrome / SafariScreen.Recording.2023-12-06.at.4.17.16.AM.movMacOS: DesktopScreen.Recording.2023-12-06.at.4.24.46.AM.mov |
| mode="modal" | ||
| // We are disabling the default keyboard handling here since the automatic behavior is to close a | ||
| // keyboard that's open when swiping to dismiss a modal. In those cases, pressing the back button on | ||
| // a header will briefly open and close the keyboard and crash Android. | ||
| // eslint-disable-next-line react/jsx-props-no-multi-spaces | ||
| keyboardHandlingEnabled={false} |
There was a problem hiding this comment.
Why is this being removed?
There was a problem hiding this comment.
@allroundexperts Please, see this discussion for the context
| } | ||
|
|
||
| if (topmostRoute.params && topmostRoute.params.reportID) { | ||
| if (topmostRoute?.params && 'reportID' in topmostRoute.params && typeof topmostRoute.params.reportID === 'string' && topmostRoute.params.reportID) { |
There was a problem hiding this comment.
Curious why && typeof topmostRoute.params.reportID === 'string' && topmostRoute.params.reportID is needed? Shouldn't 'reportID' in topmostRoute.params be enough?
There was a problem hiding this comment.
@allroundexperts Not really, we need to narrow down the type to make sure reportID is string, that's why
| addCentralPaneNavigatorRoute(partialState); | ||
| } | ||
| const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList}); | ||
| const state = stackRouter.getRehydratedState(partialState, {routeNames, routeParamList, routeGetIdList}); |
There was a problem hiding this comment.
Why is routeGetIdList being added here?
| // Holds all of the callbacks that need to be triggered when the network reconnects | ||
| let callbackID = 0; | ||
| const reconnectionCallbacks: Record<string, () => Promise<void>> = {}; | ||
| const reconnectionCallbacks: Record<string, () => void> = {}; |
There was a problem hiding this comment.
Why isn't this a promise anymore?
There was a problem hiding this comment.
Because the callback passed to reconnect function is not a Promise
App/src/libs/Navigation/AppNavigator/AuthScreens.tsx
Lines 156 to 162 in d6c824b
| type GetNavigationModalCardStylesParams = {isSmallScreenWidth: number}; | ||
|
|
||
| type GetNavigationModalCardStyles = (params: GetNavigationModalCardStylesParams) => ViewStyle; | ||
| type GetNavigationModalCardStyles = () => ViewStyle; |
There was a problem hiding this comment.
Why the params are being removed?
There was a problem hiding this comment.
| /** If the admin room should be opened */ | ||
| openOnAdminRoom?: boolean; | ||
|
|
There was a problem hiding this comment.
Why is this being added?
|
Found the following two console warnings. I'm quite sure that these are not related to this PR but still, it would be good to confirm these before merging @VickyStash!
|
allroundexperts
left a comment
There was a problem hiding this comment.
Tests well. I'm not blocking the approval because of my comments because this is such a high priority PR.
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #24935 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
@allroundexperts I wasn't able to reproduce a console warning from the first screenshot, do you remember the steps of reproduction? |
|
@Gonals The SWM team is currently working on navigation refactoring, and this migration could speed up things - so please prioritize this one 🙏 |
|
Ahh, damn. @VickyStash, seems like we have some conflicts. I'll merge once they are solved |
# Conflicts: # src/libs/Navigation/AppNavigator/createCustomStackNavigator/CustomRouter.ts
|
@Gonals Is there anything that prevents you from merging? 😅 |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Gonals in version: 1.4.9-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/Gonals in version: 1.4.9-0 🚀
|
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.4.9-5 🚀
|



Details
[TS migration] Migrate 'AppNavigator' lib to TypeScript
Fixed Issues
$ #24935
PROPOSAL: N/A
Tests
Note: Test the app generally, navigating through the app, login screen, settings, report screen, etc
Offline tests
N/A
QA Steps
Note: Test the app generally, navigating through the app, login screen, settings, report screen, etc
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android1.mp4
Android: mWeb Chrome
android_web1.mp4
iOS: Native
ios1.mp4
iOS: mWeb Safari
ios_web1.mp4
MacOS: Chrome / Safari
web1.mp4
MacOS: Desktop
desktop1.mp4