Skip to content

refactor(iOS): limit scope of shouldUseCustomBackBarButtonItem flag #2867

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

Merged

Conversation

maciekstosio
Copy link
Contributor

Description / Changes

This is continuation of #2860 that proposes small refactor around back button logic. This area is very confusing and in my opinion this is due to flag shouldUseCustomBackBarButtonItem that breaks the flow of other if's and causes other props to not work. Not we contained this flag in if (visible) which currently is the only case when backButtonItem might be used after the changes from #2800.

Test code and steps to reproduce

see FabricExample/e2e/issuesTests/Test2809.e2e.ts and apps/src/tests/Test2809/index.tsx

Checklist

  • Ensured that CI passes

@maciekstosio maciekstosio requested a review from kkafar April 11, 2025 15:13
Base automatically changed from @kkafar/refactor-header-config-code-part-1 to main April 11, 2025 17:55
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

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

I don't think this works.

Consider scenario: config.disableBackButtonMenu == true && config.isBackTitleVisible == false

You won't use custom back button then -> you will break the behaviour of disableBackButtonMenu prop. We can't merge this.

@maciekstosio
Copy link
Contributor Author

maciekstosio commented Apr 11, 2025

But it didn't work before these changes too. When backTitleVisible == false, then in else statement we set shouldUseCustomBackBarButtonItem = NO and backButtonItem won't be set, thus we use default UIBarButtonItem implementation with backButtonMenu

As far as I remember this is what we decided in #2800, the backTitleVisible works as a kill switch.

@maciekstosio maciekstosio requested a review from kkafar April 11, 2025 19:54
@kkafar kkafar changed the title chore(iOS): refactor back button logic refactor(iOS): limit impact of shouldUseCustomBackBarButtonItem flag Apr 14, 2025
@kkafar kkafar changed the title refactor(iOS): limit impact of shouldUseCustomBackBarButtonItem flag refactor(iOS): limit scope of shouldUseCustomBackBarButtonItem flag Apr 14, 2025
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

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

I think we're good. Thanks!

@maciekstosio maciekstosio merged commit 0e418c1 into main Apr 14, 2025
6 checks passed
@maciekstosio maciekstosio deleted the @maciekstosio/Refactor-back-button-logic-in-header-config branch April 14, 2025 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants