Cant click whats under the bottom sheet when adding backdrop
See original GitHub issueBug
When I add a back drop component to the bottom sheet, I canot click on anything bellow the bottom sheet, even when backdrop is closed. Tryed to add enableTouchThrough={true} to backdrop but it didnt help.
Environment info
| @gorhom/bottom-sheet | ^2.2.4 | | react-native | 0.63.4 | | react-native-reanimated | ^1.13.2 | | react-native-gesture-handler | ^1.9.0 |
Steps To Reproduce
- Create a screen with a button.
- Add bottom sheet and have 2 snap points, one on 20% and one on 70% (never on 0).
- Add backdrop comopnent to be presented only when the bottom sheet is on 70%.
- Try to click the button, when to bottom sheet is on 20% (the first snap point).
Describe what you expected to happen:
- The button should be clicked.
what happend:
- the button is not clicked.
Reproducible sample code
import React, { useRef } from 'react';
import styled from 'styled-components/native';
import BottomSheet, {
BottomSheetBackdrop,
BottomSheetBackdropProps,
BottomSheetBackgroundProps,
} from '@gorhom/bottom-sheet';
import { View } from 'react-native';
const StyledBackdrop = (props: BottomSheetBackdropProps) => {
return (
<BottomSheetBackdrop
{...props}
closeOnPress={false}
enableTouchThrough={true}
/>
);
};
const snapDrawerPoints = [168, 470];
export const BottomDrawer = ({ children }: { children?: React.ReactNode }) => {
const bottomSheetRef = useRef<BottomSheet>(null);
return (
<BottomSheet
ref={bottomSheetRef}
backdropComponent={StyledBackdrop}
snapPoints={snapDrawerPoints}>
<Container>{children}</Container>
</BottomSheet>
);
};
const Container = styled.View`
flex: 1;
margin: 20px 20px 0 20px;
`;
Edit
Found out it works fine for some devices and doesnt work for others. Works fine on pixel 4 for example, and doesnt work for oneplus 8 and galaxy note 20 ultra. Wasnt tested on iPhone.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Why am I able to click "behind" the bottomsheet in Android?
A simple solution is to add the. android:clickable="true". attribute to the layout that you are using for your bottom sheet. That way it...
Read more >Change background and apply visual effects in Google Meet
Open the Meet app Meet app and then select a meeting. · Before you join, on the bottom of your self view, tap...
Read more >Use Background Images in Your Views - Tableau Help
In the Background Images dialog box, click Add Image. In the Add Background ... Click the Add button at the bottom of the...
Read more >5 Examples of the new Ionic 6 Bottom Sheet Modal
For now we need to focus on the presentation of the modal, and to get the bottom sheet you have to set the...
Read more >Video: Remove a watermark - Microsoft Support
Training: Can't figure out how to remove a watermark, because you can't find where it is? ... Want more? Add a background picture...
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 FreeTop 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
Top GitHub Comments
@AmirDebbie @oneji @ShaunLWM
I had the same issue on the iPhone. Adding
pointerEvents='none'
to theAnimated.View
in the example solved this for me.Hope this helps.
I don’t think this actually resolves the problem. Using a different backdrop is a bit of a workaround not, solving the issue with
enableTouchThrough
not enabling BottomSheetBackdrop to receive pointer events…