Skip to content

Commit

Permalink
remove broken keyboard offset code (#3842)
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzius authored May 3, 2024
1 parent 997e621 commit 67b0cdf
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/screens/Messages/Conversation/MessagesList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, {useCallback, useEffect, useRef} from 'react'
import React, {useCallback, useRef} from 'react'
import {
Dimensions,
FlatList,
NativeScrollEvent,
NativeSyntheticEvent,
Expand Down Expand Up @@ -184,23 +183,12 @@ export function MessagesList() {

function useKeyboardVerticalOffset() {
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({
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,
})
}

0 comments on commit 67b0cdf

Please sign in to comment.