5217876f24
* add keyboard padding to android dialogs * missing `keyboardDismissMode` for `ScrollableInner` * add to `MutedWords` * add to `LabelsOnMe`
32 lines
707 B
TypeScript
32 lines
707 B
TypeScript
import React from 'react'
|
|
import {useKeyboardHandler} from 'react-native-keyboard-controller'
|
|
import Animated, {
|
|
useAnimatedStyle,
|
|
useSharedValue,
|
|
} from 'react-native-reanimated'
|
|
|
|
export function KeyboardPadding({maxHeight}: {maxHeight?: number}) {
|
|
const keyboardHeight = useSharedValue(0)
|
|
|
|
useKeyboardHandler(
|
|
{
|
|
onMove: e => {
|
|
'worklet'
|
|
|
|
if (maxHeight && e.height > maxHeight) {
|
|
keyboardHeight.value = maxHeight
|
|
} else {
|
|
keyboardHeight.value = e.height
|
|
}
|
|
},
|
|
},
|
|
[maxHeight],
|
|
)
|
|
|
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
height: keyboardHeight.value,
|
|
}))
|
|
|
|
return <Animated.View style={animatedStyle} />
|
|
}
|