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 Modal - unable to swipe close modal on Android

See original GitHub issue

Bug

  • Unable to close bottom sheet modal on Android. iOS works great.

Environment info

Library Version
@gorhom/bottom-sheet ^1.4.1
react-native 0.62.2
react-native-reanimated ^1.9.0
react-native-gesture-handler ^1.6.1

Steps To Reproduce

  1. Implement bottom sheet modal
  2. Try to swipe down on Android

Describe what you expected to happen:

  1. Expect the modal to close when user swipes down

Reproducible sample code

Wrapped my navigation in modal provider

const AppNavigation = () => {
  return (
    <SafeAreaProvider>
      <NavigationContainer>
        <AlertContextProvider customStyles={customStyles}>
          <BottomSheetModalProvider dismissOnScrollDown={true} allowTouchThroughOverlay={false}>
            <PlayerContextProvider>
              <MainStackNavigator />
            </PlayerContextProvider>
          </BottomSheetModalProvider>
        </AlertContextProvider>
      </NavigationContainer>
    </SafeAreaProvider>
  );
};
  • Rendering modal on button press
// Makes the search full page modal appear 
  const handlePresentPress = useCallback(() => {
    present(
      <SearchComponent 
        updateSearch={(search) => setSearch(search)} 
        onTagSelect={(tag) => updateSearch(tag.title)}
        search={search} 
        isLoading={isLoading} 
        tags={storyReducer.allTags}
      />,
      {
        snapPoints: snapPoints, 
        onChange: handleSheetChanges,
      }
    );
  }, [present, snapPoints, handleSheetChanges]);

Issue Analytics

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

github_iconTop GitHub Comments

13reactions
adamsoutarcommented, Nov 26, 2020

Are you able to swipe on normal (non-modal) sheets? I had an issue where I was unable to drag sheets on Android, and it turned out I hadn’t set up react-native-gesture-handler properly for Android in MainActivity.java

4reactions
Myzel394commented, May 15, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bottom sheet only opens sometimes · Issue #161
On load it's open correctly, but if I swipe down to close it, then it only opens seemingly randomly when the onPress={openPostActions} is ......
Read more >
React native - Drag up modal from bottom while swiping ...
I have tried react-native-swipe-modal-up-down and react-native-modalize but they both don't support showing it slowly while swiping up the ...
Read more >
How to prevent a sheet from being dismissed with a swipe
SwiftUI provides the interactiveDismissDisabled() modifier to control whether the user can swipe downwards to dismiss a sheet.
Read more >
modal_bottom_sheet | Flutter Package
Create awesome and powerful modal bottom sheets. ... scrollview + dragging down to close ( showModalBottomSheet won't work correctly with scrollviews.
Read more >
gorhom/bottom-sheet
Modal presentation view, Bottom Sheet Modal. Smooth gesture interactions & snapping animations. Seamless keyboard handling for iOS & Android ...
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