Closed Prabindas001 closed 2 years ago
Are you seeing this log show up on your device by any chance?
Could not locate shadow view with tag #1065, this is probably caused by a temporary inconsistency between native views and shadow views.
I am experiencing a similar issue to yours I think. It is happening on iOS though. It seems to be working okay on Android.
It is inconsistent with when it happens though. However, when it does occur, I get that message printed out in the device logs.
It will happen after presenting the bottom sheet a few times and dismissing it. Then when I go to present the sheet again, the backdrop will show up initially, without any sheet. I can dismiss it by clicking outside the boundary of where the sheet should have appeared. Then some of the touch events below where the sheet should have appeared are blocked. So it's as if the sheet is there, but I can't see it.
Facing same issue, It could be solved by changing Touchables,
import { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, } from 'react-native';
To:
import { TouchableOpacity, TouchableHighlight, TouchableWithoutFeedback, } from '@gorhom/bottom-sheet';
From docs.
But I couldn't use them because they don't work exactly as touchables from react-native and need more customization to work as before. and I don't want to customize every touchable in the app. (By the way, If touchable wasn't the issue this is the perfect bottomsheet library for me.)
Using the Custom Backdrop example (https://gorhom.github.io/react-native-bottom-sheet/custom-backdrop) I saw the same problem.
I fixed it by adding pointerEvents="none"
to the Animated.View in the example.
E.g return <Animated.View pointerEvents="none" style={containerStyle} />;
Does this fix it for you? @Prabindas001
For those who are still struggling with this issue. As a temporary fix, it's possible to introduce a flag and hide the backdrop component by returning null from the render function before the first opening.
The following workaround fixes the issue in Android devices with higher SDK versions, that utilize the animatedSnapPoints
value from the useBottomSheetDynamicSnapPoints
hook.
const [hasExpandedAtLeastOnce, setHasExpandedAtLeastOnce] = useState(false);
const expand = useCallback(() => {
if (!bottomSheetRef.current) return;
bottomSheetRef.current.expand();
setHasExpandedAtLeastOnce(true);
}, [bottomSheetRef.current]);
const renderBackdrop = useCallback((props: BottomSheetDefaultBackdropProps) => {
if (!hasExpandedAtLeastOnce)
return null;
return <BottomSheetBackdrop disappearsOnIndex={-1} appearsOnIndex={0} {...props} />;
}, [hasExpandedAtLeastOnce]);
Then add this to your BottomSheet component:
backdropComponent={renderBackdrop}
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.
Using the Custom Backdrop example (https://gorhom.github.io/react-native-bottom-sheet/custom-backdrop) I saw the same problem.
I fixed it by adding
pointerEvents="none"
to the Animated.View in the example.E.g
return <Animated.View pointerEvents="none" style={containerStyle} />;
Does this fix it for you? @Prabindas001
This fixed the issue. Thanks.
Using the Custom Backdrop example (https://gorhom.github.io/react-native-bottom-sheet/custom-backdrop) I saw the same problem.
I fixed it by adding
pointerEvents="none"
to the Animated.View in the example.E.g
return <Animated.View pointerEvents="none" style={containerStyle} />;
Does this fix it for you? @Prabindas001
This removes the capability to close the bottom sheet by pressing backdrop. It also introduces a "clickthrough" experience on the backdrop. In other words, pressing anywhere on the backdrop will interact with elements underneath it.
The question is, what is the real cause of the backdrop blocking interactions with the view?
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..
Bug
The first time it works as expected, but once I move to some other screen and come back, all touch events are blocked by the backdrop overlay. Though, the backdrop component is not visible at that time.
The same app is tested on Android and iOS, but the issue is only present on the Android device.
Environment info
Device Details:
OS: Android 11 (MIUI Global 12.5.8 Stable) Model: Redmi Note 10 Pro (M2101K6P)
Steps To Reproduce
Reproducible sample code
Its all from example code, still I'm adding the code here: