-
-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with simultaneous keyboard dismiss and sheet close #1164
base: v4
Are you sure you want to change the base?
Fix issue with simultaneous keyboard dismiss and sheet close #1164
Conversation
for any interested, here is a patch: diff --git a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
index b166440..ce74512 100644
--- a/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
+++ b/node_modules/@gorhom/bottom-sheet/src/components/bottomSheet/BottomSheet.tsx
@@ -1402,6 +1402,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
(Platform.OS === 'android' &&
keyboardBehavior === KEYBOARD_BEHAVIOR.interactive &&
android_keyboardInputMode === KEYBOARD_INPUT_MODE.adjustResize)
+ || animatedNextPositionIndex.value == -1
) {
animatedKeyboardHeightInContainer.value = 0;
return; |
@paulrostorp while this patch did prevent my modal bottom sheet from staying / snapping back up to it's highest snap point after dismissing the keyboard, for bottom sheets with more than one snap point, I noticed that after the keyboard closed (by way of dragging the sheet down), my bottom sheet was stuck at it's first (non 0) snap point. I believe this to be momentum-based since hard swipes down fully close the modal, but if you swipe too lightly, the sheet gets stuck in this weird halfway position... I could only fully close the modal by doing something like this: useTimeout(() => bottomSheetRef.current?.dismiss(), keyboardShown ? null : 10); so far I've only tested on android; my bottom sheet modal has the following (relevant) properties:
|
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
not stale |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
not stale |
@gorhom any feedback on this PR? |
Will look into this pr this weekend |
Tested the Discord fork and it worked for us 🎊 |
@gorhom any chance for a recent review? |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
not stale, @gorhom ? |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
Not stale |
No way to merge this? 😷 |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
no stale, gringo. |
@paulrostorp , is there any update when this fix will be merged. |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
🫠 |
Is the fix merged ? |
@paulrostorp could you provide the issue repro sample code. |
@paulrostorp I tested this PR with Pixel 7. Not sure why but in my case this fix isn't working correctly. This is my component: <BottomSheet
index={bottomSheetIndex}
ref={sheetRef}
snapPoints={['70%']}
enablePanDownToClose={true}
handleComponent={null}
backdropComponent={renderBackdrop}
>
{...}
</BottomSheet> const close = () => {
Keyboard.dismiss();
setBottomSheetIndex(-1);
sheetRef.current?.close();
}; |
Any chance in making this work?, facing the same issue |
Motivation
This aims to address #1159 and #1072
This simply exits the
OnKeyboardStateChange
callback if the sheet is about close.This may conflict with a1ec74d but as I am unsure of the calendar for the
v5
release, I thought I'd open a PR for this fix only. Please advise