Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace modal screens with modals from @react-navigation #53493

Open
chrispader opened this issue Dec 3, 2024 · 47 comments
Open

Replace modal screens with modals from @react-navigation #53493

chrispader opened this issue Dec 3, 2024 · 47 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Planning Changes still in the thought process Reviewing Has a PR in review Weekly KSv2

Comments

@chrispader
Copy link
Contributor

chrispader commented Dec 3, 2024

P/S Slack thread: expensify.slack.com/archives/C01GTK53T8Q/p1733938583809829

Problem

As discussed in this issue and this Slack thread we should replace modal screens (navigation screens/routes, that only render a modal) and modals that stay open when the containing screen gets unmounted.

The current modals use react-native-modal which uses RN internal Modal under the hood. Using these modals with @react-navigation/native-stack poses issues with animations and navigation, as these modals cannot animate in/out, due to the screen mounting/unmounting at the same time. Additionally, the animations will not look the same as the rest of the screen animations, which doesn't look very nice.

Solution

Replace the following types of modals with modal (screens) from @react-navigation

  • screens/routes that only render a modal
  • modals on screens, that are navigated back from while the modal is still open or animating out at the same time

cc @mountiny


List of components and screens to migrate to @react-navigation modal screens

Tracking my progress on an exhaustive list of components and screens that can/should be migrated to modal screens.

The list of components/screens (and other files) are triaged/prioritized as follows:
(File names are listed without file ending, usually .tsx)

  • 🔴 HIGH: Should definitely be migrated, due to current issues with animations and navigation.

    These modals are already causing issues with animations, because

    • they are animating in while a new screen is still mounting
    • they are still open/displayed while the old screen unmounting

    causing no or cut off animations.

  • 🟡 MEDIUM: Not causing any issues at the moment, but still worth to migrate to modal screens since the behave "like a screen", to achieve consistent animations and generally improve navigation. (gestures, native feel)

    This includes modals that are either

    • animated in from right-to-left (like a screen) or
    • that are part of another screen with animation: none,
    • etc.
  • 🟢 LOW: These screens are animated in from bottom-to-top like actual modals and are never (un-)mounted while at the same time as the screen. Migrating these modals to modal screens (and extra navigation routes) would make animations more consistent with the other screens, but it is not necessary and might not be worth the effort.

    Using a custom modal implementation or something like gorhom/react-native-bottom-sheet probably makes more sense.

Base components to (potentially) re-write

BaseModal
  • Affected modals:
    • TransactionStartDateSelectorModal
    • PaymentCardCurrencyModal
    • AmountSelectorModal
    • AttachmentModal
    • AvatarCropModal
    • CategorySelectorModal
    • ConfirmModal
    • CountrySelectorModal
    • YearPickerModal
    • DecisionModal
    • FeatureTrainingModal
    • PushRowModal
    • RequireTwoFactorAuthenticationModal
    • SearchRouterModal
    • StateSelectorModal
    • TestToolsModal
    • TextSelectorModal
    • ValueSelectorModal
    • BusinessTypeSelectorModal
    • NetSuiteCustomListSelectorModal
    • ExpenseLimitTypeSelectorModal
    • TransactionStartDateSelectorModal
    • UnitSelectorModal
    • WorkspaceMemberDetailsRoleSelectionModal
    • InitialListValueSelectorModal
    • TypeSelectorModal
  • Pages:
    • EditReportFieldDate
    • SetDatePage
    • DateOfBirthPage
    • SearchSelectedNarrow
  • Components:
    • SearchDateFilterBase
    • DateOfBirthStep
    • DebugDetailsDateTimePickerPage
    • AdditionalDetailsStep
    • IncorporationDateBusiness
    • IOURequestStepDate
Popover (uses Modal)
  • Comment: Uses Modal under the hood
  • Components:
    • EmojiPicker
    • PopoverMenu
    • PopoverWithMeasuredContent
    • PopoverReportActionContextMenu
    • BasePopoverReactionList
    • ProcessMoneyReportHoldMenu
    • WorkspaceCardsListLabel
    • AccountSwitcher
    • AddPaymentMethodMenu
    • AvatarWithImagePicker
    • AttachmentPickerWithMenu

Triaging

Modals only visible on native platforms (Android & iOS) are marked with 📱.

🔴 HIGH: Modals causing issues at the moment

Modals animating in from the bottom are marked with ⬆️, modals animating in from the right with ⬅️

AttachmentModal ⬅️ (screen recordings attached)
  • Comment: Add one or many extra routes?

  • Components:

    • AvatarWithImagePicker
    • ReportAvatar
    • TransactionReceiptPage
    • ReportActionCompose
    • ReportAttachments
    • ProfileAvatar
    • WorkspaceAvatar
  • iOS: Animating in not working, because the modal is animating at the same time, as a new screen with animation: none is mounting.

    Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-01-05.at.14.21.11.mp4
  • Android: Animation out is not working, probably due to the screen unmounting before the modal can animate out

    Screen.Recording.2025-01-05.at.14.20.52.mov
ConfirmModal ⬆️ (screen recordings attached)
  • Comment: Not all ConfirmModals are causing issues

  • Screens, where we navigate back while also animating the modal out:

    • TagSettingsPage (Remove tag)
    • WorkspaceEditTaxPage (Remove tax)
    • CategorySettingsPage (Remove category)
    • PolicyDistanceRateDetailsPage (Remove distance rate)
  • iOS: Modal not able to animate out, because the screen that wraps the modal is already unmounting:

    Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-01-05.at.14.24.29.mp4
  • Android: Same issue, though less obvious:

    Screen.Recording.2025-01-05.at.14.24.47.mov

🟡 MEDIUM: Screen-like modals - Animating in from right-to-left

SearchRouterModal
  • Pages:
    • AuthScreens
AmountSelectorModal -> AmountPicker
  • Pages:
    • Form
    • WorkspaceCreateTaxPage
AvatarCropModal -> AvatarWithImagePicker
  • Pages:
    • NewChatConfirmPage
    • ReportDetailsPage
    • ProfilePage
    • WorkspaceProfilePage
CategorySelectorModal
  • Pages:
    • WorkspaceCategoriesSettingsPage
  • Components:
    • CategorySelector
      • Pages:
        • PolicyDistanceRatesSettingsPage
        • WorkspacePerDiemSettingsPage (unused?)
YearPickerModal -> CalendarPicker -> DatePicker
  • Comment: Didn't test all flows
  • Pages:
    • SearchDateFilterBase
    • DateOfBirthStep
    • DebugDetailsDateTimePickerPage
    • EditReportFieldDate
    • AdditionalDetailsStep
    • IncorporationDateBusiness
    • IOURequestStepDate
    • SetDatePage
    • DateOfBirthPage
  • Components:
    • TransactionStartDateSelectorModal
TextSelectorModal -> TextPicker
  • Pages:
    • CreateReportFieldsPage
    • WorkspaceCreateTaxPage
  • Components:
    • Form
ValidateCodeActionModal
  • Pages:
    • MissingPersonalDetailsContent (multiple occurrences)
    • BankAccountStep
    • ContactMethodDetailsPage (multiple occurrences)
    • NewContactMethodPage
    • DelegateMagicCodeModal
    • CodesStep
    • BaseGetPhysicalCard
    • ExpensifyCardPage
    • ReportCardLostPage
    • ReportVirtualCardFraudPage
    • VerifyAccountPage
    • ConfirmationStep
ValueSelectorModal -> ValuePicker
  • Pages:
    • WorkspaceNewRoomPage
  • Components:
    • Form (multiple occurrences)
FeatureTrainingModal
  • Pages:
    • TrackTrainingPage
  • Components:
    • ExplanationModal
    • MigratedUserWelcomeModal
    • OnboardingWelcomeVideo
PaymentCardCurrencyModal
ConnectToQuickbooksOnlineFlow 📱
ConnectToXeroFlow 📱
CardAuthenticationModal
  • Pages:
    • PaymentCard
    • WorkspaceOwnerChangeWrapperPage
NetSuiteCustomListSelectorModal -> NetSuiteCustomListPicker
  • Pages:
    • ChooseCustomListStep
ExpenseLimitTypeSelectorModal -> ExpenseLimitTypeSelector
  • Pages:
    • CategoryFlagAmountsOverPage
TransactionStartDateSelectorModal
  • Components:
    • TransactionStartDateStep
UnitSelectorModal -> UnitSelector
  • Pages:
    • PolicyDistanceRatesSettingsPage
WorkspaceMemberDetailsRoleSelectionModal
  • Pages:
    • WorkspaceMemberDetailsPage (multiple occurrences)
InitialListValueSelectorModal -> InitialListValueSelector
  • Pages:
    • CreateReportFieldsPage
TypeSelectorModal -> TypeSelector
  • Pages:
    • CreateReportFieldsPage

🟢 LOW: Contained modals - Only visible as part of the current screen, animating in from bottom-to-top

ConfirmModal
  • Comment: We will need to decide about creating an extra route for every screen individually.
  • Screens:
    • EditReportFieldPage
    • ReportDetailsPage
    • ReportParticipantDetailsPage
    • ReportParticipantsPage
    • RoomMemberDetailsPage
    • RoomMembersPage
    • EmptySearchView
    • ConsolePage
    • InitialSettingsPage
    • ContactMethodDetailsPage
    • VisibilityPage
    • CloseAccountPage
    • SecuritySettingsPage
    • TroubleshootPage
    • WalletPage
    • WorkspaceInitialPage
    • WorkspaceMembersPage
    • WorkspaceMoreFeaturesPage
    • WorkspaceProfilePage
    • WorkspacesListPage
    • PolicyAccountingPage
    • SageIntacctEditUserDimensionsPage
    • NetSuiteImportCustomFieldView
    • ImportedCategoriesPage
    • WorkspaceCategoriesPage
    • WorkspaceCompanyCardDetailsPage
    • WorkspaceCompanyCardsSettingsPage
    • PolicyDistanceRatesPage
    • WorkspaceEditCardLimitPage
    • WorkspaceEditCardLimitTypePage
    • WorkspaceExpensifyCardDetailsPage
    • WorkspaceExpensifyCardPageEmptyState
    • WorkspaceInvoiceVBASection
    • ImportedMembersPage
    • WorkspaceMemberDetailsPage
    • ImportedPerDiemPage
    • WorkspacePerDiemDetailsPage
    • WorkspacePerDiemPage
    • ReportFieldsListValuesPage
    • ReportFieldsSettingsPage
    • ReportFieldsValueSettingsPage
    • WorkspaceReportFieldsPage
    • ImportedTagsPage
    • WorkspaceTagsPage
    • WorkspaceViewTagsPage
    • WorkspaceTaxesPage
    • WorkspaceWorkflowsPage
    • WorkspaceWorkflowsApprovalsEditPage
  • Components:
    • Expensify
    • AccountSwitcher
    • AccountingConnectionConfirmationModal
    • AttachmentModal
    • ConfirmModal
    • DelegateNoAccessModal
    • FocusModeNotification
    • ImportSpreadsheet
    • LocationPermissionModal
    • MoneyReportHeader
    • ExportWithDropdownMenu
    • SearchPageHeader
    • SupportActionRestrictedModal
    • BaseUpdateAppModal
    • HeaderView
    • PopoverReportActionContextMenu
    • ReportDetailsExportPage
    • FloatingActionButtonAndPopover
    • IOURequestStepScan
    • IOURequestStepWaypoint
    • CardSection
    • WorkspaceResetBankAccountModal
  • Hooks:
    • useDeleteSavedSearch
DecisionModal
  • Pages:
    • SearchPageHeader
    • ReportDetailsPage (multiple occurrences)
    • WorkspaceMembersPage (multiple occurrences)
    • WorkspaceCategoriesPage (multiple occurrences)
    • WorkspaceTagsPage
  • Components:
    • BaseImportOnyxState
    • ProcessMoneyReportHoldMenu
SelectionListModal -> SelectionListWithModal
  • Pages:
    • Search
    • ReportParticipantsPage
    • RoomMembersPage
    • WorkspaceMembersPage
    • WorkspaceCategoriesPage
    • PolicyDistanceRatesPage
    • WorkspacePerDiemPage
    • ReportFieldsListValuesPage
    • WorkspaceReportFieldsPage
    • WorkspaceTagsPage
    • WorkspaceViewTagsPage
    • WorkspaceTaxesPage
RequireTwoFactorAuthenticationModal
  • Components:
    • Expensify (multiple occurrences)
TestToolsModal
  • Pages:
    • AuthScreens
SearchSelectedNarrow -> SearchPageHeader
  • Pages:
    • SearchPage
    • SearchSelectionModaHeader

❓ Unknown: Unable to test because the modal is either missing or not accessible

CountrySelectorModal -> CountryPicker -> Address
  • Pages:
    • MissingPersonalDetailsContent -> MissingPersonalDetails (unused?)
StateSelectorModal -> StatePicker -> Address
  • Components:
    • MissingPersonalDetailsContent -> MissingPersonalDetails (unused?)
PushRowModal -> PushRowWithModal (unused?)
  • Pages:
    • ReimburseAccountPage
    • AddressFormFields
    • BusinessType
    • IncorporationLocation
    • PaymentVolume
    • Confirmation
BusinessTypeSelectorModal -> BusinessTypePicker
  • Pages:
    • ReimburseAccountPage
    • BusinessInfo
Issue OwnerCurrent Issue Owner: @chrispader
@chrispader chrispader added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Dec 3, 2024
Copy link

melvin-bot bot commented Dec 3, 2024

Triggered auto assignment to @Christinadobrzyn (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@chrispader chrispader changed the title Replace modal screens with modals from @react-navigation [TRACKING] Replace modal screens with modals from @react-navigation Dec 3, 2024
@mountiny mountiny self-assigned this Dec 4, 2024
@mountiny mountiny changed the title [TRACKING] Replace modal screens with modals from @react-navigation [HOLD] Replace modal screens with modals from @react-navigation Dec 4, 2024
@mountiny mountiny added the Planning Changes still in the thought process label Dec 4, 2024
@mountiny
Copy link
Contributor

mountiny commented Dec 4, 2024

@chrispader we will have to discuss this and make a proposal first

Copy link

melvin-bot bot commented Dec 10, 2024

@chrispader, @mountiny, @Christinadobrzyn Eep! 4 days overdue now. Issues have feelings too...

@Christinadobrzyn
Copy link
Contributor

Hey @mountiny or @chrispader - should this remain a daily issue?

Are we holding it for this PR - #53362

@melvin-bot melvin-bot bot removed the Overdue label Dec 10, 2024
@mountiny
Copy link
Contributor

No, we are holding this for a proposal/ discussion around it

@mountiny
Copy link
Contributor

Made chris the owner of the issue

@Christinadobrzyn
Copy link
Contributor

Just a heads up that I'm going to be ooo Dec 12 - 13th. Back on Monday 16th. I'm not going to assign this to a BZ teammate but if anything is urgent, please reach out to the team for a volunteer.

@chrispader
Copy link
Contributor Author

chrispader commented Dec 11, 2024

I've just posted a P/S thread for this here: https://expensify.slack.com/archives/C01GTK53T8Q/p1733938583809829

@Christinadobrzyn
Copy link
Contributor

Nice work on the P/S @chrispader - looks like it has lots of votes to move forward. Let us know what you're thinking for next steps!

@melvin-bot melvin-bot bot added the Overdue label Dec 16, 2024
Copy link

melvin-bot bot commented Dec 17, 2024

@chrispader, @mountiny, @Christinadobrzyn Huh... This is 4 days overdue. Who can take care of this?

@garrettmknight garrettmknight moved this to Bugs and Follow Up Issues in [#whatsnext] #expense Dec 17, 2024
@mountiny mountiny changed the title [HOLD] Replace modal screens with modals from @react-navigation Replace modal screens with modals from @react-navigation Dec 18, 2024
@mountiny
Copy link
Contributor

I think w can take this off hold, adding this to quality as low as I think it aims to improve UX.

@chrispader can you please start with a plan on how to tackle this before writing any code. Also would be great to get agreement from @adamgrzybowski @WoLewicki on the next steps and maybe even work together with them as this is change close to screens and navigation

@WoLewicki
Copy link
Contributor

I'd also add @BartoszGrajdek who is reworking some of the modals to work with reanimated.

@adamgrzybowski
Copy link
Contributor

I love the plan and approach with many smaller PRs for migrating. Great job analyzing this issue!

@WoLewicki
Copy link
Contributor

Sounds reasonable to me!

Copy link

melvin-bot bot commented Jan 9, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick!

Copy link

melvin-bot bot commented Jan 13, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

@mountiny
Copy link
Contributor

@chrispader What are your next steps?

@chrispader
Copy link
Contributor Author

chrispader commented Jan 14, 2025

@chrispader What are your next steps?

I'm going to start working on a holistic change for the AttachmentModal specifically this week. Once i've migrated the AttachmentModal, i can start working on the other 🟡 modals

@melvin-bot melvin-bot bot removed the Overdue label Jan 14, 2025
Copy link

melvin-bot bot commented Jan 20, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn Eep! 4 days overdue now. Issues have feelings too...

@melvin-bot melvin-bot bot added the Overdue label Jan 20, 2025
@parasharrajat
Copy link
Member

@chrispader Please tag me to the PR for reviews. Thanks. Also, do you have any update on this?

Copy link

melvin-bot bot commented Jan 22, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn Still overdue 6 days?! Let's take care of this!

@chrispader
Copy link
Contributor Author

No update yet. Going to continue working on this PR this week (especially a fix for the AttachmentModal component)

@jjcoffee
Copy link
Contributor

@chrispader Could you confirm if your work will fix #55537?

@melvin-bot melvin-bot bot added the Overdue label Jan 28, 2025
Copy link

melvin-bot bot commented Jan 28, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn Huh... This is 4 days overdue. Who can take care of this?

Copy link

melvin-bot bot commented Jan 30, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn Still overdue 6 days?! Let's take care of this!

@mountiny
Copy link
Contributor

@chrispader Can you please leave an update with the current progress and next steps? thanks!

@chrispader
Copy link
Contributor Author

chrispader commented Feb 2, 2025

@mountiny @parasharrajat sorry for the delay on this one.

This is what i did so far:

  • For the AttachmentModal we'll actually want to transform this into a "regular" screen, rather than a modal screen on native platforms, since we're already treating it like any other screen (right-to-left).
  • My second PR will add the necessary tools that current modals (e.g. ConfirmModal) will need to continue functioning as a separate screen + route.
    • Haven't set up a PR yet, but i already tried some changes. Will set up a PR for that soon!

@melvin-bot melvin-bot bot removed the Overdue label Feb 2, 2025
Copy link

melvin-bot bot commented Feb 5, 2025

@chrispader, @parasharrajat, @mountiny, @Christinadobrzyn Whoops! This issue is 2 days overdue. Let's get this updated quick!

@melvin-bot melvin-bot bot added the Overdue label Feb 5, 2025
@mountiny
Copy link
Contributor

mountiny commented Feb 6, 2025

Thanks!

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 Overdue labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Planning Changes still in the thought process Reviewing Has a PR in review Weekly KSv2
Projects
Status: LOW
Development

No branches or pull requests

8 participants