Skip to content

Improve image replacement in odometer flow #85716

Closed

Description

@Julesssss

Bug spotted from @DylanDylann :

When clicking "Replace," the app navigates to the odometer distance page and then to the odometer image page. I think we should open the picker directly instead of navigating the user back to the odometer image page.

565304689-e74a9283-6abb-4c40-b64b-01f556ebe842.mov

Activity

  1. added a commit that references this issue on Mar 18, 2026
    34ca6c8
  2. wildan-m commented on Mar 18, 2026

    @wildan-m
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When clicking "Replace" on an odometer image, the app dismisses the modal, briefly shows the odometer distance page, then navigates to the full odometer image capture page. This creates unnecessary intermediate navigation. We should open the image picker directly instead.

    What is the root cause of that problem?

    The Replace button's onPress handler in TransactionReceiptModalContent treats odometer images the same way as regular receipts — it calls Navigation.dismissModal() then navigates to the full ODOMETER_IMAGE capture page:

    {(shouldShowReplaceReceiptButton || isOdometerImage) && (
    <Button
    icon={expensifyIcons.Camera}
    onPress={() => {
    const getDestinationRoute = () => {
    return isOdometerImage
    ? ROUTES.ODOMETER_IMAGE.getRoute(action ?? CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, imageType, isEditingConfirmation, backToReport)
    : ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(
    action ?? CONST.IOU.ACTION.EDIT,
    iouType,
    draftTransactionID ?? transaction?.transactionID,
    report?.reportID,
    Navigation.getActiveRoute(),
    );
    };
    Navigation.dismissModal({
    afterTransition: () => Navigation.navigate(getDestinationRoute()),
    });
    }}
    text={translate('common.replace')}
    style={styles.transactionReceiptButton}
    />
    )}

    This causes the user to see the distance odometer screen flash before landing on the image capture page, since dismissModal returns to the underlying screen first, and afterTransition then pushes the capture page on top.

    What changes do you think we should make in order to solve the problem?

    For odometer images, wrap the Replace button with AttachmentPicker (type=IMAGE) and call openPicker directly on press. When the user selects a file, call setMoneyRequestOdometerImage (already imported in the file) with the selected file and close the modal via navigation.goBack(). This skips the intermediate navigation entirely and opens the native file picker immediately.

    For non-odometer receipts, keep the existing behavior (dismiss modal → navigate to scan step).

    https://github.com/Expensify/App/compare/main...wildan-m:App:wildan/85716-odometer-replace-picker?expand=1

  3. DylanDylann commented on Mar 19, 2026

    @DylanDylann
    Contributor

    @jakubkalinski0 Let's discuss here

  4. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    @Julesssss @DylanDylann Oh, okay, I read that completely wrong and thought you don't want to navigate to the odometer image page but open the attachment picker immediately and block the drag&drop this way. Could you clarify this for me a little bit.

    You want to get rid of this very, very short period of time when you can see odometer tab after the image preview closes that we can see before the odometer image screen?

    output.mp4
  5. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    If thats what we are talking about then thats exactly what happens for scan as well and it's not caused by wrong navigation as we correctly navigate to odometer image, which can be seen here:

    {(shouldShowReplaceReceiptButton || isOdometerImage) && (
    <Button
    icon={expensifyIcons.Camera}
    onPress={() => {
    const getDestinationRoute = () => {
    return isOdometerImage
    ? ROUTES.ODOMETER_IMAGE.getRoute(action ?? CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, imageType, isEditingConfirmation, backToReport)

    Scan for comparison:

    Screen.Recording.2026-03-19.at.10.47.29.mov
  6. DylanDylann commented on Mar 19, 2026

    @DylanDylann
    Contributor

    I suggest skipping both the distance page and the odometer image page, and opening the picker right away instead. I think this would provide a better UX, since the odometer image page feels redundant on laptop and I forgot that it serves more purposes on native.

  7. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    It does serve more purposes on native, but we could go for a platform specific behavior if we would like to. It wouldn't be that hard to distinguish desktop web from other platforms and behave differently.

  8. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    My concern is that, even on web it provides more functionalities - allows drag&drop, which, in my opinion would be good to have + that's exactly what happens for scan as well. We also show the scan page on web there

  9. DylanDylann commented on Mar 19, 2026

    @DylanDylann
    Contributor

    Let’s wait for a final confirmation from Jules first. Since the same behavior occurs in the scan feature, I’m okay with keeping it as is for now.

  10. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    I agree, but even if we decide to go ahead with it, then it seems like a very low prio change and we can take care of it later since the behavior aligns across the app. (from the positives I am pretty sure that those are only 2 instances where something like this happens)

  11. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    Actually, one more question popped into my mind. In this situation:

    I suggest skipping both the distance page and the odometer image page, and opening the picker right away instead.

    What will be under the attachment picker? The odometer distance page?

  12. DylanDylann commented on Mar 19, 2026

    @DylanDylann
    Contributor

    What will be under the attachment picker? The odometer distance page?

    I assumed the picker could be shown on top of the previous modal preview.

  13. jakubkalinski0 commented on Mar 19, 2026

    @jakubkalinski0
    Member

    I assumed the picker could be shown on top of the previous modal preview.

    It's possible, that makes sense. So we go like -> Replace -> show attachment picker -> pick an image -> hide attachment picker -> land on modal image preview with the updated image -> user can close/crop/rotate/replace?

  14. Julesssss commented on Mar 19, 2026

    @Julesssss
    ContributorAuthor

    You want to get rid of this very, very short period of time when you can see odometer tab

    Thats what I was thinking, yeah.

    If thats what we are talking about then thats exactly what happens for scan

    Ah fair point.

    Okay so lets forget this improvement in that case. We can rethink about it later but I'm just going to close. No need to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions