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.

Bottom sheet crashes app due to racing conditions with animated values

See original GitHub issue

Bug

This will be hard to explain, partly because I’m guessing what the issue is. When using bottom sheet modals, the Expo client app crashes when switching between modals, under some conditions, which are unavoidable especially when using an API to fetch data and then presenting a modal.

I believe the issue is that the animated values are not fully set while the modal is opening or closing, and sometimes it returns nil for the values, which is when the app will crash. Something to do with reanimated. Sorry, I’m being vague because I don’t totally know what is going on.

Why do I suspect the animated value? Because while struggling with this issue, I have managed to see, sometimes, an error such as undefined is not an object (evaluating '_useBottomSheetModal.dismiss'). Googling it traced it back to reanimated and explained it has to do with animated values.

Oh, and as a bonus problem, I added two commented lines in the snack to demonstrate my previous issue which was automatically closed. That bot is very picky I must say 😉

Environment info

Library Version
@gorhom/bottom-sheet “^2”
“react-native” https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz
“react-native-reanimated” “~1.13.0”
“react-native-gesture-handler” “~1.8.0”

Steps To Reproduce

I shared a snack below, so no need to explain this.

Reproducible sample code

Have a look at this snack I created: https://snack.expo.io/@kickbk/bottom-sheet-crashes-app-due-to-racing-conditions-with-animated-values Wait for the bottom sheet to appear, then drag it down to dismiss. If needed, drag down twice. It will crash the app on your phone and on the online simulator as well, without warning.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asadMumtaz-YSTLcommented, Aug 26, 2022

@gorhom Kindly help me how resolve this issue?

ERROR TypeError: undefined is not an object (evaluating ‘_$$_REQUIRE(_dependencyMap[2], “@gorhom/bottom-sheet”).BottomSheetModal’)

thank in advance

1reaction
TALBI-svgcommented, Jun 23, 2022

hello guys i got this issue can someone help me ### TypeError: undefined is not an object (evaluating ‘_$$_REQUIRE(_dependencyMap[5], “@gorhom/bottom-sheet”).BottomSheetModalProvider’)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android bottom sheet crash after update support library
We have a bottom sheet, after updating support library version to '26.0.1', when you open the app and before bottom sheet is shown,...
Read more >
Animate movement using spring physics - Android Developers
In a spring-based animation, the value and the velocity are calculated based on the spring force that are applied on each frame. If...
Read more >
Android SDK v2 Changelog - Documentation - Persona
Added the ability to style footer components as a bottom presented sheet. ... Fix a race condition crash on the inquiry success screen ......
Read more >
Handling common HTML and CSS problems - MDN Web Docs
With the scene set, we'll now look specifically at the common cross-browser problems you will come across in HTML and CSS code, and...
Read more >
Release Notes for Office Current Channel (Preview)
We fixed an issue where when using Track Changes the app was unable ... been equal to the scalar value (the value you...
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