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.

Bug with animatedIndex prop of Backdrop Component in BottomSheetModal

See original GitHub issue

Bug: animatedIndex prop of Backdrop Component in BottomSheetModal doesn’t work as expected

I think the animatedIndex in BottomSheetModal has not correct type and can’t be animated using interpolate function of reanimated library. If I use BottomSheet instead of BottomSheetModal, it works properly, but in BottomSheetModal, animatedIndex doesn’t work properly

Environment info

Library Version
@gorhom/bottom-sheet 2.3
react-native 0.63.4
react-native-reanimated 1.9.0
react-native-gesture-handler 1.10.3

Steps To Reproduce

  1. Create a BottomSheetModal
  2. Provide Custom Backdrop Component
  3. Try to animate the Backdrop using animatedIndex

Describe what you expected to happen:

  1. I expected animatedIndex to be an animated value

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
theMasixcommented, Apr 22, 2021

Issue resolved! It was all about snapPoints.

my previous snapPoints was

  const snapPoints = useMemo(() => [0, contentHeight], [contentHeight]);

and I updated them to

  const snapPoints = useMemo(() => [contentHeight], [contentHeight]);

Now the animatedIndex and animations works as expected. I don’t know why my previous snapPoints worked with BottomSheet properly. It would be great if you can provide more information about snapPoints and how they works in the doc. So no one will have any issue same as mine.

@gorhom

0reactions
b0n1qcommented, Feb 13, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Backdrop | React Native Bottom Sheet - GitHub Pages
When you provide your own backdrop component, it will receive these animated props animatedIndex & animatedPosition that indicates the position and the ...
Read more >
@gorhom/bottom-sheet: Versions | Openbase
refactor: allow to render component inside default backdrop ( #662 ) ... fix: revert changes on BottomSheetModal that blocked stack behavour (15225ae).
Read more >
Creating and styling a modal bottom sheet in React Native
In this tutorial, we'll create a basic application with a modal bottom sheet feature. We'll set up the app, fetch data, and style...
Read more >
https://raw.githubusercontent.com/gorhom/react-nat...
... added onPress prop to backdrop component (#1029)(by @tarikpnr) ... revert changes on BottomSheetModal that blocked stack behavour ...
Read more >
Bug with animatedIndex prop of Backdrop Component ... - GitAnswer
<BottomSheetModal ref={ref} index={1} snapPoints={snapPoints} onChange={handleSheetChanges} bottomInset={0} backdropComponent={(props) => <CustomBackdrop {...
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