@react-native-ohos/react-native-keyboard-controller 1.12.8-rc.1

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 (248) 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 +9 -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.json5 +11 -0
  12. package/harmony/keyboard_controller/src/main/cpp/CMakeLists.txt +7 -0
  13. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.cpp +96 -0
  14. package/harmony/keyboard_controller/src/main/cpp/EventEmitters.h +90 -0
  15. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentDescriptor.h +77 -0
  16. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.cpp +158 -0
  17. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewComponentInstance.h +74 -0
  18. package/harmony/keyboard_controller/src/main/cpp/KeyboardControllerViewJSIBinder.h +43 -0
  19. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentDescriptor.h +64 -0
  20. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.cpp +89 -0
  21. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaComponentInstance.h +63 -0
  22. package/harmony/keyboard_controller/src/main/cpp/KeyboardGestureAreaJSIBinder.h +39 -0
  23. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.cpp +25 -0
  24. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardController.h +27 -0
  25. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.cpp +43 -0
  26. package/harmony/keyboard_controller/src/main/cpp/RNKeyboardControllerPackage.h +56 -0
  27. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.cpp +24 -0
  28. package/harmony/keyboard_controller/src/main/cpp/RNStatusBarManagerCompat.h +28 -0
  29. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.cpp +43 -0
  30. package/harmony/keyboard_controller/src/main/cpp/keyboardControllerPackage.h +56 -0
  31. package/harmony/keyboard_controller/src/main/ets/Logger.ts +46 -0
  32. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerPackage.ets +46 -0
  33. package/harmony/keyboard_controller/src/main/ets/RNKeyboardControllerTurboModule.ts +210 -0
  34. package/harmony/keyboard_controller/src/main/ets/RNStatusBarManagerCompatTurboModule.ts +98 -0
  35. package/harmony/keyboard_controller/src/main/ets/Type.ts +41 -0
  36. package/harmony/keyboard_controller/src/main/module.json +29 -0
  37. package/harmony/keyboard_controller/src/main/module.json5 +11 -0
  38. package/harmony/keyboard_controller/src/main/resources/base/element/string.json +8 -0
  39. package/harmony/keyboard_controller/src/main/resources/en_US/element/string.json +8 -0
  40. package/harmony/keyboard_controller/src/main/resources/zh_CN/element/string.json +8 -0
  41. package/harmony/keyboard_controller/ts.ets +9 -0
  42. package/harmony/keyboard_controller.har +0 -0
  43. package/lib/commonjs/animated.js +174 -0
  44. package/lib/commonjs/animated.js.map +1 -0
  45. package/lib/commonjs/bindings.js +38 -0
  46. package/lib/commonjs/bindings.js.map +1 -0
  47. package/lib/commonjs/bindings.native.js +37 -0
  48. package/lib/commonjs/bindings.native.js.map +1 -0
  49. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js +66 -0
  50. package/lib/commonjs/components/KeyboardAvoidingView/hooks.js.map +1 -0
  51. package/lib/commonjs/components/KeyboardAvoidingView/index.js +102 -0
  52. package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -0
  53. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +255 -0
  54. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -0
  55. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +110 -0
  56. package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
  57. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js +37 -0
  58. package/lib/commonjs/components/KeyboardAwareScrollView/utils.js.map +1 -0
  59. package/lib/commonjs/components/KeyboardStickyView/index.js +40 -0
  60. package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -0
  61. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +76 -0
  62. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -0
  63. package/lib/commonjs/components/KeyboardToolbar/Button.js +70 -0
  64. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -0
  65. package/lib/commonjs/components/KeyboardToolbar/colors.js +21 -0
  66. package/lib/commonjs/components/KeyboardToolbar/colors.js.map +1 -0
  67. package/lib/commonjs/components/KeyboardToolbar/colors.native.js +40 -0
  68. package/lib/commonjs/components/KeyboardToolbar/colors.native.js.map +1 -0
  69. package/lib/commonjs/components/KeyboardToolbar/index.js +152 -0
  70. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -0
  71. package/lib/commonjs/components/KeyboardToolbar/types.js +6 -0
  72. package/lib/commonjs/components/KeyboardToolbar/types.js.map +1 -0
  73. package/lib/commonjs/components/hooks/useColorScheme.js +10 -0
  74. package/lib/commonjs/components/hooks/useColorScheme.js.map +1 -0
  75. package/lib/commonjs/components/index.js +42 -0
  76. package/lib/commonjs/components/index.js.map +1 -0
  77. package/lib/commonjs/constants.js +25 -0
  78. package/lib/commonjs/constants.js.map +1 -0
  79. package/lib/commonjs/context.js +42 -0
  80. package/lib/commonjs/context.js.map +1 -0
  81. package/lib/commonjs/hooks/index.js +104 -0
  82. package/lib/commonjs/hooks/index.js.map +1 -0
  83. package/lib/commonjs/hooks/useWindowDimensions/index.android.js +29 -0
  84. package/lib/commonjs/hooks/useWindowDimensions/index.android.js.map +1 -0
  85. package/lib/commonjs/hooks/useWindowDimensions/index.js +13 -0
  86. package/lib/commonjs/hooks/useWindowDimensions/index.js.map +1 -0
  87. package/lib/commonjs/index.js +116 -0
  88. package/lib/commonjs/index.js.map +1 -0
  89. package/lib/commonjs/internal.js +73 -0
  90. package/lib/commonjs/internal.js.map +1 -0
  91. package/lib/commonjs/monkey-patch.android.js +57 -0
  92. package/lib/commonjs/monkey-patch.android.js.map +1 -0
  93. package/lib/commonjs/monkey-patch.js +11 -0
  94. package/lib/commonjs/monkey-patch.js.map +1 -0
  95. package/lib/commonjs/reanimated.js +12 -0
  96. package/lib/commonjs/reanimated.js.map +1 -0
  97. package/lib/commonjs/reanimated.native.js +88 -0
  98. package/lib/commonjs/reanimated.native.js.map +1 -0
  99. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +10 -0
  100. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  101. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js +12 -0
  102. package/lib/commonjs/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
  103. package/lib/commonjs/specs/NativeKeyboardController.js +9 -0
  104. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
  105. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +9 -0
  106. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
  107. package/lib/commonjs/types.js +6 -0
  108. package/lib/commonjs/types.js.map +1 -0
  109. package/lib/commonjs/utils.js +9 -0
  110. package/lib/commonjs/utils.js.map +1 -0
  111. package/lib/module/animated.js +166 -0
  112. package/lib/module/animated.js.map +1 -0
  113. package/lib/module/bindings.js +32 -0
  114. package/lib/module/bindings.js.map +1 -0
  115. package/lib/module/bindings.native.js +31 -0
  116. package/lib/module/bindings.native.js.map +1 -0
  117. package/lib/module/components/KeyboardAvoidingView/hooks.js +59 -0
  118. package/lib/module/components/KeyboardAvoidingView/hooks.js.map +1 -0
  119. package/lib/module/components/KeyboardAvoidingView/index.js +95 -0
  120. package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -0
  121. package/lib/module/components/KeyboardAwareScrollView/index.js +248 -0
  122. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -0
  123. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +103 -0
  124. package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -0
  125. package/lib/module/components/KeyboardAwareScrollView/utils.js +29 -0
  126. package/lib/module/components/KeyboardAwareScrollView/utils.js.map +1 -0
  127. package/lib/module/components/KeyboardStickyView/index.js +33 -0
  128. package/lib/module/components/KeyboardStickyView/index.js.map +1 -0
  129. package/lib/module/components/KeyboardToolbar/Arrow.js +68 -0
  130. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -0
  131. package/lib/module/components/KeyboardToolbar/Button.js +62 -0
  132. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -0
  133. package/lib/module/components/KeyboardToolbar/colors.js +15 -0
  134. package/lib/module/components/KeyboardToolbar/colors.js.map +1 -0
  135. package/lib/module/components/KeyboardToolbar/colors.native.js +34 -0
  136. package/lib/module/components/KeyboardToolbar/colors.native.js.map +1 -0
  137. package/lib/module/components/KeyboardToolbar/index.js +140 -0
  138. package/lib/module/components/KeyboardToolbar/index.js.map +1 -0
  139. package/lib/module/components/KeyboardToolbar/types.js +2 -0
  140. package/lib/module/components/KeyboardToolbar/types.js.map +1 -0
  141. package/lib/module/components/hooks/useColorScheme.js +4 -0
  142. package/lib/module/components/hooks/useColorScheme.js.map +1 -0
  143. package/lib/module/components/index.js +5 -0
  144. package/lib/module/components/index.js.map +1 -0
  145. package/lib/module/constants.js +19 -0
  146. package/lib/module/constants.js.map +1 -0
  147. package/lib/module/context.js +35 -0
  148. package/lib/module/context.js.map +1 -0
  149. package/lib/module/hooks/index.js +68 -0
  150. package/lib/module/hooks/index.js.map +1 -0
  151. package/lib/module/hooks/useWindowDimensions/index.android.js +22 -0
  152. package/lib/module/hooks/useWindowDimensions/index.android.js.map +1 -0
  153. package/lib/module/hooks/useWindowDimensions/index.js +2 -0
  154. package/lib/module/hooks/useWindowDimensions/index.js.map +1 -0
  155. package/lib/module/index.js +10 -0
  156. package/lib/module/index.js.map +1 -0
  157. package/lib/module/internal.js +66 -0
  158. package/lib/module/internal.js.map +1 -0
  159. package/lib/module/monkey-patch.android.js +47 -0
  160. package/lib/module/monkey-patch.android.js.map +1 -0
  161. package/lib/module/monkey-patch.js +5 -0
  162. package/lib/module/monkey-patch.js.map +1 -0
  163. package/lib/module/reanimated.js +6 -0
  164. package/lib/module/reanimated.js.map +1 -0
  165. package/lib/module/reanimated.native.js +78 -0
  166. package/lib/module/reanimated.native.js.map +1 -0
  167. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +3 -0
  168. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  169. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js +5 -0
  170. package/lib/module/specs/KeyboardGestureAreaNativeComponent.js.map +1 -0
  171. package/lib/module/specs/NativeKeyboardController.js +3 -0
  172. package/lib/module/specs/NativeKeyboardController.js.map +1 -0
  173. package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
  174. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
  175. package/lib/module/types.js +2 -0
  176. package/lib/module/types.js.map +1 -0
  177. package/lib/module/utils.js +2 -0
  178. package/lib/module/utils.js.map +1 -0
  179. package/lib/typescript/animated.d.ts +31 -0
  180. package/lib/typescript/bindings.d.ts +12 -0
  181. package/lib/typescript/bindings.native.d.ts +12 -0
  182. package/lib/typescript/components/KeyboardAvoidingView/hooks.d.ts +6 -0
  183. package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +50 -0
  184. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +25 -0
  185. package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +6 -0
  186. package/lib/typescript/components/KeyboardAwareScrollView/utils.d.ts +2 -0
  187. package/lib/typescript/components/KeyboardStickyView/index.d.ts +35 -0
  188. package/lib/typescript/components/KeyboardToolbar/Arrow.d.ts +9 -0
  189. package/lib/typescript/components/KeyboardToolbar/Button.d.ts +15 -0
  190. package/lib/typescript/components/KeyboardToolbar/colors.d.ts +2 -0
  191. package/lib/typescript/components/KeyboardToolbar/colors.native.d.ts +2 -0
  192. package/lib/typescript/components/KeyboardToolbar/index.d.ts +50 -0
  193. package/lib/typescript/components/KeyboardToolbar/types.d.ts +18 -0
  194. package/lib/typescript/components/hooks/useColorScheme.d.ts +2 -0
  195. package/lib/typescript/components/index.d.ts +8 -0
  196. package/lib/typescript/constants.d.ts +16 -0
  197. package/lib/typescript/context.d.ts +23 -0
  198. package/lib/typescript/hooks/index.d.ts +17 -0
  199. package/lib/typescript/hooks/useWindowDimensions/index.android.d.ts +2 -0
  200. package/lib/typescript/hooks/useWindowDimensions/index.d.ts +1 -0
  201. package/lib/typescript/index.d.ts +8 -0
  202. package/lib/typescript/internal.d.ts +30 -0
  203. package/lib/typescript/monkey-patch.android.d.ts +2 -0
  204. package/lib/typescript/monkey-patch.d.ts +2 -0
  205. package/lib/typescript/reanimated.d.ts +5 -0
  206. package/lib/typescript/reanimated.native.d.ts +7 -0
  207. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +53 -0
  208. package/lib/typescript/specs/KeyboardGestureAreaNativeComponent.d.ts +10 -0
  209. package/lib/typescript/specs/NativeKeyboardController.d.ts +12 -0
  210. package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
  211. package/lib/typescript/types.d.ts +133 -0
  212. package/lib/typescript/utils.d.ts +1 -0
  213. package/package.json +177 -0
  214. package/react-native-keyboard-controller.podspec +61 -0
  215. package/src/animated.tsx +246 -0
  216. package/src/bindings.native.ts +57 -0
  217. package/src/bindings.ts +38 -0
  218. package/src/components/KeyboardAvoidingView/hooks.ts +58 -0
  219. package/src/components/KeyboardAvoidingView/index.tsx +156 -0
  220. package/src/components/KeyboardAwareScrollView/index.tsx +373 -0
  221. package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +133 -0
  222. package/src/components/KeyboardAwareScrollView/utils.ts +41 -0
  223. package/src/components/KeyboardStickyView/index.tsx +57 -0
  224. package/src/components/KeyboardToolbar/Arrow.tsx +80 -0
  225. package/src/components/KeyboardToolbar/Button.tsx +98 -0
  226. package/src/components/KeyboardToolbar/colors.native.ts +37 -0
  227. package/src/components/KeyboardToolbar/colors.ts +16 -0
  228. package/src/components/KeyboardToolbar/index.tsx +211 -0
  229. package/src/components/KeyboardToolbar/types.ts +40 -0
  230. package/src/components/hooks/useColorScheme.ts +5 -0
  231. package/src/components/index.ts +11 -0
  232. package/src/constants.ts +19 -0
  233. package/src/context.ts +65 -0
  234. package/src/hooks/index.ts +90 -0
  235. package/src/hooks/useWindowDimensions/index.android.ts +33 -0
  236. package/src/hooks/useWindowDimensions/index.ts +1 -0
  237. package/src/index.ts +21 -0
  238. package/src/internal.ts +84 -0
  239. package/src/monkey-patch.android.ts +44 -0
  240. package/src/monkey-patch.ts +4 -0
  241. package/src/reanimated.native.ts +132 -0
  242. package/src/reanimated.ts +29 -0
  243. package/src/specs/KeyboardControllerViewNativeComponent.ts +70 -0
  244. package/src/specs/KeyboardGestureAreaNativeComponent.ts +15 -0
  245. package/src/specs/NativeKeyboardController.ts +19 -0
  246. package/src/specs/NativeStatusBarManagerCompat.ts +14 -0
  247. package/src/types.ts +211 -0
  248. package/src/utils.ts +1 -0
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _colors.colors;
10
+ }
11
+ });
12
+ exports.default = void 0;
13
+ var _react = _interopRequireWildcard(require("react"));
14
+ var _reactNative = require("react-native");
15
+ var _bindings = require("../../bindings");
16
+ var _KeyboardStickyView = _interopRequireDefault(require("../KeyboardStickyView"));
17
+ var _useColorScheme = _interopRequireDefault(require("../hooks/useColorScheme"));
18
+ var _Arrow = _interopRequireDefault(require("./Arrow"));
19
+ var _Button = _interopRequireDefault(require("./Button"));
20
+ var _colors = require("./colors");
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
23
+ const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
24
+ const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
25
+ const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;
26
+ const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;
27
+ const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
28
+ const KEYBOARD_TOOLBAR_HEIGHT = 42;
29
+ const DEFAULT_OPACITY = "FF";
30
+ const offset = {
31
+ closed: KEYBOARD_TOOLBAR_HEIGHT
32
+ };
33
+ const dismissKeyboard = () => _bindings.KeyboardController.dismiss();
34
+ const goToNextField = () => _bindings.KeyboardController.setFocusTo("next");
35
+ const goToPrevField = () => _bindings.KeyboardController.setFocusTo("prev");
36
+
37
+ /**
38
+ * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
39
+ * `Done` buttons.
40
+ */
41
+ const KeyboardToolbar = ({
42
+ content,
43
+ theme = _colors.colors,
44
+ doneText,
45
+ button,
46
+ icon,
47
+ showArrows = true,
48
+ onNextCallback,
49
+ onPrevCallback,
50
+ onDoneCallback,
51
+ blur = null,
52
+ opacity = DEFAULT_OPACITY
53
+ }) => {
54
+ const colorScheme = (0, _useColorScheme.default)();
55
+ const [inputs, setInputs] = (0, _react.useState)({
56
+ current: 0,
57
+ count: 0
58
+ });
59
+ const isPrevDisabled = inputs.current === 0;
60
+ const isNextDisabled = inputs.current === inputs.count - 1;
61
+ (0, _react.useEffect)(() => {
62
+ const subscription = _bindings.FocusedInputEvents.addListener("focusDidSet", e => {
63
+ setInputs(e);
64
+ });
65
+ return subscription.remove;
66
+ }, []);
67
+ const doneStyle = (0, _react.useMemo)(() => [styles.doneButton, {
68
+ color: theme[colorScheme].primary
69
+ }], [colorScheme, theme]);
70
+ const toolbarStyle = (0, _react.useMemo)(() => [styles.toolbar, {
71
+ backgroundColor: `${theme[colorScheme].background}${opacity}`
72
+ }], [colorScheme, opacity, theme]);
73
+ const ButtonContainer = button || _Button.default;
74
+ const IconContainer = icon || _Arrow.default;
75
+ const onPressNext = (0, _react.useCallback)(() => {
76
+ goToNextField();
77
+ onNextCallback === null || onNextCallback === void 0 || onNextCallback();
78
+ }, [onNextCallback]);
79
+ const onPressPrev = (0, _react.useCallback)(() => {
80
+ goToPrevField();
81
+ onPrevCallback === null || onPrevCallback === void 0 || onPrevCallback();
82
+ }, [onPrevCallback]);
83
+ const onPressDone = (0, _react.useCallback)(() => {
84
+ dismissKeyboard();
85
+ onDoneCallback === null || onDoneCallback === void 0 || onDoneCallback();
86
+ }, [onDoneCallback]);
87
+ return /*#__PURE__*/_react.default.createElement(_KeyboardStickyView.default, {
88
+ offset: offset
89
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
90
+ style: toolbarStyle,
91
+ testID: TEST_ID_KEYBOARD_TOOLBAR
92
+ }, blur, showArrows && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(ButtonContainer, {
93
+ accessibilityLabel: "Previous",
94
+ accessibilityHint: "Will move focus to previous field",
95
+ disabled: isPrevDisabled,
96
+ onPress: onPressPrev,
97
+ testID: TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,
98
+ theme: theme
99
+ }, /*#__PURE__*/_react.default.createElement(IconContainer, {
100
+ disabled: isPrevDisabled,
101
+ type: "prev",
102
+ theme: theme
103
+ })), /*#__PURE__*/_react.default.createElement(ButtonContainer, {
104
+ accessibilityLabel: "Next",
105
+ accessibilityHint: "Will move focus to next field",
106
+ disabled: isNextDisabled,
107
+ onPress: onPressNext,
108
+ testID: TEST_ID_KEYBOARD_TOOLBAR_NEXT,
109
+ theme: theme
110
+ }, /*#__PURE__*/_react.default.createElement(IconContainer, {
111
+ disabled: isNextDisabled,
112
+ type: "next",
113
+ theme: theme
114
+ }))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
115
+ style: styles.flex,
116
+ testID: TEST_ID_KEYBOARD_TOOLBAR_CONTENT
117
+ }, content), /*#__PURE__*/_react.default.createElement(ButtonContainer, {
118
+ accessibilityLabel: "Done",
119
+ accessibilityHint: "Will close the keyboard",
120
+ onPress: onPressDone,
121
+ testID: TEST_ID_KEYBOARD_TOOLBAR_DONE,
122
+ rippleRadius: 28,
123
+ style: styles.doneButtonContainer,
124
+ theme: theme
125
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
126
+ style: doneStyle,
127
+ maxFontSizeMultiplier: 1.3
128
+ }, doneText || "Done"))));
129
+ };
130
+ const styles = _reactNative.StyleSheet.create({
131
+ flex: {
132
+ flex: 1
133
+ },
134
+ toolbar: {
135
+ position: "absolute",
136
+ bottom: 0,
137
+ alignItems: "center",
138
+ width: "100%",
139
+ flexDirection: "row",
140
+ height: KEYBOARD_TOOLBAR_HEIGHT,
141
+ paddingHorizontal: 8
142
+ },
143
+ doneButton: {
144
+ fontWeight: "600",
145
+ fontSize: 15
146
+ },
147
+ doneButtonContainer: {
148
+ marginRight: 8
149
+ }
150
+ });
151
+ var _default = exports.default = KeyboardToolbar;
152
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_KeyboardStickyView","_interopRequireDefault","_useColorScheme","_Arrow","_Button","_colors","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TEST_ID_KEYBOARD_TOOLBAR","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","TEST_ID_KEYBOARD_TOOLBAR_NEXT","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","TEST_ID_KEYBOARD_TOOLBAR_DONE","KEYBOARD_TOOLBAR_HEIGHT","DEFAULT_OPACITY","offset","closed","dismissKeyboard","KeyboardController","dismiss","goToNextField","setFocusTo","goToPrevField","KeyboardToolbar","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","colorScheme","useColorScheme","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","useEffect","subscription","FocusedInputEvents","addListener","remove","doneStyle","useMemo","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","ButtonContainer","Button","IconContainer","Arrow","onPressNext","useCallback","onPressPrev","onPressDone","createElement","View","style","testID","Fragment","accessibilityLabel","accessibilityHint","disabled","onPress","type","flex","rippleRadius","doneButtonContainer","Text","maxFontSizeMultiplier","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","paddingHorizontal","fontWeight","fontSize","marginRight","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\r\nimport { StyleSheet, Text, View } from \"react-native\";\r\n\r\nimport {\r\n FocusedInputEvents,\r\n} from \"../../bindings\";\r\nimport KeyboardStickyView from \"../KeyboardStickyView\"\r\nimport { KeyboardController } from \"../../bindings\";\r\nimport useColorScheme from \"../hooks/useColorScheme\";\r\n\r\nimport Arrow from \"./Arrow\";\r\nimport Button from \"./Button\";\r\nimport { colors } from \"./colors\";\r\n\r\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\r\nimport type { ReactNode } from \"react\";\r\n\r\nexport type KeyboardToolbarProps = {\r\n /** An element that is shown in the middle of the toolbar. */\r\n content?: JSX.Element | null;\r\n /** A set of dark/light colors consumed by toolbar component. */\r\n theme?: KeyboardToolbarTheme;\r\n /** Custom text for done button. */\r\n doneText?: ReactNode;\r\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\r\n button?: typeof Button;\r\n /** Custom icon component used to display next/prev buttons. */\r\n icon?: typeof Arrow;\r\n /**\r\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\r\n * and want to show only `Done` button. Default to `true`.\r\n */\r\n showArrows?: boolean;\r\n /**\r\n * A callback that is called when the user presses the next button along with the default action.\r\n */\r\n onNextCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the previous button along with the default action.\r\n */\r\n onPrevCallback?: () => void;\r\n /**\r\n * A callback that is called when the user presses the done button along with the default action.\r\n */\r\n onDoneCallback?: () => void;\r\n /**\r\n * A component that applies blur effect to the toolbar.\r\n */\r\n blur?: JSX.Element | null;\r\n /**\r\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\r\n */\r\n opacity?: HEX;\r\n};\r\nconst TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\r\nconst TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\r\nconst TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\r\n\r\nconst KEYBOARD_TOOLBAR_HEIGHT = 42;\r\nconst DEFAULT_OPACITY: HEX = \"FF\";\r\nconst offset = { closed: KEYBOARD_TOOLBAR_HEIGHT };\r\n\r\nconst dismissKeyboard = () => KeyboardController.dismiss();\r\nconst goToNextField = () => KeyboardController.setFocusTo(\"next\");\r\nconst goToPrevField = () => KeyboardController.setFocusTo(\"prev\");\r\n\r\n/**\r\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and\r\n * `Done` buttons.\r\n */\r\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = ({\r\n content,\r\n theme = colors,\r\n doneText,\r\n button,\r\n icon,\r\n showArrows = true,\r\n onNextCallback,\r\n onPrevCallback,\r\n onDoneCallback,\r\n blur = null,\r\n opacity = DEFAULT_OPACITY,\r\n}) => {\r\n const colorScheme = useColorScheme();\r\n const [inputs, setInputs] = useState({\r\n current: 0,\r\n count: 0,\r\n });\r\n const isPrevDisabled = inputs.current === 0;\r\n const isNextDisabled = inputs.current === inputs.count - 1;\r\n\r\n useEffect(() => {\r\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\r\n setInputs(e);\r\n });\r\n\r\n return subscription.remove;\r\n }, []);\r\n const doneStyle = useMemo(\r\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\r\n [colorScheme, theme],\r\n );\r\n const toolbarStyle = useMemo(\r\n () => [\r\n styles.toolbar,\r\n {\r\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\r\n },\r\n ],\r\n [colorScheme, opacity, theme],\r\n );\r\n const ButtonContainer = button || Button;\r\n const IconContainer = icon || Arrow;\r\n\r\n const onPressNext = useCallback(() => {\r\n goToNextField();\r\n onNextCallback?.();\r\n }, [onNextCallback]);\r\n const onPressPrev = useCallback(() => {\r\n goToPrevField();\r\n onPrevCallback?.();\r\n }, [onPrevCallback]);\r\n const onPressDone = useCallback(() => {\r\n dismissKeyboard();\r\n onDoneCallback?.();\r\n }, [onDoneCallback]);\r\n\r\n return (\r\n <KeyboardStickyView offset={offset}>\r\n <View style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\r\n {blur}\r\n {showArrows && (\r\n <>\r\n <ButtonContainer\r\n accessibilityLabel=\"Previous\"\r\n accessibilityHint=\"Will move focus to previous field\"\r\n disabled={isPrevDisabled}\r\n onPress={onPressPrev}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isPrevDisabled}\r\n type=\"prev\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n <ButtonContainer\r\n accessibilityLabel=\"Next\"\r\n accessibilityHint=\"Will move focus to next field\"\r\n disabled={isNextDisabled}\r\n onPress={onPressNext}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\r\n theme={theme}\r\n >\r\n <IconContainer\r\n disabled={isNextDisabled}\r\n type=\"next\"\r\n theme={theme}\r\n />\r\n </ButtonContainer>\r\n </>\r\n )}\r\n\r\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\r\n {content}\r\n </View>\r\n <ButtonContainer\r\n accessibilityLabel=\"Done\"\r\n accessibilityHint=\"Will close the keyboard\"\r\n onPress={onPressDone}\r\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\r\n rippleRadius={28}\r\n style={styles.doneButtonContainer}\r\n theme={theme}\r\n >\r\n <Text style={doneStyle} maxFontSizeMultiplier={1.3}>\r\n {doneText || \"Done\"}\r\n </Text>\r\n </ButtonContainer>\r\n </View>\r\n </KeyboardStickyView>\r\n );\r\n};\r\n\r\nconst styles = StyleSheet.create({\r\n flex: {\r\n flex: 1,\r\n },\r\n toolbar: {\r\n position: \"absolute\",\r\n bottom: 0,\r\n alignItems: \"center\",\r\n width: \"100%\",\r\n flexDirection: \"row\",\r\n height: KEYBOARD_TOOLBAR_HEIGHT,\r\n paddingHorizontal: 8,\r\n },\r\n doneButton: {\r\n fontWeight: \"600\",\r\n fontSize: 15,\r\n },\r\n doneButtonContainer: {\r\n marginRight: 8,\r\n },\r\n});\r\n\r\nexport { colors as DefaultKeyboardToolbarTheme };\r\nexport default KeyboardToolbar;\r\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AAGA,IAAAG,mBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,eAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,MAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,OAAA,GAAAH,sBAAA,CAAAJ,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAAkC,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAV,wBAAAU,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAU,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,CAAAI,GAAA,CAAAX,CAAA,UAAAO,CAAA,CAAAK,GAAA,CAAAZ,CAAA,GAAAO,CAAA,CAAAM,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AAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBc,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAzG,OAAA,GAGYgC,eAAe","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { ColorValue } from \"react-native\";\r\n\r\ntype Theme = {\r\n /** Color for arrow when it's enabled */\r\n primary: ColorValue;\r\n /** Color for arrow when it's disabled */\r\n disabled: ColorValue;\r\n /** Keyboard toolbar background color */\r\n background: string;\r\n /** Color for ripple effect (on button touch) on Android */\r\n ripple: ColorValue;\r\n};\r\nexport type KeyboardToolbarTheme = {\r\n light: Theme;\r\n dark: Theme;\r\n};\r\ntype HexSymbol =\r\n | \"0\"\r\n | \"1\"\r\n | \"2\"\r\n | \"3\"\r\n | \"4\"\r\n | \"5\"\r\n | \"6\"\r\n | \"7\"\r\n | \"8\"\r\n | \"9\"\r\n | \"A\"\r\n | \"B\"\r\n | \"C\"\r\n | \"D\"\r\n | \"E\"\r\n | \"F\"\r\n | \"a\"\r\n | \"b\"\r\n | \"c\"\r\n | \"d\"\r\n | \"e\"\r\n | \"f\";\r\nexport type HEX = `${HexSymbol}${HexSymbol}`;\r\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _reactNative = require("react-native");
8
+ const useColorScheme = () => (0, _reactNative.useColorScheme)() || "light";
9
+ var _default = exports.default = useColorScheme;
10
+ //# sourceMappingURL=useColorScheme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","useColorScheme","useColorSchemeRN","_default","exports","default"],"sources":["useColorScheme.ts"],"sourcesContent":["import { useColorScheme as useColorSchemeRN } from \"react-native\";\r\n\r\nconst useColorScheme = () => useColorSchemeRN() || \"light\";\r\n\r\nexport default useColorScheme;\r\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAGA,CAAA,KAAM,IAAAC,2BAAgB,EAAC,CAAC,IAAI,OAAO;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAE5CJ,cAAc","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _KeyboardToolbar.DefaultKeyboardToolbarTheme;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "KeyboardAvoidingView", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _KeyboardAvoidingView.default;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "KeyboardAwareScrollView", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _KeyboardAwareScrollView.default;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "KeyboardStickyView", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _KeyboardStickyView.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "KeyboardToolbar", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _KeyboardToolbar.default;
34
+ }
35
+ });
36
+ var _KeyboardAvoidingView = _interopRequireDefault(require("./KeyboardAvoidingView"));
37
+ var _KeyboardStickyView = _interopRequireDefault(require("./KeyboardStickyView"));
38
+ var _KeyboardAwareScrollView = _interopRequireDefault(require("./KeyboardAwareScrollView"));
39
+ var _KeyboardToolbar = _interopRequireWildcard(require("./KeyboardToolbar"));
40
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
41
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_KeyboardAvoidingView","_interopRequireDefault","require","_KeyboardStickyView","_KeyboardAwareScrollView","_KeyboardToolbar","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\r\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\r\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\r\nexport {\r\n default as KeyboardToolbar,\r\n DefaultKeyboardToolbarTheme,\r\n} from \"./KeyboardToolbar\";\r\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\r\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\r\nexport type { KeyboardAwareScrollViewProps } from \"./KeyboardAwareScrollView\";\r\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,wBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gBAAA,GAAAC,uBAAA,CAAAJ,OAAA;AAG2B,SAAAI,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAAA,SAAAP,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAK,UAAA,GAAAL,CAAA,KAAAU,OAAA,EAAAV,CAAA","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.AndroidSoftInputModes = void 0;
7
+ // copied from `android.view.WindowManager.LayoutParams`
8
+ let AndroidSoftInputModes = exports.AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes) {
9
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_NOTHING"] = 48] = "SOFT_INPUT_ADJUST_NOTHING";
10
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_PAN"] = 32] = "SOFT_INPUT_ADJUST_PAN";
11
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_RESIZE"] = 16] = "SOFT_INPUT_ADJUST_RESIZE";
12
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_ADJUST_UNSPECIFIED"] = 0] = "SOFT_INPUT_ADJUST_UNSPECIFIED";
13
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_IS_FORWARD_NAVIGATION"] = 256] = "SOFT_INPUT_IS_FORWARD_NAVIGATION";
14
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_ADJUST"] = 240] = "SOFT_INPUT_MASK_ADJUST";
15
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MASK_STATE"] = 15] = "SOFT_INPUT_MASK_STATE";
16
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_MODE_CHANGED"] = 512] = "SOFT_INPUT_MODE_CHANGED";
17
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_HIDDEN"] = 3] = "SOFT_INPUT_STATE_ALWAYS_HIDDEN";
18
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_ALWAYS_VISIBLE"] = 5] = "SOFT_INPUT_STATE_ALWAYS_VISIBLE";
19
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_HIDDEN"] = 2] = "SOFT_INPUT_STATE_HIDDEN";
20
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNCHANGED"] = 1] = "SOFT_INPUT_STATE_UNCHANGED";
21
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_UNSPECIFIED"] = 0] = "SOFT_INPUT_STATE_UNSPECIFIED";
22
+ AndroidSoftInputModes[AndroidSoftInputModes["SOFT_INPUT_STATE_VISIBLE"] = 4] = "SOFT_INPUT_STATE_VISIBLE";
23
+ return AndroidSoftInputModes;
24
+ }({});
25
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AndroidSoftInputModes","exports"],"sources":["constants.ts"],"sourcesContent":["// copied from `android.view.WindowManager.LayoutParams`\r\nexport enum AndroidSoftInputModes {\r\n SOFT_INPUT_ADJUST_NOTHING = 48,\r\n SOFT_INPUT_ADJUST_PAN = 32,\r\n SOFT_INPUT_ADJUST_RESIZE = 16,\r\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\r\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\r\n SOFT_INPUT_MASK_ADJUST = 240,\r\n SOFT_INPUT_MASK_STATE = 15,\r\n SOFT_INPUT_MODE_CHANGED = 512,\r\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\r\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\r\n SOFT_INPUT_STATE_HIDDEN = 2,\r\n SOFT_INPUT_STATE_UNCHANGED = 1,\r\n // temporarily disable this rule to avoid breaking changes.\r\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\r\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\r\n SOFT_INPUT_STATE_VISIBLE = 4,\r\n}\r\n"],"mappings":";;;;;;AAAA;AAAA,IACYA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA","ignoreList":[]}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useKeyboardContext = exports.KeyboardContext = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ const NOOP = () => {};
10
+ const withSharedValue = value => ({
11
+ value,
12
+ addListener: NOOP,
13
+ removeListener: NOOP,
14
+ modify: NOOP
15
+ });
16
+ const DEFAULT_SHARED_VALUE = withSharedValue(0);
17
+ const DEFAULT_LAYOUT = withSharedValue(null);
18
+ const defaultContext = {
19
+ enabled: true,
20
+ animated: {
21
+ progress: new _reactNative.Animated.Value(0),
22
+ height: new _reactNative.Animated.Value(0)
23
+ },
24
+ reanimated: {
25
+ progress: DEFAULT_SHARED_VALUE,
26
+ height: DEFAULT_SHARED_VALUE
27
+ },
28
+ layout: DEFAULT_LAYOUT,
29
+ setKeyboardHandlers: NOOP,
30
+ setInputHandlers: NOOP,
31
+ setEnabled: NOOP
32
+ };
33
+ const KeyboardContext = exports.KeyboardContext = /*#__PURE__*/(0, _react.createContext)(defaultContext);
34
+ const useKeyboardContext = () => {
35
+ const context = (0, _react.useContext)(KeyboardContext);
36
+ if (__DEV__ && context === defaultContext) {
37
+ console.warn("Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.");
38
+ }
39
+ return context;
40
+ };
41
+ exports.useKeyboardContext = useKeyboardContext;
42
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","NOOP","withSharedValue","value","addListener","removeListener","modify","DEFAULT_SHARED_VALUE","DEFAULT_LAYOUT","defaultContext","enabled","animated","progress","Animated","Value","height","reanimated","layout","setKeyboardHandlers","setInputHandlers","setEnabled","KeyboardContext","exports","createContext","useKeyboardContext","context","useContext","__DEV__","console","warn"],"sources":["context.ts"],"sourcesContent":["import { createContext, useContext } from \"react\";\r\nimport { Animated } from \"react-native\";\r\n\r\nimport type {\r\n FocusedInputHandlers,\r\n FocusedInputLayoutChangedEvent,\r\n KeyboardHandlers,\r\n} from \"./types\";\r\nimport type React from \"react\";\r\nimport type { SharedValue } from \"react-native-reanimated\";\r\n\r\nexport type AnimatedContext = {\r\n progress: Animated.Value;\r\n height: Animated.AnimatedMultiplication<number>;\r\n};\r\nexport type ReanimatedContext = {\r\n progress: SharedValue<number>;\r\n height: SharedValue<number>;\r\n};\r\nexport type KeyboardAnimationContext = {\r\n enabled: boolean;\r\n animated: AnimatedContext;\r\n reanimated: ReanimatedContext;\r\n layout: SharedValue<FocusedInputLayoutChangedEvent | null>;\r\n setKeyboardHandlers: (handlers: KeyboardHandlers) => void;\r\n setInputHandlers: (handlers: FocusedInputHandlers) => void;\r\n setEnabled: React.Dispatch<React.SetStateAction<boolean>>;\r\n};\r\nconst NOOP = () => {};\r\nconst withSharedValue = <T>(value: T): SharedValue<T> => ({\r\n value,\r\n addListener: NOOP,\r\n removeListener: NOOP,\r\n modify: NOOP,\r\n});\r\nconst DEFAULT_SHARED_VALUE = withSharedValue(0);\r\nconst DEFAULT_LAYOUT = withSharedValue<FocusedInputLayoutChangedEvent | null>(\r\n null,\r\n);\r\nconst defaultContext: KeyboardAnimationContext = {\r\n enabled: true,\r\n animated: {\r\n progress: new Animated.Value(0),\r\n height: new Animated.Value(0),\r\n },\r\n reanimated: {\r\n progress: DEFAULT_SHARED_VALUE,\r\n height: DEFAULT_SHARED_VALUE,\r\n },\r\n layout: DEFAULT_LAYOUT,\r\n setKeyboardHandlers: NOOP,\r\n setInputHandlers: NOOP,\r\n setEnabled: NOOP,\r\n};\r\nexport const KeyboardContext = createContext(defaultContext);\r\nexport const useKeyboardContext = () => {\r\n const context = useContext(KeyboardContext);\r\n if (__DEV__ && context === defaultContext) {\r\n console.warn(\r\n \"Couldn't find real values for `KeyboardContext`. Please make sure you're inside of `KeyboardProvider` - otherwise functionality of `react-native-keyboard-controller` will not work.\",\r\n );\r\n }\r\n\r\n return context;\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AA2BA,MAAME,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AACrB,MAAMC,eAAe,GAAOC,KAAQ,KAAsB;EACxDA,KAAK;EACLC,WAAW,EAAEH,IAAI;EACjBI,cAAc,EAAEJ,IAAI;EACpBK,MAAM,EAAEL;AACV,CAAC,CAAC;AACF,MAAMM,oBAAoB,GAAGL,eAAe,CAAC,CAAC,CAAC;AAC/C,MAAMM,cAAc,GAAGN,eAAe,CACpC,IACF,CAAC;AACD,MAAMO,cAAwC,GAAG;EAC/CC,OAAO,EAAE,IAAI;EACbC,QAAQ,EAAE;IACRC,QAAQ,EAAE,IAAIC,qBAAQ,CAACC,KAAK,CAAC,CAAC,CAAC;IAC/BC,MAAM,EAAE,IAAIF,qBAAQ,CAACC,KAAK,CAAC,CAAC;EAC9B,CAAC;EACDE,UAAU,EAAE;IACVJ,QAAQ,EAAEL,oBAAoB;IAC9BQ,MAAM,EAAER;EACV,CAAC;EACDU,MAAM,EAAET,cAAc;EACtBU,mBAAmB,EAAEjB,IAAI;EACzBkB,gBAAgB,EAAElB,IAAI;EACtBmB,UAAU,EAAEnB;AACd,CAAC;AACM,MAAMoB,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,oBAAa,EAACd,cAAc,CAAC;AACrD,MAAMe,kBAAkB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACL,eAAe,CAAC;EAC3C,IAAIM,OAAO,IAAIF,OAAO,KAAKhB,cAAc,EAAE;IACzCmB,OAAO,CAACC,IAAI,CACV,sLACF,CAAC;EACH;EAEA,OAAOJ,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAE,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ useResizeMode: true,
8
+ useKeyboardAnimation: true,
9
+ useReanimatedKeyboardAnimation: true,
10
+ useGenericKeyboardHandler: true,
11
+ useKeyboardHandler: true,
12
+ useKeyboardController: true,
13
+ useReanimatedFocusedInput: true,
14
+ useFocusedInputHandler: true
15
+ };
16
+ exports.useFocusedInputHandler = useFocusedInputHandler;
17
+ exports.useGenericKeyboardHandler = useGenericKeyboardHandler;
18
+ exports.useKeyboardAnimation = void 0;
19
+ exports.useKeyboardController = useKeyboardController;
20
+ exports.useKeyboardHandler = useKeyboardHandler;
21
+ exports.useReanimatedFocusedInput = useReanimatedFocusedInput;
22
+ exports.useResizeMode = exports.useReanimatedKeyboardAnimation = void 0;
23
+ var _react = require("react");
24
+ var _bindings = require("../bindings");
25
+ var _constants = require("../constants");
26
+ var _context = require("../context");
27
+ var _utils = require("../utils");
28
+ var _useWindowDimensions = require("./useWindowDimensions");
29
+ Object.keys(_useWindowDimensions).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
32
+ if (key in exports && exports[key] === _useWindowDimensions[key]) return;
33
+ Object.defineProperty(exports, key, {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _useWindowDimensions[key];
37
+ }
38
+ });
39
+ });
40
+ const useResizeMode = () => {
41
+ (0, _react.useEffect)(() => {
42
+ _bindings.KeyboardController.setInputMode(_constants.AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE);
43
+ return () => _bindings.KeyboardController.setDefaultMode();
44
+ }, []);
45
+ };
46
+ exports.useResizeMode = useResizeMode;
47
+ const useKeyboardAnimation = () => {
48
+ useResizeMode();
49
+ const context = (0, _context.useKeyboardContext)();
50
+ return context.animated;
51
+ };
52
+ exports.useKeyboardAnimation = useKeyboardAnimation;
53
+ const useReanimatedKeyboardAnimation = () => {
54
+ useResizeMode();
55
+ const context = (0, _context.useKeyboardContext)();
56
+ return context.reanimated;
57
+ };
58
+ exports.useReanimatedKeyboardAnimation = useReanimatedKeyboardAnimation;
59
+ function useGenericKeyboardHandler(handler, deps) {
60
+ const context = (0, _context.useKeyboardContext)();
61
+ (0, _react.useEffect)(() => {
62
+ const key = (0, _utils.uuid)();
63
+ context.setKeyboardHandlers({
64
+ [key]: handler
65
+ });
66
+ return () => {
67
+ context.setKeyboardHandlers({
68
+ [key]: undefined
69
+ });
70
+ };
71
+ }, deps);
72
+ }
73
+ function useKeyboardHandler(handler, deps) {
74
+ useResizeMode();
75
+ useGenericKeyboardHandler(handler, deps);
76
+ }
77
+ function useKeyboardController() {
78
+ const context = (0, _context.useKeyboardContext)();
79
+ return {
80
+ setEnabled: context.setEnabled,
81
+ enabled: context.enabled
82
+ };
83
+ }
84
+ function useReanimatedFocusedInput() {
85
+ const context = (0, _context.useKeyboardContext)();
86
+ return {
87
+ input: context.layout
88
+ };
89
+ }
90
+ function useFocusedInputHandler(handler, deps) {
91
+ const context = (0, _context.useKeyboardContext)();
92
+ (0, _react.useEffect)(() => {
93
+ const key = (0, _utils.uuid)();
94
+ context.setInputHandlers({
95
+ [key]: handler
96
+ });
97
+ return () => {
98
+ context.setInputHandlers({
99
+ [key]: undefined
100
+ });
101
+ };
102
+ }, deps);
103
+ }
104
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_bindings","_constants","_context","_utils","_useWindowDimensions","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","useResizeMode","useEffect","KeyboardController","setInputMode","AndroidSoftInputModes","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode","useKeyboardAnimation","context","useKeyboardContext","animated","useReanimatedKeyboardAnimation","reanimated","useGenericKeyboardHandler","handler","deps","uuid","setKeyboardHandlers","undefined","useKeyboardHandler","useKeyboardController","setEnabled","enabled","useReanimatedFocusedInput","input","layout","useFocusedInputHandler","setInputHandlers"],"sources":["index.ts"],"sourcesContent":["import { useEffect } from \"react\";\r\n\r\nimport { KeyboardController } from \"../bindings\";\r\nimport { AndroidSoftInputModes } from \"../constants\";\r\nimport { useKeyboardContext } from \"../context\";\r\nimport { uuid } from \"../utils\";\r\n\r\nimport type { AnimatedContext, ReanimatedContext } from \"../context\";\r\nimport type { FocusedInputHandler, KeyboardHandler } from \"../types\";\r\nimport type { DependencyList } from \"react\";\r\n\r\nexport const useResizeMode = () => {\r\n useEffect(() => {\r\n KeyboardController.setInputMode(\r\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE,\r\n );\r\n\r\n return () => KeyboardController.setDefaultMode();\r\n }, []);\r\n};\r\n\r\nexport const useKeyboardAnimation = (): AnimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.animated;\r\n};\r\n\r\nexport const useReanimatedKeyboardAnimation = (): ReanimatedContext => {\r\n useResizeMode();\r\n const context = useKeyboardContext();\r\n\r\n return context.reanimated;\r\n};\r\n\r\nexport function useGenericKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setKeyboardHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setKeyboardHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport function useKeyboardHandler(\r\n handler: KeyboardHandler,\r\n deps?: DependencyList,\r\n) {\r\n useResizeMode();\r\n useGenericKeyboardHandler(handler, deps);\r\n}\r\n\r\nexport function useKeyboardController() {\r\n const context = useKeyboardContext();\r\n\r\n return { setEnabled: context.setEnabled, enabled: context.enabled };\r\n}\r\n\r\nexport function useReanimatedFocusedInput() {\r\n const context = useKeyboardContext();\r\n\r\n return { input: context.layout };\r\n}\r\n\r\nexport function useFocusedInputHandler(\r\n handler?: FocusedInputHandler,\r\n deps?: DependencyList,\r\n) {\r\n const context = useKeyboardContext();\r\n\r\n useEffect(() => {\r\n const key = uuid();\r\n\r\n context.setInputHandlers({ [key]: handler });\r\n\r\n return () => {\r\n context.setInputHandlers({ [key]: undefined });\r\n };\r\n }, deps);\r\n}\r\n\r\nexport * from \"./useWindowDimensions\";\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAoFA,IAAAK,oBAAA,GAAAL,OAAA;AAAAM,MAAA,CAAAC,IAAA,CAAAF,oBAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,oBAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,oBAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AA9EO,MAAMS,aAAa,GAAGA,CAAA,KAAM;EACjC,IAAAC,gBAAS,EAAC,MAAM;IACdC,4BAAkB,CAACC,YAAY,CAC7BC,gCAAqB,CAACC,wBACxB,CAAC;IAED,OAAO,MAAMH,4BAAkB,CAACI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,CAACc;EAAQ,CAAC;AACrE;AAEO,SAASC,yBAAyBA,CAAA,EAAG;EAC1C,MAAMf,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,OAAO;IAAEe,KAAK,EAAEhB,OAAO,CAACiB;EAAO,CAAC;AAClC;AAEO,SAASC,sBAAsBA,CACpCZ,OAA6B,EAC7BC,IAAqB,EACrB;EACA,MAAMP,OAAO,GAAG,IAAAC,2BAAkB,EAAC,CAAC;EAEpC,IAAAR,gBAAS,EAAC,MAAM;IACd,MAAMV,GAAG,GAAG,IAAAyB,WAAI,EAAC,CAAC;IAElBR,OAAO,CAACmB,gBAAgB,CAAC;MAAE,CAACpC,GAAG,GAAGuB;IAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM;MACXN,OAAO,CAACmB,gBAAgB,CAAC;QAAE,CAACpC,GAAG,GAAG2B;MAAU,CAAC,CAAC;IAChD,CAAC;EACH,CAAC,EAAEH,IAAI,CAAC;AACV","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useWindowDimensions = void 0;
7
+ var _react = require("react");
8
+ var _bindings = require("../../bindings");
9
+ let initialDimensions = {
10
+ width: 0,
11
+ height: 0
12
+ };
13
+ _bindings.WindowDimensionsEvents.addListener("windowDidResize", e => {
14
+ initialDimensions = e;
15
+ });
16
+ const useWindowDimensions = () => {
17
+ const [dimensions, setDimensions] = (0, _react.useState)(initialDimensions);
18
+ (0, _react.useEffect)(() => {
19
+ const subscription = _bindings.WindowDimensionsEvents.addListener("windowDidResize", e => {
20
+ setDimensions(e);
21
+ });
22
+ return () => {
23
+ subscription.remove();
24
+ };
25
+ }, []);
26
+ return dimensions;
27
+ };
28
+ exports.useWindowDimensions = useWindowDimensions;
29
+ //# sourceMappingURL=index.android.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_bindings","initialDimensions","width","height","WindowDimensionsEvents","addListener","e","useWindowDimensions","dimensions","setDimensions","useState","useEffect","subscription","remove","exports"],"sources":["index.android.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\r\n\r\nimport { WindowDimensionsEvents } from \"../../bindings\";\r\n\r\nimport type { WindowDimensionsEventData } from \"../../types\";\r\n\r\nlet initialDimensions: WindowDimensionsEventData = {\r\n width: 0,\r\n height: 0,\r\n};\r\n\r\nWindowDimensionsEvents.addListener(\"windowDidResize\", (e) => {\r\n initialDimensions = e;\r\n});\r\n\r\nexport const useWindowDimensions = () => {\r\n const [dimensions, setDimensions] = useState(initialDimensions);\r\n\r\n useEffect(() => {\r\n const subscription = WindowDimensionsEvents.addListener(\r\n \"windowDidResize\",\r\n (e) => {\r\n setDimensions(e);\r\n },\r\n );\r\n\r\n return () => {\r\n subscription.remove();\r\n };\r\n }, []);\r\n\r\n return dimensions;\r\n};\r\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAIE,iBAA4C,GAAG;EACjDC,KAAK,EAAE,CAAC;EACRC,MAAM,EAAE;AACV,CAAC;AAEDC,gCAAsB,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EAC3DL,iBAAiB,GAAGK,CAAC;AACvB,CAAC,CAAC;AAEK,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAM,CAACC,UAAU,EAAEC,aAAa,CAAC,GAAG,IAAAC,eAAQ,EAACT,iBAAiB,CAAC;EAE/D,IAAAU,gBAAS,EAAC,MAAM;IACd,MAAMC,YAAY,GAAGR,gCAAsB,CAACC,WAAW,CACrD,iBAAiB,EAChBC,CAAC,IAAK;MACLG,aAAa,CAACH,CAAC,CAAC;IAClB,CACF,CAAC;IAED,OAAO,MAAM;MACXM,YAAY,CAACC,MAAM,CAAC,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOL,UAAU;AACnB,CAAC;AAACM,OAAA,CAAAP,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useWindowDimensions", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _reactNative.useWindowDimensions;
10
+ }
11
+ });
12
+ var _reactNative = require("react-native");
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require"],"sources":["index.ts"],"sourcesContent":["export { useWindowDimensions } from \"react-native\";\r\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ KeyboardAvoidingView: true,
8
+ KeyboardStickyView: true,
9
+ KeyboardAwareScrollView: true,
10
+ KeyboardToolbar: true,
11
+ DefaultKeyboardToolbarTheme: true
12
+ };
13
+ Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _components.DefaultKeyboardToolbarTheme;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "KeyboardAvoidingView", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _components.KeyboardAvoidingView;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "KeyboardAwareScrollView", {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _components.KeyboardAwareScrollView;
29
+ }
30
+ });
31
+ Object.defineProperty(exports, "KeyboardStickyView", {
32
+ enumerable: true,
33
+ get: function () {
34
+ return _components.KeyboardStickyView;
35
+ }
36
+ });
37
+ Object.defineProperty(exports, "KeyboardToolbar", {
38
+ enumerable: true,
39
+ get: function () {
40
+ return _components.KeyboardToolbar;
41
+ }
42
+ });
43
+ var _bindings = require("./bindings");
44
+ Object.keys(_bindings).forEach(function (key) {
45
+ if (key === "default" || key === "__esModule") return;
46
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
47
+ if (key in exports && exports[key] === _bindings[key]) return;
48
+ Object.defineProperty(exports, key, {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _bindings[key];
52
+ }
53
+ });
54
+ });
55
+ var _animated = require("./animated");
56
+ Object.keys(_animated).forEach(function (key) {
57
+ if (key === "default" || key === "__esModule") return;
58
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
59
+ if (key in exports && exports[key] === _animated[key]) return;
60
+ Object.defineProperty(exports, key, {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _animated[key];
64
+ }
65
+ });
66
+ });
67
+ var _context = require("./context");
68
+ Object.keys(_context).forEach(function (key) {
69
+ if (key === "default" || key === "__esModule") return;
70
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
71
+ if (key in exports && exports[key] === _context[key]) return;
72
+ Object.defineProperty(exports, key, {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _context[key];
76
+ }
77
+ });
78
+ });
79
+ var _hooks = require("./hooks");
80
+ Object.keys(_hooks).forEach(function (key) {
81
+ if (key === "default" || key === "__esModule") return;
82
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
83
+ if (key in exports && exports[key] === _hooks[key]) return;
84
+ Object.defineProperty(exports, key, {
85
+ enumerable: true,
86
+ get: function () {
87
+ return _hooks[key];
88
+ }
89
+ });
90
+ });
91
+ var _constants = require("./constants");
92
+ Object.keys(_constants).forEach(function (key) {
93
+ if (key === "default" || key === "__esModule") return;
94
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
95
+ if (key in exports && exports[key] === _constants[key]) return;
96
+ Object.defineProperty(exports, key, {
97
+ enumerable: true,
98
+ get: function () {
99
+ return _constants[key];
100
+ }
101
+ });
102
+ });
103
+ var _types = require("./types");
104
+ Object.keys(_types).forEach(function (key) {
105
+ if (key === "default" || key === "__esModule") return;
106
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
107
+ if (key in exports && exports[key] === _types[key]) return;
108
+ Object.defineProperty(exports, key, {
109
+ enumerable: true,
110
+ get: function () {
111
+ return _types[key];
112
+ }
113
+ });
114
+ });
115
+ var _components = require("./components");
116
+ //# sourceMappingURL=index.js.map