Backdrop flashes on mount
See original GitHub issueBug
Adding a backdrop on v2 seems to causes the initial backdrop to flash on mount even though the modal is closed. You can see here, where once I tap “mount” it flashes the backdrop quickly. If I remove the backdrop, it doesn’t show up. I’ve tried doing a custom, more basic backdrop and it doesn’t seem to work either (same thing). Note: it’s fairly quick here, but in a larger app it seems to take even longer to disappear
I did notice that this issue #118 seems to be related, but I’m on the latest version and still having issues. I tried adding some debugging logs but couldn’t get more from it. I have a feeling it’s related to the animatedIndex
value being passed in? That value controls opacity of the backdrop and if it’s not 0 on mount it’ll flash (what seems to be at full opacity).
Environment info
Library | Version |
---|---|
@gorhom/bottom-sheet | 2.0.3 |
react-native | 0.63.4 |
react-native-reanimated | 1.13.2 |
react-native-gesture-handler | 1.9.0 |
Steps To Reproduce
Go to android (IOS doesn’t have the problem on the snack simulator, but if you do it on real simulator or real device you’ll see it, press mount, you’ll see the screen flicker:
https://snack.expo.io/7UoD9PU0Z
Describe what you expected to happen: On mount, if the modal is closed I.e. index === -1, we should not show the backdrop flash. The animation code is correct, but the mounting logic seems a little odd
Reproducible sample code
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:27 (11 by maintainers)
Top GitHub Comments
@gorhom any idea how to prevent this flash on mount for
v3
?I just fixed the issue. It was all about
snapPoints
!Backdrop flashes if I provide:
But doesn’t have any flashing if I provide:
I just shifted all values and
snapPoints
by one and it fixed the issue. So I think it’s a bug about how the package handlessnapPoints
orappearsOnIndex
anddisappearsOnIndex
Note: backdrop animation doesn’t have any differenece between two configs, the only difference is that in first config, backdrop flashes on first mount only.