isaac-udy/Enro

option to change fragment replace transaction with add transaction?

developer-- opened this issue · 6 comments

Nice work.
is there any option to use fragments add transaction instead of replace?

I'm not exactly sure what you mean - I'd be happy to help if you'd be able to provide some more information, and describe what you're trying to do.

I mean if there is any option to use replace transaction instead of add.

Instead of replace:

val fragment = ExampleFragment()
transaction.beginTarnsaction().replace(fragment).commit()

use add

val fragment = ExampleFragment()
transaction.beginTarnsaction().add(fragment).commit()

In Enro, you don't directly make Fragment Transactions, so I'm still not quite following what you want to do.

When are you using replace and when are you wanting to use add? If you are using Enro, you shouldn't need to use either of these.

Yes, I know that directly I don't have to make fragment transactions. I was asking if Enro (sdk) under the hood can support that kind of option (add/replace) when navigating between fragments.

Enro doesn't (and likely won't) support changing the behaviour of the DefaultFragmentExecutor based on any options provided when you do the navigation. The idea of Enro is that you don't know that you're navigating to a Fragment or Activity (and in the future perhaps a View or Composable), so it doesn't really make sense to make that an option inside of Enro.

For example the instruction "Navigate to this NavigationKey and use an 'add' instead of 'replace'" doesn't make sense, because the NavigationKey is not a Fragment, and does not directly have a relationship with a Fragment.

If you don't mind explaining exactly what you want to achieve, or what your problem with 'replace' is, I'd be happy to explain how to use an "override" to achieve the behaviour you're looking for. It should be relatively simple to write an override that has any sort of custom behaviour you like.

Inactive for over four weeks, closing.