Skip to content

Commit 652b4a9

Browse files
committed
Fixes auto pop issue when selecting a country
1 parent e516348 commit 652b4a9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/EditAddressForm.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ struct EditAddressForm: View {
147147
LazyNavigationLink(destination: FilterListSelector(viewModel: StateSelectorViewModel()), isActive: $showStateSelector) {
148148
EmptyView()
149149
}
150+
151+
///
152+
/// iOS 14.5 has a bug where
153+
/// Pushing a view while having "exactly two" navigation links makes the pushed view to be popped when the initial view changes its state.
154+
/// EG: AddressForm -> CountrySelector -> Country is selected -> AddressForm updates country -> CountrySelector is popped automatically.
155+
/// Adding an extra and useless navigation link fixes the problem but throws a warning in the console.
156+
/// Ref: https://forums.swift.org/t/14-5-beta3-navigationlink-unexpected-pop/45279
157+
///
158+
NavigationLink(destination: EmptyView()) {
159+
EmptyView()
160+
}
150161
}
151162

152163
/// Decides if the navigation trailing item should be a done button or a loading indicator.

0 commit comments

Comments
 (0)