Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v3] BottomSheetScrollView not working with dynamic snapPoints #270

Closed
bogoslavskiy opened this issue Feb 8, 2021 · 7 comments
Closed
Labels
bug Something isn't working no-issue-activity

Comments

@bogoslavskiy
Copy link

bogoslavskiy commented Feb 8, 2021

Bug

Any dynamic snapPoint change not working with BottomSheetScrollView,
During scrolling BottomSheetModal disappears immediately

Environment info

Library Version
@gorhom/bottom-sheet ^3
react-native 0.63
react-native-reanimated 2.0.0-rc.2
react-native-gesture-handler 1.9.0

Steps To Reproduce

  1. Set dynamic snapPoints
  2. Wrap content in BottomSheetScrollView

Describe what you expected to happen:

  1. Content height can be longer than screen height
  2. If content height < screen height, BottomSheet must be equal to the content height

Reproducible sample code

const [contentHeight, setContentHeight] = React.useState(0);
const snapPoints = React.useMemo(() => [contentHeight], [contentHeight]);

const handleOnLayout = React.useCallback(({ nativeEvent }: LayoutChangeEvent) => {
  const { height } = nativeEvent.layout;
  setContentHeight(height);
}, []);

<BottomSheetModal 
  ref={bottomSheetRef}
  snapPoints={snapPoints}
>
  <View onLayout={handleOnLayout}>
    <BottomSheetScrollView>
      <View 
        style={{
          height: 800,
          backgroundColor: 'red'
        }}
      />
    </BottomSheetScrollView>
  </View>
</BottomSheetModal>
@github-actions
Copy link

github-actions bot commented Jul 5, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@selimxsuha
Copy link

any solution?

@cltsang
Copy link

cltsang commented Apr 7, 2022

any solution?

https://gorhom.github.io/react-native-bottom-sheet/hooks/#usebottomsheetdynamicsnappoints

@quicksilverr
Copy link

This doesn't answer the question @cltsang

@cltsang
Copy link

cltsang commented Nov 25, 2022

It does answer the question.
Just need to follow the example closely, and replace BottomSheetView with BottomSheetScrollView.

@Hopefulee
Copy link

@cltsang - thanks heaps. It does what i need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity
Projects
None yet
Development

No branches or pull requests

5 participants