Skip to content

Grouping Fragments

Mert Şimşek edited this page Dec 3, 2018 · 1 revision

In some cases, you may want to group fragment, to remove it all. It will be more understandable with an example.

Let say your user follow these steps in your app.

  • BasketFragment
  • CreditCardFormFragment
  • AddressFormFragment
  • SuccessFragment

When user paid successfully, you may want to clear payment related steps and go back to BasketFragment. It can be easily done with the Medusa.

First, you need to start fragment with groupName. Let's say PAYMENT for this case.

navigator.start(creditCardFragment, "PAYMENT")
navigator.start(addressFormFragment, "PAYMENT")
navigator.start(successFragment, "PAYMENT")

Then you can easily clear payment steps with following code.

navigator.clearGroup("PAYMENT")
Clone this wiki locally