Skip to content

Commit f8865ea

Browse files
committed
fix: Gaurding modal from scrolling KeyboardAwareScrollView when a modal opens and the keyboard is not open.
1 parent b7b47e3 commit f8865ea

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • src/components/KeyboardAwareScrollView

src/components/KeyboardAwareScrollView/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ const KeyboardAwareScrollView = forwardRef<
231231
return false;
232232
}
233233

234+
// MW - if the keyboard is already hidden and the new height is 0, we don't need to do anything
235+
// This was being triggered when a modal or bottom sheet was opened after focusing a field at the bottom of
236+
// the scrollview.
237+
if (keyboardHeight.value === 0 && e === 0) {
238+
return false;
239+
}
240+
234241
// insets mode: `ScrollViewWithBottomPadding` extends scrollable area without
235242
// changing layout, so when the keyboard hides and we're at the end of the
236243
// ScrollView we must manually scroll back.
@@ -254,6 +261,7 @@ const KeyboardAwareScrollView = forwardRef<
254261
},
255262
[mode],
256263
);
264+
257265
const performScrollWithPositionRestoration = useCallback(
258266
(newPosition: number) => {
259267
"worklet";
@@ -495,6 +503,7 @@ const KeyboardAwareScrollView = forwardRef<
495503

496504
if (e.height === 0) {
497505
removeGhostPadding(e.height);
506+
ghostViewSpace.value = -1;
498507
}
499508

500509
keyboardHeight.value = e.height;

0 commit comments

Comments
 (0)