Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions android/src/main/java/com/swmansion/rnscreens/ScreenStack.kt
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ class ScreenStack(
screenWrappers
.asSequence()
.dropWhile { it !== visibleBottom } // ignore all screens beneath the visible bottom
// Skip fragments that are still attached, otherwise the transaction throws
// "Fragment already added" - e.g. when visibleBottom's fragment got detached
// while fragments above it stayed attached. Dismissed wrappers are exempt:
// their removal is queued earlier in this transaction, so adding them back
// is the legal remove + add re-attach path.
.filter { !it.fragment.isAdded || dismissedWrappers.contains(it) }
.forEach { wrapper ->
// TODO: It should be enough to dispatch this on commit action once.
transaction.add(id, wrapper.fragment).runOnCommit {
Expand Down
Loading