react-native-keyboard-controller 1.17.5 → 1.18.0

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 (169) hide show
  1. package/README.md +4 -1
  2. package/android/src/base/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +3 -2
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardBackgroundViewManager.kt +19 -0
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +4 -0
  5. package/android/src/fabric/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +3 -1
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/Context.kt +20 -0
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/extensions/ThemedReactContext.kt +2 -12
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardBackgroundViewManagerImpl.kt +13 -0
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/managers/KeyboardControllerViewManagerImpl.kt +1 -1
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +4 -0
  11. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/{StatusBarManagerCompatModuleImpl.kt → statusbar/StatusBarManagerCompatModuleImpl.kt} +31 -5
  12. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/statusbar/StatusBarModuleProxy.kt +86 -0
  13. package/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt +9 -11
  14. package/android/src/main/java/com/reactnativekeyboardcontroller/views/background/KeyboardBackgroundViewGroup.kt +35 -0
  15. package/android/src/main/java/com/reactnativekeyboardcontroller/views/background/Skins.kt +91 -0
  16. package/android/src/main/jni/reactnativekeyboardcontroller.h +1 -0
  17. package/android/src/main/res/values/attrs.xml +7 -0
  18. package/android/src/main/res/values/colors.xml +35 -0
  19. package/android/src/main/res/values-v29/colors.xml +5 -0
  20. package/android/src/main/res/values-v30/colors.xml +17 -0
  21. package/android/src/main/res/values-v33/colors.xml +16 -0
  22. package/android/src/main/res/values-v34/colors.xml +18 -0
  23. package/android/src/main/res/values-v35/colors.xml +10 -0
  24. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardBackgroundViewManager.kt +15 -0
  25. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -0
  26. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +3 -1
  27. package/android/src/turbo/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +2 -2
  28. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewComponentDescriptor.h +27 -0
  29. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.cpp +14 -0
  30. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewShadowNode.h +30 -0
  31. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardBackgroundViewState.h +28 -0
  32. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderComponentDescriptor.h +27 -0
  33. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderShadowNode.cpp +14 -0
  34. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderShadowNode.h +30 -0
  35. package/common/cpp/react/renderer/components/reactnativekeyboardcontroller/RNKCKeyboardExtenderState.h +28 -0
  36. package/ios/KeyboardControllerModule.mm +9 -0
  37. package/ios/delegates/KCTextInputCompositeDelegate.swift +5 -5
  38. package/ios/events/KeyboardEventEmitterPayload.swift +1 -1
  39. package/ios/extensions/UIResponder.swift +27 -0
  40. package/ios/interactive/KeyboardAreaExtender.swift +5 -5
  41. package/ios/observers/FocusedInputObserver.swift +14 -5
  42. package/ios/observers/KeyboardMovementObserver.swift +7 -1
  43. package/ios/protocols/TextInput.swift +22 -0
  44. package/ios/swizzling/UIResponderSwizzle.swift +3 -0
  45. package/ios/views/KeyboardBackgroundViewManager.h +29 -0
  46. package/ios/views/KeyboardBackgroundViewManager.mm +168 -0
  47. package/ios/views/KeyboardExtenderContainerView.swift +59 -0
  48. package/ios/views/KeyboardExtenderManager.h +29 -0
  49. package/ios/views/KeyboardExtenderManager.mm +287 -0
  50. package/jest/index.js +6 -1
  51. package/lib/commonjs/animated.js +7 -10
  52. package/lib/commonjs/animated.js.map +1 -1
  53. package/lib/commonjs/bindings.js +15 -1
  54. package/lib/commonjs/bindings.js.map +1 -1
  55. package/lib/commonjs/bindings.native.js +5 -1
  56. package/lib/commonjs/bindings.native.js.map +1 -1
  57. package/lib/commonjs/components/KeyboardAwareScrollView/index.js +49 -29
  58. package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
  59. package/lib/commonjs/components/KeyboardToolbar/Arrow.js +2 -3
  60. package/lib/commonjs/components/KeyboardToolbar/Arrow.js.map +1 -1
  61. package/lib/commonjs/components/KeyboardToolbar/Button.js +2 -3
  62. package/lib/commonjs/components/KeyboardToolbar/Button.js.map +1 -1
  63. package/lib/commonjs/components/KeyboardToolbar/index.js +2 -2
  64. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  65. package/lib/commonjs/hooks/useKeyboardState/index.js +18 -8
  66. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
  67. package/lib/commonjs/index.js +8 -1
  68. package/lib/commonjs/index.js.map +1 -1
  69. package/lib/commonjs/module.js +2 -1
  70. package/lib/commonjs/module.js.map +1 -1
  71. package/lib/commonjs/specs/KeyboardBackgroundViewNativeComponent.js +12 -0
  72. package/lib/commonjs/specs/KeyboardBackgroundViewNativeComponent.js.map +1 -0
  73. package/lib/commonjs/specs/KeyboardExtenderNativeComponent.js +13 -0
  74. package/lib/commonjs/specs/KeyboardExtenderNativeComponent.js.map +1 -0
  75. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  76. package/lib/commonjs/types/module.js.map +1 -1
  77. package/lib/commonjs/types/views.js.map +1 -1
  78. package/lib/commonjs/views/KeyboardExtender/index.ios.js +43 -0
  79. package/lib/commonjs/views/KeyboardExtender/index.ios.js.map +1 -0
  80. package/lib/commonjs/views/KeyboardExtender/index.js +46 -0
  81. package/lib/commonjs/views/KeyboardExtender/index.js.map +1 -0
  82. package/lib/commonjs/views/index.js +7 -0
  83. package/lib/commonjs/views/index.js.map +1 -1
  84. package/lib/module/animated.js +8 -11
  85. package/lib/module/animated.js.map +1 -1
  86. package/lib/module/bindings.js +14 -0
  87. package/lib/module/bindings.js.map +1 -1
  88. package/lib/module/bindings.native.js +4 -0
  89. package/lib/module/bindings.native.js.map +1 -1
  90. package/lib/module/components/KeyboardAwareScrollView/index.js +50 -30
  91. package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
  92. package/lib/module/components/KeyboardToolbar/Arrow.js +2 -2
  93. package/lib/module/components/KeyboardToolbar/Arrow.js.map +1 -1
  94. package/lib/module/components/KeyboardToolbar/Button.js +2 -2
  95. package/lib/module/components/KeyboardToolbar/Button.js.map +1 -1
  96. package/lib/module/components/KeyboardToolbar/index.js +2 -2
  97. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  98. package/lib/module/hooks/useKeyboardState/index.js +18 -6
  99. package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
  100. package/lib/module/index.js +1 -1
  101. package/lib/module/index.js.map +1 -1
  102. package/lib/module/module.js +2 -1
  103. package/lib/module/module.js.map +1 -1
  104. package/lib/module/specs/KeyboardBackgroundViewNativeComponent.js +5 -0
  105. package/lib/module/specs/KeyboardBackgroundViewNativeComponent.js.map +1 -0
  106. package/lib/module/specs/KeyboardExtenderNativeComponent.js +6 -0
  107. package/lib/module/specs/KeyboardExtenderNativeComponent.js.map +1 -0
  108. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  109. package/lib/module/types/module.js.map +1 -1
  110. package/lib/module/types/views.js.map +1 -1
  111. package/lib/module/views/KeyboardExtender/index.ios.js +36 -0
  112. package/lib/module/views/KeyboardExtender/index.ios.js.map +1 -0
  113. package/lib/module/views/KeyboardExtender/index.js +39 -0
  114. package/lib/module/views/KeyboardExtender/index.js.map +1 -0
  115. package/lib/module/views/index.js +1 -0
  116. package/lib/module/views/index.js.map +1 -1
  117. package/lib/typescript/animated.d.ts +7 -0
  118. package/lib/typescript/bindings.d.ts +14 -1
  119. package/lib/typescript/bindings.native.d.ts +3 -1
  120. package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +2 -2
  121. package/lib/typescript/hooks/useKeyboardState/index.d.ts +8 -2
  122. package/lib/typescript/index.d.ts +1 -1
  123. package/lib/typescript/specs/KeyboardBackgroundViewNativeComponent.d.ts +6 -0
  124. package/lib/typescript/specs/KeyboardExtenderNativeComponent.d.ts +7 -0
  125. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
  126. package/lib/typescript/types/module.d.ts +15 -3
  127. package/lib/typescript/types/views.d.ts +5 -0
  128. package/lib/typescript/views/KeyboardExtender/index.d.ts +19 -0
  129. package/lib/typescript/views/KeyboardExtender/index.ios.d.ts +19 -0
  130. package/lib/typescript/views/index.d.ts +1 -0
  131. package/package.json +7 -3
  132. package/react-native.config.js +1 -0
  133. package/src/animated.tsx +14 -9
  134. package/src/bindings.native.ts +8 -0
  135. package/src/bindings.ts +18 -0
  136. package/src/components/KeyboardAwareScrollView/index.tsx +72 -47
  137. package/src/components/KeyboardToolbar/Arrow.tsx +2 -2
  138. package/src/components/KeyboardToolbar/Button.tsx +2 -2
  139. package/src/components/KeyboardToolbar/index.tsx +2 -2
  140. package/src/hooks/useKeyboardState/index.ts +25 -6
  141. package/src/index.ts +1 -1
  142. package/src/module.ts +2 -1
  143. package/src/specs/KeyboardBackgroundViewNativeComponent.ts +10 -0
  144. package/src/specs/KeyboardExtenderNativeComponent.ts +13 -0
  145. package/src/specs/NativeKeyboardController.ts +1 -0
  146. package/src/types/module.ts +17 -3
  147. package/src/types/views.ts +5 -0
  148. package/src/views/KeyboardExtender/index.ios.tsx +35 -0
  149. package/src/views/KeyboardExtender/index.tsx +42 -0
  150. package/src/views/index.ts +1 -0
  151. package/ios/extensions/UIKeyboardAppearance.swift +0 -21
  152. package/lib/commonjs/components/hooks/useColorScheme.js +0 -10
  153. package/lib/commonjs/components/hooks/useColorScheme.js.map +0 -1
  154. package/lib/commonjs/monkey-patch.android.js +0 -53
  155. package/lib/commonjs/monkey-patch.android.js.map +0 -1
  156. package/lib/commonjs/monkey-patch.js +0 -11
  157. package/lib/commonjs/monkey-patch.js.map +0 -1
  158. package/lib/module/components/hooks/useColorScheme.js +0 -4
  159. package/lib/module/components/hooks/useColorScheme.js.map +0 -1
  160. package/lib/module/monkey-patch.android.js +0 -42
  161. package/lib/module/monkey-patch.android.js.map +0 -1
  162. package/lib/module/monkey-patch.js +0 -5
  163. package/lib/module/monkey-patch.js.map +0 -1
  164. package/lib/typescript/components/hooks/useColorScheme.d.ts +0 -2
  165. package/lib/typescript/monkey-patch.android.d.ts +0 -2
  166. package/lib/typescript/monkey-patch.d.ts +0 -2
  167. package/src/components/hooks/useColorScheme.ts +0 -5
  168. package/src/monkey-patch.android.ts +0 -41
  169. package/src/monkey-patch.ts +0 -5
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_module","_useColorScheme","_interopRequireDefault","_KeyboardStickyView","_Arrow","_Button","_colors","_constants","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","KeyboardToolbar","props","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","DEFAULT_OPACITY","offset","closed","opened","enabled","insets","rest","colorScheme","useColorScheme","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","useEffect","subscription","FocusedInputEvents","addListener","remove","doneStyle","useMemo","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","KEYBOARD_HAS_ROUNDED_CORNERS","paddingLeft","left","paddingRight","right","floating","containerStyle","marginLeft","marginRight","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","ButtonContainer","Button","IconContainer","Arrow","onPressNext","useCallback","event","isDefaultPrevented","KeyboardController","setFocusTo","onPressPrev","onPressDone","dismiss","createElement","style","View","testID","TEST_ID_KEYBOARD_TOOLBAR","arrows","accessibilityHint","accessibilityLabel","disabled","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","onPress","type","TEST_ID_KEYBOARD_TOOLBAR_NEXT","flex","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","rippleRadius","doneButtonContainer","TEST_ID_KEYBOARD_TOOLBAR_DONE","Text","maxFontSizeMultiplier","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","fontWeight","fontSize","alignSelf","borderRadius","overflow","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport { FocusedInputEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\nimport useColorScheme from \"../hooks/useColorScheme\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n TEST_ID_KEYBOARD_TOOLBAR_CONTENT,\n TEST_ID_KEYBOARD_TOOLBAR_DONE,\n TEST_ID_KEYBOARD_TOOLBAR_NEXT,\n TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,\n} from \"./constants\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent, ViewProps } from \"react-native\";\n\ntype SafeAreaInsets = {\n left: number;\n right: number;\n};\n\nexport type KeyboardToolbarProps = Omit<\n ViewProps,\n \"style\" | \"testID\" | \"children\"\n> & {\n /** An element that is shown in the middle of the toolbar. */\n content?: React.JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: (event: GestureResponderEvent) => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: React.JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n /**\n * A object containing `left`/`right` properties. Used to specify proper container padding in landscape mode.\n */\n insets?: SafeAreaInsets;\n} & Pick<KeyboardStickyViewProps, \"offset\" | \"enabled\">;\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and\n * `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.\n *\n * @param props - Component props.\n * @returns A component that is shown above the keyboard with `Prev`/`Next` and `Done` buttons.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-toolbar|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardToolbar doneText=\"Close\" />\n * ```\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = (props) => {\n const {\n content,\n theme = colors,\n doneText = \"Done\",\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n offset: { closed = 0, opened = 0 } = {},\n enabled = true,\n insets,\n ...rest\n } = props;\n const colorScheme = useColorScheme();\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n !KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n paddingLeft: insets?.left,\n paddingRight: insets?.right,\n }\n : null,\n KEYBOARD_HAS_ROUNDED_CORNERS ? styles.floating : null,\n ],\n [colorScheme, opacity, theme, insets],\n );\n const containerStyle = useMemo(\n () => [\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n marginLeft: (insets?.left ?? 0) + 16,\n marginRight: (insets?.right ?? 0) + 16,\n }\n : null,\n ],\n [insets],\n );\n const offset = useMemo(\n () => ({\n closed: closed + KEYBOARD_TOOLBAR_HEIGHT,\n opened: opened + OPENED_OFFSET,\n }),\n [closed, opened],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(\n (event: GestureResponderEvent) => {\n onNextCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n KeyboardController.setFocusTo(\"next\");\n }\n },\n [onNextCallback],\n );\n const onPressPrev = useCallback(\n (event: GestureResponderEvent) => {\n onPrevCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n KeyboardController.setFocusTo(\"prev\");\n }\n },\n [onPrevCallback],\n );\n const onPressDone = useCallback(\n (event: GestureResponderEvent) => {\n onDoneCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n KeyboardController.dismiss();\n }\n },\n [onDoneCallback],\n );\n\n return (\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <View style={styles.arrows}>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the previous field\"\n accessibilityLabel=\"Previous\"\n disabled={isPrevDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n onPress={onPressPrev}\n >\n <IconContainer\n disabled={isPrevDisabled}\n theme={theme}\n type=\"prev\"\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the next field\"\n accessibilityLabel=\"Next\"\n disabled={isNextDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n onPress={onPressNext}\n >\n <IconContainer\n disabled={isNextDisabled}\n theme={theme}\n type=\"next\"\n />\n </ButtonContainer>\n </View>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n {doneText && (\n <ButtonContainer\n accessibilityHint=\"Closes the keyboard\"\n accessibilityLabel=\"Done\"\n rippleRadius={28}\n style={styles.doneButtonContainer}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n theme={theme}\n onPress={onPressDone}\n >\n <Text maxFontSizeMultiplier={1.3} style={doneStyle}>\n {doneText}\n </Text>\n </ButtonContainer>\n )}\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n },\n arrows: {\n flexDirection: \"row\",\n paddingLeft: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 16,\n marginLeft: 8,\n },\n floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAD,sBAAA,CAAAL,OAAA;AAEA,IAAAO,MAAA,GAAAF,sBAAA,CAAAL,OAAA;AACA,IAAAQ,OAAA,GAAAH,sBAAA,CAAAL,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAUqB,SAAAK,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAZ,wBAAAY,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAA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,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBC,MAAM,EAAE1C;EACV,CAAC;EACDoB,MAAM,EAAE;IACNqB,aAAa,EAAE,KAAK;IACpBjD,WAAW,EAAE;EACf,CAAC;EACDR,UAAU,EAAE;IACV2D,UAAU,EAAE,KAAK;IACjBC,QAAQ,EAAE;EACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBhC,WAAW,EAAE,EAAE;IACfD,UAAU,EAAE;EACd,CAAC;EACDF,QAAQ,EAAE;IACRiD,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA/H,OAAA,GAGYwB,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_bindings","_hooks","_module","_KeyboardStickyView","_interopRequireDefault","_Arrow","_Button","_colors","_constants","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","KeyboardToolbar","props","content","theme","colors","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","DEFAULT_OPACITY","offset","closed","opened","enabled","insets","rest","colorScheme","useKeyboardState","state","appearance","inputs","setInputs","useState","current","count","isPrevDisabled","isNextDisabled","useEffect","subscription","FocusedInputEvents","addListener","remove","doneStyle","useMemo","styles","doneButton","color","primary","toolbarStyle","toolbar","backgroundColor","background","KEYBOARD_HAS_ROUNDED_CORNERS","paddingLeft","left","paddingRight","right","floating","containerStyle","marginLeft","marginRight","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","ButtonContainer","Button","IconContainer","Arrow","onPressNext","useCallback","event","isDefaultPrevented","KeyboardController","setFocusTo","onPressPrev","onPressDone","dismiss","createElement","style","View","testID","TEST_ID_KEYBOARD_TOOLBAR","arrows","accessibilityHint","accessibilityLabel","disabled","TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS","onPress","type","TEST_ID_KEYBOARD_TOOLBAR_NEXT","flex","TEST_ID_KEYBOARD_TOOLBAR_CONTENT","rippleRadius","doneButtonContainer","TEST_ID_KEYBOARD_TOOLBAR_DONE","Text","maxFontSizeMultiplier","StyleSheet","create","position","bottom","alignItems","width","flexDirection","height","fontWeight","fontSize","alignSelf","borderRadius","overflow","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, Text, View } from \"react-native\";\n\nimport { FocusedInputEvents } from \"../../bindings\";\nimport { useKeyboardState } from \"../../hooks\";\nimport { KeyboardController } from \"../../module\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n TEST_ID_KEYBOARD_TOOLBAR_CONTENT,\n TEST_ID_KEYBOARD_TOOLBAR_DONE,\n TEST_ID_KEYBOARD_TOOLBAR_NEXT,\n TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS,\n} from \"./constants\";\n\nimport type { HEX, KeyboardToolbarTheme } from \"./types\";\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\nimport type { ReactNode } from \"react\";\nimport type { GestureResponderEvent, ViewProps } from \"react-native\";\n\ntype SafeAreaInsets = {\n left: number;\n right: number;\n};\n\nexport type KeyboardToolbarProps = Omit<\n ViewProps,\n \"style\" | \"testID\" | \"children\"\n> & {\n /** An element that is shown in the middle of the toolbar. */\n content?: React.JSX.Element | null;\n /** A set of dark/light colors consumed by toolbar component. */\n theme?: KeyboardToolbarTheme;\n /** Custom text for done button. */\n doneText?: ReactNode;\n /** Custom touchable component for toolbar (used for prev/next/done buttons). */\n button?: typeof Button;\n /** Custom icon component used to display next/prev buttons. */\n icon?: typeof Arrow;\n /**\n * Whether to show next and previous buttons. Can be useful to set it to `false` if you have only one input\n * and want to show only `Done` button. Default to `true`.\n */\n showArrows?: boolean;\n /**\n * A callback that is called when the user presses the next button along with the default action.\n */\n onNextCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the previous button along with the default action.\n */\n onPrevCallback?: (event: GestureResponderEvent) => void;\n /**\n * A callback that is called when the user presses the done button along with the default action.\n */\n onDoneCallback?: (event: GestureResponderEvent) => void;\n /**\n * A component that applies blur effect to the toolbar.\n */\n blur?: React.JSX.Element | null;\n /**\n * A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.\n */\n opacity?: HEX;\n /**\n * A object containing `left`/`right` properties. Used to specify proper container padding in landscape mode.\n */\n insets?: SafeAreaInsets;\n} & Pick<KeyboardStickyViewProps, \"offset\" | \"enabled\">;\n\n/**\n * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and\n * `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.\n *\n * @param props - Component props.\n * @returns A component that is shown above the keyboard with `Prev`/`Next` and `Done` buttons.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-toolbar|Documentation} page for more details.\n * @example\n * ```tsx\n * <KeyboardToolbar doneText=\"Close\" />\n * ```\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> = (props) => {\n const {\n content,\n theme = colors,\n doneText = \"Done\",\n button,\n icon,\n showArrows = true,\n onNextCallback,\n onPrevCallback,\n onDoneCallback,\n blur = null,\n opacity = DEFAULT_OPACITY,\n offset: { closed = 0, opened = 0 } = {},\n enabled = true,\n insets,\n ...rest\n } = props;\n const colorScheme = useKeyboardState((state) => state.appearance);\n const [inputs, setInputs] = useState({\n current: 0,\n count: 0,\n });\n const isPrevDisabled = inputs.current === 0;\n const isNextDisabled = inputs.current === inputs.count - 1;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\n }, []);\n const doneStyle = useMemo(\n () => [styles.doneButton, { color: theme[colorScheme].primary }],\n [colorScheme, theme],\n );\n const toolbarStyle = useMemo(\n () => [\n styles.toolbar,\n {\n backgroundColor: `${theme[colorScheme].background}${opacity}`,\n },\n !KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n paddingLeft: insets?.left,\n paddingRight: insets?.right,\n }\n : null,\n KEYBOARD_HAS_ROUNDED_CORNERS ? styles.floating : null,\n ],\n [colorScheme, opacity, theme, insets],\n );\n const containerStyle = useMemo(\n () => [\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? {\n marginLeft: (insets?.left ?? 0) + 16,\n marginRight: (insets?.right ?? 0) + 16,\n }\n : null,\n ],\n [insets],\n );\n const offset = useMemo(\n () => ({\n closed: closed + KEYBOARD_TOOLBAR_HEIGHT,\n opened: opened + OPENED_OFFSET,\n }),\n [closed, opened],\n );\n const ButtonContainer = button || Button;\n const IconContainer = icon || Arrow;\n\n const onPressNext = useCallback(\n (event: GestureResponderEvent) => {\n onNextCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n KeyboardController.setFocusTo(\"next\");\n }\n },\n [onNextCallback],\n );\n const onPressPrev = useCallback(\n (event: GestureResponderEvent) => {\n onPrevCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n KeyboardController.setFocusTo(\"prev\");\n }\n },\n [onPrevCallback],\n );\n const onPressDone = useCallback(\n (event: GestureResponderEvent) => {\n onDoneCallback?.(event);\n\n if (!event.isDefaultPrevented()) {\n KeyboardController.dismiss();\n }\n },\n [onDoneCallback],\n );\n\n return (\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {blur}\n {showArrows && (\n <View style={styles.arrows}>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the previous field\"\n accessibilityLabel=\"Previous\"\n disabled={isPrevDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS}\n theme={theme}\n onPress={onPressPrev}\n >\n <IconContainer\n disabled={isPrevDisabled}\n theme={theme}\n type=\"prev\"\n />\n </ButtonContainer>\n <ButtonContainer\n accessibilityHint=\"Moves focus to the next field\"\n accessibilityLabel=\"Next\"\n disabled={isNextDisabled}\n testID={TEST_ID_KEYBOARD_TOOLBAR_NEXT}\n theme={theme}\n onPress={onPressNext}\n >\n <IconContainer\n disabled={isNextDisabled}\n theme={theme}\n type=\"next\"\n />\n </ButtonContainer>\n </View>\n )}\n\n <View style={styles.flex} testID={TEST_ID_KEYBOARD_TOOLBAR_CONTENT}>\n {content}\n </View>\n {doneText && (\n <ButtonContainer\n accessibilityHint=\"Closes the keyboard\"\n accessibilityLabel=\"Done\"\n rippleRadius={28}\n style={styles.doneButtonContainer}\n testID={TEST_ID_KEYBOARD_TOOLBAR_DONE}\n theme={theme}\n onPress={onPressDone}\n >\n <Text maxFontSizeMultiplier={1.3} style={doneStyle}>\n {doneText}\n </Text>\n </ButtonContainer>\n )}\n </View>\n </KeyboardStickyView>\n );\n};\n\nconst styles = StyleSheet.create({\n flex: {\n flex: 1,\n },\n toolbar: {\n position: \"absolute\",\n bottom: 0,\n alignItems: \"center\",\n width: \"100%\",\n flexDirection: \"row\",\n height: KEYBOARD_TOOLBAR_HEIGHT,\n },\n arrows: {\n flexDirection: \"row\",\n paddingLeft: 8,\n },\n doneButton: {\n fontWeight: \"600\",\n fontSize: 15,\n },\n doneButtonContainer: {\n marginRight: 16,\n marginLeft: 8,\n },\n floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nexport { colors as DefaultKeyboardToolbarTheme };\nexport default KeyboardToolbar;\n"],"mappings":";;;;;;;;;;;;AAA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ACZ,CAAC;EACDb,mBAAmB,EAAE;IACnBhC,WAAW,EAAE,EAAE;IACfD,UAAU,EAAE;EACd,CAAC;EACDF,QAAQ,EAAE;IACRiD,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjI,OAAA,GAGYwB,eAAe","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useKeyboardState = void 0;
6
+ exports.useKeyboardState = useKeyboardState;
7
7
  var _react = require("react");
8
8
  var _bindings = require("../../bindings");
9
9
  var _module = require("../../module");
@@ -12,18 +12,23 @@ const getLatestState = () => ({
12
12
  ..._module.KeyboardController.state(),
13
13
  isVisible: _module.KeyboardController.isVisible()
14
14
  });
15
+ const defaultSelector = state => state;
15
16
 
16
17
  /**
17
18
  * React Hook that represents the current keyboard state on iOS and Android.
18
19
  * It tracks keyboard visibility, height, appearance, type and other properties.
19
20
  * This hook subscribes to keyboard events and updates the state reactively.
20
21
  *
22
+ * @template T - A type of the returned object from the `selector`.
23
+ * @param selector - A function that receives the current keyboard state and picks only necessary properties to avoid frequent re-renders.
21
24
  * @returns Object {@link KeyboardState|containing} keyboard state information.
22
25
  * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-state|Documentation} page for more details.
23
26
  * @example
24
27
  * ```tsx
25
28
  * function MyComponent() {
26
- * const { isVisible, height } = useKeyboardState();
29
+ * const isVisible = useKeyboardState((state) => state.isVisible);
30
+ * const height = useKeyboardState((state) => state.height);
31
+ *
27
32
  * return (
28
33
  * <View>
29
34
  * <Text>Keyboard is {isVisible ? 'visible' : 'hidden'}</Text>
@@ -33,23 +38,28 @@ const getLatestState = () => ({
33
38
  * }
34
39
  * ```
35
40
  */
36
- const useKeyboardState = () => {
37
- const [state, setState] = (0, _react.useState)(getLatestState);
41
+ function useKeyboardState(selector = defaultSelector) {
42
+ const [state, setState] = (0, _react.useState)(() => selector(getLatestState()));
38
43
  (0, _react.useEffect)(() => {
39
44
  const subscriptions = EVENTS.map(event => _bindings.KeyboardEvents.addListener(event, () =>
40
45
  // state will be updated by global listener first,
41
46
  // so we simply read it and don't derive data from the event
42
- setState(getLatestState)));
47
+ setState(selector(getLatestState()))));
48
+ // update `appearance` prematurely
49
+ const willShowSubscription = _bindings.KeyboardEvents.addListener("keyboardWillShow", e => setState(selector({
50
+ ...getLatestState(),
51
+ appearance: e.appearance
52
+ })));
43
53
 
44
54
  // we might have missed an update between reading a value in render and
45
55
  // `addListener` in this handler, so we set it here. If there was
46
56
  // no change, React will filter out this update as a no-op.
47
- setState(getLatestState);
57
+ setState(selector(getLatestState()));
48
58
  return () => {
49
59
  subscriptions.forEach(subscription => subscription.remove());
60
+ willShowSubscription.remove();
50
61
  };
51
62
  }, []);
52
63
  return state;
53
- };
54
- exports.useKeyboardState = useKeyboardState;
64
+ }
55
65
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","require","_bindings","_module","EVENTS","getLatestState","KeyboardController","state","isVisible","useKeyboardState","setState","useState","useEffect","subscriptions","map","event","KeyboardEvents","addListener","forEach","subscription","remove","exports"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type { KeyboardState } from \"../../types\";\n\nconst EVENTS = [\"keyboardDidShow\", \"keyboardDidHide\"] as const;\n\nconst getLatestState = () => ({\n ...KeyboardController.state(),\n isVisible: KeyboardController.isVisible(),\n});\n\n/**\n * React Hook that represents the current keyboard state on iOS and Android.\n * It tracks keyboard visibility, height, appearance, type and other properties.\n * This hook subscribes to keyboard events and updates the state reactively.\n *\n * @returns Object {@link KeyboardState|containing} keyboard state information.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-state|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const { isVisible, height } = useKeyboardState();\n * return (\n * <View>\n * <Text>Keyboard is {isVisible ? 'visible' : 'hidden'}</Text>\n * <Text>Keyboard height: {height}</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport const useKeyboardState = (): KeyboardState => {\n const [state, setState] = useState(getLatestState);\n\n useEffect(() => {\n const subscriptions = EVENTS.map((event) =>\n KeyboardEvents.addListener(event, () =>\n // state will be updated by global listener first,\n // so we simply read it and don't derive data from the event\n setState(getLatestState),\n ),\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setState(getLatestState);\n\n return () => {\n subscriptions.forEach((subscription) => subscription.remove());\n };\n }, []);\n\n return state;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,MAAMG,MAAM,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU;AAE9D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGC,0BAAkB,CAACC,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEF,0BAAkB,CAACE,SAAS,CAAC;AAC1C,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,gBAAgB,GAAGA,CAAA,KAAqB;EACnD,MAAM,CAACF,KAAK,EAAEG,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAACN,cAAc,CAAC;EAElD,IAAAO,gBAAS,EAAC,MAAM;IACd,MAAMC,aAAa,GAAGT,MAAM,CAACU,GAAG,CAAEC,KAAK,IACrCC,wBAAc,CAACC,WAAW,CAACF,KAAK,EAAE;IAChC;IACA;IACAL,QAAQ,CAACL,cAAc,CACzB,CACF,CAAC;;IAED;IACA;IACA;IACAK,QAAQ,CAACL,cAAc,CAAC;IAExB,OAAO,MAAM;MACXQ,aAAa,CAACK,OAAO,CAAEC,YAAY,IAAKA,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOb,KAAK;AACd,CAAC;AAACc,OAAA,CAAAZ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_react","require","_bindings","_module","EVENTS","getLatestState","KeyboardController","state","isVisible","defaultSelector","useKeyboardState","selector","setState","useState","useEffect","subscriptions","map","event","KeyboardEvents","addListener","willShowSubscription","e","appearance","forEach","subscription","remove"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type { KeyboardState } from \"../../types\";\n\nconst EVENTS = [\"keyboardDidShow\", \"keyboardDidHide\"] as const;\n\nconst getLatestState = () => ({\n ...KeyboardController.state(),\n isVisible: KeyboardController.isVisible(),\n});\n\ntype KeyboardStateSelector<T> = (state: KeyboardState) => T;\n\nconst defaultSelector: KeyboardStateSelector<KeyboardState> = (state) => state;\n\n/**\n * React Hook that represents the current keyboard state on iOS and Android.\n * It tracks keyboard visibility, height, appearance, type and other properties.\n * This hook subscribes to keyboard events and updates the state reactively.\n *\n * @template T - A type of the returned object from the `selector`.\n * @param selector - A function that receives the current keyboard state and picks only necessary properties to avoid frequent re-renders.\n * @returns Object {@link KeyboardState|containing} keyboard state information.\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/hooks/keyboard/use-keyboard-state|Documentation} page for more details.\n * @example\n * ```tsx\n * function MyComponent() {\n * const isVisible = useKeyboardState((state) => state.isVisible);\n * const height = useKeyboardState((state) => state.height);\n *\n * return (\n * <View>\n * <Text>Keyboard is {isVisible ? 'visible' : 'hidden'}</Text>\n * <Text>Keyboard height: {height}</Text>\n * </View>\n * );\n * }\n * ```\n */\nfunction useKeyboardState<T = KeyboardState>(\n selector: KeyboardStateSelector<T> = defaultSelector as KeyboardStateSelector<T>,\n): T {\n const [state, setState] = useState<T>(() => selector(getLatestState()));\n\n useEffect(() => {\n const subscriptions = EVENTS.map((event) =>\n KeyboardEvents.addListener(event, () =>\n // state will be updated by global listener first,\n // so we simply read it and don't derive data from the event\n setState(selector(getLatestState())),\n ),\n );\n // update `appearance` prematurely\n const willShowSubscription = KeyboardEvents.addListener(\n \"keyboardWillShow\",\n (e) =>\n setState(selector({ ...getLatestState(), appearance: e.appearance })),\n );\n\n // we might have missed an update between reading a value in render and\n // `addListener` in this handler, so we set it here. If there was\n // no change, React will filter out this update as a no-op.\n setState(selector(getLatestState()));\n\n return () => {\n subscriptions.forEach((subscription) => subscription.remove());\n willShowSubscription.remove();\n };\n }, []);\n\n return state;\n}\n\nexport { useKeyboardState };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAIA,MAAMG,MAAM,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAU;AAE9D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGC,0BAAkB,CAACC,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEF,0BAAkB,CAACE,SAAS,CAAC;AAC1C,CAAC,CAAC;AAIF,MAAMC,eAAqD,GAAIF,KAAK,IAAKA,KAAK;;AAE9E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,gBAAgBA,CACvBC,QAAkC,GAAGF,eAA2C,EAC7E;EACH,MAAM,CAACF,KAAK,EAAEK,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAI,MAAMF,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CAAC;EAEvE,IAAAS,gBAAS,EAAC,MAAM;IACd,MAAMC,aAAa,GAAGX,MAAM,CAACY,GAAG,CAAEC,KAAK,IACrCC,wBAAc,CAACC,WAAW,CAACF,KAAK,EAAE;IAChC;IACA;IACAL,QAAQ,CAACD,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CACrC,CACF,CAAC;IACD;IACA,MAAMe,oBAAoB,GAAGF,wBAAc,CAACC,WAAW,CACrD,kBAAkB,EACjBE,CAAC,IACAT,QAAQ,CAACD,QAAQ,CAAC;MAAE,GAAGN,cAAc,CAAC,CAAC;MAAEiB,UAAU,EAAED,CAAC,CAACC;IAAW,CAAC,CAAC,CACxE,CAAC;;IAED;IACA;IACA;IACAV,QAAQ,CAACD,QAAQ,CAACN,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,MAAM;MACXU,aAAa,CAACQ,OAAO,CAAEC,YAAY,IAAKA,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC;MAC9DL,oBAAoB,CAACK,MAAM,CAAC,CAAC;IAC/B,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOlB,KAAK;AACd","ignoreList":[]}
@@ -9,7 +9,8 @@ var _exportNames = {
9
9
  KeyboardAwareScrollView: true,
10
10
  KeyboardToolbar: true,
11
11
  DefaultKeyboardToolbarTheme: true,
12
- OverKeyboardView: true
12
+ OverKeyboardView: true,
13
+ KeyboardExtender: true
13
14
  };
14
15
  Object.defineProperty(exports, "DefaultKeyboardToolbarTheme", {
15
16
  enumerable: true,
@@ -29,6 +30,12 @@ Object.defineProperty(exports, "KeyboardAwareScrollView", {
29
30
  return _components.KeyboardAwareScrollView;
30
31
  }
31
32
  });
33
+ Object.defineProperty(exports, "KeyboardExtender", {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _views.KeyboardExtender;
37
+ }
38
+ });
32
39
  Object.defineProperty(exports, "KeyboardStickyView", {
33
40
  enumerable: true,
34
41
  get: function () {
@@ -1 +1 @@
1
- {"version":3,"names":["_bindings","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_animated","_context","_hooks","_constants","_module","_types","_components","_views"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\n\nexport {\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView } from \"./views\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,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,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,SAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,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AAA;AAAA;AAEA,IAAAe,WAAA,GAAAnB,OAAA;AAcA,IAAAoB,MAAA,GAAApB,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_bindings","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_animated","_context","_hooks","_constants","_module","_types","_components","_views"],"sources":["index.ts"],"sourcesContent":["export * from \"./bindings\";\nexport * from \"./animated\";\nexport * from \"./context\";\nexport * from \"./hooks\";\nexport * from \"./constants\";\nexport * from \"./module\";\nexport * from \"./types\";\n\nexport {\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewProps,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,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,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,SAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,SAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA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AA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAM,MAAA,CAAAd,GAAA;IAAA;EAAA;AAAA;AAEA,IAAAe,WAAA,GAAAnB,OAAA;AAcA,IAAAoB,MAAA,GAAApB,OAAA","ignoreList":[]}
@@ -12,7 +12,7 @@ let lastState = {
12
12
  timestamp: new Date().getTime(),
13
13
  target: -1,
14
14
  type: "default",
15
- appearance: "default"
15
+ appearance: "light"
16
16
  };
17
17
  _bindings.KeyboardEvents.addListener("keyboardDidHide", e => {
18
18
  isClosed = true;
@@ -46,6 +46,7 @@ const KeyboardController = exports.KeyboardController = {
46
46
  setDefaultMode: _bindings.KeyboardControllerNative.setDefaultMode,
47
47
  setInputMode: _bindings.KeyboardControllerNative.setInputMode,
48
48
  setFocusTo: _bindings.KeyboardControllerNative.setFocusTo,
49
+ preload: _bindings.KeyboardControllerNative.preload,
49
50
  dismiss,
50
51
  isVisible,
51
52
  state
@@ -1 +1 @@
1
- {"version":3,"names":["_bindings","require","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","KeyboardEvents","addListener","e","dismiss","options","keepFocus","Promise","resolve","subscription","undefined","remove","KeyboardControllerNative","isVisible","state","KeyboardController","exports","setDefaultMode","setInputMode","setFocusTo"],"sources":["module.ts"],"sourcesContent":["import { KeyboardControllerNative, KeyboardEvents } from \"./bindings\";\n\nimport type {\n DismissOptions,\n KeyboardControllerModule,\n KeyboardEventData,\n} from \"./types\";\n\nlet isClosed = true;\nlet lastState: KeyboardEventData = {\n height: 0,\n duration: 0,\n timestamp: new Date().getTime(),\n target: -1,\n type: \"default\",\n appearance: \"default\",\n};\n\nKeyboardEvents.addListener(\"keyboardDidHide\", (e) => {\n isClosed = true;\n lastState = e;\n});\n\nKeyboardEvents.addListener(\"keyboardDidShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: DismissOptions): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n\n return new Promise((resolve) => {\n if (isClosed) {\n resolve();\n\n return;\n }\n\n const subscription = KeyboardEvents.addListener(\"keyboardDidHide\", () => {\n resolve(undefined);\n subscription.remove();\n });\n\n KeyboardControllerNative.dismiss(keepFocus);\n });\n};\nconst isVisible = () => !isClosed;\nconst state = () => lastState;\n\n/**\n * KeyboardController module. Helps to perform imperative actions/checks with keyboard.\n */\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: KeyboardControllerNative.setDefaultMode,\n setInputMode: KeyboardControllerNative.setInputMode,\n setFocusTo: KeyboardControllerNative.setFocusTo,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAQA,IAAIC,QAAQ,GAAG,IAAI;AACnB,IAAIC,SAA4B,GAAG;EACjCC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC/BC,MAAM,EAAE,CAAC,CAAC;EACVC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE;AACd,CAAC;AAEDC,wBAAc,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDZ,QAAQ,GAAG,IAAI;EACfC,SAAS,GAAGW,CAAC;AACf,CAAC,CAAC;AAEFF,wBAAc,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDZ,QAAQ,GAAG,KAAK;EAChBC,SAAS,GAAGW,CAAC;AACf,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOC,OAAwB,IAAoB;EACjE,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAE7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIjB,QAAQ,EAAE;MACZiB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGR,wBAAc,CAACC,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEM,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFC,kCAAwB,CAACR,OAAO,CAACE,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC;AACD,MAAMO,SAAS,GAAGA,CAAA,KAAM,CAACtB,QAAQ;AACjC,MAAMuB,KAAK,GAAGA,CAAA,KAAMtB,SAAS;;AAE7B;AACA;AACA;AACO,MAAMuB,kBAA4C,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EAC1DE,cAAc,EAAEL,kCAAwB,CAACK,cAAc;EACvDC,YAAY,EAAEN,kCAAwB,CAACM,YAAY;EACnDC,UAAU,EAAEP,kCAAwB,CAACO,UAAU;EAC/Cf,OAAO;EACPS,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_bindings","require","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","KeyboardEvents","addListener","e","dismiss","options","keepFocus","Promise","resolve","subscription","undefined","remove","KeyboardControllerNative","isVisible","state","KeyboardController","exports","setDefaultMode","setInputMode","setFocusTo","preload"],"sources":["module.ts"],"sourcesContent":["import { KeyboardControllerNative, KeyboardEvents } from \"./bindings\";\n\nimport type {\n DismissOptions,\n KeyboardControllerModule,\n KeyboardEventData,\n} from \"./types\";\n\nlet isClosed = true;\nlet lastState: KeyboardEventData = {\n height: 0,\n duration: 0,\n timestamp: new Date().getTime(),\n target: -1,\n type: \"default\",\n appearance: \"light\",\n};\n\nKeyboardEvents.addListener(\"keyboardDidHide\", (e) => {\n isClosed = true;\n lastState = e;\n});\n\nKeyboardEvents.addListener(\"keyboardDidShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: DismissOptions): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n\n return new Promise((resolve) => {\n if (isClosed) {\n resolve();\n\n return;\n }\n\n const subscription = KeyboardEvents.addListener(\"keyboardDidHide\", () => {\n resolve(undefined);\n subscription.remove();\n });\n\n KeyboardControllerNative.dismiss(keepFocus);\n });\n};\nconst isVisible = () => !isClosed;\nconst state = () => lastState;\n\n/**\n * KeyboardController module. Helps to perform imperative actions/checks with keyboard.\n */\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: KeyboardControllerNative.setDefaultMode,\n setInputMode: KeyboardControllerNative.setInputMode,\n setFocusTo: KeyboardControllerNative.setFocusTo,\n preload: KeyboardControllerNative.preload,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAQA,IAAIC,QAAQ,GAAG,IAAI;AACnB,IAAIC,SAA4B,GAAG;EACjCC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC/BC,MAAM,EAAE,CAAC,CAAC;EACVC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE;AACd,CAAC;AAEDC,wBAAc,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDZ,QAAQ,GAAG,IAAI;EACfC,SAAS,GAAGW,CAAC;AACf,CAAC,CAAC;AAEFF,wBAAc,CAACC,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDZ,QAAQ,GAAG,KAAK;EAChBC,SAAS,GAAGW,CAAC;AACf,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOC,OAAwB,IAAoB;EACjE,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAE7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIjB,QAAQ,EAAE;MACZiB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGR,wBAAc,CAACC,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEM,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFC,kCAAwB,CAACR,OAAO,CAACE,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC;AACD,MAAMO,SAAS,GAAGA,CAAA,KAAM,CAACtB,QAAQ;AACjC,MAAMuB,KAAK,GAAGA,CAAA,KAAMtB,SAAS;;AAE7B;AACA;AACA;AACO,MAAMuB,kBAA4C,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EAC1DE,cAAc,EAAEL,kCAAwB,CAACK,cAAc;EACvDC,YAAY,EAAEN,kCAAwB,CAACM,YAAY;EACnDC,UAAU,EAAEP,kCAAwB,CAACO,UAAU;EAC/CC,OAAO,EAAER,kCAAwB,CAACQ,OAAO;EACzChB,OAAO;EACPS,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _default = exports.default = (0, _codegenNativeComponent.default)("KeyboardBackgroundView", {
10
+ interfaceOnly: true
11
+ });
12
+ //# sourceMappingURL=KeyboardBackgroundViewNativeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent","interfaceOnly"],"sources":["KeyboardBackgroundViewNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\n\nexport interface NativeProps extends ViewProps {}\n\nexport default codegenNativeComponent<NativeProps>(\"KeyboardBackgroundView\", {\n interfaceOnly: true,\n}) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAO9E,IAAAG,+BAAsB,EAAc,wBAAwB,EAAE;EAC3EC,aAAa,EAAE;AACjB,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ var _default = exports.default = (0, _codegenNativeComponent.default)("KeyboardExtender", {
10
+ interfaceOnly: true,
11
+ excludedPlatforms: ["android"]
12
+ });
13
+ //# sourceMappingURL=KeyboardExtenderNativeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","e","__esModule","default","_default","exports","codegenNativeComponent","interfaceOnly","excludedPlatforms"],"sources":["KeyboardExtenderNativeComponent.ts"],"sourcesContent":["import codegenNativeComponent from \"react-native/Libraries/Utilities/codegenNativeComponent\";\n\nimport type { HostComponent } from \"react-native\";\nimport type { ViewProps } from \"react-native/Libraries/Components/View/ViewPropTypes\";\n\nexport interface NativeProps extends ViewProps {\n enabled?: boolean;\n}\n\nexport default codegenNativeComponent<NativeProps>(\"KeyboardExtender\", {\n interfaceOnly: true,\n excludedPlatforms: [\"android\"],\n}) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA6F,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,IAAAG,QAAA,GAAAC,OAAA,CAAAF,OAAA,GAS9E,IAAAG,+BAAsB,EAAc,kBAAkB,EAAE;EACrEC,aAAa,EAAE,IAAI;EACnBC,iBAAiB,EAAE,CAAC,SAAS;AAC/B,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeKeyboardController.ts"],"sourcesContent":["import { TurboModuleRegistry } from \"react-native\";\n\nimport type { TurboModule } from \"react-native\";\n\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n // methods\n setInputMode(mode: number): void;\n setDefaultMode(): void;\n dismiss(keepFocus: boolean): void;\n setFocusTo(direction: string): void;\n\n // event emitter\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n}\n\nexport default TurboModuleRegistry.get<Spec>(\"KeyboardController\");\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAkBpCC,gCAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sources":["NativeKeyboardController.ts"],"sourcesContent":["import { TurboModuleRegistry } from \"react-native\";\n\nimport type { TurboModule } from \"react-native\";\n\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n // methods\n setInputMode(mode: number): void;\n setDefaultMode(): void;\n preload(): void;\n dismiss(keepFocus: boolean): void;\n setFocusTo(direction: string): void;\n\n // event emitter\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n}\n\nexport default TurboModuleRegistry.get<Spec>(\"KeyboardController\");\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAmBpCC,gCAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["module.ts"],"sourcesContent":["import type { EmitterSubscription, TextInputProps } from \"react-native\";\n\n// Event module declarations\nexport type KeyboardControllerEvents =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\";\nexport type KeyboardEventData = {\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Timestamp of the last keyboard event. */\n timestamp: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n /** `keyboardType` property from focused `TextInput`. */\n type: NonNullable<TextInputProps[\"keyboardType\"]>;\n /** Keyboard appearance. Can be one of `default`, `dark` or `light`. */\n appearance: NonNullable<TextInputProps[\"keyboardAppearance\"]>;\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type KeyboardState = {\n /** Whether the keyboard is currently visible. */\n isVisible: boolean;\n} & KeyboardEventData;\nexport type KeyboardEventsModule = {\n /**\n * The `addListener` function connects a JavaScript function to an identified native\n * keyboard notification event.\n *\n * This function then returns the reference to the listener.\n *\n * `name` is the string that identifies the event you're listening for. This\n * can be any of the following:\n *\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n */\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEventData) => void,\n ) => EmitterSubscription;\n};\nexport type Direction = \"next\" | \"prev\" | \"current\";\nexport type DismissOptions = {\n /**\n * A boolean property indicating whether focus should be kept on the input after dismissing the keyboard. Default is `false`.\n */\n keepFocus: boolean;\n};\nexport type KeyboardControllerModule = {\n // android only\n /**\n * Sets default `windowSoftInputMode` (the one that declared in `AndroidManifest.xml`).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setdefaultmode-|docs} page for more details.\n */\n setDefaultMode: () => void;\n /**\n * Changes `windowSoftInputMode` on Android. @see AndroidSoftInputModes for all possible values and {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|docs} page for more details.\n */\n setInputMode: (mode: number) => void;\n // all platforms\n /**\n * Dismisses the active keyboard. Removes a focus by default, but allows to pass `{keepFocus: true}` to keep focus.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#dismiss|docs} page for more details.\n */\n dismiss: (options?: DismissOptions) => Promise<void>;\n /**\n * Moves focus to the specified direction (`next`, `prev` or `current` to restore a focus).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setfocusto|docs} page for more details.\n */\n setFocusTo: (direction: Direction) => void;\n /**\n * Whether the keyboard is fully visible.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#isvisible|docs} page for more details.\n */\n isVisible: () => boolean;\n /**\n * Method that returns current keyboard state.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#state|docs} page for more details.\n */\n state: () => KeyboardEventData;\n};\nexport type KeyboardControllerNativeModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // all platforms\n dismiss: (keepFocus: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["module.ts"],"sourcesContent":["import type { EmitterSubscription, TextInputProps } from \"react-native\";\n\n// Event module declarations\nexport type KeyboardControllerEvents =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\";\nexport type KeyboardEventData = {\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Timestamp of the last keyboard event. */\n timestamp: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n /** `keyboardType` property from focused `TextInput`. */\n type: NonNullable<TextInputProps[\"keyboardType\"]>;\n /** Keyboard appearance. Can be one of `dark` or `light`. */\n appearance: \"dark\" | \"light\";\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type KeyboardState = {\n /** Whether the keyboard is currently visible. */\n isVisible: boolean;\n} & KeyboardEventData;\nexport type KeyboardEventsModule = {\n /**\n * The `addListener` function connects a JavaScript function to an identified native\n * keyboard notification event.\n *\n * This function then returns the reference to the listener.\n *\n * `name` is the string that identifies the event you're listening for. This\n * can be any of the following:\n *\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n */\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEventData) => void,\n ) => EmitterSubscription;\n};\nexport type Direction = \"next\" | \"prev\" | \"current\";\nexport type DismissOptions = {\n /**\n * A boolean property indicating whether focus should be kept on the input after dismissing the keyboard. Default is `false`.\n */\n keepFocus: boolean;\n};\nexport type KeyboardControllerModule = {\n // android only\n /**\n * Sets default `windowSoftInputMode` (the one that declared in `AndroidManifest.xml`).\n *\n * @platform android\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setdefaultmode-|docs} page for more details.\n */\n setDefaultMode: () => void;\n /**\n * Changes `windowSoftInputMode` on Android.\n *\n * @platform android\n * @see AndroidSoftInputModes for all possible values and {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|docs} page for more details.\n */\n setInputMode: (mode: number) => void;\n // ios only\n /**\n * A method that preloads the keyboard. It's useful when you want to avoid a delay when the user focuses the first input.\n *\n * @platform ios\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#preload-|docs} page for more details.\n */\n preload: () => void;\n // all platforms\n /**\n * Dismisses the active keyboard. Removes a focus by default, but allows to pass `{keepFocus: true}` to keep focus.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#dismiss|docs} page for more details.\n */\n dismiss: (options?: DismissOptions) => Promise<void>;\n /**\n * Moves focus to the specified direction (`next`, `prev` or `current` to restore a focus).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setfocusto|docs} page for more details.\n */\n setFocusTo: (direction: Direction) => void;\n /**\n * Whether the keyboard is fully visible.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#isvisible|docs} page for more details.\n */\n isVisible: () => boolean;\n /**\n * Method that returns current keyboard state.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#state|docs} page for more details.\n */\n state: () => KeyboardEventData;\n};\nexport type KeyboardControllerNativeModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // ios only\n preload: () => void;\n // all platforms\n dismiss: (keepFocus: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["views.ts"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardGestureAreaProps = {\n /**\n * Determines how the keyboard position will be controlled:\n * - `ios` - keyboard will be following finger only when finger touches keyboard\n * - `linear` - keyboard will be following finger position linearly.\n *\n * @platform android\n */\n interpolator?: \"ios\" | \"linear\";\n /**\n * Whether to allow to show a keyboard from dismissed state by swipe up.\n * Default to `false`.\n *\n * @platform android\n */\n showOnSwipeUp?: boolean;\n /**\n * Whether to allow to control a keyboard by gestures. The strategy how\n * it should be controlled is determined by `interpolator` property.\n * Defaults to `true`.\n *\n * @platform android\n */\n enableSwipeToDismiss?: boolean;\n /**\n * Extra distance to the keyboard.\n */\n offset?: number;\n /**\n * A corresponding `nativeID` value from the associated `TextInput` (a string that links the `KeyboardGestureArea` to one or more `TextInput` components).\n * This is **required on iOS** in order to apply the `offset` when the keyboard is shown. Only the currently focused `TextInput` with a matching `nativeID`\n * will receive offset behavior.\n *\n * @platform ios\n */\n textInputNativeID?: string;\n} & ViewProps;\nexport type OverKeyboardViewProps = PropsWithChildren<{\n /**\n * A boolean prop indicating whether the view is visible or not. If it's true then view is shown on the screen. If it's false then view is hidden.\n */\n visible: boolean;\n}>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["views.ts"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardGestureAreaProps = {\n /**\n * Determines how the keyboard position will be controlled:\n * - `ios` - keyboard will be following finger only when finger touches keyboard\n * - `linear` - keyboard will be following finger position linearly.\n *\n * @platform android\n */\n interpolator?: \"ios\" | \"linear\";\n /**\n * Whether to allow to show a keyboard from dismissed state by swipe up.\n * Default to `false`.\n *\n * @platform android\n */\n showOnSwipeUp?: boolean;\n /**\n * Whether to allow to control a keyboard by gestures. The strategy how\n * it should be controlled is determined by `interpolator` property.\n * Defaults to `true`.\n *\n * @platform android\n */\n enableSwipeToDismiss?: boolean;\n /**\n * Extra distance to the keyboard.\n */\n offset?: number;\n /**\n * A corresponding `nativeID` value from the associated `TextInput` (a string that links the `KeyboardGestureArea` to one or more `TextInput` components).\n * This is **required on iOS** in order to apply the `offset` when the keyboard is shown. Only the currently focused `TextInput` with a matching `nativeID`\n * will receive offset behavior.\n *\n * @platform ios\n */\n textInputNativeID?: string;\n} & ViewProps;\nexport type OverKeyboardViewProps = PropsWithChildren<{\n /**\n * A boolean prop indicating whether the view is visible or not. If it's true then view is shown on the screen. If it's false then view is hidden.\n */\n visible: boolean;\n}>;\nexport type KeyboardBackgroundViewProps = PropsWithChildren<ViewProps>;\nexport type KeyboardExtenderProps = PropsWithChildren<{\n /** Controls whether this `KeyboardExtender` instance should take an effect. Default is `true`. */\n enabled: boolean;\n}>;\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _bindings = require("../../bindings");
10
+ var _hooks = require("../../hooks");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ /**
13
+ * A component that embeds its children into the keyboard thus enhancing keyboard functionality.
14
+ *
15
+ * @param props - Component props.
16
+ * @returns A view component that renders inside the keyboard above all system buttons.
17
+ * @example
18
+ * ```tsx
19
+ * <KeyboardExtender>
20
+ * <Button>10$</Button>
21
+ * <Button>20$</Button>
22
+ * <Button>50$</Button>
23
+ * </KeyboardExtender>
24
+ * ```
25
+ */
26
+ const KeyboardExtender = props => {
27
+ const {
28
+ children,
29
+ enabled = true
30
+ } = props;
31
+ const {
32
+ width
33
+ } = (0, _hooks.useWindowDimensions)();
34
+ return /*#__PURE__*/_react.default.createElement(_bindings.RCTKeyboardExtender, {
35
+ enabled: enabled
36
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
37
+ style: {
38
+ width
39
+ }
40
+ }, children));
41
+ };
42
+ var _default = exports.default = KeyboardExtender;
43
+ //# sourceMappingURL=index.ios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_bindings","_hooks","e","__esModule","default","KeyboardExtender","props","children","enabled","width","useWindowDimensions","createElement","RCTKeyboardExtender","View","style","_default","exports"],"sources":["index.ios.tsx"],"sourcesContent":["import React from \"react\";\nimport { View } from \"react-native\";\n\nimport { RCTKeyboardExtender } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { KeyboardExtenderProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\n/**\n * A component that embeds its children into the keyboard thus enhancing keyboard functionality.\n *\n * @param props - Component props.\n * @returns A view component that renders inside the keyboard above all system buttons.\n * @example\n * ```tsx\n * <KeyboardExtender>\n * <Button>10$</Button>\n * <Button>20$</Button>\n * <Button>50$</Button>\n * </KeyboardExtender>\n * ```\n */\nconst KeyboardExtender = (props: PropsWithChildren<KeyboardExtenderProps>) => {\n const { children, enabled = true } = props;\n const { width } = useWindowDimensions();\n\n return (\n <RCTKeyboardExtender enabled={enabled}>\n <View style={{ width }}>{children}</View>\n </RCTKeyboardExtender>\n );\n};\n\nexport default KeyboardExtender;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAkD,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAIC,KAA+C,IAAK;EAC5E,MAAM;IAAEC,QAAQ;IAAEC,OAAO,GAAG;EAAK,CAAC,GAAGF,KAAK;EAC1C,MAAM;IAAEG;EAAM,CAAC,GAAG,IAAAC,0BAAmB,EAAC,CAAC;EAEvC,oBACEd,MAAA,CAAAQ,OAAA,CAAAO,aAAA,CAACX,SAAA,CAAAY,mBAAmB;IAACJ,OAAO,EAAEA;EAAQ,gBACpCZ,MAAA,CAAAQ,OAAA,CAAAO,aAAA,CAACZ,YAAA,CAAAc,IAAI;IAACC,KAAK,EAAE;MAAEL;IAAM;EAAE,GAAEF,QAAe,CACrB,CAAC;AAE1B,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEaC,gBAAgB","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _bindings = require("../../bindings");
10
+ var _components = require("../../components");
11
+ var _hooks = require("../../hooks");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ const AnimatedKeyboardBackgroundView = _reactNative.Animated.createAnimatedComponent(_bindings.KeyboardBackgroundView);
14
+
15
+ /**
16
+ * A component that embeds its children into the keyboard thus enhancing keyboard functionality.
17
+ *
18
+ * @param props - Component props.
19
+ * @returns A view component that renders inside the keyboard above all system buttons.
20
+ * @example
21
+ * ```tsx
22
+ * <KeyboardExtender>
23
+ * <Button>10$</Button>
24
+ * <Button>20$</Button>
25
+ * <Button>50$</Button>
26
+ * </KeyboardExtender>
27
+ * ```
28
+ */
29
+ const KeyboardExtender = props => {
30
+ const {
31
+ children,
32
+ enabled = true
33
+ } = props;
34
+ const {
35
+ progress
36
+ } = (0, _hooks.useKeyboardAnimation)();
37
+ return /*#__PURE__*/_react.default.createElement(_components.KeyboardStickyView, {
38
+ enabled: enabled
39
+ }, /*#__PURE__*/_react.default.createElement(AnimatedKeyboardBackgroundView, {
40
+ style: {
41
+ opacity: progress
42
+ }
43
+ }, children));
44
+ };
45
+ var _default = exports.default = KeyboardExtender;
46
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_bindings","_components","_hooks","e","__esModule","default","AnimatedKeyboardBackgroundView","Animated","createAnimatedComponent","KeyboardBackgroundView","KeyboardExtender","props","children","enabled","progress","useKeyboardAnimation","createElement","KeyboardStickyView","style","opacity","_default","exports"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { Animated } from \"react-native\";\n\nimport { KeyboardBackgroundView } from \"../../bindings\";\nimport { KeyboardStickyView } from \"../../components\";\nimport { useKeyboardAnimation } from \"../../hooks\";\n\nimport type { KeyboardExtenderProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\nconst AnimatedKeyboardBackgroundView = Animated.createAnimatedComponent(\n KeyboardBackgroundView,\n);\n\n/**\n * A component that embeds its children into the keyboard thus enhancing keyboard functionality.\n *\n * @param props - Component props.\n * @returns A view component that renders inside the keyboard above all system buttons.\n * @example\n * ```tsx\n * <KeyboardExtender>\n * <Button>10$</Button>\n * <Button>20$</Button>\n * <Button>50$</Button>\n * </KeyboardExtender>\n * ```\n */\nconst KeyboardExtender = (props: PropsWithChildren<KeyboardExtenderProps>) => {\n const { children, enabled = true } = props;\n const { progress } = useKeyboardAnimation();\n\n return (\n <KeyboardStickyView enabled={enabled}>\n <AnimatedKeyboardBackgroundView style={{ opacity: progress }}>\n {children}\n </AnimatedKeyboardBackgroundView>\n </KeyboardStickyView>\n );\n};\n\nexport default KeyboardExtender;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAmD,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKnD,MAAMG,8BAA8B,GAAGC,qBAAQ,CAACC,uBAAuB,CACrEC,gCACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAIC,KAA+C,IAAK;EAC5E,MAAM;IAAEC,QAAQ;IAAEC,OAAO,GAAG;EAAK,CAAC,GAAGF,KAAK;EAC1C,MAAM;IAAEG;EAAS,CAAC,GAAG,IAAAC,2BAAoB,EAAC,CAAC;EAE3C,oBACEnB,MAAA,CAAAS,OAAA,CAAAW,aAAA,CAACf,WAAA,CAAAgB,kBAAkB;IAACJ,OAAO,EAAEA;EAAQ,gBACnCjB,MAAA,CAAAS,OAAA,CAAAW,aAAA,CAACV,8BAA8B;IAACY,KAAK,EAAE;MAAEC,OAAO,EAAEL;IAAS;EAAE,GAC1DF,QAC6B,CACd,CAAC;AAEzB,CAAC;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAhB,OAAA,GAEaK,gBAAgB","ignoreList":[]}
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "KeyboardExtender", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _KeyboardExtender.default;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "OverKeyboardView", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -10,5 +16,6 @@ Object.defineProperty(exports, "OverKeyboardView", {
10
16
  }
11
17
  });
12
18
  var _OverKeyboardView = _interopRequireDefault(require("./OverKeyboardView"));
19
+ var _KeyboardExtender = _interopRequireDefault(require("./KeyboardExtender"));
13
20
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_OverKeyboardView","_interopRequireDefault","require","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as OverKeyboardView } from \"./OverKeyboardView\";\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
1
+ {"version":3,"names":["_OverKeyboardView","_interopRequireDefault","require","_KeyboardExtender","e","__esModule","default"],"sources":["index.ts"],"sourcesContent":["export { default as OverKeyboardView } from \"./OverKeyboardView\";\nexport { default as KeyboardExtender } from \"./KeyboardExtender\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAiE,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /* eslint react/jsx-sort-props: off */
2
- import React, { useLayoutEffect, useMemo, useRef, useState } from "react";
2
+ import React, { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { Animated, Platform, StyleSheet } from "react-native";
4
4
  import { controlEdgeToEdgeValues, isEdgeToEdge } from "react-native-is-edge-to-edge";
5
5
  import Reanimated, { useSharedValue } from "react-native-reanimated";
@@ -7,7 +7,7 @@ import { KeyboardControllerView } from "./bindings";
7
7
  import { KeyboardContext } from "./context";
8
8
  import { focusedInputEventsMap, keyboardEventsMap } from "./event-mappings";
9
9
  import { useAnimatedValue, useEventHandlerRegistration } from "./internal";
10
- import { applyMonkeyPatch, revertMonkeyPatch } from "./monkey-patch";
10
+ import { KeyboardController } from "./module";
11
11
  import { useAnimatedKeyboardHandler, useFocusedInputLayoutHandler } from "./reanimated";
12
12
  const IS_EDGE_TO_EDGE = isEdgeToEdge();
13
13
  const KeyboardControllerViewAnimated = Reanimated.createAnimatedComponent(Animated.createAnimatedComponent(KeyboardControllerView));
@@ -44,7 +44,8 @@ export const KeyboardProvider = props => {
44
44
  statusBarTranslucent,
45
45
  navigationBarTranslucent,
46
46
  preserveEdgeToEdge,
47
- enabled: initiallyEnabled = true
47
+ enabled: initiallyEnabled = true,
48
+ preload = true
48
49
  } = props;
49
50
  // ref
50
51
  const viewTagRef = useRef(null);
@@ -135,15 +136,11 @@ export const KeyboardProvider = props => {
135
136
  }
136
137
  }
137
138
  }, []);
138
-
139
- // layout effects
140
- useLayoutEffect(() => {
141
- if (enabled) {
142
- applyMonkeyPatch();
143
- } else {
144
- revertMonkeyPatch();
139
+ useEffect(() => {
140
+ if (preload) {
141
+ KeyboardController.preload();
145
142
  }
146
- }, [enabled]);
143
+ }, [preload]);
147
144
  if (__DEV__) {
148
145
  controlEdgeToEdgeValues({
149
146
  statusBarTranslucent,