remove broken keyboard offset code (#3842)
parent
997e621ce3
commit
67b0cdf649
|
@ -1,6 +1,5 @@
|
||||||
import React, {useCallback, useEffect, useRef} from 'react'
|
import React, {useCallback, useRef} from 'react'
|
||||||
import {
|
import {
|
||||||
Dimensions,
|
|
||||||
FlatList,
|
FlatList,
|
||||||
NativeScrollEvent,
|
NativeScrollEvent,
|
||||||
NativeSyntheticEvent,
|
NativeSyntheticEvent,
|
||||||
|
@ -184,23 +183,12 @@ export function MessagesList() {
|
||||||
|
|
||||||
function useKeyboardVerticalOffset() {
|
function useKeyboardVerticalOffset() {
|
||||||
const {top: topInset} = useSafeAreaInsets()
|
const {top: topInset} = useSafeAreaInsets()
|
||||||
const [screenWindowDifference, setScreenWindowDifference] = React.useState(
|
|
||||||
() => Dimensions.get('screen').height - Dimensions.get('window').height,
|
|
||||||
)
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const subscription = Dimensions.addEventListener(
|
|
||||||
'change',
|
|
||||||
({screen, window}) => {
|
|
||||||
setScreenWindowDifference(screen.height - window.height)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
return () => subscription.remove()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
return Platform.select({
|
return Platform.select({
|
||||||
ios: topInset,
|
ios: topInset,
|
||||||
android: screenWindowDifference,
|
// I thought this might be the navigation bar height, but not sure
|
||||||
|
// 25 is just trial and error
|
||||||
|
android: 25,
|
||||||
default: 0,
|
default: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue