Refactor chat list implementation (#10059)

This commit is contained in:
Samuel Newman
2026-04-10 09:58:16 -07:00
committed by GitHub
parent 2c717dc1e7
commit 888eca73b3
18 changed files with 773 additions and 398 deletions
@@ -0,0 +1,48 @@
import {
type KeyboardStickyViewProps,
useReanimatedKeyboardAnimation,
} from 'react-native-keyboard-controller'
import Animated, {useAnimatedStyle} from 'react-native-reanimated'
// Vendored from https://github.com/kirillzyusko/react-native-keyboard-controller/blob/main/src/components/KeyboardStickyView/index.tsx
// Converted to Reanimated to support `minimumOffset` clamping.
export function KeyboardStickyView({
children,
offset: {closed = 0, opened = 0} = {},
style,
enabled = true,
minimumOffset,
...props
}: KeyboardStickyViewProps & {
/**
* Stop the stickyview going lower than this (i.e. bottom safe area)
*/
minimumOffset?: number
}) {
const {height, progress} = useReanimatedKeyboardAnimation()
const animatedStyle = useAnimatedStyle(() => {
const offset = closed + (opened - closed) * progress.get()
let translateY: number
if (enabled) {
let h = height.get()
if (minimumOffset != null) {
h = Math.min(h, -minimumOffset)
}
translateY = h + offset
} else {
translateY = closed
}
return {
transform: [{translateY}],
}
})
return (
<Animated.View style={[animatedStyle, style]} {...props}>
{children}
</Animated.View>
)
}