Skip to content

Commit

Permalink
fix(BottomSheetTextInput): reset shouldHandleKeyboardEvents on unmount (
Browse files Browse the repository at this point in the history
  • Loading branch information
koplyarov authored Sep 6, 2023
1 parent 218e006 commit 6a5034c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/bottomSheetTextInput/BottomSheetTextInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo, useCallback, forwardRef } from 'react';
import React, { memo, useCallback, forwardRef, useEffect } from 'react';
import { TextInput } from 'react-native-gesture-handler';
import { useBottomSheetInternal } from '../../hooks';
import type { BottomSheetTextInputProps } from './types';
Expand All @@ -9,6 +9,13 @@ const BottomSheetTextInputComponent = forwardRef<
>(({ onFocus, onBlur, ...rest }, ref) => {
//#region hooks
const { shouldHandleKeyboardEvents } = useBottomSheetInternal();

useEffect(() => {
return () => {
// Reset the flag on unmount
shouldHandleKeyboardEvents.value = false;
};
}, [shouldHandleKeyboardEvents]);
//#endregion

//#region callbacks
Expand Down

0 comments on commit 6a5034c

Please sign in to comment.