Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Commit 17c971b

Browse files
committed
fix: scroll back to handled offset
1 parent 2841724 commit 17c971b

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default function useInputScrollHandler(options: Options = {}) {
3636
// Refs
3737
const ref = useRef<ScrollView>(null);
3838
const offset = useRef<NativeScrollPoint>();
39+
const handledOffset = useRef<NativeScrollPoint>();
3940

4041
// Window
4142
const screen = useWindowDimensions();
@@ -128,10 +129,22 @@ export default function useInputScrollHandler(options: Options = {}) {
128129
}
129130
}
130131
);
132+
133+
handledOffset.current = offset.current;
131134
};
132135

133136
const handleResetKeyboardSpace: KeyboardEventListener = () => {
134137
setKeyboardSpace(0);
138+
139+
if (handledOffset.current) {
140+
const responder = getScrollResponder();
141+
142+
responder.scrollTo({
143+
x: handledOffset.current.x,
144+
y: handledOffset.current.y,
145+
animated: true,
146+
});
147+
}
135148
};
136149

137150
// Effects

0 commit comments

Comments
 (0)