diff --git a/package/src/utilities.ts b/package/src/utilities.ts index bb3537b..3700eea 100644 --- a/package/src/utilities.ts +++ b/package/src/utilities.ts @@ -1,51 +1,59 @@ -import { TextInput } from "react-native" -import Animated, { Easing } from "react-native-reanimated"; +import {TextInput} from 'react-native'; +import Animated, {Easing} from 'react-native-reanimated'; export async function measureFocusedInputBottomYAsync() { - return new Promise(resolve=>{ - const input = TextInput.State.currentlyFocusedInput(); - if(!input) return; - input.measure((x, y, width, height, pageX, pageY)=>{ - resolve(pageY + height); - }) - }) + return new Promise(resolve => { + const input = TextInput.State.currentlyFocusedInput(); + if (!input) return; + input.measure((x, y, width, height, pageX, pageY) => { + resolve(pageY + height); + }); + }); } -export function measureFocusedInputBottomY(callback: (bottomY: number)=>void) { - const input = TextInput.State.currentlyFocusedInput(); - if(!input) return; - input.measure((x, y, width, height, pageX, pageY)=>{ - callback(pageY + height); - }) +export function measureFocusedInputBottomY( + callback: (bottomY: number) => void, +) { + const input = TextInput.State.currentlyFocusedInput(); + if (!input) return; + input.measure((x, y, width, height, pageX, pageY) => { + callback(pageY + height); + }); } export function measureInputBottomYAsync() { - return new Promise(resolve=>{ - measureFocusedInputBottomY(resolve) - }) + return new Promise(resolve => { + measureFocusedInputBottomY(resolve); + }); } export function calcAndroidSystemPan({ - keyboardEndY, - inputBottomY, -} : { - keyboardEndY: number, - inputBottomY: number + keyboardEndY, + inputBottomY, +}: { + keyboardEndY: number; + inputBottomY: number; }) { - const delta = inputBottomY - keyboardEndY; - return Math.max(0, delta); + const delta = inputBottomY - keyboardEndY; + return Math.max(0, delta); } -export function closeAnimation(duration: number, easing: Animated.EasingFunction) { - return { - duration: duration + 50, - easing: Easing.in(easing) - } +export function closeAnimation( + duration: number, + easing: Animated.EasingFunction, +) { + return { + duration: duration + 50, + easing: Easing.out(easing), + }; } -export function openAnimation(duration: number, easing: Animated.EasingFunction) { - return { - duration, - easing: Easing.out(easing) - } -} \ No newline at end of file +export function openAnimation( + duration: number, + easing: Animated.EasingFunction, +) { + return { + duration, + easing: Easing.out(easing), + }; +}