The Great Unjanking of the Sheets (#9973)
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
import React from 'react'
|
||||
import {Keyboard} from 'react-native'
|
||||
import {useEffect} from 'react'
|
||||
import {
|
||||
Keyboard,
|
||||
type KeyboardEventListener,
|
||||
type KeyboardEventName,
|
||||
} from 'react-native'
|
||||
|
||||
export function useOnKeyboardDidShow(cb: () => unknown) {
|
||||
React.useEffect(() => {
|
||||
const subscription = Keyboard.addListener('keyboardDidShow', cb)
|
||||
export function useOnKeyboard(
|
||||
eventName: KeyboardEventName,
|
||||
cb: KeyboardEventListener,
|
||||
) {
|
||||
useEffect(() => {
|
||||
const subscription = Keyboard.addListener(eventName, cb)
|
||||
|
||||
return () => {
|
||||
subscription.remove()
|
||||
}
|
||||
}, [cb])
|
||||
}, [eventName, cb])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user