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.

Scrolling content makes the bottomsheet close / snap

See original GitHub issue

Bug

I add a BottomSheet with the snapPoints [20, “50%”, “90%”]. Then wrap my content in BottomSheetScrollView. I expand the BottomSheet to 90% scroll the content, but when I start to scroll the content back to top the BottomSheet “closes” or snaps to closest point (it looks like.)

I was able to reproduce this in both my own code and in the example for ScrollView. I’m not sure, but it looks like it only happens if you drag the content for a longer distance, not “short” scrolls.

It happens on Android and iOS.

https://user-images.githubusercontent.com/1405227/105365539-a8fe7000-5bfe-11eb-82af-5b57be194648.mov

Environment info

In my app:

Library Version
@gorhom/bottom-sheet 2.0.4
react-native 0.63.4
react-native-reanimated 1.13.0
react-native-gesture-handler 1.9.0

From example-app in repo:

Library Version
@gorhom/bottom-sheet 2.0.4
react-native 0.63.4
react-native-reanimated 1.13.2
react-native-gesture-handler 1.9.0

Steps To Reproduce

  1. Run code or use ScrollView-example
  2. Expand BottomSheet
  3. Scroll content
  4. Scroll back up in a single drag-event

Reproducible sample code

import React from 'react'
import { View } from 'react-native'
import BottomSheet, {
    BottomSheetScrollView,
} from '@gorhom/bottom-sheet'

const C = () => {
    return (
        <View style={{ flex: 1 }}>
            <BottomSheet snapPoints={[20, '50%', '90%']} index={1}>
                <BottomSheetScrollView>
                    <View style={{ flex: 1 }}>
                        {Array(50)
                            .fill('x')
                            .map((_, i) => {
                                return (
                                    <View
                                        key={String(i)}
                                        style={{
                                            marginBottom: 40,
                                            backgroundColor: '#cecece',
                                            height: 60,
                                        }}
                                    />
                                )
                            })}
                    </View>
                </BottomSheetScrollView>
            </BottomSheet>
        </View>
    )
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gorhomcommented, Jan 22, 2021

@sandan10 i have checked the codebase , there is no left over debugging logs.

please check again and let me know… thanks for the coffee 😇

1reaction
sandan10commented, Jan 22, 2021

Thanks, looks like the scrolling is working now!

It also seems like there is some debug-logging going on when scrolling. Snippet of output:

 e {"_dispatchInstances": {"_debugHookTypes": null, "_debugID": 3444, "_debugIsCurrentlyTiming": false, 
 "_debugNeedsRemount": false, "_debugOwner": {"_debugHookTypes": null, "_debugID": 3442, "_debugIsCurrentlyTiming": 
 false, "_debugNeedsRemount": false, "_debugOwner": [FiberNode], "_debugSource": [Object], "actualDuration": 41, 
 "actualStartTime": 4773, "alternate": [FiberNode], "child": [Circular],
 ....
Read more comments on GitHub >

github_iconTop Results From Across the Web

Scroll through Flutter Bottom Sheet - Stack Overflow
I have a Column with a list of ListTile s as the content of the bottom sheet. My problem is that if I...
Read more >
Scrollables | React Native Bottom Sheet - GitHub Pages
Scrollables. This library provides a pre-integrated virtualized lists that utilize an internal functionalities with the bottom sheet container to allow ...
Read more >
Flutter Tutorial - Snapping Modal Bottom Sheet ... - YouTube
Create a snapping modal bottom sheet in Flutter that snaps to different positions. This Flutter snapping sheet is also scrollable, ...
Read more >
snapping_sheet | Flutter Package - Pub.dev
In order to make the sheet know about the scroll controller, you need to provide it in the SnappingSheetContent class (See example below)....
Read more >
Sheets: bottom - Material Design
BottomSheetBehavior is applied to a child of CoordinatorLayout to make that child a persistent bottom sheet, which is a view that comes up...
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