question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Backdrop flashes on mount

See original GitHub issue

Bug

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

Kapture 2021-01-15 at 08 43 53

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

https://snack.expo.io/7UoD9PU0Z

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:27 (11 by maintainers)

github_iconTop GitHub Comments

9reactions
ferrannpcommented, Jan 29, 2021

@gorhom any idea how to prevent this flash on mount for v3 ?

8reactions
theMasixcommented, Apr 29, 2021

I just fixed the issue. It was all about snapPoints!

Backdrop flashes if I provide:

  • snapPoints: [contentHeight] (with useMemo)
  • index: 0
  • without appearsOnIndex and disappearsOnIndex on backdrop

But doesn’t have any flashing if I provide:

  • snapPoints: [0, contentHeight] (with useMemo)
  • index: 1
  • appearsOnIndex:2 and disappearsOnIndex:1 on backdrop

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 handles snapPoints or appearsOnIndex and disappearsOnIndex

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flash Holder Mount, Backdrop Clamp Multi Function ...
Flash Holder Mount, Backdrop Clamp Multi Function Reliable Heavy Duty for Photo Studio for Studio Backdrop Camera ; Easy to Use · Sophisticated...
Read more >
Pro Portraits with Just Two Flashes - O'Reilly
Try to position your subject at least four feet from the backdrop. This helps soften its appearance in the final shot. Now, mount...
Read more >
Photo Studio Super Clamp Holder Mount With Mini Ball Head ...
Photo Studio Super Clamp Holder Mount With Mini Ball Head for Tripod Backdrop Flash Light Stand Support Photography Accessories. 1 order. US $7.21....
Read more >
SLFC New Tripod Camera Clip Clamp Flash Reflector Holder ...
Arrives by Mon, Dec 19 Buy SLFC New Tripod Camera Clip Clamp Flash Reflector Holder Mount for Studio Backdrop Camera at Walmart.com.
Read more >
Tripod Clip Clamp Mount Flash Reflector Holder for Studio Backdrop ...
Buy Tripod Clip Clamp Mount Flash Reflector Holder for Studio Backdrop Camera HTC ViveVive Pro with 360 Swivel Tripod Mini Ball Head Standard...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found