react-native-keyboard-controller 1.15.1 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,8 +128,8 @@ const KeyboardProvider = ({
128
128
  }
129
129
  }, []);
130
130
 
131
- // effects
132
- (0, _react.useEffect)(() => {
131
+ // layout effects
132
+ (0, _react.useLayoutEffect)(() => {
133
133
  if (enabled) {
134
134
  (0, _monkeyPatch.applyMonkeyPatch)();
135
135
  } else {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useEffect","applyMonkeyPatch","revertMonkeyPatch","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({ statusBarTranslucent, navigationBarTranslucent });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAGsB,SAAAU,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,G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AuB,EAAC;MAAElD,oBAAoB;MAAEC;IAAyB,CAAC,CAAC;EAC7E;EAEA,oBACEpD,MAAA,CAAAkB,OAAA,CAAAoF,aAAA,CAAC/F,QAAA,CAAAgG,eAAe,CAACC,QAAQ;IAACjB,KAAK,EAAEhB;EAAQ,gBACvCvE,MAAA,CAAAkB,OAAA,CAAAoF,aAAA,CAACpE,8BAA8B;IAC7BuE,GAAG,EAAElD,UAAW;IAChBF,OAAO,EAAEA,OAAQ;IACjBD,wBAAwB,EAAEpB,eAAe,IAAIoB,wBAAyB;IACtED,oBAAoB,EAAEnB,eAAe,IAAImB,oBAAqB;IAC9DyB,KAAK,EAAErC,MAAM,CAACG;IACd;IAAA;IACAgE,wBAAwB,EAAElB,eAAgB;IAC1CE,mBAAmB,EAAE3C,EAAE,KAAK,KAAK,GAAGiC,cAAc,GAAG2B,SAAU;IAC/D3B,cAAc,EAAEjC,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG2B,SAAU;IAC9DhB,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAE7C,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG2B,SAAU;IACjEC,qCAAqC,EAAEf;EAAmB,GAEzD3C,QAC6B,CAAC,eACjClD,MAAA,CAAAkB,OAAA,CAAAoF,aAAA,CAACnG,YAAA,CAAAkC,QAAQ,CAACwE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAjC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACkC,OAAA,CAAA7D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeIsEdgeToEdge","_reactNativeReanimated","_bindings","_context","_eventMappings","_internal","_monkeyPatch","_reanimated","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","IS_EDGE_TO_EDGE","isEdgeToEdge","KeyboardControllerViewAnimated","Reanimated","createAnimatedComponent","Animated","KeyboardControllerView","styles","StyleSheet","create","container","flex","hidden","display","position","OS","Platform","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","viewTagRef","useRef","setEnabled","useState","progress","useAnimatedValue","height","progressSV","useSharedValue","heightSV","layout","setKeyboardHandlers","useEventHandlerRegistration","keyboardEventsMap","setInputHandlers","focusedInputEventsMap","context","useMemo","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","useAnimatedKeyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","useFocusedInputLayoutHandler","onFocusedInputLayoutChanged","target","useLayoutEffect","applyMonkeyPatch","revertMonkeyPatch","__DEV__","controlEdgeToEdgeValues","createElement","KeyboardContext","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View","exports"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n // layout effects\n useLayoutEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({ statusBarTranslucent, navigationBarTranslucent });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAGsB,SAAAU,yBAAAC,C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C/D3B,cAAc,EAAEjC,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG2B,SAAU;IAC9DhB,yBAAyB,EAAEX,cAAe;IAC1CY,iBAAiB,EAAE7C,EAAE,KAAK,SAAS,GAAGiC,cAAc,GAAG2B,SAAU;IACjEC,qCAAqC,EAAEf;EAAmB,GAEzD3C,QAC6B,CAAC,eACjClD,MAAA,CAAAkB,OAAA,CAAAoF,aAAA,CAACnG,YAAA,CAAAkC,QAAQ,CAACwE,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACAjC,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC;AAACkC,OAAA,CAAA7D,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /* eslint react/jsx-sort-props: off */
2
- import React, { useEffect, useMemo, useRef, useState } from "react";
2
+ import React, { useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { Animated, Platform, StyleSheet } from "react-native";
4
4
  import { controlEdgeToEdgeValues, isEdgeToEdge } from "react-native-is-edge-to-edge";
5
5
  import Reanimated, { useSharedValue } from "react-native-reanimated";
@@ -119,8 +119,8 @@ export const KeyboardProvider = ({
119
119
  }
120
120
  }, []);
121
121
 
122
- // effects
123
- useEffect(() => {
122
+ // layout effects
123
+ useLayoutEffect(() => {
124
124
  if (enabled) {
125
125
  applyMonkeyPatch();
126
126
  } else {
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","controlEdgeToEdgeValues","isEdgeToEdge","Reanimated","useSharedValue","KeyboardControllerView","KeyboardContext","focusedInputEventsMap","keyboardEventsMap","useAnimatedValue","useEventHandlerRegistration","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","IS_EDGE_TO_EDGE","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","viewTagRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","setInputHandlers","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","__DEV__","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n // effects\n useEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({ statusBarTranslucent, navigationBarTranslucent });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACnE,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAC7D,SACEC,uBAAuB,EACvBC,YAAY,QACP,8BAA8B;AACrC,OAAOC,UAAU,IAAIC,cAAc,QAAQ,yBAAyB;AAEpE,SAASC,sBAAsB,QAAQ,YAAY;AACnD,SAASC,eAAe,QAAQ,WAAW;AAC3C,SAASC,qBAAqB,EAAEC,iBAAiB,QAAQ,kBAAkB;AAC3E,SAASC,gBAAgB,EAAEC,2BAA2B,QAAQ,YAAY;AAC1E,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACpE,SACEC,0BAA0B,EAC1BC,4BAA4B,QACvB,cAAc;AAYrB,MAAMC,eAAe,GAAGb,YAAY,CAAC,CAAC;AAEtC,MAAMc,8BAA8B,GAAGb,UAAU,CAACc,uBAAuB,CACvEnB,QAAQ,CAACmB,uBAAuB,CAACZ,sBAAsB,CACzD,CAAC;AAOD,MAAMa,MAAM,GAAGlB,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GAAGqB,SAAU;IACjEC,qCAAqC,EAAEV;EAAmB,GAEzDlC,QAC6B,CAAC,eACjClC,KAAA,CAAAyE,aAAA,CAACpE,QAAQ,CAAC0E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA3B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","useLayoutEffect","useMemo","useRef","useState","Animated","Platform","StyleSheet","controlEdgeToEdgeValues","isEdgeToEdge","Reanimated","useSharedValue","KeyboardControllerView","KeyboardContext","focusedInputEventsMap","keyboardEventsMap","useAnimatedValue","useEventHandlerRegistration","applyMonkeyPatch","revertMonkeyPatch","useAnimatedKeyboardHandler","useFocusedInputLayoutHandler","IS_EDGE_TO_EDGE","KeyboardControllerViewAnimated","createAnimatedComponent","styles","create","container","flex","hidden","display","position","OS","KeyboardProvider","children","statusBarTranslucent","navigationBarTranslucent","enabled","initiallyEnabled","viewTagRef","setEnabled","progress","height","progressSV","heightSV","layout","setKeyboardHandlers","setInputHandlers","context","animated","multiply","reanimated","style","transform","translateX","translateY","onKeyboardMove","event","nativeEvent","useNativeDriver","updateSharedValues","platforms","includes","value","keyboardHandler","onKeyboardMoveStart","onKeyboardMoveInteractive","onKeyboardMoveEnd","inputLayoutHandler","onFocusedInputLayoutChanged","e","target","__DEV__","createElement","Provider","ref","onKeyboardMoveReanimated","undefined","onFocusedInputLayoutChangedReanimated","View"],"sources":["animated.tsx"],"sourcesContent":["/* eslint react/jsx-sort-props: off */\nimport React, { useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport { Animated, Platform, StyleSheet } from \"react-native\";\nimport {\n controlEdgeToEdgeValues,\n isEdgeToEdge,\n} from \"react-native-is-edge-to-edge\";\nimport Reanimated, { useSharedValue } from \"react-native-reanimated\";\n\nimport { KeyboardControllerView } from \"./bindings\";\nimport { KeyboardContext } from \"./context\";\nimport { focusedInputEventsMap, keyboardEventsMap } from \"./event-mappings\";\nimport { useAnimatedValue, useEventHandlerRegistration } from \"./internal\";\nimport { applyMonkeyPatch, revertMonkeyPatch } from \"./monkey-patch\";\nimport {\n useAnimatedKeyboardHandler,\n useFocusedInputLayoutHandler,\n} from \"./reanimated\";\n\nimport type { KeyboardAnimationContext } from \"./context\";\nimport type {\n FocusedInputHandler,\n FocusedInputLayoutChangedEvent,\n KeyboardControllerProps,\n KeyboardHandler,\n NativeEvent,\n} from \"./types\";\nimport type { ViewStyle } from \"react-native\";\n\nconst IS_EDGE_TO_EDGE = isEdgeToEdge();\n\nconst KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(\n Animated.createAnimatedComponent(KeyboardControllerView),\n);\n\ntype Styles = {\n container: ViewStyle;\n hidden: ViewStyle;\n};\n\nconst styles = StyleSheet.create<Styles>({\n container: {\n flex: 1,\n },\n hidden: {\n display: \"none\",\n position: \"absolute\",\n },\n});\n\ntype KeyboardProviderProps = {\n children: React.ReactNode;\n /**\n * Set the value to `true`, if you use translucent status bar on Android.\n * If you already control status bar translucency via `react-native-screens`\n * or `StatusBar` component from `react-native`, you can ignore it.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14\n * @platform android\n */\n statusBarTranslucent?: boolean;\n /**\n * Set the value to `true`, if you use translucent navigation bar on Android.\n * Defaults to `false`.\n *\n * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119\n * @platform android\n */\n navigationBarTranslucent?: boolean;\n /**\n * A boolean prop indicating whether the module is enabled. It indicate only initial state,\n * i. e. if you try to change this prop after component mount it will not have any effect.\n * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.\n * Defaults to `true`.\n */\n enabled?: boolean;\n};\n\n// capture `Platform.OS` in separate variable to avoid deep workletization of entire RN package\n// see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/393 and https://github.com/kirillzyusko/react-native-keyboard-controller/issues/294 for more details\nconst OS = Platform.OS;\n\nexport const KeyboardProvider = ({\n children,\n statusBarTranslucent,\n navigationBarTranslucent,\n enabled: initiallyEnabled = true,\n}: KeyboardProviderProps) => {\n // ref\n const viewTagRef = useRef<React.Component<KeyboardControllerProps>>(null);\n // state\n const [enabled, setEnabled] = useState(initiallyEnabled);\n // animated values\n const progress = useAnimatedValue(0);\n const height = useAnimatedValue(0);\n // shared values\n const progressSV = useSharedValue(0);\n const heightSV = useSharedValue(0);\n const layout = useSharedValue<FocusedInputLayoutChangedEvent | null>(null);\n const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n keyboardEventsMap,\n viewTagRef,\n );\n const setInputHandlers = useEventHandlerRegistration<FocusedInputHandler>(\n focusedInputEventsMap,\n viewTagRef,\n );\n // memo\n const context = useMemo<KeyboardAnimationContext>(\n () => ({\n enabled,\n animated: { progress: progress, height: Animated.multiply(height, -1) },\n reanimated: { progress: progressSV, height: heightSV },\n layout,\n setKeyboardHandlers,\n setInputHandlers,\n setEnabled,\n }),\n [enabled],\n );\n const style = useMemo(\n () => [\n styles.hidden,\n { transform: [{ translateX: height }, { translateY: progress }] },\n ],\n [],\n );\n const onKeyboardMove = useMemo(\n () =>\n Animated.event(\n [\n {\n nativeEvent: {\n progress,\n height,\n },\n },\n ],\n // Setting useNativeDriver to true on web triggers a warning due to the absence of a native driver for web. Therefore, it is set to false.\n { useNativeDriver: Platform.OS !== \"web\" },\n ),\n [],\n );\n // handlers\n const updateSharedValues = (event: NativeEvent, platforms: string[]) => {\n \"worklet\";\n\n if (platforms.includes(OS)) {\n // eslint-disable-next-line react-compiler/react-compiler\n progressSV.value = event.progress;\n heightSV.value = -event.height;\n }\n };\n const keyboardHandler = useAnimatedKeyboardHandler(\n {\n onKeyboardMoveStart: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"ios\"]);\n },\n onKeyboardMove: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n onKeyboardMoveInteractive: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\", \"ios\"]);\n },\n onKeyboardMoveEnd: (event: NativeEvent) => {\n \"worklet\";\n\n updateSharedValues(event, [\"android\"]);\n },\n },\n [],\n );\n const inputLayoutHandler = useFocusedInputLayoutHandler(\n {\n onFocusedInputLayoutChanged: (e) => {\n \"worklet\";\n\n if (e.target !== -1) {\n layout.value = e;\n } else {\n layout.value = null;\n }\n },\n },\n [],\n );\n\n // layout effects\n useLayoutEffect(() => {\n if (enabled) {\n applyMonkeyPatch();\n } else {\n revertMonkeyPatch();\n }\n }, [enabled]);\n\n if (__DEV__) {\n controlEdgeToEdgeValues({ statusBarTranslucent, navigationBarTranslucent });\n }\n\n return (\n <KeyboardContext.Provider value={context}>\n <KeyboardControllerViewAnimated\n ref={viewTagRef}\n enabled={enabled}\n navigationBarTranslucent={IS_EDGE_TO_EDGE || navigationBarTranslucent}\n statusBarTranslucent={IS_EDGE_TO_EDGE || statusBarTranslucent}\n style={styles.container}\n // on*Reanimated prop must precede animated handlers to work correctly\n onKeyboardMoveReanimated={keyboardHandler}\n onKeyboardMoveStart={OS === \"ios\" ? onKeyboardMove : undefined}\n onKeyboardMove={OS === \"android\" ? onKeyboardMove : undefined}\n onKeyboardMoveInteractive={onKeyboardMove}\n onKeyboardMoveEnd={OS === \"android\" ? onKeyboardMove : undefined}\n onFocusedInputLayoutChangedReanimated={inputLayoutHandler}\n >\n {children}\n </KeyboardControllerViewAnimated>\n <Animated.View\n // we are using this small hack, because if the component (where\n // animated value has been used) is unmounted, then animation will\n // stop receiving events (seems like it's react-native optimization).\n // So we need to keep a reference to the animated value, to keep it's\n // always mounted (keep a reference to an animated value).\n //\n // To test why it's needed, try to open screen which consumes Animated.Value\n // then close it and open it again (for example 'Animated transition').\n style={style}\n />\n </KeyboardContext.Provider>\n );\n};\n"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SAASC,QAAQ,EAAEC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EA,oBACEpC,KAAA,CAAAyE,aAAA,CAAC5D,eAAe,CAAC6D,QAAQ;IAACX,KAAK,EAAEf;EAAQ,gBACvChD,KAAA,CAAAyE,aAAA,CAAClD,8BAA8B;IAC7BoD,GAAG,EAAEpC,UAAW;IAChBF,OAAO,EAAEA,OAAQ;IACjBD,wBAAwB,EAAEd,eAAe,IAAIc,wBAAyB;IACtED,oBAAoB,EAAEb,eAAe,IAAIa,oBAAqB;IAC9DiB,KAAK,EAAE3B,MAAM,CAACE;IACd;IAAA;IACAiD,wBAAwB,EAAEZ,eAAgB;IAC1CC,mBAAmB,EAAEjC,EAAE,KAAK,KAAK,GAAGwB,cAAc,GAAGqB,SAAU;IAC/DrB,cAAc,EAAExB,EAAE,KAAK,SAAS,GAAGwB,cAAc,GAAGqB,SAAU;IAC9DX,yBAAyB,EAAEV,cAAe;IAC1CW,iBAAiB,EAAEnC,EAAE,KAAK,SAAS,GAAGwB,cAAc,GAAGqB,SAAU;IACjEC,qCAAqC,EAAEV;EAAmB,GAEzDlC,QAC6B,CAAC,eACjClC,KAAA,CAAAyE,aAAA,CAACpE,QAAQ,CAAC0E,IAAI;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA3B,KAAK,EAAEA;EAAM,CACd,CACuB,CAAC;AAE/B,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keyboard-controller",
3
- "version": "1.15.1",
3
+ "version": "1.15.2",
4
4
  "description": "Keyboard manager which works in identical way on both iOS and Android",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/animated.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint react/jsx-sort-props: off */
2
- import React, { useEffect, useMemo, useRef, useState } from "react";
2
+ import React, { useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { Animated, Platform, StyleSheet } from "react-native";
4
4
  import {
5
5
  controlEdgeToEdgeValues,
@@ -192,8 +192,8 @@ export const KeyboardProvider = ({
192
192
  [],
193
193
  );
194
194
 
195
- // effects
196
- useEffect(() => {
195
+ // layout effects
196
+ useLayoutEffect(() => {
197
197
  if (enabled) {
198
198
  applyMonkeyPatch();
199
199
  } else {