Repository navigation
fix: clear the scrim pin when a sheet view is torn down - #112
Merged
Merged
Conversation
Android does not recycle these views today, so this only affects a host used again after destroy(). Such a host kept `scrimPinnedFull` if it was destroyed during a re-anchor, holding the scrim at the fully open opacity. Also clear the detent-derived fields and animation bookkeeping destroy() missed. Values set from props and the listeners are still not restored, so this does not make reuse fully supported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recycling drops the active spring without running its completion, so `scrimPinnedFull` can outlive the sheet. From reading the code, a reused sheet with `animateIn` off would show the tallest detent's scrim opacity at a lower detent until the pin clears. This was not reproduced on a device, and the change has only been type-checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…investigation-d0e5fb # Conflicts: # android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetHostView.kt # ios/BottomSheetHostingView.swift
Add a control test showing the re-anchor really pins the scrim, using a detent whose scrim is invisible unless pinned. Note why the reuse test only checks for dismissal, and drop two resets that had no effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
scrimPinnedFullholds the scrim at the fully open opacity while an open sheet re-anchors to new detents. Neither teardown path cleared it, so a view torn down during a re-anchor kept the pin. If that view is used again at a lower detent, the scrim shows the tallest detent's opacity until something clears the pin.resetSheetState()clears the pinBottomSheetViewManagerdoesn't callsetupViewRecycling()destroy()clears the pin and other leftover statedetach()keeps the pin on purpose, so a Strict Mode reattach can resume the settleOn Android,
destroy()now also resetshasCardGapsand the card clipping,widestCardInsetsandscrimOpacities. Only the scrim pin has a demonstrated bug and a test; the others are tidying. This doesn't make Android reuse fully supported, because values set from props and the listeners still aren't restored.Testing
testDebugUnitTestpasses (155 tests).a scrim pinned at destroy does not carry over to a reused sheetfails without the fix because the scrim tap wrongly dismisses the sheet.a re-anchor pins the scrim at the fully open opacityis a control: it fails if the setup stops pinning, so the first test can't pass without exercising the reset.Not in this PR
On Android, tapping above the card on an open modal sheet with an invisible scrim fires
onIndexChangeandonSettlefor the current detent. It reproduces onmainat 289be4f, so this PR doesn't cause it, and it will be fixed separately. That's why the new test only checks that the sheet doesn't dismiss.🤖 Generated with Claude Code