Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/pages/Share/ShareRootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {shouldValidateFile} from '@libs/ReceiptUtils';
import ShareActionHandler from '@libs/ShareActionHandlerModule';
import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan';
import {close as closeModal} from '@userActions/Modal';
import Tab from '@userActions/Tab';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand Down Expand Up @@ -120,6 +121,9 @@ function ShareRootPage() {
if (tempFile.mimeType) {
if (receiptFileFormats.includes(tempFile.mimeType) && fileExtension) {
setIsFileScannable(true);
// Reset the persisted tab to SUBMIT so that defaultSelectedTab takes effect
// even when a previous Share session left the tab on SHARE.
Tab.setSelectedTab(CONST.TAB.SHARE.NAVIGATOR_ID, CONST.TAB.SHARE.SUBMIT);
} else {
setIsFileScannable(false);
}
Expand Down Expand Up @@ -199,6 +203,7 @@ function ShareRootPage() {
<OnyxTabNavigator
id={CONST.TAB.SHARE.NAVIGATOR_ID}
tabBar={TabSelector}
defaultSelectedTab={CONST.TAB.SHARE.SUBMIT}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Bypass persisted tab state when defaulting to Submit

defaultSelectedTab={CONST.TAB.SHARE.SUBMIT} does not actually make Submit the default once a tab choice is already saved, because OnyxTabNavigator prefers the persisted selectedTab over defaultSelectedTab (validInitialTab in src/libs/Navigation/OnyxTabNavigator.tsx). In practice, users who previously landed on/used SHARE (for example after sharing a non-scannable file where only Share exists) will keep reopening on Share, so this change does not reliably deliver the intended default behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daledah, this is correct, which means this will not be testable on an already existing account. Could you add this to test steps please?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, coming back to this, this isn't supposed to work on a new account only. @daledah, could you look at this comment please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eVoloshchak i updated

lazyLoadEnabled
onTabSelect={onTabSelectFocusHandler}
>
Expand Down
Loading