Add padding to dialogs when keyboard is open on Android (#4182)

* add keyboard padding to android dialogs

* missing `keyboardDismissMode` for `ScrollableInner`

* add to `MutedWords`

* add to `LabelsOnMe`
This commit is contained in:
Hailey 2024-05-23 10:01:31 -07:00 committed by GitHub
parent 3d1ed04a70
commit 5217876f24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 54 additions and 3 deletions

View file

@ -0,0 +1,31 @@
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} />
}