Skip to content

Commit 74fe8ef

Browse files
committed
fix(keyboard): retake keyboard offset on close
1 parent cf917ab commit 74fe8ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Provider.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, {
22
useCallback,
3+
useEffect,
34
useLayoutEffect,
45
useMemo,
56
useState,
@@ -18,6 +19,7 @@ import Animated, {
1819
type SharedValue,
1920
} from 'react-native-reanimated';
2021
import {
22+
Keyboard,
2123
TextInput,
2224
type ScrollViewProps,
2325
type TextInputProps,
@@ -181,6 +183,16 @@ export function useFormSmartScroll({
181183

182184
const translateY = useSharedValue(0);
183185

186+
useEffect(() => {
187+
const sub = Keyboard.addListener('keyboardWillHide', () => {
188+
translateY.value = withTiming(0);
189+
});
190+
191+
return () => {
192+
sub.remove();
193+
};
194+
}, []);
195+
184196
useAnimatedReaction(
185197
() => currentFocus,
186198
(focus) => {

0 commit comments

Comments
 (0)