···250250 // We use this value to keep track of when we want to disable the animation.
251251 const layoutScrollWithoutAnimation = useSharedValue(false)
252252253253- useKeyboardHandler({
254254- onStart: e => {
255255- 'worklet'
256256- // Immediate updates - like opening the emoji picker - will have a duration of zero. In those cases, we should
257257- // just update the height here instead of having the `onMove` event do it (that event will not fire!)
258258- if (e.duration === 0) {
259259- layoutScrollWithoutAnimation.set(true)
253253+ useKeyboardHandler(
254254+ {
255255+ onStart: e => {
256256+ 'worklet'
257257+ // Immediate updates - like opening the emoji picker - will have a duration of zero. In those cases, we should
258258+ // just update the height here instead of having the `onMove` event do it (that event will not fire!)
259259+ if (e.duration === 0) {
260260+ layoutScrollWithoutAnimation.set(true)
261261+ keyboardHeight.set(e.height)
262262+ } else {
263263+ keyboardIsOpening.set(true)
264264+ }
265265+ },
266266+ onMove: e => {
267267+ 'worklet'
260268 keyboardHeight.set(e.height)
261261- } else {
262262- keyboardIsOpening.set(true)
263263- }
269269+ if (e.height > bottomOffset) {
270270+ scrollTo(flatListRef, 0, 1e7, false)
271271+ }
272272+ },
273273+ onEnd: () => {
274274+ 'worklet'
275275+ keyboardIsOpening.set(false)
276276+ },
264277 },
265265- onMove: e => {
266266- 'worklet'
267267- keyboardHeight.set(e.height)
268268- if (e.height > bottomOffset) {
269269- scrollTo(flatListRef, 0, 1e7, false)
270270- }
271271- },
272272- onEnd: () => {
273273- 'worklet'
274274- keyboardIsOpening.set(false)
275275- },
276276- })
278278+ [bottomOffset],
279279+ )
277280278281 const animatedListStyle = useAnimatedStyle(() => ({
279282 marginBottom: