@react-native-ohos/react-native-keyboard-controller 1.12.8-beta.9

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 (251) hide show
  1. package/LICENSE +21 -0
  2. package/README.OpenSource +11 -0
  3. package/README.md +19 -0
  4. package/harmony/keyboard_controller/BuildProfile.ets +17 -0
  5. package/harmony/keyboard_controller/Index.ets +30 -0
  6. package/harmony/keyboard_controller/ResourceTable.txt +9 -0
  7. package/harmony/keyboard_controller/build-profile.json5 +31 -0
  8. package/harmony/keyboard_controller/consumer-rules.txt +0 -0
  9. package/harmony/keyboard_controller/hvigorfile.ts +6 -0
  10. package/harmony/keyboard_controller/obfuscation-rules.txt +18 -0
  11. package/harmony/keyboard_controller/oh-package-lock.json5 +19 -0
  12. package/harmony/keyboard_controller/oh-package.json5 +11 -0
  13. package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
  14. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
  15. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +111 -0
  16. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +98 -0
  17. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +274 -0
  18. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +101 -0
  19. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +64 -0
  20. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +85 -0
  21. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +110 -0
  22. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +84 -0
  23. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +60 -0
  24. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +46 -0
  25. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +48 -0
  26. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +64 -0
  27. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +77 -0
  28. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +45 -0
  29. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +49 -0
  30. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.cpp +186 -0
  31. package/harmony/keyboard_controller/src/main/cpp/ViewHierarchyNavigator.h +112 -0
  32. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +64 -0
  33. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +77 -0
  34. package/harmony/keyboard_controller/src/main/ets/Logger.ts +67 -0
  35. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +70 -0
  36. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +245 -0
  37. package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +119 -0
  38. package/harmony/keyboard_controller/src/main/ets/Type.ts +62 -0
  39. package/harmony/keyboard_controller/src/main/module.json +29 -0
  40. package/harmony/keyboard_controller/src/main/module.json5 +11 -0
  41. package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
  42. package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
  43. package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
  44. package/harmony/keyboard_controller/ts.ets +30 -0
  45. package/harmony/keyboard_controller.har +0 -0
  46. package/lib/commonjs/animated.js +188 -0
  47. package/lib/commonjs/animated.js.map +1 -0
  48. package/lib/commonjs/bindings.js +38 -0
  49. package/lib/commonjs/bindings.js.map +1 -0
  50. package/lib/commonjs/bindings.native.js +37 -0
  51. package/lib/commonjs/bindings.native.js.map +1 -0
  52. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
  53. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
  54. package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
  55. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
  56. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
  57. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
  58. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
  59. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
  60. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
  61. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
  62. package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
  63. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
  64. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
  65. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
  66. package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
  67. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
  68. package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
  69. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
  70. package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
  71. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
  72. package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
  73. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
  74. package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
  75. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
  76. package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
  77. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
  78. package/lib/commonjs/components/index.js +42 -0
  79. package/lib/commonjs/components/index.js.map +1 -0
  80. package/lib/commonjs/constants.js +27 -0
  81. package/lib/commonjs/constants.js.map +1 -0
  82. package/lib/commonjs/context.js +42 -0
  83. package/lib/commonjs/context.js.map +1 -0
  84. package/lib/commonjs/hooks/index.js +104 -0
  85. package/lib/commonjs/hooks/index.js.map +1 -0
  86. package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
  87. package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
  88. package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
  89. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
  90. package/lib/commonjs/index.js +116 -0
  91. package/lib/commonjs/index.js.map +1 -0
  92. package/lib/commonjs/internal.js +73 -0
  93. package/lib/commonjs/internal.js.map +1 -0
  94. package/lib/commonjs/monkey-patch.android.js +57 -0
  95. package/lib/commonjs/monkey-patch.android.js.map +1 -0
  96. package/lib/commonjs/monkey-patch.js +11 -0
  97. package/lib/commonjs/monkey-patch.js.map +1 -0
  98. package/lib/commonjs/reanimated.js +12 -0
  99. package/lib/commonjs/reanimated.js.map +1 -0
  100. package/lib/commonjs/reanimated.native.js +88 -0
  101. package/lib/commonjs/reanimated.native.js.map +1 -0
  102. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
  103. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  104. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
  105. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
  106. package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
  107. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
  108. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
  109. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
  110. package/lib/commonjs/types.js +6 -0
  111. package/lib/commonjs/types.js.map +1 -0
  112. package/lib/commonjs/utils.js +9 -0
  113. package/lib/commonjs/utils.js.map +1 -0
  114. package/lib/module/animated.js +180 -0
  115. package/lib/module/animated.js.map +1 -0
  116. package/lib/module/bindings.js +32 -0
  117. package/lib/module/bindings.js.map +1 -0
  118. package/lib/module/bindings.native.js +31 -0
  119. package/lib/module/bindings.native.js.map +1 -0
  120. package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
  121. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
  122. package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
  123. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
  124. package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
  125. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
  126. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
  127. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
  128. package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
  129. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
  130. package/lib/module/components/KeyboardStickyView/index.js +33 -0
  131. package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
  132. package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
  133. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
  134. package/lib/module/components/KeyboardToolbar/Button.js +62 -0
  135. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
  136. package/lib/module/components/KeyboardToolbar/colors.js +15 -0
  137. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
  138. package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
  139. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
  140. package/lib/module/components/KeyboardToolbar/index.js +140 -0
  141. package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
  142. package/lib/module/components/KeyboardToolbar/types.js +2 -0
  143. package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
  144. package/lib/module/components/hooks/useColorScheme.js +4 -0
  145. package/lib/module/components/hooks/useColorScheme.js.map +1 -0
  146. package/lib/module/components/index.js +5 -0
  147. package/lib/module/components/index.js.map +1 -0
  148. package/lib/module/constants.js +21 -0
  149. package/lib/module/constants.js.map +1 -0
  150. package/lib/module/context.js +35 -0
  151. package/lib/module/context.js.map +1 -0
  152. package/lib/module/hooks/index.js +68 -0
  153. package/lib/module/hooks/index.js.map +1 -0
  154. package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
  155. package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
  156. package/lib/module/hooks/useWindowDimensions/index.js +2 -0
  157. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
  158. package/lib/module/index.js +10 -0
  159. package/lib/module/index.js.map +1 -0
  160. package/lib/module/internal.js +66 -0
  161. package/lib/module/internal.js.map +1 -0
  162. package/lib/module/monkey-patch.android.js +47 -0
  163. package/lib/module/monkey-patch.android.js.map +1 -0
  164. package/lib/module/monkey-patch.js +5 -0
  165. package/lib/module/monkey-patch.js.map +1 -0
  166. package/lib/module/reanimated.js +6 -0
  167. package/lib/module/reanimated.js.map +1 -0
  168. package/lib/module/reanimated.native.js +78 -0
  169. package/lib/module/reanimated.native.js.map +1 -0
  170. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
  171. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  172. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
  173. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
  174. package/lib/module/specs/NativeKeyboardController.js +3 -0
  175. package/lib/module/specs/NativeKeyboardController.js.map +1 -0
  176. package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
  177. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
  178. package/lib/module/types.js +2 -0
  179. package/lib/module/types.js.map +1 -0
  180. package/lib/module/utils.js +2 -0
  181. package/lib/module/utils.js.map +1 -0
  182. package/lib/typescript/animated.d.ts +31 -0
  183. package/lib/typescript/bindings.d.ts +12 -0
  184. package/lib/typescript/bindings.native.d.ts +12 -0
  185. package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
  186. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
  187. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
  188. package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
  189. package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
  190. package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
  191. package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
  192. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
  193. package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
  194. package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
  195. package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
  196. package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
  197. package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
  198. package/lib/typescript/components/index.d.ts +8 -0
  199. package/lib/typescript/constants.d.ts +16 -0
  200. package/lib/typescript/context.d.ts +23 -0
  201. package/lib/typescript/hooks/index.d.ts +17 -0
  202. package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
  203. package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
  204. package/lib/typescript/index.d.ts +8 -0
  205. package/lib/typescript/internal.d.ts +30 -0
  206. package/lib/typescript/monkey-patch.android.d.ts +2 -0
  207. package/lib/typescript/monkey-patch.d.ts +2 -0
  208. package/lib/typescript/reanimated.d.ts +5 -0
  209. package/lib/typescript/reanimated.native.d.ts +7 -0
  210. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
  211. package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
  212. package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
  213. package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
  214. package/lib/typescript/types.d.ts +133 -0
  215. package/lib/typescript/utils.d.ts +1 -0
  216. package/package.json +178 -0
  217. package/react-native-keyboard-controller.podspec +61 -0
  218. package/src/animated.tsx +253 -0
  219. package/src/bindings.native.ts +57 -0
  220. package/src/bindings.ts +38 -0
  221. package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
  222. package/src/components/KeyboardAvoidingView/index.tsx +156 -0
  223. package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
  224. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
  225. package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
  226. package/src/components/KeyboardStickyView/index.tsx +57 -0
  227. package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
  228. package/src/components/KeyboardToolbar/Button.tsx +98 -0
  229. package/src/components/KeyboardToolbar/colors.native.ts +37 -0
  230. package/src/components/KeyboardToolbar/colors.ts +16 -0
  231. package/src/components/KeyboardToolbar/index.tsx +211 -0
  232. package/src/components/KeyboardToolbar/types.ts +40 -0
  233. package/src/components/hooks/useColorScheme.ts +5 -0
  234. package/src/components/index.ts +11 -0
  235. package/src/constants.ts +19 -0
  236. package/src/context.ts +65 -0
  237. package/src/hooks/index.ts +90 -0
  238. package/src/hooks/useWindowDimensions/index.android.ts +33 -0
  239. package/src/hooks/useWindowDimensions/index.ts +1 -0
  240. package/src/index.ts +21 -0
  241. package/src/internal.ts +84 -0
  242. package/src/monkey-patch.android.ts +44 -0
  243. package/src/monkey-patch.ts +4 -0
  244. package/src/reanimated.native.ts +132 -0
  245. package/src/reanimated.ts +29 -0
  246. package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
  247. package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
  248. package/src/specs/NativeKeyboardController.ts +19 -0
  249. package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
  250. package/src/types.ts +211 -0
  251. package/src/utils.ts +1 -0
@@ -0,0 +1,18 @@
1
+ import type { ColorValue } from "react-native";
2
+ type Theme = {
3
+ /** Color for arrow when it's enabled */
4
+ primary: ColorValue;
5
+ /** Color for arrow when it's disabled */
6
+ disabled: ColorValue;
7
+ /** Keyboard toolbar background color */
8
+ background: string;
9
+ /** Color for ripple effect (on button touch) on Android */
10
+ ripple: ColorValue;
11
+ };
12
+ export type KeyboardToolbarTheme = {
13
+ light: Theme;
14
+ dark: Theme;
15
+ };
16
+ type HexSymbol = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f";
17
+ export type HEX = `${HexSymbol}${HexSymbol}`;
18
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const useColorScheme: () => "light" | "dark";
2
+ export default useColorScheme;
@@ -0,0 +1,8 @@
1
+ export { default as KeyboardAvoidingView } from "./KeyboardAvoidingView";
2
+ export { default as KeyboardStickyView } from "./KeyboardStickyView";
3
+ export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
4
+ export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme, } from "./KeyboardToolbar";
5
+ export type { KeyboardAvoidingViewProps } from "./KeyboardAvoidingView";
6
+ export type { KeyboardStickyViewProps } from "./KeyboardStickyView";
7
+ export type { KeyboardAwareScrollViewProps } from "./KeyboardAwareScrollView";
8
+ export type { KeyboardToolbarProps } from "./KeyboardToolbar";
@@ -0,0 +1,16 @@
1
+ export declare enum AndroidSoftInputModes {
2
+ SOFT_INPUT_ADJUST_NOTHING = 48,
3
+ SOFT_INPUT_ADJUST_PAN = 32,
4
+ SOFT_INPUT_ADJUST_RESIZE = 16,
5
+ SOFT_INPUT_ADJUST_UNSPECIFIED = 0,
6
+ SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,
7
+ SOFT_INPUT_MASK_ADJUST = 240,
8
+ SOFT_INPUT_MASK_STATE = 15,
9
+ SOFT_INPUT_MODE_CHANGED = 512,
10
+ SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,
11
+ SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,
12
+ SOFT_INPUT_STATE_HIDDEN = 2,
13
+ SOFT_INPUT_STATE_UNCHANGED = 1,
14
+ SOFT_INPUT_STATE_UNSPECIFIED = 0,
15
+ SOFT_INPUT_STATE_VISIBLE = 4
16
+ }
@@ -0,0 +1,23 @@
1
+ import { Animated } from "react-native";
2
+ import type { FocusedInputHandlers, FocusedInputLayoutChangedEvent, KeyboardHandlers } from "./types";
3
+ import type React from "react";
4
+ import type { SharedValue } from "react-native-reanimated";
5
+ export type AnimatedContext = {
6
+ progress: Animated.Value;
7
+ height: Animated.AnimatedMultiplication<number>;
8
+ };
9
+ export type ReanimatedContext = {
10
+ progress: SharedValue<number>;
11
+ height: SharedValue<number>;
12
+ };
13
+ export type KeyboardAnimationContext = {
14
+ enabled: boolean;
15
+ animated: AnimatedContext;
16
+ reanimated: ReanimatedContext;
17
+ layout: SharedValue<FocusedInputLayoutChangedEvent | null>;
18
+ setKeyboardHandlers: (handlers: KeyboardHandlers) => void;
19
+ setInputHandlers: (handlers: FocusedInputHandlers) => void;
20
+ setEnabled: React.Dispatch<React.SetStateAction<boolean>>;
21
+ };
22
+ export declare const KeyboardContext: React.Context<KeyboardAnimationContext>;
23
+ export declare const useKeyboardContext: () => KeyboardAnimationContext;
@@ -0,0 +1,17 @@
1
+ import type { AnimatedContext, ReanimatedContext } from "../context";
2
+ import type { FocusedInputHandler, KeyboardHandler } from "../types";
3
+ import type { DependencyList } from "react";
4
+ export declare const useResizeMode: () => void;
5
+ export declare const useKeyboardAnimation: () => AnimatedContext;
6
+ export declare const useReanimatedKeyboardAnimation: () => ReanimatedContext;
7
+ export declare function useGenericKeyboardHandler(handler: KeyboardHandler, deps?: DependencyList): void;
8
+ export declare function useKeyboardHandler(handler: KeyboardHandler, deps?: DependencyList): void;
9
+ export declare function useKeyboardController(): {
10
+ setEnabled: import("react").Dispatch<import("react").SetStateAction<boolean>>;
11
+ enabled: boolean;
12
+ };
13
+ export declare function useReanimatedFocusedInput(): {
14
+ input: import("react-native-reanimated").SharedValue<import("../types").FocusedInputLayoutChangedEvent | null>;
15
+ };
16
+ export declare function useFocusedInputHandler(handler?: FocusedInputHandler, deps?: DependencyList): void;
17
+ export * from "./useWindowDimensions";
@@ -0,0 +1,2 @@
1
+ import type { WindowDimensionsEventData } from "../../types";
2
+ export declare const useWindowDimensions: () => WindowDimensionsEventData;
@@ -0,0 +1 @@
1
+ export { useWindowDimensions } from "react-native";
@@ -0,0 +1,8 @@
1
+ export * from "./bindings";
2
+ export * from "./animated";
3
+ export * from "./context";
4
+ export * from "./hooks";
5
+ export * from "./constants";
6
+ export * from "./types";
7
+ export { KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView, KeyboardToolbar, DefaultKeyboardToolbarTheme, } from "./components";
8
+ export type { KeyboardAvoidingViewProps, KeyboardStickyViewProps, KeyboardAwareScrollViewProps, KeyboardToolbarProps, } from "./components";
@@ -0,0 +1,30 @@
1
+ import { Animated } from "react-native";
2
+ import type { Handlers } from "./types";
3
+ type UntypedHandler = Record<string, (event: never) => void>;
4
+ type SharedHandlersReturnType<T extends UntypedHandler> = [
5
+ (handler: Handlers<T>) => void,
6
+ <K extends keyof T>(type: K, event: Parameters<T[K]>[0]) => void
7
+ ];
8
+ /**
9
+ * Hook for storing worklet handlers (objects with keys, where values are worklets).
10
+ * Returns methods for setting handlers and broadcasting events in them.
11
+ *
12
+ * T is a generic that looks like:
13
+ * @example
14
+ * {
15
+ * onEvent: () => {},
16
+ * onEvent2: () => {},
17
+ * }
18
+ */
19
+ export declare function useSharedHandlers<T extends UntypedHandler>(): SharedHandlersReturnType<T>;
20
+ /**
21
+ * TS variant of `useAnimatedValue` hook which is added in RN 0.71
22
+ * A better alternative of storing animated values in refs, since
23
+ * it doesn't recreate a new `Animated.Value` object on every re-render
24
+ * and therefore consumes less memory. We can not use a variant from
25
+ * RN, since this library supports earlier versions of RN.
26
+ *
27
+ * @see https://github.com/facebook/react-native/commit/e22217fe8b9455e32695f88ca835e11442b0a937
28
+ */
29
+ export declare function useAnimatedValue(initialValue: number, config?: Animated.AnimatedConfig): Animated.Value;
30
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const applyMonkeyPatch: () => void;
2
+ export declare const revertMonkeyPatch: () => void;
@@ -0,0 +1,2 @@
1
+ export declare const applyMonkeyPatch: () => void;
2
+ export declare const revertMonkeyPatch: () => void;
@@ -0,0 +1,5 @@
1
+ import type { EventWithName, FocusedInputLayoutChangedEvent, FocusedInputLayoutHandlerHook, FocusedInputSelectionChangedEvent, FocusedInputSelectionHandlerHook, FocusedInputTextChangedEvent, FocusedInputTextHandlerHook, KeyboardHandlerHook, NativeEvent } from "./types";
2
+ export declare const useAnimatedKeyboardHandler: KeyboardHandlerHook<Record<string, unknown>, EventWithName<NativeEvent>>;
3
+ export declare const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<Record<string, unknown>, EventWithName<FocusedInputLayoutChangedEvent>>;
4
+ export declare const useFocusedInputTextHandler: FocusedInputTextHandlerHook<Record<string, unknown>, EventWithName<FocusedInputTextChangedEvent>>;
5
+ export declare const useFocusedInputSelectionHandler: FocusedInputSelectionHandlerHook<Record<string, unknown>, EventWithName<FocusedInputSelectionChangedEvent>>;
@@ -0,0 +1,7 @@
1
+ import type { EventWithName, FocusedInputLayoutChangedEvent, FocusedInputLayoutHandlerHook, FocusedInputSelectionChangedEvent, FocusedInputSelectionHandlerHook, FocusedInputTextChangedEvent, FocusedInputTextHandlerHook, KeyboardHandlerHook, NativeEvent } from "./types";
2
+ type EventContext = Record<string, unknown>;
3
+ export declare const useAnimatedKeyboardHandler: KeyboardHandlerHook<EventContext, EventWithName<NativeEvent>>;
4
+ export declare const useFocusedInputLayoutHandler: FocusedInputLayoutHandlerHook<EventContext, EventWithName<FocusedInputLayoutChangedEvent>>;
5
+ export declare const useFocusedInputTextHandler: FocusedInputTextHandlerHook<EventContext, EventWithName<FocusedInputTextChangedEvent>>;
6
+ export declare const useFocusedInputSelectionHandler: FocusedInputSelectionHandlerHook<EventContext, EventWithName<FocusedInputSelectionChangedEvent>>;
7
+ export {};
@@ -0,0 +1,53 @@
1
+ import type { HostComponent } from "react-native";
2
+ import type { ViewProps } from "react-native/Libraries/Components/View/ViewPropTypes";
3
+ import type { DirectEventHandler, Double, Int32 } from "react-native/Libraries/Types/CodegenTypes";
4
+ type KeyboardMoveEvent = Readonly<{
5
+ height: Double;
6
+ progress: Double;
7
+ duration: Int32;
8
+ target: Int32;
9
+ }>;
10
+ type FocusedInputLayoutChangedEvent = Readonly<{
11
+ target: Int32;
12
+ parentScrollViewTarget: Int32;
13
+ layout: {
14
+ x: Double;
15
+ y: Double;
16
+ width: Double;
17
+ height: Double;
18
+ absoluteX: Double;
19
+ absoluteY: Double;
20
+ };
21
+ }>;
22
+ type FocusedInputTextChangedEvent = Readonly<{
23
+ text: string;
24
+ }>;
25
+ type FocusedInputSelectionChangedEvent = Readonly<{
26
+ target: Int32;
27
+ selection: {
28
+ start: {
29
+ x: Double;
30
+ y: Double;
31
+ position: Int32;
32
+ };
33
+ end: {
34
+ x: Double;
35
+ y: Double;
36
+ position: Int32;
37
+ };
38
+ };
39
+ }>;
40
+ export interface NativeProps extends ViewProps {
41
+ enabled?: boolean;
42
+ statusBarTranslucent?: boolean;
43
+ navigationBarTranslucent?: boolean;
44
+ onKeyboardMoveStart?: DirectEventHandler<KeyboardMoveEvent>;
45
+ onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;
46
+ onKeyboardMoveEnd?: DirectEventHandler<KeyboardMoveEvent>;
47
+ onKeyboardMoveInteractive?: DirectEventHandler<KeyboardMoveEvent>;
48
+ onFocusedInputLayoutChanged?: DirectEventHandler<FocusedInputLayoutChangedEvent>;
49
+ onFocusedInputTextChanged?: DirectEventHandler<FocusedInputTextChangedEvent>;
50
+ onFocusedInputSelectionChanged?: DirectEventHandler<FocusedInputSelectionChangedEvent>;
51
+ }
52
+ declare const _default: HostComponent<NativeProps>;
53
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { HostComponent } from "react-native";
2
+ import type { ViewProps } from "react-native/Libraries/Components/View/ViewPropTypes";
3
+ import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
4
+ export interface NativeProps extends ViewProps {
5
+ interpolator?: WithDefault<"linear" | "ios", "linear">;
6
+ showOnSwipeUp?: boolean;
7
+ enableSwipeToDismiss?: boolean;
8
+ }
9
+ declare const _default: HostComponent<NativeProps>;
10
+ export default _default;
@@ -0,0 +1,12 @@
1
+ import type { TurboModule } from "react-native";
2
+ export interface Spec extends TurboModule {
3
+ readonly getConstants: () => {};
4
+ setInputMode(mode: number): void;
5
+ setDefaultMode(): void;
6
+ dismiss(): void;
7
+ setFocusTo(direction: string): void;
8
+ addListener: (eventName: string) => void;
9
+ removeListeners: (count: number) => void;
10
+ }
11
+ declare const _default: Spec | null;
12
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import type { TurboModule } from "react-native";
2
+ export interface Spec extends TurboModule {
3
+ readonly getConstants: () => {};
4
+ setHidden(hidden: boolean): void;
5
+ setColor(color: number, animated: boolean): void;
6
+ setTranslucent(translucent: boolean): void;
7
+ setStyle(style: string): void;
8
+ }
9
+ declare const _default: Spec | null;
10
+ export default _default;
@@ -0,0 +1,133 @@
1
+ import type { EmitterSubscription, NativeSyntheticEvent, ViewProps } from "react-native";
2
+ export type NativeEvent = {
3
+ progress: number;
4
+ height: number;
5
+ duration: number;
6
+ target: number;
7
+ };
8
+ export type FocusedInputLayoutChangedEvent = {
9
+ target: number;
10
+ parentScrollViewTarget: number;
11
+ layout: {
12
+ x: number;
13
+ y: number;
14
+ width: number;
15
+ height: number;
16
+ absoluteX: number;
17
+ absoluteY: number;
18
+ };
19
+ };
20
+ export type FocusedInputTextChangedEvent = {
21
+ text: string;
22
+ };
23
+ export type FocusedInputSelectionChangedEvent = {
24
+ target: number;
25
+ selection: {
26
+ start: {
27
+ x: number;
28
+ y: number;
29
+ position: number;
30
+ };
31
+ end: {
32
+ x: number;
33
+ y: number;
34
+ position: number;
35
+ };
36
+ };
37
+ };
38
+ export type EventWithName<T> = {
39
+ eventName: string;
40
+ } & T;
41
+ export type KeyboardControllerProps = {
42
+ onKeyboardMoveStart?: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
43
+ onKeyboardMove?: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
44
+ onKeyboardMoveEnd?: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
45
+ onKeyboardMoveInteractive?: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
46
+ onFocusedInputLayoutChanged?: (e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>) => void;
47
+ onFocusedInputTextChanged?: (e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>) => void;
48
+ onFocusedInputSelectionChanged?: (e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>) => void;
49
+ onKeyboardMoveReanimated?: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
50
+ onFocusedInputLayoutChangedReanimated?: (e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>) => void;
51
+ onFocusedInputTextChangedReanimated?: (e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>) => void;
52
+ onFocusedInputSelectionChangedReanimated?: (e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>) => void;
53
+ statusBarTranslucent?: boolean;
54
+ navigationBarTranslucent?: boolean;
55
+ enabled?: boolean;
56
+ } & ViewProps;
57
+ export type KeyboardGestureAreaProps = {
58
+ interpolator: "ios" | "linear";
59
+ /**
60
+ * Whether to allow to show a keyboard from dismissed state by swipe up.
61
+ * Default to `false`.
62
+ */
63
+ showOnSwipeUp?: boolean;
64
+ /**
65
+ * Whether to allow to control a keyboard by gestures. The strategy how
66
+ * it should be controlled is determined by `interpolator` property.
67
+ * Defaults to `true`.
68
+ */
69
+ enableSwipeToDismiss?: boolean;
70
+ } & ViewProps;
71
+ export type Direction = "next" | "prev" | "current";
72
+ export type KeyboardControllerModule = {
73
+ setDefaultMode: () => void;
74
+ setInputMode: (mode: number) => void;
75
+ dismiss: () => void;
76
+ setFocusTo: (direction: Direction) => void;
77
+ addListener: (eventName: string) => void;
78
+ removeListeners: (count: number) => void;
79
+ };
80
+ export type KeyboardControllerEvents = "keyboardWillShow" | "keyboardDidShow" | "keyboardWillHide" | "keyboardDidHide";
81
+ export type KeyboardEventData = {
82
+ height: number;
83
+ duration: number;
84
+ timestamp: number;
85
+ target: number;
86
+ };
87
+ export type KeyboardEventsModule = {
88
+ addListener: (name: KeyboardControllerEvents, cb: (e: KeyboardEventData) => void) => EmitterSubscription;
89
+ };
90
+ export type FocusedInputAvailableEvents = "focusDidSet";
91
+ export type FocusedInputEventData = {
92
+ current: number;
93
+ count: number;
94
+ };
95
+ export type FocusedInputEventsModule = {
96
+ addListener: (name: FocusedInputAvailableEvents, cb: (e: FocusedInputEventData) => void) => EmitterSubscription;
97
+ };
98
+ export type WindowDimensionsAvailableEvents = "windowDidResize";
99
+ export type WindowDimensionsEventData = {
100
+ width: number;
101
+ height: number;
102
+ };
103
+ export type WindowDimensionsEventsModule = {
104
+ addListener: (name: WindowDimensionsAvailableEvents, cb: (e: WindowDimensionsEventData) => void) => EmitterSubscription;
105
+ };
106
+ export type KeyboardHandlerHook<TContext, Event> = (handlers: {
107
+ onKeyboardMoveStart?: (e: NativeEvent, context: TContext) => void;
108
+ onKeyboardMove?: (e: NativeEvent, context: TContext) => void;
109
+ onKeyboardMoveEnd?: (e: NativeEvent, context: TContext) => void;
110
+ onKeyboardMoveInteractive?: (e: NativeEvent, context: TContext) => void;
111
+ }, dependencies?: unknown[]) => (e: NativeSyntheticEvent<Event>) => void;
112
+ export type FocusedInputLayoutHandlerHook<TContext, Event> = (handlers: {
113
+ onFocusedInputLayoutChanged?: (e: FocusedInputLayoutChangedEvent, context: TContext) => void;
114
+ }, dependencies?: unknown[]) => (e: NativeSyntheticEvent<Event>) => void;
115
+ export type FocusedInputTextHandlerHook<TContext, Event> = (handlers: {
116
+ onFocusedInputTextChanged?: (e: FocusedInputTextChangedEvent, context: TContext) => void;
117
+ }, dependencies?: unknown[]) => (e: NativeSyntheticEvent<Event>) => void;
118
+ export type FocusedInputSelectionHandlerHook<TContext, Event> = (handlers: {
119
+ onFocusedInputSelectionChanged?: (e: FocusedInputSelectionChangedEvent, context: TContext) => void;
120
+ }, dependencies?: unknown[]) => (e: NativeSyntheticEvent<Event>) => void;
121
+ export type Handlers<T> = Record<string, T | undefined>;
122
+ export type KeyboardHandler = Partial<{
123
+ onStart: (e: NativeEvent) => void;
124
+ onMove: (e: NativeEvent) => void;
125
+ onEnd: (e: NativeEvent) => void;
126
+ onInteractive: (e: NativeEvent) => void;
127
+ }>;
128
+ export type KeyboardHandlers = Handlers<KeyboardHandler>;
129
+ export type FocusedInputHandler = Partial<{
130
+ onChangeText: (e: FocusedInputTextChangedEvent) => void;
131
+ onSelectionChange: (e: FocusedInputSelectionChangedEvent) => void;
132
+ }>;
133
+ export type FocusedInputHandlers = Handlers<FocusedInputHandler>;
@@ -0,0 +1 @@
1
+ export declare const uuid: () => string;
package/package.json ADDED
@@ -0,0 +1,178 @@
1
+ {
2
+ "name": "@react-native-ohos/react-native-keyboard-controller",
3
+ "version": "1.12.8-beta.9",
4
+ "description": "Keyboard manager which works in identical way on iOS and Android and harmony",
5
+ "main": "lib/commonjs/index",
6
+ "module": "lib/module/index",
7
+ "types": "lib/typescript/index.d.ts",
8
+ "react-native": "src/index",
9
+ "source": "src/index",
10
+ "files": [
11
+ "src",
12
+ "lib",
13
+ "android",
14
+ "ios",
15
+ "harmony",
16
+ "cpp",
17
+ "react-native-keyboard-controller.podspec",
18
+ "jest",
19
+ "!lib/typescript/example",
20
+ "!harmony/keyboard_controller/build",
21
+ "!android/build",
22
+ "!android/.gradle",
23
+ "!android/gradle",
24
+ "!android/gradlew",
25
+ "!android/gradlew.bat",
26
+ "!ios/build",
27
+ "!ios/KeyboardControllerNative",
28
+ "!**/__tests__",
29
+ "!**/__fixtures__",
30
+ "!**/__mocks__"
31
+ ],
32
+ "scripts": {
33
+ "format": "prettier '**/*' --ignore-unknown --write",
34
+ "test": "jest",
35
+ "typescript": "tsc --noEmit --project tsconfig.build.json",
36
+ "lint": "eslint --quiet \"**/*.{js,ts,tsx}\"",
37
+ "lint-clang": "find ios/ -iname *.h -o -iname *.m -o -iname *.mm | grep -v -e Pods -e build | xargs clang-format -i -n --Werror",
38
+ "prepare": "bob build",
39
+ "release": "release-it",
40
+ "example": "yarn --cwd example",
41
+ "pods": "cd example && pod-install --quiet",
42
+ "bootstrap": "yarn example && yarn && yarn pods"
43
+ },
44
+ "keywords": [
45
+ "react-native",
46
+ "keyboard",
47
+ "interactive",
48
+ "dismiss",
49
+ "animation",
50
+ "focused input",
51
+ "text changed",
52
+ "selection changed",
53
+ "avoiding view",
54
+ "avoid keyboard",
55
+ "sticky view",
56
+ "keyboard aware scroll view",
57
+ "keyboard toolbar",
58
+ "keyboard done button",
59
+ "keyboard next button",
60
+ "keyboard previous button",
61
+ "ios",
62
+ "android",
63
+ "harmony"
64
+ ],
65
+ "repository": "https://github.com/react-native-oh-library/react-native-keyboard-controller",
66
+ "author": "Kiryl Ziusko <zyusko.kirik@gmail.com> (https://github.com/kirillzyusko)",
67
+ "license": "MIT",
68
+ "bugs": {
69
+ "url": "https://github.com/react-native-oh-library/react-native-keyboard-controller/issues"
70
+ },
71
+ "homepage": "https://kirillzyusko.github.io/react-native-keyboard-controller/",
72
+ "publishConfig": {
73
+ "registry": "https://registry.npmjs.org/",
74
+ "access": "public"
75
+ },
76
+ "devDependencies": {
77
+ "@commitlint/config-conventional": "^11.0.0",
78
+ "@react-native/eslint-config": "^0.75.3",
79
+ "@release-it/conventional-changelog": "^2.0.0",
80
+ "@testing-library/react-hooks": "^8.0.1",
81
+ "@types/jest": "^29.2.1",
82
+ "@types/react": "^18.2.6",
83
+ "@typescript-eslint/eslint-plugin": "^6.7.4",
84
+ "@typescript-eslint/parser": "^6.7.4",
85
+ "clang-format": "^1.8.0",
86
+ "commitlint": "^11.0.0",
87
+ "eslint": "^8.19.0",
88
+ "eslint-config-prettier": "^8.5.0",
89
+ "eslint-import-resolver-typescript": "^3.6.1",
90
+ "eslint-plugin-eslint-comments": "^3.2.0",
91
+ "eslint-plugin-import": "^2.28.1",
92
+ "eslint-plugin-jest": "^26.5.3",
93
+ "eslint-plugin-prettier": "^4.2.1",
94
+ "eslint-plugin-react-compiler": "^0.0.0-experimental-0998c1e-20240625",
95
+ "eslint-plugin-react-perf": "^3.3.2",
96
+ "husky": "^6.0.0",
97
+ "jest": "^29.6.3",
98
+ "pod-install": "^0.1.0",
99
+ "prettier": "^2.8.8",
100
+ "react": "18.3.1",
101
+ "react-native": "0.75.3",
102
+ "react-native-builder-bob": "^0.18.0",
103
+ "react-native-reanimated": "3.15.0",
104
+ "react-test-renderer": "18.2.0",
105
+ "release-it": "^14.2.2",
106
+ "typescript": "5.0.4"
107
+ },
108
+ "peerDependencies": {
109
+ "react": "*",
110
+ "react-native": "*",
111
+ "react-native-reanimated": ">=3.0.0",
112
+ "react-native-keyboard-controller": "1.12.7"
113
+ },
114
+ "jest": {
115
+ "preset": "react-native",
116
+ "modulePathIgnorePatterns": [
117
+ "<rootDir>/example/node_modules",
118
+ "<rootDir>/lib/"
119
+ ]
120
+ },
121
+ "commitlint": {
122
+ "extends": [
123
+ "@commitlint/config-conventional"
124
+ ]
125
+ },
126
+ "release-it": {
127
+ "git": {
128
+ "commitMessage": "chore: release ${version}",
129
+ "tagName": "v${version}"
130
+ },
131
+ "npm": {
132
+ "publish": true
133
+ },
134
+ "github": {
135
+ "release": true
136
+ },
137
+ "plugins": {
138
+ "@release-it/conventional-changelog": {
139
+ "preset": "angular"
140
+ }
141
+ }
142
+ },
143
+ "prettier": {
144
+ "quoteProps": "consistent",
145
+ "trailingComma": "all"
146
+ },
147
+ "react-native-builder-bob": {
148
+ "source": "src",
149
+ "output": "lib",
150
+ "targets": [
151
+ "commonjs",
152
+ "module",
153
+ [
154
+ "typescript",
155
+ {
156
+ "project": "tsconfig.build.json"
157
+ }
158
+ ]
159
+ ]
160
+ },
161
+ "codegenConfig": {
162
+ "name": "reactnativekeyboardcontroller",
163
+ "type": "all",
164
+ "jsSrcsDir": "./src/specs",
165
+ "android": {
166
+ "javaPackageName": "com.reactnativekeyboardcontroller"
167
+ }
168
+ },
169
+ "harmony": {
170
+ "alias": "react-native-keyboard-controller",
171
+ "autolinking": {
172
+ "etsPackageClassName":"RNKeyboardControllerPackage",
173
+ "cppPackageClassName":"RNKeyboardControllerPackage",
174
+ "cmakeLibraryTargetName": "rnoh_keyboard_controller",
175
+ "ohPackageName": "@react-native-ohos/react-native-keyboard-controller"
176
+ }
177
+ }
178
+ }
@@ -0,0 +1,61 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
6
+
7
+ new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
8
+
9
+ Pod::Spec.new do |s|
10
+ s.name = "react-native-keyboard-controller"
11
+ s.version = package["version"]
12
+ s.summary = package["description"]
13
+ s.homepage = package["homepage"]
14
+ s.license = package["license"]
15
+ s.authors = package["author"]
16
+
17
+ s.platforms = { :ios => "11.0" }
18
+ s.source = { :git => "https://github.com/kirillzyusko/react-native-keyboard-controller.git", :tag => "#{s.version}" }
19
+
20
+ s.source_files = "ios/**/*.{h,m,mm,swift}"
21
+ s.exclude_files = "ios/KeyboardControllerNative/**/*"
22
+ s.public_header_files = "ios/**/*.h"
23
+
24
+ # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
25
+ if new_arch_enabled then
26
+ s.pod_target_xcconfig = {
27
+ # This is handy when we want to detect if new arch is enabled in Swift code
28
+ # and can be used like:
29
+ # #if KEYBOARD_CONTROLLER_NEW_ARCH_ENABLED
30
+ # // do sth when new arch is enabled
31
+ # #else
32
+ # // do sth when old arch is enabled
33
+ # #endif
34
+ "OTHER_SWIFT_FLAGS" => "-DKEYBOARD_CONTROLLER_NEW_ARCH_ENABLED"
35
+ }
36
+ end
37
+
38
+ # install_modules_dependencies has been defined since React Native 71
39
+ if defined?(install_modules_dependencies)
40
+ install_modules_dependencies(s)
41
+ else
42
+ s.dependency 'React-Core'
43
+
44
+ # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
45
+ if new_arch_enabled then
46
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
47
+ s.pod_target_xcconfig = s.pod_target_xcconfig | {
48
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
49
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
50
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
51
+ }
52
+
53
+ s.dependency "React-RCTFabric"
54
+ s.dependency "React-Codegen"
55
+ s.dependency "RCT-Folly"
56
+ s.dependency "RCTRequired"
57
+ s.dependency "RCTTypeSafety"
58
+ s.dependency "ReactCommon/turbomodule/core"
59
+ end
60
+ end
61
+ end