Skip to content

Commit

Permalink
close bottom sheets before navigating back
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejo committed Jan 12, 2025
1 parent 4cdfcea commit a7f1592
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,19 @@ class WooShippingLabelCreationViewModel @Inject constructor(
customWeight = input
}

fun onNavigateBack() {
triggerEvent(Event.Exit)
fun onNavigateBack(): Boolean {
val state = uiState.value
return when {
state.isAddressSelectionExpanded -> {
uiState.update { it.copy(isAddressSelectionExpanded = false) }
false
}
state.isShipmentDetailsExpanded -> {
uiState.update { it.copy(isShipmentDetailsExpanded = false) }
false
}
else -> true
}
}

data object StartPackageSelection : Event()
Expand Down

0 comments on commit a7f1592

Please sign in to comment.