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.

[v4] `enablePanDownToClose` not working on iOS and Android

See original GitHub issue

Bug

I nested the bottomSheet in a react-native-modal component and use the modal backdrop for onClose.

The prop enablePanDownToClose is not working on my iOS and Android app.

If I wrap my app or component with GestureHandlerRootView it doesn’t make any differences.

Do you have any idea?

Environment info

Library Version
@gorhom/bottom-sheet 4
react-native 0.64.3
react-native-reanimated 2.2.4
react-native-gesture-handler 1.10.3

Steps To Reproduce

  1. Add code from below
  2. Start your app
  3. Try to swipe

Describe what you expected to happen:

  1. BottomSheet should slide down

Reproducible sample code

return (
			<Modal
				isVisible={props.modalVisible}
				useNativeDriver={true}
				backdropOpacity={dimensions.shadowOpacity}
				style={styles.modalCenteredView}
				onBackdropPress={props.onClose}
				onBackButtonPress={props.onClose}
				statusBarTranslucent
				hideModalContentWhileAnimating
			>
				<BottomSheet
					ref={bottomSheetRef}
					index={0}
					snapPoints={props.bottomSheetHeight ? [props.bottomSheetHeight] : [DEFAULT_BOTTOM_SHEET_HEIGHT]}
					enablePanDownToClose
				>
					<BottomSheetView style={styles.bottomContent}>{content}</BottomSheetView>
				</BottomSheet>
			</Modal>
		);

https://user-images.githubusercontent.com/64470126/145685607-e03eaea2-97b1-42cb-8744-647ed476433a.mov

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:7

github_iconTop GitHub Comments

15reactions
MaganAnkurcommented, Jul 12, 2022

enablePanDownToClose didn’t work on android. Adding GestureHandlerRootView to App.js file resolved the issue for me.

<SafeAreaProvider>
              <GestureHandlerRootView style={{flex: 1}}>
                <BottomSheetModalProvider>
                  <NavigationContainer ref={navigationRef}>
                    <MainNavigator />
                  </NavigationContainer>
                </BottomSheetModalProvider>
              </GestureHandlerRootView>
 </SafeAreaProvider>
8reactions
ahAskaricommented, Mar 7, 2022

use GestureHandlerRootView to wrap BottomSheet component and and adjust flex: 1 It works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bottom sheet is not getting closed in react native android
I am unable to close or swap top bottom the bottomsheet in android only. Also when keyboard appears this bottomsheet keeps transparent ...
Read more >
Props | React Native Bottom Sheet - GitHub Pages
Defines how violently sheet has to be stopped while over dragging. type, default, required. number, 2.5, NO. detached ​. Defines whether the bottom...
Read more >
React Native Development for iOS and Android: Differences
Yes, we can reuse most code when working with both platforms, but in the end Android and iOS are quite different systems, which...
Read more >
Troubleshooting | Stream Chat - React Native SDK Docs
Without this some Android devices will fail to load images despite permissions being granted within the settings. Feedback. Camera not working#. iOS#. Add...
Read more >
React Native - 4 Top Differences in Development for ...
Read about 4 top differences in the development of Android & iOS apps ... kind of problem, because Android Studio works on Apple's...
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