UNPKG

react-native-keyboard-controller

Version:

Keyboard manager which works in identical way on both iOS and Android

52 lines (50 loc) • 2.38 kB
import { useEvent, useAnimatedProps as useReanimatedAnimatedProps, useAnimatedReaction as useReanimatedAnimatedReaction, useAnimatedStyle as useReanimatedAnimatedStyle, useDerivedValue as useReanimatedDerivedValue, useHandler as useReanimatedHandler } from "react-native-reanimated"; // Dependencies are only needed on Web when the Babel plugin is unavailable. export const useAnimatedProps = (updater, _dependencies, adapters, isAnimatedProps) => useReanimatedAnimatedProps(updater, undefined, adapters, isAnimatedProps); export const useAnimatedReaction = (prepare, react) => useReanimatedAnimatedReaction(prepare, react); export const useAnimatedStyle = updater => useReanimatedAnimatedStyle(updater); export const useDerivedValue = updater => useReanimatedDerivedValue(updater); export const useHandler = handlers => useReanimatedHandler(handlers); export const useAnimatedKeyboardHandler = (handlers, dependencies) => { const { context, doDependenciesDiffer } = useHandler(handlers, dependencies); return useEvent(event => { "worklet"; const { onKeyboardMoveStart, onKeyboardMove, onKeyboardMoveEnd, onKeyboardMoveInteractive } = handlers; if (onKeyboardMoveStart && event.eventName.endsWith("onKeyboardMoveStart")) { onKeyboardMoveStart(event, context); } if (onKeyboardMove && event.eventName.endsWith("onKeyboardMove")) { onKeyboardMove(event, context); } if (onKeyboardMoveEnd && event.eventName.endsWith("onKeyboardMoveEnd")) { onKeyboardMoveEnd(event, context); } if (onKeyboardMoveInteractive && event.eventName.endsWith("onKeyboardMoveInteractive")) { onKeyboardMoveInteractive(event, context); } }, ["onKeyboardMoveStart", "onKeyboardMove", "onKeyboardMoveEnd", "onKeyboardMoveInteractive"], doDependenciesDiffer); }; export const useFocusedInputLayoutHandler = (handlers, dependencies) => { const { context, doDependenciesDiffer } = useHandler(handlers, dependencies); return useEvent(event => { "worklet"; const { onFocusedInputLayoutChanged } = handlers; if (onFocusedInputLayoutChanged && event.eventName.endsWith("onFocusedInputLayoutChanged")) { onFocusedInputLayoutChanged(event, context); } }, ["onFocusedInputLayoutChanged"], doDependenciesDiffer); }; //# sourceMappingURL=reanimated.native.js.map