Bottom Sheet Modal - unable to swipe close modal on Android
See original GitHub issueBug
- 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
- Implement bottom sheet modal
- Try to swipe down on Android
Describe what you expected to happen:
- 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:
- Created 3 years ago
- Comments:16 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 inMainActivity.java
I also faced this issue. Just had to wrap my app with
<GestureHandlerRootView />
.