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] Backdrop press to close and enablePanDownToClose doesn't work on physical Android devices

See original GitHub issue

Bug

Backdrop press to close and enablePanDownToClose doesn’t work on physical Android devices.

Children of the bottom sheet are clickable, but backdrop doesn’t react to touches, as does the pan down to close.

Tested on all versions of v4. The backdrop press works on v2.

v4 - both features do work fine on iOS.

v2 Doesn’t allow to swipe down on physical Android devices even with snapPoints set to [-250,250].

Environment info

Xiaomi Redmi Note 8 Pro

Library Version
@gorhom/bottom-sheet 4.1.0
react-native 0.64.2
react-native-reanimated 2.2.2
react-native-gesture-handler 1.10.3

Steps To Reproduce

  1. Open the screen with bottom sheet included
  2. Open the bottom sheet
  3. Press on the backdrop (nothing happens)
  4. Pan down to close (nothing happens)

Describe what you expected to happen:

  1. Press on backdrop should close the bottom sheet.
  2. Pan down should close the bottom sheet.

Reproducible sample code

import React, { useCallback } from 'react';
import { Text } from 'react-native';
import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet';

export const RateAppSheet: React.FC =  () => {

    const renderBackdrop = useCallback(
      props => <BottomSheetBackdrop disappearsOnIndex={-1} appearsOnIndex={0} {...props} />,
      [],
    );

    return (
      <BottomSheet
        ref={ref}
        index={-1}
        enablePanDownToClose={true}
        snapPoints={[250]}
        backdropComponent={renderBackdrop}
      >
        <Text>Hello, the backdrop and pan down isn't working on physical android devices on v4</Text>
      </BottomSheet>
    );
  },
);

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:11

github_iconTop GitHub Comments

5reactions
lukebarscommented, Sep 28, 2021

I was missing the GestureHandlerRootView wrapper in my App. Works alright now.

3reactions
projodesigncommented, Sep 29, 2021

I was missing the GestureHandlerRootView wrapper in my App. Works alright now.

This solved it for me also. For others that see a broken screen - you may need to add style={{flex:1}} to the <GestureHandlerRootView /> tag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[v4] `enablePanDownToClose` not working on iOS and ...
I nested the bottomSheet in a react-native-modal component and use the modal backdrop for onClose. The prop enablePanDownToClose is not working ...
Read more >
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
enablePanDownToClose ​. Enable pan down gesture to close the sheet. ... backgroundStyle ​. View style to be applied to the background component.
Read more >
react native modal keyboard avoiding
I'm trying to use a keyboard avoiding view to basically push up the entire app window on iOS (mocking the behavior seen by...
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