react-native-keyboard-controller 1.17.1 → 1.17.3

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.
Files changed (135) hide show
  1. package/README.md +24 -23
  2. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +20 -0
  3. package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +4 -0
  4. package/ios/KeyboardControllerModule.mm +2 -0
  5. package/ios/views/KeyboardControllerView.mm +18 -0
  6. package/ios/views/KeyboardControllerViewManager.swift +19 -0
  7. package/lib/commonjs/animated.js +23 -7
  8. package/lib/commonjs/animated.js.map +1 -1
  9. package/lib/commonjs/bindings.js +19 -0
  10. package/lib/commonjs/bindings.js.map +1 -1
  11. package/lib/commonjs/components/KeyboardAvoidingView/index.js +14 -4
  12. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
  13. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +54 -36
  14. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  15. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +17 -1
  16. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  17. package/lib/commonjs/components/KeyboardStickyView/index.js +13 -0
  18. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
  19. package/lib/commonjs/components/KeyboardToolbar/index.js +31 -22
  20. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  21. package/lib/commonjs/context.js +16 -0
  22. package/lib/commonjs/context.js.map +1 -1
  23. package/lib/commonjs/hooks/index.js +164 -0
  24. package/lib/commonjs/hooks/index.js.map +1 -1
  25. package/lib/commonjs/hooks/useKeyboardState/index.js +21 -0
  26. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
  27. package/lib/commonjs/hooks/useWindowDimensions/index.js +29 -6
  28. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -1
  29. package/lib/commonjs/internal.js +21 -0
  30. package/lib/commonjs/internal.js.map +1 -1
  31. package/lib/commonjs/module.js +4 -0
  32. package/lib/commonjs/module.js.map +1 -1
  33. package/lib/commonjs/monkey-patch.android.js +0 -5
  34. package/lib/commonjs/monkey-patch.android.js.map +1 -1
  35. package/lib/commonjs/{types.js → types/hooks.js} +1 -1
  36. package/lib/commonjs/types/hooks.js.map +1 -0
  37. package/lib/commonjs/types/index.js +50 -0
  38. package/lib/commonjs/types/index.js.map +1 -0
  39. package/lib/commonjs/types/internal.js +6 -0
  40. package/lib/commonjs/types/internal.js.map +1 -0
  41. package/lib/commonjs/types/module.js +6 -0
  42. package/lib/commonjs/types/module.js.map +1 -0
  43. package/lib/commonjs/types/views.js +6 -0
  44. package/lib/commonjs/types/views.js.map +1 -0
  45. package/lib/commonjs/views/OverKeyboardView/index.js +18 -4
  46. package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -1
  47. package/lib/module/animated.js +23 -7
  48. package/lib/module/animated.js.map +1 -1
  49. package/lib/module/bindings.js +19 -0
  50. package/lib/module/bindings.js.map +1 -1
  51. package/lib/module/components/KeyboardAvoidingView/index.js +14 -4
  52. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
  53. package/lib/module/components/KeyboardAwareScrollView/index.js +56 -38
  54. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  55. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +17 -1
  56. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
  57. package/lib/module/components/KeyboardStickyView/index.js +13 -0
  58. package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
  59. package/lib/module/components/KeyboardToolbar/index.js +31 -22
  60. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  61. package/lib/module/context.js +16 -0
  62. package/lib/module/context.js.map +1 -1
  63. package/lib/module/hooks/index.js +164 -0
  64. package/lib/module/hooks/index.js.map +1 -1
  65. package/lib/module/hooks/useKeyboardState/index.js +21 -0
  66. package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
  67. package/lib/module/hooks/useWindowDimensions/index.js +28 -1
  68. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -1
  69. package/lib/module/internal.js +21 -0
  70. package/lib/module/internal.js.map +1 -1
  71. package/lib/module/module.js +4 -0
  72. package/lib/module/module.js.map +1 -1
  73. package/lib/module/monkey-patch.android.js +0 -5
  74. package/lib/module/monkey-patch.android.js.map +1 -1
  75. package/lib/module/types/hooks.js +2 -0
  76. package/lib/module/types/hooks.js.map +1 -0
  77. package/lib/module/types/index.js +5 -0
  78. package/lib/module/types/index.js.map +1 -0
  79. package/lib/module/types/internal.js +2 -0
  80. package/lib/module/types/internal.js.map +1 -0
  81. package/lib/module/types/module.js +2 -0
  82. package/lib/module/types/module.js.map +1 -0
  83. package/lib/module/types/views.js +2 -0
  84. package/lib/module/types/views.js.map +1 -0
  85. package/lib/module/views/OverKeyboardView/index.js +18 -4
  86. package/lib/module/views/OverKeyboardView/index.js.map +1 -1
  87. package/lib/typescript/animated.d.ts +20 -6
  88. package/lib/typescript/bindings.d.ts +19 -0
  89. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +11 -2
  90. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +23 -6
  91. package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +17 -1
  92. package/lib/typescript/components/KeyboardStickyView/index.d.ts +15 -2
  93. package/lib/typescript/components/KeyboardToolbar/index.d.ts +13 -2
  94. package/lib/typescript/context.d.ts +32 -0
  95. package/lib/typescript/hooks/index.d.ts +157 -0
  96. package/lib/typescript/hooks/useKeyboardState/index.d.ts +20 -0
  97. package/lib/typescript/hooks/useWindowDimensions/index.d.ts +2 -1
  98. package/lib/typescript/internal.d.ts +21 -0
  99. package/lib/typescript/module.d.ts +3 -0
  100. package/lib/typescript/{types.d.ts → types/hooks.d.ts} +72 -78
  101. package/lib/typescript/types/index.d.ts +4 -0
  102. package/lib/typescript/types/internal.d.ts +17 -0
  103. package/lib/typescript/types/module.d.ts +91 -0
  104. package/lib/typescript/types/views.d.ts +45 -0
  105. package/lib/typescript/views/OverKeyboardView/index.d.ts +14 -1
  106. package/package.json +2 -1
  107. package/src/animated.tsx +27 -12
  108. package/src/bindings.ts +19 -0
  109. package/src/components/KeyboardAvoidingView/index.tsx +14 -4
  110. package/src/components/KeyboardAwareScrollView/index.tsx +60 -40
  111. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +17 -1
  112. package/src/components/KeyboardStickyView/index.tsx +14 -1
  113. package/src/components/KeyboardToolbar/index.tsx +31 -19
  114. package/src/context.ts +33 -0
  115. package/src/hooks/index.ts +157 -0
  116. package/src/hooks/useKeyboardState/index.ts +20 -0
  117. package/src/hooks/useWindowDimensions/index.ts +41 -1
  118. package/src/internal.ts +21 -0
  119. package/src/module.ts +3 -0
  120. package/src/monkey-patch.android.ts +3 -6
  121. package/src/{types.ts → types/hooks.ts} +72 -105
  122. package/src/types/index.ts +4 -0
  123. package/src/types/internal.ts +24 -0
  124. package/src/types/module.ts +105 -0
  125. package/src/types/views.ts +46 -0
  126. package/src/views/OverKeyboardView/index.tsx +15 -4
  127. package/lib/commonjs/hooks/useWindowDimensions/index.android.js +0 -34
  128. package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +0 -1
  129. package/lib/commonjs/types.js.map +0 -1
  130. package/lib/module/hooks/useWindowDimensions/index.android.js +0 -27
  131. package/lib/module/hooks/useWindowDimensions/index.android.js.map +0 -1
  132. package/lib/module/types.js +0 -2
  133. package/lib/module/types.js.map +0 -1
  134. package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +0 -2
  135. package/src/hooks/useWindowDimensions/index.android.ts +0 -38
@@ -2,6 +2,20 @@ import { useRef } from "react";
2
2
  import { Animated } from "react-native";
3
3
  import { registerEventHandler, unregisterEventHandler } from "./event-handler";
4
4
  import { findNodeHandle } from "./utils/findNodeHandle";
5
+ /**
6
+ * An internal hook that helps to register workletized event handlers.
7
+ *
8
+ * @param map - Map of event handlers and their names.
9
+ * @param viewTagRef - Ref to the view that produces events.
10
+ * @returns A function that registers supplied event handlers.
11
+ * @example
12
+ * ```ts
13
+ * const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(
14
+ * keyboardEventsMap,
15
+ * viewTagRef,
16
+ * );
17
+ * ```
18
+ */
5
19
  export function useEventHandlerRegistration(map, viewTagRef) {
6
20
  const onRegisterHandler = handler => {
7
21
  const ids = [];
@@ -43,7 +57,14 @@ export function useEventHandlerRegistration(map, viewTagRef) {
43
57
  * and therefore consumes less memory. We can not use a variant from
44
58
  * RN, since this library supports earlier versions of RN.
45
59
  *
60
+ * @param initialValue - Initial value of the animated value (numeric).
61
+ * @param config - Additional {@link Animated.AnimatedConfig|configuration} for the animated value.
62
+ * @returns Properly memoized {@link Animated.Value|Animated} value.
46
63
  * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937
64
+ * @example
65
+ * ```ts
66
+ * const progress = useAnimatedValue(0);
67
+ * ```
47
68
  */
48
69
  export function useAnimatedValue(initialValue, config) {
49
70
  const ref = useRef(null);
@@ -1 +1 @@
1
- {"version":3,"names":["useRef","Animated","registerEventHandler","unregisterEventHandler","findNodeHandle","useEventHandlerRegistration","map","viewTagRef","onRegisterHandler","handler","ids","attachWorkletHandlers","viewTag","current","__DEV__","console","warn","push","Object","keys","handlerName","eventName","get","functionToCall","event","queueMicrotask","forEach","id","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useRef } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport { registerEventHandler, unregisterEventHandler } from \"./event-handler\";\nimport { findNodeHandle } from \"./utils/findNodeHandle\";\n\ntype EventHandler = (event: never) => void;\ntype ComponentOrHandle = Parameters<typeof findNodeHandle>[0];\n\nexport function useEventHandlerRegistration<\n H extends Partial<Record<string, EventHandler>>,\n>(\n map: Map<keyof H, string>,\n viewTagRef: React.MutableRefObject<ComponentOrHandle>,\n) {\n const onRegisterHandler = (handler: H) => {\n const ids: (number | null)[] = [];\n const attachWorkletHandlers = () => {\n const viewTag = findNodeHandle(viewTagRef.current);\n\n if (__DEV__ && !viewTag) {\n console.warn(\n \"Can not attach worklet handlers for `react-native-keyboard-controller` because view tag can not be resolved. Be sure that `KeyboardProvider` is fully mounted before registering handlers. If you think it is a bug in library, please open an issue.\",\n );\n }\n\n ids.push(\n ...Object.keys(handler).map((handlerName) => {\n const eventName = map.get(handlerName as keyof H);\n const functionToCall = handler[handlerName as keyof H];\n\n if (eventName && viewTag) {\n return registerEventHandler(\n (event: Parameters<NonNullable<H[keyof H]>>[0]) => {\n \"worklet\";\n\n functionToCall?.(event);\n },\n eventName,\n viewTag,\n );\n }\n\n return null;\n }),\n );\n };\n\n if (viewTagRef.current) {\n attachWorkletHandlers();\n } else {\n // view may not be mounted yet - defer registration until call-stack becomes empty\n queueMicrotask(attachWorkletHandlers);\n }\n\n return () => {\n ids.forEach((id) => (id ? unregisterEventHandler(id) : null));\n };\n };\n\n return onRegisterHandler;\n}\n\n/**\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\n * A better alternative of storing animated values in refs, since\n * it doesn't recreate a new `Animated.Value` object on every re-render\n * and therefore consumes less memory. We can not use a variant from\n * RN, since this library supports earlier versions of RN.\n *\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\n */\nexport function useAnimatedValue(\n initialValue: number,\n config?: Animated.AnimatedConfig,\n): Animated.Value {\n const ref = useRef<Animated.Value | null>(null);\n\n if (ref.current === null) {\n ref.current = new Animated.Value(initialValue, config);\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,oBAAoB,EAAEC,sBAAsB,QAAQ,iBAAiB;AAC9E,SAASC,cAAc,QAAQ,wBAAwB;AAKvD,OAAO,SAASC,2BAA2BA,CAGzCC,GAAyB,EACzBC,UAAqD,EACrD;EACA,MAAMC,iBAAiB,GAAIC,OAAU,IAAK;IACxC,MAAMC,GAAsB,GAAG,EAAE;IACjC,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;MAClC,MAAMC,OAAO,GAAGR,cAAc,CAACG,UAAU,CAACM,OAAO,CAAC;MAElD,IAAIC,OAAO,IAAI,CAACF,OAAO,EAAE;QACvBG,OAAO,CAACC,IAAI,CACV,uPACF,CAAC;MACH;MAEAN,GAAG,CAACO,IAAI,CACN,GAAGC,MAAM,CAACC,IAAI,CAACV,OAAO,CAAC,CAACH,GAAG,CAAEc,WAAW,IAAK;QAC3C,MAAMC,SAAS,GAAGf,GAAG,CAACgB,GAAG,CAACF,WAAsB,CAAC;QACjD,MAAMG,cAAc,GAAGd,OAAO,CAACW,WAAW,CAAY;QAEtD,IAAIC,SAAS,IAAIT,OAAO,EAAE;UACxB,OAAOV,oBAAoB,CACxBsB,KAA6C,IAAK;YACjD,SAAS;;YAETD,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAGC,KAAK,CAAC;UACzB,CAAC,EACDH,SAAS,EACTT,OACF,CAAC;QACH;QAEA,OAAO,IAAI;MACb,CAAC,CACH,CAAC;IACH,CAAC;IAED,IAAIL,UAAU,CAACM,OAAO,EAAE;MACtBF,qBAAqB,CAAC,CAAC;IACzB,CAAC,MAAM;MACL;MACAc,cAAc,CAACd,qBAAqB,CAAC;IACvC;IAEA,OAAO,MAAM;MACXD,GAAG,CAACgB,OAAO,CAAEC,EAAE,IAAMA,EAAE,GAAGxB,sBAAsB,CAACwB,EAAE,CAAC,GAAG,IAAK,CAAC;IAC/D,CAAC;EACH,CAAC;EAED,OAAOnB,iBAAiB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASoB,gBAAgBA,CAC9BC,YAAoB,EACpBC,MAAgC,EAChB;EAChB,MAAMC,GAAG,GAAG/B,MAAM,CAAwB,IAAI,CAAC;EAE/C,IAAI+B,GAAG,CAAClB,OAAO,KAAK,IAAI,EAAE;IACxBkB,GAAG,CAAClB,OAAO,GAAG,IAAIZ,QAAQ,CAAC+B,KAAK,CAACH,YAAY,EAAEC,MAAM,CAAC;EACxD;EAEA,OAAOC,GAAG,CAAClB,OAAO;AACpB","ignoreList":[]}
1
+ {"version":3,"names":["useRef","Animated","registerEventHandler","unregisterEventHandler","findNodeHandle","useEventHandlerRegistration","map","viewTagRef","onRegisterHandler","handler","ids","attachWorkletHandlers","viewTag","current","__DEV__","console","warn","push","Object","keys","handlerName","eventName","get","functionToCall","event","queueMicrotask","forEach","id","useAnimatedValue","initialValue","config","ref","Value"],"sources":["internal.ts"],"sourcesContent":["import { useRef } from \"react\";\nimport { Animated } from \"react-native\";\n\nimport { registerEventHandler, unregisterEventHandler } from \"./event-handler\";\nimport { findNodeHandle } from \"./utils/findNodeHandle\";\n\ntype EventHandler = (event: never) => void;\ntype ComponentOrHandle = Parameters<typeof findNodeHandle>[0];\n\n/**\n * An internal hook that helps to register workletized event handlers.\n *\n * @param map - Map of event handlers and their names.\n * @param viewTagRef - Ref to the view that produces events.\n * @returns A function that registers supplied event handlers.\n * @example\n * ```ts\n * const setKeyboardHandlers = useEventHandlerRegistration<KeyboardHandler>(\n * keyboardEventsMap,\n * viewTagRef,\n * );\n * ```\n */\nexport function useEventHandlerRegistration<\n H extends Partial<Record<string, EventHandler>>,\n>(\n map: Map<keyof H, string>,\n viewTagRef: React.MutableRefObject<ComponentOrHandle>,\n) {\n const onRegisterHandler = (handler: H) => {\n const ids: (number | null)[] = [];\n const attachWorkletHandlers = () => {\n const viewTag = findNodeHandle(viewTagRef.current);\n\n if (__DEV__ && !viewTag) {\n console.warn(\n \"Can not attach worklet handlers for `react-native-keyboard-controller` because view tag can not be resolved. Be sure that `KeyboardProvider` is fully mounted before registering handlers. If you think it is a bug in library, please open an issue.\",\n );\n }\n\n ids.push(\n ...Object.keys(handler).map((handlerName) => {\n const eventName = map.get(handlerName as keyof H);\n const functionToCall = handler[handlerName as keyof H];\n\n if (eventName && viewTag) {\n return registerEventHandler(\n (event: Parameters<NonNullable<H[keyof H]>>[0]) => {\n \"worklet\";\n\n functionToCall?.(event);\n },\n eventName,\n viewTag,\n );\n }\n\n return null;\n }),\n );\n };\n\n if (viewTagRef.current) {\n attachWorkletHandlers();\n } else {\n // view may not be mounted yet - defer registration until call-stack becomes empty\n queueMicrotask(attachWorkletHandlers);\n }\n\n return () => {\n ids.forEach((id) => (id ? unregisterEventHandler(id) : null));\n };\n };\n\n return onRegisterHandler;\n}\n\n/**\n * TS variant of `useAnimatedValue` hook which is added in RN 0.71\n * A better alternative of storing animated values in refs, since\n * it doesn't recreate a new `Animated.Value` object on every re-render\n * and therefore consumes less memory. We can not use a variant from\n * RN, since this library supports earlier versions of RN.\n *\n * @param initialValue - Initial value of the animated value (numeric).\n * @param config - Additional {@link Animated.AnimatedConfig|configuration} for the animated value.\n * @returns Properly memoized {@link Animated.Value|Animated} value.\n * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937\n * @example\n * ```ts\n * const progress = useAnimatedValue(0);\n * ```\n */\nexport function useAnimatedValue(\n initialValue: number,\n config?: Animated.AnimatedConfig,\n): Animated.Value {\n const ref = useRef<Animated.Value | null>(null);\n\n if (ref.current === null) {\n ref.current = new Animated.Value(initialValue, config);\n }\n\n return ref.current;\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AAEvC,SAASC,oBAAoB,EAAEC,sBAAsB,QAAQ,iBAAiB;AAC9E,SAASC,cAAc,QAAQ,wBAAwB;AAKvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,2BAA2BA,CAGzCC,GAAyB,EACzBC,UAAqD,EACrD;EACA,MAAMC,iBAAiB,GAAIC,OAAU,IAAK;IACxC,MAAMC,GAAsB,GAAG,EAAE;IACjC,MAAMC,qBAAqB,GAAGA,CAAA,KAAM;MAClC,MAAMC,OAAO,GAAGR,cAAc,CAACG,UAAU,CAACM,OAAO,CAAC;MAElD,IAAIC,OAAO,IAAI,CAACF,OAAO,EAAE;QACvBG,OAAO,CAACC,IAAI,CACV,uPACF,CAAC;MACH;MAEAN,GAAG,CAACO,IAAI,CACN,GAAGC,MAAM,CAACC,IAAI,CAACV,OAAO,CAAC,CAACH,GAAG,CAAEc,WAAW,IAAK;QAC3C,MAAMC,SAAS,GAAGf,GAAG,CAACgB,GAAG,CAACF,WAAsB,CAAC;QACjD,MAAMG,cAAc,GAAGd,OAAO,CAACW,WAAW,CAAY;QAEtD,IAAIC,SAAS,IAAIT,OAAO,EAAE;UACxB,OAAOV,oBAAoB,CACxBsB,KAA6C,IAAK;YACjD,SAAS;;YAETD,cAAc,aAAdA,cAAc,eAAdA,cAAc,CAAGC,KAAK,CAAC;UACzB,CAAC,EACDH,SAAS,EACTT,OACF,CAAC;QACH;QAEA,OAAO,IAAI;MACb,CAAC,CACH,CAAC;IACH,CAAC;IAED,IAAIL,UAAU,CAACM,OAAO,EAAE;MACtBF,qBAAqB,CAAC,CAAC;IACzB,CAAC,MAAM;MACL;MACAc,cAAc,CAACd,qBAAqB,CAAC;IACvC;IAEA,OAAO,MAAM;MACXD,GAAG,CAACgB,OAAO,CAAEC,EAAE,IAAMA,EAAE,GAAGxB,sBAAsB,CAACwB,EAAE,CAAC,GAAG,IAAK,CAAC;IAC/D,CAAC;EACH,CAAC;EAED,OAAOnB,iBAAiB;AAC1B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASoB,gBAAgBA,CAC9BC,YAAoB,EACpBC,MAAgC,EAChB;EAChB,MAAMC,GAAG,GAAG/B,MAAM,CAAwB,IAAI,CAAC;EAE/C,IAAI+B,GAAG,CAAClB,OAAO,KAAK,IAAI,EAAE;IACxBkB,GAAG,CAAClB,OAAO,GAAG,IAAIZ,QAAQ,CAAC+B,KAAK,CAACH,YAAY,EAAEC,MAAM,CAAC;EACxD;EAEA,OAAOC,GAAG,CAAClB,OAAO;AACpB","ignoreList":[]}
@@ -32,6 +32,10 @@ const dismiss = async options => {
32
32
  };
33
33
  const isVisible = () => !isClosed;
34
34
  const state = () => lastState;
35
+
36
+ /**
37
+ * KeyboardController module. Helps to perform imperative actions/checks with keyboard.
38
+ */
35
39
  export const KeyboardController = {
36
40
  setDefaultMode: KeyboardControllerNative.setDefaultMode,
37
41
  setInputMode: KeyboardControllerNative.setInputMode,
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardControllerNative","KeyboardEvents","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","addListener","e","dismiss","options","keepFocus","Promise","resolve","subscription","undefined","remove","isVisible","state","KeyboardController","setDefaultMode","setInputMode","setFocusTo"],"sources":["module.ts"],"sourcesContent":["import { KeyboardControllerNative, KeyboardEvents } from \"./bindings\";\n\nimport type {\n DismissOptions,\n KeyboardControllerModule,\n KeyboardEventData,\n} from \"./types\";\n\nlet isClosed = true;\nlet lastState: KeyboardEventData = {\n height: 0,\n duration: 0,\n timestamp: new Date().getTime(),\n target: -1,\n type: \"default\",\n appearance: \"default\",\n};\n\nKeyboardEvents.addListener(\"keyboardDidHide\", (e) => {\n isClosed = true;\n lastState = e;\n});\n\nKeyboardEvents.addListener(\"keyboardDidShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: DismissOptions): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n\n return new Promise((resolve) => {\n if (isClosed) {\n resolve();\n\n return;\n }\n\n const subscription = KeyboardEvents.addListener(\"keyboardDidHide\", () => {\n resolve(undefined);\n subscription.remove();\n });\n\n KeyboardControllerNative.dismiss(keepFocus);\n });\n};\nconst isVisible = () => !isClosed;\nconst state = () => lastState;\n\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: KeyboardControllerNative.setDefaultMode,\n setInputMode: KeyboardControllerNative.setInputMode,\n setFocusTo: KeyboardControllerNative.setFocusTo,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,cAAc,QAAQ,YAAY;AAQrE,IAAIC,QAAQ,GAAG,IAAI;AACnB,IAAIC,SAA4B,GAAG;EACjCC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC/BC,MAAM,EAAE,CAAC,CAAC;EACVC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE;AACd,CAAC;AAEDV,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,IAAI;EACfC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEFZ,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,KAAK;EAChBC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOC,OAAwB,IAAoB;EACjE,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAE7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIhB,QAAQ,EAAE;MACZgB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGlB,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEM,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFrB,wBAAwB,CAACc,OAAO,CAACE,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC;AACD,MAAMM,SAAS,GAAGA,CAAA,KAAM,CAACpB,QAAQ;AACjC,MAAMqB,KAAK,GAAGA,CAAA,KAAMpB,SAAS;AAE7B,OAAO,MAAMqB,kBAA4C,GAAG;EAC1DC,cAAc,EAAEzB,wBAAwB,CAACyB,cAAc;EACvDC,YAAY,EAAE1B,wBAAwB,CAAC0B,YAAY;EACnDC,UAAU,EAAE3B,wBAAwB,CAAC2B,UAAU;EAC/Cb,OAAO;EACPQ,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["KeyboardControllerNative","KeyboardEvents","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","addListener","e","dismiss","options","keepFocus","Promise","resolve","subscription","undefined","remove","isVisible","state","KeyboardController","setDefaultMode","setInputMode","setFocusTo"],"sources":["module.ts"],"sourcesContent":["import { KeyboardControllerNative, KeyboardEvents } from \"./bindings\";\n\nimport type {\n DismissOptions,\n KeyboardControllerModule,\n KeyboardEventData,\n} from \"./types\";\n\nlet isClosed = true;\nlet lastState: KeyboardEventData = {\n height: 0,\n duration: 0,\n timestamp: new Date().getTime(),\n target: -1,\n type: \"default\",\n appearance: \"default\",\n};\n\nKeyboardEvents.addListener(\"keyboardDidHide\", (e) => {\n isClosed = true;\n lastState = e;\n});\n\nKeyboardEvents.addListener(\"keyboardDidShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: DismissOptions): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n\n return new Promise((resolve) => {\n if (isClosed) {\n resolve();\n\n return;\n }\n\n const subscription = KeyboardEvents.addListener(\"keyboardDidHide\", () => {\n resolve(undefined);\n subscription.remove();\n });\n\n KeyboardControllerNative.dismiss(keepFocus);\n });\n};\nconst isVisible = () => !isClosed;\nconst state = () => lastState;\n\n/**\n * KeyboardController module. Helps to perform imperative actions/checks with keyboard.\n */\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: KeyboardControllerNative.setDefaultMode,\n setInputMode: KeyboardControllerNative.setInputMode,\n setFocusTo: KeyboardControllerNative.setFocusTo,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,cAAc,QAAQ,YAAY;AAQrE,IAAIC,QAAQ,GAAG,IAAI;AACnB,IAAIC,SAA4B,GAAG;EACjCC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC/BC,MAAM,EAAE,CAAC,CAAC;EACVC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE;AACd,CAAC;AAEDV,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,IAAI;EACfC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEFZ,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,KAAK;EAChBC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOC,OAAwB,IAAoB;EACjE,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAE7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIhB,QAAQ,EAAE;MACZgB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGlB,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEM,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFrB,wBAAwB,CAACc,OAAO,CAACE,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC;AACD,MAAMM,SAAS,GAAGA,CAAA,KAAM,CAACpB,QAAQ;AACjC,MAAMqB,KAAK,GAAGA,CAAA,KAAMpB,SAAS;;AAE7B;AACA;AACA;AACA,OAAO,MAAMqB,kBAA4C,GAAG;EAC1DC,cAAc,EAAEzB,wBAAwB,CAACyB,cAAc;EACvDC,YAAY,EAAE1B,wBAAwB,CAAC0B,YAAY;EACnDC,UAAU,EAAE3B,wBAAwB,CAAC2B,UAAU;EAC/Cb,OAAO;EACPQ,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
@@ -22,11 +22,6 @@ const ModifiedNativeAndroidManager = {
22
22
  setTranslucent: translucent => {
23
23
  RCTStatusBarManagerCompat.setTranslucent(translucent);
24
24
  },
25
- /**
26
- * - statusBarStyles can be:
27
- * - 'default'
28
- * - 'dark-content'
29
- */
30
25
  setStyle: statusBarStyle => {
31
26
  RCTStatusBarManagerCompat.setStyle(statusBarStyle);
32
27
  },
@@ -1 +1 @@
1
- {"version":3,"names":["NativeAndroidManager","RCTStatusBarManagerCompat","require","default","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","Object","assign","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\n\nconst RCTStatusBarManagerCompat =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"./specs/NativeStatusBarManagerCompat\").default;\n\n// Copy original default manager to keep its original state and methods\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\n\n// Create a new object that modifies the necessary methods\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nconst ModifiedNativeAndroidManager = {\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\n setColor: (color: number, animated: boolean): void => {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n setTranslucent: (translucent: boolean): void => {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n /**\n * - statusBarStyles can be:\n * - 'default'\n * - 'dark-content'\n */\n setStyle: (statusBarStyle?: string): void => {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n setHidden: (hidden: boolean): void => {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n};\n\n// Define a function to apply the monkey patch\nexport const applyMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);\n};\n\n// Define a function to revert changes back to the original state\nexport const revertMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);\n};\n"],"mappings":"AAAA;AACA,OAAO,KAAKA,oBAAoB,MAAM,2EAA2E;AAEjH,MAAMC,yBAAyB;AAC7B;AACAC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;;AAEzD;AACA,MAAMC,4BAA4B,GAAG;EAAE,GAAGJ,oBAAoB,CAACG;AAAQ,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAME,4BAA4B,GAAG;EACnC,GAAGL,oBAAoB,CAACG,OAAO;EAAE;EACjCG,QAAQ,EAAEA,CAACC,KAAa,EAAEC,QAAiB,KAAW;IACpDP,yBAAyB,CAACK,QAAQ,CAACC,KAAK,EAAEC,QAAQ,CAAC;EACrD,CAAC;EACDC,cAAc,EAAGC,WAAoB,IAAW;IAC9CT,yBAAyB,CAACQ,cAAc,CAACC,WAAW,CAAC;EACvD,CAAC;EACD;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAGC,cAAuB,IAAW;IAC3CX,yBAAyB,CAACU,QAAQ,CAACC,cAAc,CAAC;EACpD,CAAC;EACDC,SAAS,EAAGC,MAAe,IAAW;IACpCb,yBAAyB,CAACY,SAAS,CAACC,MAAM,CAAC;EAC7C;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpCC,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEE,4BAA4B,CAAC;AAC3E,CAAC;;AAED;AACA,OAAO,MAAMa,iBAAiB,GAAGA,CAAA,KAAM;EACrCF,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEC,4BAA4B,CAAC;AAC3E,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["NativeAndroidManager","RCTStatusBarManagerCompat","require","default","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","Object","assign","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\n\nconst RCTStatusBarManagerCompat =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"./specs/NativeStatusBarManagerCompat\").default;\n\n// Copy original default manager to keep its original state and methods\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\n\n// Create a new object that modifies the necessary methods\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nconst ModifiedNativeAndroidManager = {\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\n setColor: (color: number, animated: boolean): void => {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n setTranslucent: (translucent: boolean): void => {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n setStyle: (\n statusBarStyle?: \"default\" | \"dark-content\" | \"light-content\",\n ): void => {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n setHidden: (hidden: boolean): void => {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n};\n\n// Define a function to apply the monkey patch\nexport const applyMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);\n};\n\n// Define a function to revert changes back to the original state\nexport const revertMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);\n};\n"],"mappings":"AAAA;AACA,OAAO,KAAKA,oBAAoB,MAAM,2EAA2E;AAEjH,MAAMC,yBAAyB;AAC7B;AACAC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;;AAEzD;AACA,MAAMC,4BAA4B,GAAG;EAAE,GAAGJ,oBAAoB,CAACG;AAAQ,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAME,4BAA4B,GAAG;EACnC,GAAGL,oBAAoB,CAACG,OAAO;EAAE;EACjCG,QAAQ,EAAEA,CAACC,KAAa,EAAEC,QAAiB,KAAW;IACpDP,yBAAyB,CAACK,QAAQ,CAACC,KAAK,EAAEC,QAAQ,CAAC;EACrD,CAAC;EACDC,cAAc,EAAGC,WAAoB,IAAW;IAC9CT,yBAAyB,CAACQ,cAAc,CAACC,WAAW,CAAC;EACvD,CAAC;EACDC,QAAQ,EACNC,cAA6D,IACpD;IACTX,yBAAyB,CAACU,QAAQ,CAACC,cAAc,CAAC;EACpD,CAAC;EACDC,SAAS,EAAGC,MAAe,IAAW;IACpCb,yBAAyB,CAACY,SAAS,CAACC,MAAM,CAAC;EAC7C;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpCC,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEE,4BAA4B,CAAC;AAC3E,CAAC;;AAED;AACA,OAAO,MAAMa,iBAAiB,GAAGA,CAAA,KAAM;EACrCF,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEC,4BAA4B,CAAC;AAC3E,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["hooks.ts"],"sourcesContent":["import type { NativeSyntheticEvent, ViewProps } from \"react-native\";\n\n// DirectEventHandler events declaration\nexport type NativeEvent = {\n /** A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible. */\n progress: number;\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n};\nexport type FocusedInputLayoutChangedEvent = {\n /** Tag of the focused `TextInput`. */\n target: number;\n /** Tag of the parent `ScrollView`. */\n parentScrollViewTarget: number;\n layout: {\n /** X coordinate of the focused `TextInput`. */\n x: number;\n /** Y coordinate of the focused `TextInput`. */\n y: number;\n /** Width of the focused `TextInput`. */\n width: number;\n /** Height of the focused `TextInput`. */\n height: number;\n /** X coordinate of the focused `TextInput` relative to the screen. */\n absoluteX: number;\n /** Y coordinate of the focused `TextInput` relative to the screen. */\n absoluteY: number;\n };\n};\nexport type FocusedInputTextChangedEvent = {\n /** Text that user typed in the focused `TextInput`. */\n text: string;\n};\nexport type FocusedInputSelectionChangedEvent = {\n /** Tag of the focused `TextInput`. */\n target: number;\n selection: {\n /** Start of the selection. Represents top-left point of rectangle. */\n start: {\n /** X coordinate of the selection start (relative to the `TextInput`). */\n x: number;\n /** Y coordinate of the selection start (relative to the `TextInput`). */\n y: number;\n /** The start of selection. */\n position: number;\n };\n /** End of the selection. Represents bottom-right point of rectangle. */\n end: {\n /** X coordinate of the selection end (relative to the `TextInput`). */\n x: number;\n /** Y coordinate of the selection end (relative to the `TextInput`). */\n y: number;\n /** The end of selection. */\n position: number;\n };\n };\n};\nexport type EventWithName<T> = {\n eventName: string;\n} & T;\n\n// native View/Module declarations\nexport type KeyboardControllerProps = {\n //ref prop\n ref?: React.Ref<React.Component<KeyboardControllerProps>>;\n // callback props\n onKeyboardMoveStart?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onKeyboardMove?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onKeyboardMoveEnd?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onKeyboardMoveInteractive?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onFocusedInputLayoutChanged?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,\n ) => void;\n onFocusedInputTextChanged?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,\n ) => void;\n onFocusedInputSelectionChanged?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,\n ) => void;\n // fake props used to activate reanimated bindings\n onKeyboardMoveReanimated?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onFocusedInputLayoutChangedReanimated?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,\n ) => void;\n onFocusedInputTextChangedReanimated?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,\n ) => void;\n onFocusedInputSelectionChangedReanimated?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,\n ) => void;\n // props\n statusBarTranslucent?: boolean;\n navigationBarTranslucent?: boolean;\n preserveEdgeToEdge?: boolean;\n enabled?: boolean;\n} & ViewProps;\n\n// reanimated hook declaration\nexport type KeyboardHandlerHook<TContext, Event> = (\n handlers: {\n onKeyboardMoveStart?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMove?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMoveEnd?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMoveInteractive?: (e: NativeEvent, context: TContext) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\nexport type FocusedInputLayoutHandlerHook<TContext, Event> = (\n handlers: {\n onFocusedInputLayoutChanged?: (\n e: FocusedInputLayoutChangedEvent,\n context: TContext,\n ) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\nexport type FocusedInputTextHandlerHook<TContext, Event> = (\n handlers: {\n onFocusedInputTextChanged?: (\n e: FocusedInputTextChangedEvent,\n context: TContext,\n ) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\nexport type FocusedInputSelectionHandlerHook<TContext, Event> = (\n handlers: {\n onFocusedInputSelectionChanged?: (\n e: FocusedInputSelectionChangedEvent,\n context: TContext,\n ) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\n\n// package types\nexport type Handlers<T> = Record<string, T | undefined>;\nexport type KeyboardHandler = Partial<{\n /**\n * A callback that gets invoked when keyboard starts its movement.\n * The event contains DESTINATION values.\n *\n * @example\n * ```ts\n * onStart: (e) => {\n * \"worklet\";\n *\n * const willKeyboardAppear = e.progress === 1;\n * }\n * ```\n */\n onStart: (e: NativeEvent) => void;\n /**\n * A callback that gets involved every frame when keyboard changes its position.\n *\n * @example\n * ```ts\n * onMove: (e) => {\n * \"worklet\";\n *\n * const keyboardHeight = e.height;\n * }\n */\n onMove: (e: NativeEvent) => void;\n /**\n * A callback that gets invoked when keyboard finished its movement.\n *\n * @example\n * ```ts\n * onEnd: (e) => {\n * \"worklet\";\n *\n * const isKeyboardShown = e.progress === 1;\n * }\n * ```\n */\n onEnd: (e: NativeEvent) => void;\n /**\n * A callback that gets invoked every frame when keyboard changes its position due to interactive dismissal.\n *\n * @example\n * ```ts\n * onInteractive: (e) => {\n * \"worklet\";\n *\n * const keyboardHeight = e.height;\n * }\n */\n onInteractive: (e: NativeEvent) => void;\n}>;\nexport type KeyboardHandlers = Handlers<KeyboardHandler>;\nexport type FocusedInputHandler = Partial<{\n /** A callback that gets invoked every time when the text changes in focused input. */\n onChangeText: (e: FocusedInputTextChangedEvent) => void;\n /** A callback that gets invoked every time when the selection (cursor) coordinates change in focused input. */\n onSelectionChange: (e: FocusedInputSelectionChangedEvent) => void;\n}>;\nexport type FocusedInputHandlers = Handlers<FocusedInputHandler>;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export * from "./hooks";
2
+ export * from "./views";
3
+ export * from "./module";
4
+ export * from "./internal";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks\";\nexport * from \"./views\";\nexport * from \"./module\";\nexport * from \"./internal\";\n"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,YAAY","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["internal.ts"],"sourcesContent":["import type { EmitterSubscription } from \"react-native\";\n\nexport type FocusedInputAvailableEvents = \"focusDidSet\";\nexport type FocusedInputEventData = {\n current: number;\n count: number;\n};\nexport type FocusedInputEventsModule = {\n addListener: (\n name: FocusedInputAvailableEvents,\n cb: (e: FocusedInputEventData) => void,\n ) => EmitterSubscription;\n};\nexport type WindowDimensionsAvailableEvents = \"windowDidResize\";\nexport type WindowDimensionsEventData = {\n width: number;\n height: number;\n};\nexport type WindowDimensionsEventsModule = {\n addListener: (\n name: WindowDimensionsAvailableEvents,\n cb: (e: WindowDimensionsEventData) => void,\n ) => EmitterSubscription;\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["module.ts"],"sourcesContent":["import type { EmitterSubscription, TextInputProps } from \"react-native\";\n\n// Event module declarations\nexport type KeyboardControllerEvents =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\";\nexport type KeyboardEventData = {\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Timestamp of the last keyboard event. */\n timestamp: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n /** `keyboardType` property from focused `TextInput`. */\n type: NonNullable<TextInputProps[\"keyboardType\"]>;\n /** Keyboard appearance. Can be one of `default`, `dark` or `light`. */\n appearance: NonNullable<TextInputProps[\"keyboardAppearance\"]>;\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type KeyboardState = {\n /** Whether the keyboard is currently visible. */\n isVisible: boolean;\n} & KeyboardEventData;\nexport type KeyboardEventsModule = {\n /**\n * The `addListener` function connects a JavaScript function to an identified native\n * keyboard notification event.\n *\n * This function then returns the reference to the listener.\n *\n * `name` is the string that identifies the event you're listening for. This\n * can be any of the following:\n *\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n */\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEventData) => void,\n ) => EmitterSubscription;\n};\nexport type Direction = \"next\" | \"prev\" | \"current\";\nexport type DismissOptions = {\n /**\n * A boolean property indicating whether focus should be kept on the input after dismissing the keyboard. Default is `false`.\n */\n keepFocus: boolean;\n};\nexport type KeyboardControllerModule = {\n // android only\n /**\n * Sets default `windowSoftInputMode` (the one that declared in `AndroidManifest.xml`).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setdefaultmode-|docs} page for more details.\n */\n setDefaultMode: () => void;\n /**\n * Changes `windowSoftInputMode` on Android. @see AndroidSoftInputModes for all possible values and {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|docs} page for more details.\n */\n setInputMode: (mode: number) => void;\n // all platforms\n /**\n * Dismisses the active keyboard. Removes a focus by default, but allows to pass `{keepFocus: true}` to keep focus.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#dismiss|docs} page for more details.\n */\n dismiss: (options?: DismissOptions) => Promise<void>;\n /**\n * Moves focus to the specified direction (`next`, `prev` or `current` to restore a focus).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setfocusto|docs} page for more details.\n */\n setFocusTo: (direction: Direction) => void;\n /**\n * Whether the keyboard is fully visible.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#isvisible|docs} page for more details.\n */\n isVisible: () => boolean;\n /**\n * Method that returns current keyboard state.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#state|docs} page for more details.\n */\n state: () => KeyboardEventData;\n};\nexport type KeyboardControllerNativeModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // all platforms\n dismiss: (keepFocus: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=views.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["views.ts"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardGestureAreaProps = {\n /**\n * Determines how the keyboard position will be controlled:\n * - `ios` - keyboard will be following finger only when finger touches keyboard\n * - `linear` - keyboard will be following finger position linearly.\n *\n * @platform android\n */\n interpolator?: \"ios\" | \"linear\";\n /**\n * Whether to allow to show a keyboard from dismissed state by swipe up.\n * Default to `false`.\n *\n * @platform android\n */\n showOnSwipeUp?: boolean;\n /**\n * Whether to allow to control a keyboard by gestures. The strategy how\n * it should be controlled is determined by `interpolator` property.\n * Defaults to `true`.\n *\n * @platform android\n */\n enableSwipeToDismiss?: boolean;\n /**\n * Extra distance to the keyboard.\n */\n offset?: number;\n /**\n * A corresponding `nativeID` value from the associated `TextInput` (a string that links the `KeyboardGestureArea` to one or more `TextInput` components).\n * This is **required on iOS** in order to apply the `offset` when the keyboard is shown. Only the currently focused `TextInput` with a matching `nativeID`\n * will receive offset behavior.\n *\n * @platform ios\n */\n textInputNativeID?: string;\n} & ViewProps;\nexport type OverKeyboardViewProps = PropsWithChildren<{\n /**\n * A boolean prop indicating whether the view is visible or not. If it's true then view is shown on the screen. If it's false then view is hidden.\n */\n visible: boolean;\n}>;\n"],"mappings":"","ignoreList":[]}
@@ -2,10 +2,24 @@ import React, { useMemo } from "react";
2
2
  import { Platform, StyleSheet, View } from "react-native";
3
3
  import { RCTOverKeyboardView } from "../../bindings";
4
4
  import { useWindowDimensions } from "../../hooks";
5
- const OverKeyboardView = ({
6
- children,
7
- visible
8
- }) => {
5
+ /**
6
+ * A view component that renders its children over the keyboard without closing the keyboard.
7
+ * Acts similar to modal, but doesn't close the keyboard when it's visible.
8
+ *
9
+ * @param props - Component props.
10
+ * @returns A view component that renders over the keyboard.
11
+ * @example
12
+ * ```tsx
13
+ * <OverKeyboardView visible={true}>
14
+ * <Text>This will appear over the keyboard</Text>
15
+ * </OverKeyboardView>
16
+ * ```
17
+ */
18
+ const OverKeyboardView = props => {
19
+ const {
20
+ children,
21
+ visible
22
+ } = props;
9
23
  const {
10
24
  height,
11
25
  width
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMemo","Platform","StyleSheet","View","RCTOverKeyboardView","useWindowDimensions","OverKeyboardView","children","visible","height","width","inner","style","styles","absolute","OS","undefined","stretch","createElement","collapsable","create","position","top","bottom","left","right"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Platform, StyleSheet, View } from \"react-native\";\n\nimport { RCTOverKeyboardView } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { OverKeyboardViewProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\nconst OverKeyboardView = ({\n children,\n visible,\n}: PropsWithChildren<OverKeyboardViewProps>) => {\n const { height, width } = useWindowDimensions();\n const inner = useMemo(() => ({ height, width }), [height, width]);\n const style = useMemo(\n () => [\n styles.absolute,\n // On iOS - stretch view to full window dimensions to make yoga work\n Platform.OS === \"ios\" ? inner : undefined,\n // On Android - we are laid out by ShadowNode, so just stretch to full container\n Platform.OS === \"android\" ? styles.stretch : undefined,\n ],\n [inner],\n );\n\n return (\n <RCTOverKeyboardView visible={visible}>\n {/* `OverKeyboardView` should always have a single child */}\n <View collapsable={false} style={style}>\n {/* Match RN behavior and trigger mount/unmount when visibility changes */}\n {visible && children}\n </View>\n </RCTOverKeyboardView>\n );\n};\n\nconst styles = StyleSheet.create({\n absolute: {\n position: \"absolute\",\n },\n stretch: {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n },\n});\n\nexport default OverKeyboardView;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,SAASC,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,mBAAmB,QAAQ,aAAa;AAKjD,MAAMC,gBAAgB,GAAGA,CAAC;EACxBC,QAAQ;EACRC;AACwC,CAAC,KAAK;EAC9C,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGL,mBAAmB,CAAC,CAAC;EAC/C,MAAMM,KAAK,GAAGX,OAAO,CAAC,OAAO;IAAES,MAAM;IAAEC;EAAM,CAAC,CAAC,EAAE,CAACD,MAAM,EAAEC,KAAK,CAAC,CAAC;EACjE,MAAME,KAAK,GAAGZ,OAAO,CACnB,MAAM,CACJa,MAAM,CAACC,QAAQ;EACf;EACAb,QAAQ,CAACc,EAAE,KAAK,KAAK,GAAGJ,KAAK,GAAGK,SAAS;EACzC;EACAf,QAAQ,CAACc,EAAE,KAAK,SAAS,GAAGF,MAAM,CAACI,OAAO,GAAGD,SAAS,CACvD,EACD,CAACL,KAAK,CACR,CAAC;EAED,oBACEZ,KAAA,CAAAmB,aAAA,CAACd,mBAAmB;IAACI,OAAO,EAAEA;EAAQ,gBAEpCT,KAAA,CAAAmB,aAAA,CAACf,IAAI;IAACgB,WAAW,EAAE,KAAM;IAACP,KAAK,EAAEA;EAAM,GAEpCJ,OAAO,IAAID,QACR,CACa,CAAC;AAE1B,CAAC;AAED,MAAMM,MAAM,GAAGX,UAAU,CAACkB,MAAM,CAAC;EAC/BN,QAAQ,EAAE;IACRO,QAAQ,EAAE;EACZ,CAAC;EACDJ,OAAO,EAAE;IACPK,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAenB,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["React","useMemo","Platform","StyleSheet","View","RCTOverKeyboardView","useWindowDimensions","OverKeyboardView","props","children","visible","height","width","inner","style","styles","absolute","OS","undefined","stretch","createElement","collapsable","create","position","top","bottom","left","right"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Platform, StyleSheet, View } from \"react-native\";\n\nimport { RCTOverKeyboardView } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { OverKeyboardViewProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\n/**\n * A view component that renders its children over the keyboard without closing the keyboard.\n * Acts similar to modal, but doesn't close the keyboard when it's visible.\n *\n * @param props - Component props.\n * @returns A view component that renders over the keyboard.\n * @example\n * ```tsx\n * <OverKeyboardView visible={true}>\n * <Text>This will appear over the keyboard</Text>\n * </OverKeyboardView>\n * ```\n */\nconst OverKeyboardView = (props: PropsWithChildren<OverKeyboardViewProps>) => {\n const { children, visible } = props;\n const { height, width } = useWindowDimensions();\n const inner = useMemo(() => ({ height, width }), [height, width]);\n const style = useMemo(\n () => [\n styles.absolute,\n // On iOS - stretch view to full window dimensions to make yoga work\n Platform.OS === \"ios\" ? inner : undefined,\n // On Android - we are laid out by ShadowNode, so just stretch to full container\n Platform.OS === \"android\" ? styles.stretch : undefined,\n ],\n [inner],\n );\n\n return (\n <RCTOverKeyboardView visible={visible}>\n {/* `OverKeyboardView` should always have a single child */}\n <View collapsable={false} style={style}>\n {/* Match RN behavior and trigger mount/unmount when visibility changes */}\n {visible && children}\n </View>\n </RCTOverKeyboardView>\n );\n};\n\nconst styles = StyleSheet.create({\n absolute: {\n position: \"absolute\",\n },\n stretch: {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n },\n});\n\nexport default OverKeyboardView;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,SAASC,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,mBAAmB,QAAQ,aAAa;AAKjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAIC,KAA+C,IAAK;EAC5E,MAAM;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGF,KAAK;EACnC,MAAM;IAAEG,MAAM;IAAEC;EAAM,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EAC/C,MAAMO,KAAK,GAAGZ,OAAO,CAAC,OAAO;IAAEU,MAAM;IAAEC;EAAM,CAAC,CAAC,EAAE,CAACD,MAAM,EAAEC,KAAK,CAAC,CAAC;EACjE,MAAME,KAAK,GAAGb,OAAO,CACnB,MAAM,CACJc,MAAM,CAACC,QAAQ;EACf;EACAd,QAAQ,CAACe,EAAE,KAAK,KAAK,GAAGJ,KAAK,GAAGK,SAAS;EACzC;EACAhB,QAAQ,CAACe,EAAE,KAAK,SAAS,GAAGF,MAAM,CAACI,OAAO,GAAGD,SAAS,CACvD,EACD,CAACL,KAAK,CACR,CAAC;EAED,oBACEb,KAAA,CAAAoB,aAAA,CAACf,mBAAmB;IAACK,OAAO,EAAEA;EAAQ,gBAEpCV,KAAA,CAAAoB,aAAA,CAAChB,IAAI;IAACiB,WAAW,EAAE,KAAM;IAACP,KAAK,EAAEA;EAAM,GAEpCJ,OAAO,IAAID,QACR,CACa,CAAC;AAE1B,CAAC;AAED,MAAMM,MAAM,GAAGZ,UAAU,CAACmB,MAAM,CAAC;EAC/BN,QAAQ,EAAE;IACRO,QAAQ,EAAE;EACZ,CAAC;EACDJ,OAAO,EAAE;IACPK,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAepB,gBAAgB","ignoreList":[]}
@@ -7,33 +7,47 @@ type KeyboardProviderProps = {
7
7
  * or `StatusBar` component from `react-native`, you can ignore it.
8
8
  * Defaults to `false`.
9
9
  *
10
- * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
11
10
  * @platform android
11
+ * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
12
12
  */
13
13
  statusBarTranslucent?: boolean;
14
14
  /**
15
15
  * Set the value to `true`, if you use translucent navigation bar on Android.
16
16
  * Defaults to `false`.
17
17
  *
18
- * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
19
18
  * @platform android
19
+ * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
20
20
  */
21
21
  navigationBarTranslucent?: boolean;
22
22
  /**
23
23
  * A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
24
24
  * Defaults to `false`.
25
25
  *
26
- * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
27
26
  * @platform android
27
+ * @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
28
28
  */
29
29
  preserveEdgeToEdge?: boolean;
30
30
  /**
31
- * A boolean prop indicating whether the module is enabled. It indicate only initial state,
32
- * i. e. if you try to change this prop after component mount it will not have any effect.
31
+ * A boolean prop indicating whether the module is enabled. It indicate only initial state
32
+ * (if you try to change this prop after component mount it will not have any effect).
33
33
  * To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
34
34
  * Defaults to `true`.
35
35
  */
36
36
  enabled?: boolean;
37
37
  };
38
- export declare const KeyboardProvider: ({ children, statusBarTranslucent, navigationBarTranslucent, preserveEdgeToEdge, enabled: initiallyEnabled, }: KeyboardProviderProps) => React.JSX.Element;
38
+ /**
39
+ * A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,
40
+ * maps these events to `Animated`/`Reanimated` values and store them in context.
41
+ *
42
+ * @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.
43
+ * @returns A component that should be mounted in root of your App layout.
44
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.
45
+ * @example
46
+ * ```tsx
47
+ * <KeyboardProvider>
48
+ * <NavigationContainer />
49
+ * </KeyboardProvider>
50
+ * ```
51
+ */
52
+ export declare const KeyboardProvider: (props: KeyboardProviderProps) => React.JSX.Element;
39
53
  export {};
@@ -1,5 +1,14 @@
1
1
  import type { FocusedInputEventsModule, KeyboardControllerNativeModule, KeyboardControllerProps, KeyboardEventsModule, KeyboardGestureAreaProps, OverKeyboardViewProps, WindowDimensionsEventsModule } from "./types";
2
2
  export declare const KeyboardControllerNative: KeyboardControllerNativeModule;
3
+ /**
4
+ * An event emitter that provides a way to subscribe to next keyboard events:
5
+ * - `keyboardWillShow`;
6
+ * - `keyboardDidShow`;
7
+ * - `keyboardWillHide`;
8
+ * - `keyboardDidHide`.
9
+ *
10
+ * Use `addListener` function to add your event listener for a specific keyboard event.
11
+ */
3
12
  export declare const KeyboardEvents: KeyboardEventsModule;
4
13
  /**
5
14
  * This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
@@ -7,6 +16,16 @@ export declare const KeyboardEvents: KeyboardEventsModule;
7
16
  */
8
17
  export declare const FocusedInputEvents: FocusedInputEventsModule;
9
18
  export declare const WindowDimensionsEvents: WindowDimensionsEventsModule;
19
+ /**
20
+ * A view that sends events whenever keyboard or focused events are happening.
21
+ *
22
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.
23
+ */
10
24
  export declare const KeyboardControllerView: React.FC<KeyboardControllerProps>;
25
+ /**
26
+ * A view that defines a region on the screen, where gestures will control the keyboard position.
27
+ *
28
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.
29
+ */
11
30
  export declare const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps>;
12
31
  export declare const RCTOverKeyboardView: React.FC<OverKeyboardViewProps>;
@@ -33,8 +33,17 @@ export type KeyboardAvoidingViewProps = KeyboardAvoidingViewBaseProps & ({
33
33
  contentContainerStyle?: never;
34
34
  });
35
35
  /**
36
- * View that moves out of the way when the keyboard appears by automatically
37
- * adjusting its height, position, or bottom padding.
36
+ * A View component that automatically adjusts its height, position, or bottom padding
37
+ * when the keyboard appears to ensure that the content remains visible.
38
+ *
39
+ * @returns A View component that adjusts to keyboard visibility.
40
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-avoiding-view|Documentation} page for more details.
41
+ * @example
42
+ * ```tsx
43
+ * <KeyboardAvoidingView behavior="padding">
44
+ * <TextInput />
45
+ * </KeyboardAvoidingView>
46
+ * ```
38
47
  */
39
48
  declare const KeyboardAvoidingView: React.ForwardRefExoticComponent<React.PropsWithChildren<KeyboardAvoidingViewProps> & React.RefAttributes<View>>;
40
49
  export default KeyboardAvoidingView;
@@ -5,23 +5,40 @@ export type KeyboardAwareScrollViewProps = {
5
5
  bottomOffset?: number;
6
6
  /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */
7
7
  disableScrollOnKeyboardHide?: boolean;
8
- /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */
8
+ /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true`. */
9
9
  enabled?: boolean;
10
- /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */
10
+ /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */
11
11
  extraKeyboardSpace?: number;
12
- /** Custom component for `ScrollView`. Default is `ScrollView` */
12
+ /** Custom component for `ScrollView`. Default is `ScrollView`. */
13
13
  ScrollViewComponent?: React.ComponentType<ScrollViewProps>;
14
14
  } & ScrollViewProps;
15
+ /**
16
+ * A ScrollView component that automatically handles keyboard appearance and disappearance
17
+ * by adjusting its content position to ensure the focused input remains visible.
18
+ *
19
+ * The component uses a sophisticated animation system to smoothly handle keyboard transitions
20
+ * and maintain proper scroll position during keyboard interactions.
21
+ *
22
+ * @returns A ScrollView component that handles keyboard interactions.
23
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view|Documentation} page for more details.
24
+ * @example
25
+ * ```tsx
26
+ * <KeyboardAwareScrollView bottomOffset={20}>
27
+ * <TextInput placeholder="Enter text" />
28
+ * <TextInput placeholder="Another input" />
29
+ * </KeyboardAwareScrollView>
30
+ * ```
31
+ */
15
32
  declare const KeyboardAwareScrollView: React.ForwardRefExoticComponent<{
16
33
  /** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */
17
34
  bottomOffset?: number;
18
35
  /** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */
19
36
  disableScrollOnKeyboardHide?: boolean;
20
- /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true` */
37
+ /** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true`. */
21
38
  enabled?: boolean;
22
- /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0` */
39
+ /** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */
23
40
  extraKeyboardSpace?: number;
24
- /** Custom component for `ScrollView`. Default is `ScrollView` */
41
+ /** Custom component for `ScrollView`. Default is `ScrollView`. */
25
42
  ScrollViewComponent?: React.ComponentType<ScrollViewProps>;
26
43
  } & ScrollViewProps & {
27
44
  children?: React.ReactNode | undefined;
@@ -1,6 +1,22 @@
1
1
  import { useKeyboardHandler } from "../../hooks";
2
2
  /**
3
3
  * Hook that uses default transitions for iOS and Android > 11, and uses
4
- * custom interpolation on Android < 11 to achieve more smooth animation
4
+ * custom interpolation on Android < 11 to achieve more smooth animation.
5
+ *
6
+ * @param handler - Object containing keyboard event handlers.
7
+ * @param [deps] - Dependencies array for the effect.
8
+ * @example
9
+ * ```ts
10
+ * useSmoothKeyboardHandler(
11
+ * {
12
+ * onStart: (e) => {
13
+ * "worklet";
14
+ *
15
+ * // your handler for keyboard start
16
+ * },
17
+ * },
18
+ * [],
19
+ * );
20
+ * ```
5
21
  */
6
22
  export declare const useSmoothKeyboardHandler: typeof useKeyboardHandler;
@@ -14,9 +14,22 @@ export type KeyboardStickyViewProps = {
14
14
  */
15
15
  opened?: number;
16
16
  };
17
- /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true` */
17
+ /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */
18
18
  enabled?: boolean;
19
19
  } & ViewProps;
20
+ /**
21
+ * A View component that sticks to the keyboard and moves with it when it appears or disappears.
22
+ * The view can be configured with custom offsets for both closed and open keyboard states.
23
+ *
24
+ * @returns An animated View component that sticks to the keyboard.
25
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-sticky-view|Documentation} page for more details.
26
+ * @example
27
+ * ```tsx
28
+ * <KeyboardStickyView offset={{ closed: 0, opened: 20 }}>
29
+ * <Button title="Submit" />
30
+ * </KeyboardStickyView>
31
+ * ```
32
+ */
20
33
  declare const KeyboardStickyView: React.ForwardRefExoticComponent<{
21
34
  /**
22
35
  * Specify additional offset to the view for given keyboard state.
@@ -31,7 +44,7 @@ declare const KeyboardStickyView: React.ForwardRefExoticComponent<{
31
44
  */
32
45
  opened?: number;
33
46
  };
34
- /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true` */
47
+ /** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */
35
48
  enabled?: boolean;
36
49
  } & ViewProps & {
37
50
  children?: React.ReactNode | undefined;
@@ -46,11 +46,22 @@ export type KeyboardToolbarProps = Omit<ViewProps, "style" | "testID" | "childre
46
46
  * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.
47
47
  */
48
48
  opacity?: HEX;
49
+ /**
50
+ * A object containing `left`/`right` properties. Used to specify proper container padding in landscape mode.
51
+ */
49
52
  insets?: SafeAreaInsets;
50
53
  } & Pick<KeyboardStickyViewProps, "offset" | "enabled">;
51
54
  /**
52
- * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
53
- * `Done` buttons.
55
+ * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and
56
+ * `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.
57
+ *
58
+ * @param props - Component props.
59
+ * @returns A component that is shown above the keyboard with `Prev`/`Next` and `Done` buttons.
60
+ * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-toolbar|Documentation} page for more details.
61
+ * @example
62
+ * ```tsx
63
+ * <KeyboardToolbar doneText="Close" />
64
+ * ```
54
65
  */
55
66
  declare const KeyboardToolbar: React.FC<KeyboardToolbarProps>;
56
67
  export { colors as DefaultKeyboardToolbarTheme };
@@ -3,21 +3,53 @@ import type { FocusedInputHandler, FocusedInputLayoutChangedEvent, KeyboardHandl
3
3
  import type React from "react";
4
4
  import type { SharedValue } from "react-native-reanimated";
5
5
  export type AnimatedContext = {
6
+ /**
7
+ * A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.
8
+ * Represented as `Animated.Value`.
9
+ */
6
10
  progress: Animated.Value;
11
+ /** Height of the keyboard. Represented as `Animated.Value`. */
7
12
  height: Animated.AnimatedMultiplication<number>;
8
13
  };
9
14
  export type ReanimatedContext = {
15
+ /**
16
+ * A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.
17
+ * Represented as `SharedValue`.
18
+ */
10
19
  progress: SharedValue<number>;
20
+ /** Height of the keyboard. Represented as `SharedValue`. */
11
21
  height: SharedValue<number>;
12
22
  };
13
23
  export type KeyboardAnimationContext = {
24
+ /** Whether KeyboardController library is active or not. */
14
25
  enabled: boolean;
26
+ /** Object that stores animated values that reflect the keyboard’s current position and movement. */
15
27
  animated: AnimatedContext;
28
+ /** Object that stores reanimated values that reflect the keyboard’s current position and movement. */
16
29
  reanimated: ReanimatedContext;
30
+ /** Layout of the focused `TextInput` represented as `SharedValue`. */
17
31
  layout: SharedValue<FocusedInputLayoutChangedEvent | null>;
32
+ /** Method for setting workletized keyboard handlers. */
18
33
  setKeyboardHandlers: (handlers: KeyboardHandler) => () => void;
34
+ /** Method for setting workletized handlers for tracking focused input events. */
19
35
  setInputHandlers: (handlers: FocusedInputHandler) => () => void;
36
+ /** Method to enable/disable KeyboardController library. */
20
37
  setEnabled: React.Dispatch<React.SetStateAction<boolean>>;
21
38
  };
22
39
  export declare const KeyboardContext: React.Context<KeyboardAnimationContext>;
40
+ /**
41
+ * A hook that returns a reference to {@link KeyboardAnimationContext} object.
42
+ *
43
+ * @returns Object {@link KeyboardAnimationContext|containing} keyboard-controller context.
44
+ * @example
45
+ * ```ts
46
+ * const context = useKeyboardContext();
47
+ *
48
+ * useLayoutEffect(() => {
49
+ * const cleanup = context.setInputHandlers(handler);
50
+ *
51
+ * return () => cleanup();
52
+ * }, deps);
53
+ * ```
54
+ */
23
55
  export declare const useKeyboardContext: () => KeyboardAnimationContext;