fix: keyboard handler memoization (#6719)

* fix: keyboard handler memoization

* fix: return missing dependency
This commit is contained in:
Kirill Zyusko
2024-11-25 16:03:55 +01:00
committed by GitHub
parent 5164ca6288
commit 723bbfc58a
2 changed files with 33 additions and 27 deletions
+5 -2
View File
@@ -214,12 +214,15 @@ export const ScrollableInner = React.forwardRef<ScrollView, DialogInnerProps>(
} }
}) })
useKeyboardHandler({ useKeyboardHandler(
{
onEnd: e => { onEnd: e => {
'worklet' 'worklet'
runOnJS(setKeyboardHeight)(e.height) runOnJS(setKeyboardHeight)(e.height)
}, },
}) },
[],
)
const basePading = const basePading =
(isIOS ? 30 : 50) + (isIOS ? keyboardHeight / 4 : keyboardHeight) (isIOS ? 30 : 50) + (isIOS ? keyboardHeight / 4 : keyboardHeight)
@@ -250,7 +250,8 @@ export function MessagesList({
// We use this value to keep track of when we want to disable the animation. // We use this value to keep track of when we want to disable the animation.
const layoutScrollWithoutAnimation = useSharedValue(false) const layoutScrollWithoutAnimation = useSharedValue(false)
useKeyboardHandler({ useKeyboardHandler(
{
onStart: e => { onStart: e => {
'worklet' 'worklet'
// Immediate updates - like opening the emoji picker - will have a duration of zero. In those cases, we should // Immediate updates - like opening the emoji picker - will have a duration of zero. In those cases, we should
@@ -273,7 +274,9 @@ export function MessagesList({
'worklet' 'worklet'
keyboardIsOpening.set(false) keyboardIsOpening.set(false)
}, },
}) },
[bottomOffset],
)
const animatedListStyle = useAnimatedStyle(() => ({ const animatedListStyle = useAnimatedStyle(() => ({
marginBottom: marginBottom: