react-native-keyboard-controller 1.21.13 → 1.22.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 (75) hide show
  1. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +4 -0
  2. package/android/src/main/java/com/reactnativekeyboardcontroller/interactive/KeyboardAnimationController.kt +6 -0
  3. package/android/src/main/java/com/reactnativekeyboardcontroller/modules/KeyboardControllerModuleImpl.kt +5 -0
  4. package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +12 -7
  5. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +5 -0
  6. package/ios/KeyboardBackdropController.swift +64 -0
  7. package/ios/KeyboardControllerModule.mm +11 -0
  8. package/ios/KeyboardControllerModuleImpl.swift +5 -0
  9. package/ios/extensions/UIWindow.swift +5 -1
  10. package/jest/index.js +1 -0
  11. package/lib/commonjs/bindings.js +1 -0
  12. package/lib/commonjs/bindings.js.map +1 -1
  13. package/lib/commonjs/components/KeyboardChatScrollView/index.js +6 -0
  14. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -1
  15. package/lib/commonjs/components/KeyboardChatScrollView/useFrozenPadding/index.js +62 -0
  16. package/lib/commonjs/components/KeyboardChatScrollView/useFrozenPadding/index.js.map +1 -0
  17. package/lib/commonjs/components/KeyboardEffects/index.js +92 -0
  18. package/lib/commonjs/components/KeyboardEffects/index.js.map +1 -0
  19. package/lib/commonjs/components/KeyboardToolbar/constants.js +2 -3
  20. package/lib/commonjs/components/KeyboardToolbar/constants.js.map +1 -1
  21. package/lib/commonjs/components/KeyboardToolbar/index.js +8 -7
  22. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  23. package/lib/commonjs/components/index.js +7 -0
  24. package/lib/commonjs/components/index.js.map +1 -1
  25. package/lib/commonjs/constants.js +2 -1
  26. package/lib/commonjs/constants.js.map +1 -1
  27. package/lib/commonjs/index.js +7 -0
  28. package/lib/commonjs/index.js.map +1 -1
  29. package/lib/commonjs/module.js +1 -0
  30. package/lib/commonjs/module.js.map +1 -1
  31. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -1
  32. package/lib/commonjs/types/module.js.map +1 -1
  33. package/lib/module/bindings.js +1 -0
  34. package/lib/module/bindings.js.map +1 -1
  35. package/lib/module/components/KeyboardChatScrollView/index.js +6 -0
  36. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -1
  37. package/lib/module/components/KeyboardChatScrollView/useFrozenPadding/index.js +57 -0
  38. package/lib/module/components/KeyboardChatScrollView/useFrozenPadding/index.js.map +1 -0
  39. package/lib/module/components/KeyboardEffects/index.js +84 -0
  40. package/lib/module/components/KeyboardEffects/index.js.map +1 -0
  41. package/lib/module/components/KeyboardToolbar/constants.js +1 -2
  42. package/lib/module/components/KeyboardToolbar/constants.js.map +1 -1
  43. package/lib/module/components/KeyboardToolbar/index.js +2 -1
  44. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  45. package/lib/module/components/index.js +1 -0
  46. package/lib/module/components/index.js.map +1 -1
  47. package/lib/module/constants.js +1 -0
  48. package/lib/module/constants.js.map +1 -1
  49. package/lib/module/index.js +1 -1
  50. package/lib/module/index.js.map +1 -1
  51. package/lib/module/module.js +1 -0
  52. package/lib/module/module.js.map +1 -1
  53. package/lib/module/specs/NativeKeyboardController.js.map +1 -1
  54. package/lib/module/types/module.js.map +1 -1
  55. package/lib/typescript/components/KeyboardChatScrollView/useFrozenPadding/index.d.ts +30 -0
  56. package/lib/typescript/components/KeyboardEffects/index.d.ts +44 -0
  57. package/lib/typescript/components/KeyboardToolbar/constants.d.ts +0 -1
  58. package/lib/typescript/components/index.d.ts +2 -0
  59. package/lib/typescript/constants.d.ts +1 -0
  60. package/lib/typescript/index.d.ts +2 -2
  61. package/lib/typescript/specs/NativeKeyboardController.d.ts +1 -0
  62. package/lib/typescript/types/module.d.ts +7 -0
  63. package/package.json +1 -1
  64. package/src/bindings.ts +1 -0
  65. package/src/components/KeyboardChatScrollView/index.tsx +7 -0
  66. package/src/components/KeyboardChatScrollView/useFrozenPadding/index.ts +83 -0
  67. package/src/components/KeyboardEffects/index.tsx +121 -0
  68. package/src/components/KeyboardToolbar/constants.ts +1 -2
  69. package/src/components/KeyboardToolbar/index.tsx +1 -1
  70. package/src/components/index.ts +2 -0
  71. package/src/constants.ts +1 -0
  72. package/src/index.ts +2 -0
  73. package/src/module.ts +1 -0
  74. package/src/specs/NativeKeyboardController.ts +1 -0
  75. package/src/types/module.ts +7 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","forwardRef","useEffect","useMemo","useRef","StyleSheet","View","KEYBOARD_BORDER_RADIUS","KEYBOARD_HAS_ROUNDED_CORNERS","KeyboardController","KeyboardStickyView","translucentStack","currentTranslucent","applyTranslucent","next","length","translucent","setTranslucent","pushTranslucentEntry","entry","push","removeTranslucentEntry","index","indexOf","splice","KeyboardEffects","children","props","ref","stackEntry","Boolean","current","containerStyle","styles","container","rounded","createElement","_extends","style","create","position","bottom","top","left","right","height","borderTopLeftRadius","borderTopRightRadius","overflow"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useMemo, useRef } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n KEYBOARD_BORDER_RADIUS,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n} from \"../../constants\";\nimport { KeyboardController } from \"../../module\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport type { KeyboardStickyViewProps } from \"../KeyboardStickyView\";\n\ntype TranslucentStackEntry = { translucent: boolean };\n\nconst translucentStack: TranslucentStackEntry[] = [];\nlet currentTranslucent = false;\n\nconst applyTranslucent = () => {\n const next =\n translucentStack.length > 0\n ? translucentStack[translucentStack.length - 1].translucent\n : false;\n\n if (next !== currentTranslucent) {\n currentTranslucent = next;\n KeyboardController.setTranslucent(next);\n }\n};\n\nconst pushTranslucentEntry = (entry: TranslucentStackEntry) => {\n translucentStack.push(entry);\n applyTranslucent();\n};\n\nconst removeTranslucentEntry = (entry: TranslucentStackEntry) => {\n const index = translucentStack.indexOf(entry);\n\n if (index !== -1) {\n translucentStack.splice(index, 1);\n }\n\n applyTranslucent();\n};\n\nexport type KeyboardEffectsProps = {\n /**\n * Whether the keyboard backdrop should be translucent.\n *\n * @default false\n */\n translucent?: boolean;\n} & KeyboardStickyViewProps;\n\n/**\n * A component that renders content behind the keyboard. Since the keyboard\n * is translucent, the content (colors, gradients, animations) will blend\n * through and create visual effects on the keyboard.\n *\n * On iOS 26+ the keyboard has rounded corners, and the effect view\n * automatically matches that shape.\n *\n * @returns A view component positioned behind the keyboard.\n * @example\n * ```tsx\n * <KeyboardEffects>\n * <View style={{ flex: 1, backgroundColor: \"purple\" }} />\n * </KeyboardEffects>\n * ```\n */\nconst KeyboardEffects = forwardRef<\n View,\n React.PropsWithChildren<KeyboardEffectsProps>\n>(({ translucent, children, ...props }, ref) => {\n const stackEntry = useRef<TranslucentStackEntry>({\n translucent: Boolean(translucent),\n }).current;\n const containerStyle = useMemo(\n () => [\n styles.container,\n KEYBOARD_HAS_ROUNDED_CORNERS && !translucent && styles.rounded,\n ],\n [translucent],\n );\n\n useEffect(() => {\n pushTranslucentEntry(stackEntry);\n\n return () => {\n removeTranslucentEntry(stackEntry);\n };\n }, [stackEntry]);\n\n useEffect(() => {\n stackEntry.translucent = Boolean(translucent);\n applyTranslucent();\n }, [stackEntry, translucent]);\n\n return (\n <KeyboardStickyView ref={ref} {...props}>\n <View style={containerStyle}>{children}</View>\n </KeyboardStickyView>\n );\n});\n\nconst styles = StyleSheet.create({\n container: {\n position: \"absolute\",\n bottom: 0,\n top: 0,\n left: 0,\n right: 0,\n height: 999,\n },\n rounded: {\n borderTopLeftRadius: KEYBOARD_BORDER_RADIUS,\n borderTopRightRadius: KEYBOARD_BORDER_RADIUS,\n overflow: \"hidden\",\n },\n});\n\nexport default KeyboardEffects;\n"],"mappings":";AAAA,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
- import { KEYBOARD_BORDER_RADIUS } from "../../constants";
1
+ import { KEYBOARD_HAS_ROUNDED_CORNERS } from "../../constants";
2
2
  export const TEST_ID_KEYBOARD_TOOLBAR = "keyboard.toolbar";
3
3
  export const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;
4
4
  export const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;
@@ -6,6 +6,5 @@ export const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.con
6
6
  export const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;
7
7
  export const KEYBOARD_TOOLBAR_HEIGHT = 42;
8
8
  export const DEFAULT_OPACITY = "FF";
9
- export const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;
10
9
  export const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;
11
10
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["KEYBOARD_BORDER_RADIUS","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","KEYBOARD_HAS_ROUNDED_CORNERS","OPENED_OFFSET"],"sources":["constants.ts"],"sourcesContent":["import { KEYBOARD_BORDER_RADIUS } from \"../../constants\";\n\nimport type { HEX } from \"./types\";\n\nexport const TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nexport const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nexport const KEYBOARD_TOOLBAR_HEIGHT = 42;\nexport const DEFAULT_OPACITY: HEX = \"FF\";\nexport const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;\nexport const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;\n"],"mappings":"AAAA,SAASA,sBAAsB,QAAQ,iBAAiB;AAIxD,OAAO,MAAMC,wBAAwB,GAAG,kBAAkB;AAC1D,OAAO,MAAMC,iCAAiC,GAAG,GAAGD,wBAAwB,WAAW;AACvF,OAAO,MAAME,6BAA6B,GAAG,GAAGF,wBAAwB,OAAO;AAC/E,OAAO,MAAMG,gCAAgC,GAAG,GAAGH,wBAAwB,UAAU;AACrF,OAAO,MAAMI,6BAA6B,GAAG,GAAGJ,wBAAwB,OAAO;AAE/E,OAAO,MAAMK,uBAAuB,GAAG,EAAE;AACzC,OAAO,MAAMC,eAAoB,GAAG,IAAI;AACxC,OAAO,MAAMC,4BAA4B,GAAGR,sBAAsB,GAAG,CAAC;AACtE,OAAO,MAAMS,aAAa,GAAGD,4BAA4B,GAAG,CAAC,EAAE,GAAG,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["KEYBOARD_HAS_ROUNDED_CORNERS","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","OPENED_OFFSET"],"sources":["constants.ts"],"sourcesContent":["import { KEYBOARD_HAS_ROUNDED_CORNERS } from \"../../constants\";\n\nimport type { HEX } from \"./types\";\n\nexport const TEST_ID_KEYBOARD_TOOLBAR = \"keyboard.toolbar\";\nexport const TEST_ID_KEYBOARD_TOOLBAR_PREVIOUS = `${TEST_ID_KEYBOARD_TOOLBAR}.previous`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_NEXT = `${TEST_ID_KEYBOARD_TOOLBAR}.next`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = `${TEST_ID_KEYBOARD_TOOLBAR}.content`;\nexport const TEST_ID_KEYBOARD_TOOLBAR_DONE = `${TEST_ID_KEYBOARD_TOOLBAR}.done`;\n\nexport const KEYBOARD_TOOLBAR_HEIGHT = 42;\nexport const DEFAULT_OPACITY: HEX = \"FF\";\nexport const OPENED_OFFSET = KEYBOARD_HAS_ROUNDED_CORNERS ? -11 : 0;\n"],"mappings":"AAAA,SAASA,4BAA4B,QAAQ,iBAAiB;AAI9D,OAAO,MAAMC,wBAAwB,GAAG,kBAAkB;AAC1D,OAAO,MAAMC,iCAAiC,GAAG,GAAGD,wBAAwB,WAAW;AACvF,OAAO,MAAME,6BAA6B,GAAG,GAAGF,wBAAwB,OAAO;AAC/E,OAAO,MAAMG,gCAAgC,GAAG,GAAGH,wBAAwB,UAAU;AACrF,OAAO,MAAMI,6BAA6B,GAAG,GAAGJ,wBAAwB,OAAO;AAE/E,OAAO,MAAMK,uBAAuB,GAAG,EAAE;AACzC,OAAO,MAAMC,eAAoB,GAAG,IAAI;AACxC,OAAO,MAAMC,aAAa,GAAGR,4BAA4B,GAAG,CAAC,EAAE,GAAG,CAAC","ignoreList":[]}
@@ -2,6 +2,7 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React, { useEffect, useMemo, useState } from "react";
3
3
  import { StyleSheet, View } from "react-native";
4
4
  import { FocusedInputEvents, RCTKeyboardToolbarGroupView } from "../../bindings";
5
+ import { KEYBOARD_HAS_ROUNDED_CORNERS } from "../../constants";
5
6
  import { useKeyboardState } from "../../hooks";
6
7
  import KeyboardStickyView from "../KeyboardStickyView";
7
8
  import Arrow from "./Arrow";
@@ -9,7 +10,7 @@ import Button from "./Button";
9
10
  import { colors } from "./colors";
10
11
  import { Background, Content, Done, Next, Prev } from "./compound/components";
11
12
  import { ToolbarContext } from "./compound/context";
12
- import { DEFAULT_OPACITY, KEYBOARD_HAS_ROUNDED_CORNERS, KEYBOARD_TOOLBAR_HEIGHT, OPENED_OFFSET, TEST_ID_KEYBOARD_TOOLBAR } from "./constants";
13
+ import { DEFAULT_OPACITY, KEYBOARD_TOOLBAR_HEIGHT, OPENED_OFFSET, TEST_ID_KEYBOARD_TOOLBAR } from "./constants";
13
14
  /**
14
15
  * `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and
15
16
  * `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useMemo","useState","StyleSheet","View","FocusedInputEvents","RCTKeyboardToolbarGroupView","useKeyboardState","KeyboardStickyView","Arrow","Button","colors","Background","Content","Done","Next","Prev","ToolbarContext","DEFAULT_OPACITY","KEYBOARD_HAS_ROUNDED_CORNERS","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","TEST_ID_KEYBOARD_TOOLBAR","KeyboardToolbar","props","children","content","theme","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","offset","closed","opened","enabled","insets","rest","colorScheme","state","appearance","inputs","setInputs","current","count","isPrevDisabled","isNextDisabled","buttonContainer","iconContainer","subscription","addListener","e","remove","toolbarStyle","styles","toolbar","backgroundColor","background","paddingLeft","left","paddingRight","right","floating","containerStyle","sticky","backgroundElement","arrowsElement","contentContainer","doneElement","prevChild","nextChild","contentChild","doneChild","backgroundChild","Children","forEach","child","isValidElement","type","createElement","style","arrows","onPress","text","contextValue","Provider","value","_extends","testID","create","position","bottom","height","alignItems","width","flexDirection","alignSelf","borderRadius","overflow","Group","DefaultKeyboardToolbarTheme"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n RCTKeyboardToolbarGroupView,\n} from \"../../bindings\";\nimport { useKeyboardState } from \"../../hooks\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport { Background, Content, Done, Next, Prev } from \"./compound/components\";\nimport { ToolbarContext } from \"./compound/context\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_HAS_ROUNDED_CORNERS,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n} from \"./constants\";\n\nimport type { KeyboardToolbarProps } from \"./types\";\nimport type { ReactNode } from \"react\";\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>\n * <KeyboardToolbar.Done text=\"Close\" />\n * </KeyboardToolbar>\n * ```\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> & {\n Background: typeof Background;\n Content: typeof Content;\n Prev: typeof Prev;\n Next: typeof Next;\n Done: typeof Done;\n Group: typeof RCTKeyboardToolbarGroupView;\n} = (props) => {\n const {\n children,\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 const buttonContainer = button ?? Button;\n const iconContainer = icon ?? Arrow;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\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 // CRUCIAL: gives the native view real bounds\n styles.sticky,\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? ({\n left: (insets?.left ?? 0) + 16,\n right: (insets?.right ?? 0) + 16,\n } as const)\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\n let backgroundElement: ReactNode = null;\n let arrowsElement: ReactNode = null;\n let contentContainer: ReactNode = null;\n let doneElement: ReactNode = null;\n\n if (children) {\n let prevChild: ReactNode = null;\n let nextChild: ReactNode = null;\n let contentChild: ReactNode = null;\n let doneChild: ReactNode = null;\n let backgroundChild: ReactNode = null;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n const type = child.type;\n\n if (type === Background) {\n backgroundChild = child;\n } else if (type === Content) {\n contentChild = child;\n } else if (type === Prev) {\n prevChild = child;\n } else if (type === Next) {\n nextChild = child;\n } else if (type === Done) {\n doneChild = child;\n }\n });\n\n backgroundElement = backgroundChild;\n doneElement = doneChild;\n arrowsElement =\n prevChild || nextChild ? (\n <View style={styles.arrows}>\n {prevChild}\n {nextChild}\n </View>\n ) : null;\n contentContainer = contentChild ?? <Content>{contentChild}</Content>;\n } else {\n backgroundElement = blur;\n arrowsElement = showArrows ? (\n <View style={styles.arrows}>\n <Prev\n button={buttonContainer}\n icon={iconContainer}\n onPress={onPrevCallback}\n />\n <Next\n button={buttonContainer}\n icon={iconContainer}\n onPress={onNextCallback}\n />\n </View>\n ) : null;\n contentContainer = <Content>{content}</Content>;\n doneElement = doneText ? (\n <Done button={buttonContainer} text={doneText} onPress={onDoneCallback} />\n ) : null;\n }\n\n const contextValue = useMemo(\n () => ({\n theme,\n isPrevDisabled,\n isNextDisabled,\n }),\n [theme, isPrevDisabled, isNextDisabled],\n );\n\n return (\n <ToolbarContext.Provider value={contextValue}>\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {backgroundElement}\n {arrowsElement}\n {contentContainer}\n {doneElement}\n </View>\n </KeyboardStickyView>\n </ToolbarContext.Provider>\n );\n};\n\nconst styles = StyleSheet.create({\n sticky: {\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: KEYBOARD_TOOLBAR_HEIGHT,\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 floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nKeyboardToolbar.Background = Background;\nKeyboardToolbar.Content = Content;\nKeyboardToolbar.Prev = Prev;\nKeyboardToolbar.Next = Next;\nKeyboardToolbar.Done = Done;\nKeyboardToolbar.Group = RCTKeyboardToolbarGroupView;\n\nexport { colors as DefaultKeyboardToolbarTheme, KeyboardToolbarProps };\nexport default KeyboardToolb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;AAC9C,eAAelF,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["React","useEffect","useMemo","useState","StyleSheet","View","FocusedInputEvents","RCTKeyboardToolbarGroupView","KEYBOARD_HAS_ROUNDED_CORNERS","useKeyboardState","KeyboardStickyView","Arrow","Button","colors","Background","Content","Done","Next","Prev","ToolbarContext","DEFAULT_OPACITY","KEYBOARD_TOOLBAR_HEIGHT","OPENED_OFFSET","TEST_ID_KEYBOARD_TOOLBAR","KeyboardToolbar","props","children","content","theme","doneText","button","icon","showArrows","onNextCallback","onPrevCallback","onDoneCallback","blur","opacity","offset","closed","opened","enabled","insets","rest","colorScheme","state","appearance","inputs","setInputs","current","count","isPrevDisabled","isNextDisabled","buttonContainer","iconContainer","subscription","addListener","e","remove","toolbarStyle","styles","toolbar","backgroundColor","background","paddingLeft","left","paddingRight","right","floating","containerStyle","sticky","backgroundElement","arrowsElement","contentContainer","doneElement","prevChild","nextChild","contentChild","doneChild","backgroundChild","Children","forEach","child","isValidElement","type","createElement","style","arrows","onPress","text","contextValue","Provider","value","_extends","testID","create","position","bottom","height","alignItems","width","flexDirection","alignSelf","borderRadius","overflow","Group","DefaultKeyboardToolbarTheme"],"sources":["index.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { StyleSheet, View } from \"react-native\";\n\nimport {\n FocusedInputEvents,\n RCTKeyboardToolbarGroupView,\n} from \"../../bindings\";\nimport { KEYBOARD_HAS_ROUNDED_CORNERS } from \"../../constants\";\nimport { useKeyboardState } from \"../../hooks\";\nimport KeyboardStickyView from \"../KeyboardStickyView\";\n\nimport Arrow from \"./Arrow\";\nimport Button from \"./Button\";\nimport { colors } from \"./colors\";\nimport { Background, Content, Done, Next, Prev } from \"./compound/components\";\nimport { ToolbarContext } from \"./compound/context\";\nimport {\n DEFAULT_OPACITY,\n KEYBOARD_TOOLBAR_HEIGHT,\n OPENED_OFFSET,\n TEST_ID_KEYBOARD_TOOLBAR,\n} from \"./constants\";\n\nimport type { KeyboardToolbarProps } from \"./types\";\nimport type { ReactNode } from \"react\";\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>\n * <KeyboardToolbar.Done text=\"Close\" />\n * </KeyboardToolbar>\n * ```\n */\nconst KeyboardToolbar: React.FC<KeyboardToolbarProps> & {\n Background: typeof Background;\n Content: typeof Content;\n Prev: typeof Prev;\n Next: typeof Next;\n Done: typeof Done;\n Group: typeof RCTKeyboardToolbarGroupView;\n} = (props) => {\n const {\n children,\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 const buttonContainer = button ?? Button;\n const iconContainer = icon ?? Arrow;\n\n useEffect(() => {\n const subscription = FocusedInputEvents.addListener(\"focusDidSet\", (e) => {\n setInputs(e);\n });\n\n return subscription.remove;\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 // CRUCIAL: gives the native view real bounds\n styles.sticky,\n KEYBOARD_HAS_ROUNDED_CORNERS\n ? ({\n left: (insets?.left ?? 0) + 16,\n right: (insets?.right ?? 0) + 16,\n } as const)\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\n let backgroundElement: ReactNode = null;\n let arrowsElement: ReactNode = null;\n let contentContainer: ReactNode = null;\n let doneElement: ReactNode = null;\n\n if (children) {\n let prevChild: ReactNode = null;\n let nextChild: ReactNode = null;\n let contentChild: ReactNode = null;\n let doneChild: ReactNode = null;\n let backgroundChild: ReactNode = null;\n\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) {\n return;\n }\n const type = child.type;\n\n if (type === Background) {\n backgroundChild = child;\n } else if (type === Content) {\n contentChild = child;\n } else if (type === Prev) {\n prevChild = child;\n } else if (type === Next) {\n nextChild = child;\n } else if (type === Done) {\n doneChild = child;\n }\n });\n\n backgroundElement = backgroundChild;\n doneElement = doneChild;\n arrowsElement =\n prevChild || nextChild ? (\n <View style={styles.arrows}>\n {prevChild}\n {nextChild}\n </View>\n ) : null;\n contentContainer = contentChild ?? <Content>{contentChild}</Content>;\n } else {\n backgroundElement = blur;\n arrowsElement = showArrows ? (\n <View style={styles.arrows}>\n <Prev\n button={buttonContainer}\n icon={iconContainer}\n onPress={onPrevCallback}\n />\n <Next\n button={buttonContainer}\n icon={iconContainer}\n onPress={onNextCallback}\n />\n </View>\n ) : null;\n contentContainer = <Content>{content}</Content>;\n doneElement = doneText ? (\n <Done button={buttonContainer} text={doneText} onPress={onDoneCallback} />\n ) : null;\n }\n\n const contextValue = useMemo(\n () => ({\n theme,\n isPrevDisabled,\n isNextDisabled,\n }),\n [theme, isPrevDisabled, isNextDisabled],\n );\n\n return (\n <ToolbarContext.Provider value={contextValue}>\n <KeyboardStickyView\n enabled={enabled}\n offset={offset}\n style={containerStyle}\n >\n <View {...rest} style={toolbarStyle} testID={TEST_ID_KEYBOARD_TOOLBAR}>\n {backgroundElement}\n {arrowsElement}\n {contentContainer}\n {doneElement}\n </View>\n </KeyboardStickyView>\n </ToolbarContext.Provider>\n );\n};\n\nconst styles = StyleSheet.create({\n sticky: {\n position: \"absolute\",\n left: 0,\n right: 0,\n bottom: 0,\n height: KEYBOARD_TOOLBAR_HEIGHT,\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 floating: {\n alignSelf: \"center\",\n borderRadius: 20,\n overflow: \"hidden\",\n },\n});\n\nKeyboardToolbar.Background = Background;\nKeyboardToolbar.Content = Content;\nKeyboardToolbar.Prev = Prev;\nKeyboardToolbar.Next = Next;\nKeyboardToolbar.Done = Done;\nKeyboardToolbar.Group = RCTKeyboardToolbarGroupView;\n\nexport { colors as DefaultKeyboardToolbarTheme, KeyboardToolbarProps };\nexport default KeyboardToolbar;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC3D,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,SACEC,kBAAkB,EAClBC,2BAA2B,QACtB,gBAAgB;AACvB,SAASC,4BAA4B,QAAQ,iBAAiB;AAC9D,SAASC,gBAAgB,QAAQ,aAAa;AAC9C,OAAOC,kBAAkB,MAAM,uBAAuB;AAEtD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,MAAM,MAAM,UAAU;AAC7B,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,UAAU,EAAEC,OAAO,EAAEC,IAAI,EAAEC,IAAI,EAAEC,IAAI,QAAQ,uBAAuB;AAC7E,SAASC,cAAc,QAAQ,oBAAoB;AACnD,SACEC,eAAe,EAC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E,KAAK,EAAE,CAAC;IACR8B,MAAM,EAAE,CAAC;IACTC,MAAM,EAAE7E;EACV,CAAC;EACDwC,OAAO,EAAE;IACPmC,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,CAAC;IACTE,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAE,MAAM;IACbC,aAAa,EAAE,KAAK;IACpBH,MAAM,EAAE7E;EACV,CAAC;EACDkE,MAAM,EAAE;IACNc,aAAa,EAAE,KAAK;IACpBrC,WAAW,EAAE;EACf,CAAC;EACDI,QAAQ,EAAE;IACRkC,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFhF,eAAe,CAACV,UAAU,GAAGA,UAAU;AACvCU,eAAe,CAACT,OAAO,GAAGA,OAAO;AACjCS,eAAe,CAACN,IAAI,GAAGA,IAAI;AAC3BM,eAAe,CAACP,IAAI,GAAGA,IAAI;AAC3BO,eAAe,CAACR,IAAI,GAAGA,IAAI;AAC3BQ,eAAe,CAACiF,KAAK,GAAGlG,2BAA2B;AAEnD,SAASM,MAAM,IAAI6F,2BAA2B;AAC9C,eAAelF,eAAe","ignoreList":[]}
@@ -3,4 +3,5 @@ export { default as KeyboardStickyView } from "./KeyboardStickyView";
3
3
  export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
4
4
  export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./KeyboardToolbar";
5
5
  export { default as KeyboardChatScrollView } from "./KeyboardChatScrollView";
6
+ export { default as KeyboardEffects } from "./KeyboardEffects";
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","KeyboardChatScrollView"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport { default as KeyboardChatScrollView } from \"./KeyboardChatScrollView\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type {\n KeyboardAwareScrollViewMode,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView/types\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\nexport type { KeyboardChatScrollViewProps } from \"./KeyboardChatScrollView/types\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SACEH,OAAO,IAAII,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB;AAC1B,SAASL,OAAO,IAAIM,sBAAsB,QAAQ,0BAA0B","ignoreList":[]}
1
+ {"version":3,"names":["default","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","KeyboardChatScrollView","KeyboardEffects"],"sources":["index.ts"],"sourcesContent":["export { default as KeyboardAvoidingView } from \"./KeyboardAvoidingView\";\nexport { default as KeyboardStickyView } from \"./KeyboardStickyView\";\nexport { default as KeyboardAwareScrollView } from \"./KeyboardAwareScrollView\";\nexport {\n default as KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./KeyboardToolbar\";\nexport { default as KeyboardChatScrollView } from \"./KeyboardChatScrollView\";\nexport { default as KeyboardEffects } from \"./KeyboardEffects\";\nexport type { KeyboardAvoidingViewProps } from \"./KeyboardAvoidingView\";\nexport type { KeyboardStickyViewProps } from \"./KeyboardStickyView\";\nexport type { KeyboardEffectsProps } from \"./KeyboardEffects\";\nexport type {\n KeyboardAwareScrollViewMode,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n} from \"./KeyboardAwareScrollView/types\";\nexport type { KeyboardToolbarProps } from \"./KeyboardToolbar\";\nexport type { KeyboardChatScrollViewProps } from \"./KeyboardChatScrollView/types\";\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,oBAAoB,QAAQ,wBAAwB;AACxE,SAASD,OAAO,IAAIE,kBAAkB,QAAQ,sBAAsB;AACpE,SAASF,OAAO,IAAIG,uBAAuB,QAAQ,2BAA2B;AAC9E,SACEH,OAAO,IAAII,eAAe,EAC1BC,2BAA2B,QACtB,mBAAmB;AAC1B,SAASL,OAAO,IAAIM,sBAAsB,QAAQ,0BAA0B;AAC5E,SAASN,OAAO,IAAIO,eAAe,QAAQ,mBAAmB","ignoreList":[]}
@@ -21,4 +21,5 @@ export let AndroidSoftInputModes = /*#__PURE__*/function (AndroidSoftInputModes)
21
21
  return AndroidSoftInputModes;
22
22
  }({});
23
23
  export const KEYBOARD_BORDER_RADIUS = KeyboardControllerNative.getConstants().keyboardBorderRadius;
24
+ export const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;
24
25
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardControllerNative","AndroidSoftInputModes","KEYBOARD_BORDER_RADIUS","getConstants","keyboardBorderRadius"],"sources":["constants.ts"],"sourcesContent":["import { KeyboardControllerNative } from \"./bindings\";\n\n// copied from `android.view.WindowManager.LayoutParams`\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\n SOFT_INPUT_MASK_ADJUST = 240,\n SOFT_INPUT_MASK_STATE = 15,\n SOFT_INPUT_MODE_CHANGED = 512,\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\n SOFT_INPUT_STATE_HIDDEN = 2,\n SOFT_INPUT_STATE_UNCHANGED = 1,\n // temporarily disable this rule to avoid breaking changes.\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\n SOFT_INPUT_STATE_VISIBLE = 4,\n}\nexport const KEYBOARD_BORDER_RADIUS =\n KeyboardControllerNative.getConstants().keyboardBorderRadius;\n"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,YAAY;;AAErD;AACA,WAAYC,qBAAqB,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;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAkBjC,OAAO,MAAMC,sBAAsB,GACjCF,wBAAwB,CAACG,YAAY,CAAC,CAAC,CAACC,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["KeyboardControllerNative","AndroidSoftInputModes","KEYBOARD_BORDER_RADIUS","getConstants","keyboardBorderRadius","KEYBOARD_HAS_ROUNDED_CORNERS"],"sources":["constants.ts"],"sourcesContent":["import { KeyboardControllerNative } from \"./bindings\";\n\n// copied from `android.view.WindowManager.LayoutParams`\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,\n SOFT_INPUT_MASK_ADJUST = 240,\n SOFT_INPUT_MASK_STATE = 15,\n SOFT_INPUT_MODE_CHANGED = 512,\n SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,\n SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,\n SOFT_INPUT_STATE_HIDDEN = 2,\n SOFT_INPUT_STATE_UNCHANGED = 1,\n // temporarily disable this rule to avoid breaking changes.\n // eslint-disable-next-line @typescript-eslint/no-duplicate-enum-values\n SOFT_INPUT_STATE_UNSPECIFIED = 0,\n SOFT_INPUT_STATE_VISIBLE = 4,\n}\nexport const KEYBOARD_BORDER_RADIUS =\n KeyboardControllerNative.getConstants().keyboardBorderRadius;\nexport const KEYBOARD_HAS_ROUNDED_CORNERS = KEYBOARD_BORDER_RADIUS > 0;\n"],"mappings":"AAAA,SAASA,wBAAwB,QAAQ,YAAY;;AAErD;AACA,WAAYC,qBAAqB,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;EAa/B;EACA;EAdUA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAkBjC,OAAO,MAAMC,sBAAsB,GACjCF,wBAAwB,CAACG,YAAY,CAAC,CAAC,CAACC,oBAAoB;AAC9D,OAAO,MAAMC,4BAA4B,GAAGH,sBAAsB,GAAG,CAAC","ignoreList":[]}
@@ -8,6 +8,6 @@ export * from "./types";
8
8
  export * from "./compat";
9
9
  export { KeyboardChatScrollView, KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView,
10
10
  // keyboard toolbar
11
- KeyboardToolbar, DefaultKeyboardToolbarTheme } from "./components";
11
+ KeyboardToolbar, DefaultKeyboardToolbarTheme, KeyboardEffects } from "./components";
12
12
  export { OverKeyboardView, KeyboardExtender } from "./views";
13
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardChatScrollView","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","OverKeyboardView","KeyboardExtender"],"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\";\nexport * from \"./compat\";\n\nexport {\n KeyboardChatScrollView,\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n} from \"./components\";\nexport type {\n KeyboardChatScrollViewProps,\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewMode,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AAExB,SACEA,sBAAsB,EACtBC,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,QACtB,cAAc;AAUrB,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["KeyboardChatScrollView","KeyboardAvoidingView","KeyboardStickyView","KeyboardAwareScrollView","KeyboardToolbar","DefaultKeyboardToolbarTheme","KeyboardEffects","OverKeyboardView","KeyboardExtender"],"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\";\nexport * from \"./compat\";\n\nexport {\n KeyboardChatScrollView,\n KeyboardAvoidingView,\n KeyboardStickyView,\n KeyboardAwareScrollView,\n // keyboard toolbar\n KeyboardToolbar,\n DefaultKeyboardToolbarTheme,\n KeyboardEffects,\n} from \"./components\";\nexport type {\n KeyboardChatScrollViewProps,\n KeyboardAvoidingViewProps,\n KeyboardStickyViewProps,\n KeyboardAwareScrollViewMode,\n KeyboardAwareScrollViewProps,\n KeyboardAwareScrollViewRef,\n KeyboardToolbarProps,\n KeyboardEffectsProps,\n} from \"./components\";\nexport { OverKeyboardView, KeyboardExtender } from \"./views\";\n"],"mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,YAAY;AAC1B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,UAAU;AAExB,SACEA,sBAAsB,EACtBC,oBAAoB,EACpBC,kBAAkB,EAClBC,uBAAuB;AACvB;AACAC,eAAe,EACfC,2BAA2B,EAC3BC,eAAe,QACV,cAAc;AAWrB,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,SAAS","ignoreList":[]}
@@ -42,6 +42,7 @@ export const KeyboardController = {
42
42
  setInputMode: KeyboardControllerNative.setInputMode,
43
43
  setFocusTo: KeyboardControllerNative.setFocusTo,
44
44
  preload: KeyboardControllerNative.preload,
45
+ setTranslucent: KeyboardControllerNative.setTranslucent,
45
46
  dismiss,
46
47
  isVisible,
47
48
  state
@@ -1 +1 @@
1
- {"version":3,"names":["KeyboardControllerNative","KeyboardEvents","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","addListener","e","dismiss","options","keepFocus","animated","Promise","resolve","subscription","undefined","remove","isVisible","state","KeyboardController","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(\"keyboardWillShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: Partial<DismissOptions>): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n const animated = options?.animated ?? true;\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, animated);\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 isV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AAQ;AACjC,MAAMsB,KAAK,GAAGA,CAAA,KAAMrB,SAAS;;AAE7B;AACA;AACA;AACA,OAAO,MAAMsB,kBAA4C,GAAG;EAC1DC,cAAc,EAAE1B,wBAAwB,CAAC0B,cAAc;EACvDC,YAAY,EAAE3B,wBAAwB,CAAC2B,YAAY;EACnDC,UAAU,EAAE5B,wBAAwB,CAAC4B,UAAU;EAC/CC,OAAO,EAAE7B,wBAAwB,CAAC6B,OAAO;EACzCf,OAAO;EACPS,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["KeyboardControllerNative","KeyboardEvents","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","addListener","e","dismiss","options","keepFocus","animated","Promise","resolve","subscription","undefined","remove","isVisible","state","KeyboardController","setDefaultMode","setInputMode","setFocusTo","preload","setTranslucent"],"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(\"keyboardWillShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: Partial<DismissOptions>): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n const animated = options?.animated ?? true;\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, animated);\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 setTranslucent: KeyboardControllerNative.setTranslucent,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,cAAc,QAAQ,YAAY;AAQrE,IAAIC,QAAQ,GAAG,IAAI;AACnB,IAAIC,SAA4B,GAAG;EACjCC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC/BC,MAAM,EAAE,CAAC,CAAC;EACVC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE;AACd,CAAC;AAEDV,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,IAAI;EACfC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEFZ,cAAc,CAACW,WAAW,CAAC,kBAAkB,EAAGC,CAAC,IAAK;EACpDX,QAAQ,GAAG,KAAK;EAChBC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOC,OAAiC,IAAoB;EAC1E,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAC7C,MAAMC,QAAQ,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,QAAQ,KAAI,IAAI;EAE1C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIjB,QAAQ,EAAE;MACZiB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGnB,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEO,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFtB,wBAAwB,CAACc,OAAO,CAACE,SAAS,EAAEC,QAAQ,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC;AACD,MAAMM,SAAS,GAAGA,CAAA,KAAM,CAACrB,QAAQ;AACjC,MAAMsB,KAAK,GAAGA,CAAA,KAAMrB,SAAS;;AAE7B;AACA;AACA;AACA,OAAO,MAAMsB,kBAA4C,GAAG;EAC1DC,cAAc,EAAE1B,wBAAwB,CAAC0B,cAAc;EACvDC,YAAY,EAAE3B,wBAAwB,CAAC2B,YAAY;EACnDC,UAAU,EAAE5B,wBAAwB,CAAC4B,UAAU;EAC/CC,OAAO,EAAE7B,wBAAwB,CAAC6B,OAAO;EACzCC,cAAc,EAAE9B,wBAAwB,CAAC8B,cAAc;EACvDhB,OAAO;EACPS,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["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 keyboardBorderRadius: number;\n };\n\n // methods\n setInputMode(mode: number): void;\n setDefaultMode(): void;\n preload(): void;\n dismiss(keepFocus: boolean, animated: boolean): void;\n setFocusTo(direction: string): void;\n viewPositionInWindow(viewTag: number): Promise<object>;\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,SAASA,mBAAmB,QAAQ,cAAc;AAsBlD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,oBAAoB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["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 keyboardBorderRadius: number;\n };\n\n // methods\n setInputMode(mode: number): void;\n setDefaultMode(): void;\n preload(): void;\n setTranslucent(translucent: boolean): void;\n dismiss(keepFocus: boolean, animated: boolean): void;\n setFocusTo(direction: string): void;\n viewPositionInWindow(viewTag: number): Promise<object>;\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,SAASA,mBAAmB,QAAQ,cAAc;AAuBlD,eAAeA,mBAAmB,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 `dark` or `light`. */\n appearance: \"dark\" | \"light\";\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type IKeyboardState = {\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 /**\n * A boolean property controlling whether dismissal should be animated. Default is `true`.\n */\n animated: 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 * If you want to close keyboard immediately pass `{animated: false}`.\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?: Partial<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 ViewPositionInWindowResult = {\n x: number;\n y: number;\n width: number;\n height: number;\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, animated: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n viewPositionInWindow: (\n viewTag: number,\n ) => Promise<ViewPositionInWindowResult>;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n // constants\n getConstants: () => {\n keyboardBorderRadius: number;\n };\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 IKeyboardState = {\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 /**\n * A boolean property controlling whether dismissal should be animated. Default is `true`.\n */\n animated: 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 /**\n * Sets the keyboard backdrop translucency.\n *\n * @platform ios\n */\n setTranslucent: (translucent: boolean) => 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 * If you want to close keyboard immediately pass `{animated: false}`.\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?: Partial<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 ViewPositionInWindowResult = {\n x: number;\n y: number;\n width: number;\n height: number;\n};\nexport type KeyboardControllerNativeModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // ios only\n preload: () => void;\n setTranslucent: (translucent: boolean) => void;\n // all platforms\n dismiss: (keepFocus: boolean, animated: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n viewPositionInWindow: (\n viewTag: number,\n ) => Promise<ViewPositionInWindowResult>;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n // constants\n getConstants: () => {\n keyboardBorderRadius: number;\n };\n};\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,30 @@
1
+ import type { SharedValue } from "react-native-reanimated";
2
+ type UseFrozenPaddingOptions = {
3
+ /** When `true`, keyboard-driven layout writes are skipped. */
4
+ freeze: SharedValue<boolean>;
5
+ /** The distance between the bottom of the screen and the `ScrollView`. */
6
+ offset: number;
7
+ /** Keyboard-driven padding managed by `useChatKeyboard`. */
8
+ padding: SharedValue<number>;
9
+ };
10
+ /**
11
+ * Hook that reconciles keyboard padding after a frozen interval.
12
+ *
13
+ * `useChatKeyboard` handlers skip all writes while `freeze` is enabled, so if
14
+ * the keyboard opens or closes during the frozen interval `padding` keeps a
15
+ * stale value (e.g. the open-keyboard height after a frozen dismissal). This
16
+ * hook observes keyboard events independently of `freeze` and recomputes the
17
+ * padding from the latest observed keyboard height as soon as `freeze`
18
+ * transitions back to `false`.
19
+ *
20
+ * @param options - Keyboard padding shared values plus the scroll view `offset`.
21
+ * @param options.freeze - When `true`, keyboard-driven layout writes are skipped.
22
+ * @param options.offset - The distance between the bottom of the screen and the `ScrollView`.
23
+ * @param options.padding - Keyboard-driven padding managed by `useChatKeyboard`.
24
+ * @example
25
+ * ```ts
26
+ * useFrozenPadding({ freeze, offset, padding });
27
+ * ```
28
+ */
29
+ declare function useFrozenPadding({ freeze, offset, padding, }: UseFrozenPaddingOptions): void;
30
+ export { useFrozenPadding };
@@ -0,0 +1,44 @@
1
+ import React from "react";
2
+ import { View } from "react-native";
3
+ import type { KeyboardStickyViewProps } from "../KeyboardStickyView";
4
+ export type KeyboardEffectsProps = {
5
+ /**
6
+ * Whether the keyboard backdrop should be translucent.
7
+ *
8
+ * @default false
9
+ */
10
+ translucent?: boolean;
11
+ } & KeyboardStickyViewProps;
12
+ /**
13
+ * A component that renders content behind the keyboard. Since the keyboard
14
+ * is translucent, the content (colors, gradients, animations) will blend
15
+ * through and create visual effects on the keyboard.
16
+ *
17
+ * On iOS 26+ the keyboard has rounded corners, and the effect view
18
+ * automatically matches that shape.
19
+ *
20
+ * @returns A view component positioned behind the keyboard.
21
+ * @example
22
+ * ```tsx
23
+ * <KeyboardEffects>
24
+ * <View style={{ flex: 1, backgroundColor: "purple" }} />
25
+ * </KeyboardEffects>
26
+ * ```
27
+ */
28
+ declare const KeyboardEffects: React.ForwardRefExoticComponent<{
29
+ /**
30
+ * Whether the keyboard backdrop should be translucent.
31
+ *
32
+ * @default false
33
+ */
34
+ translucent?: boolean;
35
+ } & {
36
+ offset?: {
37
+ closed?: number;
38
+ opened?: number;
39
+ };
40
+ enabled?: boolean;
41
+ } & import("react-native").ViewProps & {
42
+ children?: React.ReactNode | undefined;
43
+ } & React.RefAttributes<View>>;
44
+ export default KeyboardEffects;
@@ -6,5 +6,4 @@ export declare const TEST_ID_KEYBOARD_TOOLBAR_CONTENT = "keyboard.toolbar.conten
6
6
  export declare const TEST_ID_KEYBOARD_TOOLBAR_DONE = "keyboard.toolbar.done";
7
7
  export declare const KEYBOARD_TOOLBAR_HEIGHT = 42;
8
8
  export declare const DEFAULT_OPACITY: HEX;
9
- export declare const KEYBOARD_HAS_ROUNDED_CORNERS: boolean;
10
9
  export declare const OPENED_OFFSET: number;
@@ -3,8 +3,10 @@ export { default as KeyboardStickyView } from "./KeyboardStickyView";
3
3
  export { default as KeyboardAwareScrollView } from "./KeyboardAwareScrollView";
4
4
  export { default as KeyboardToolbar, DefaultKeyboardToolbarTheme, } from "./KeyboardToolbar";
5
5
  export { default as KeyboardChatScrollView } from "./KeyboardChatScrollView";
6
+ export { default as KeyboardEffects } from "./KeyboardEffects";
6
7
  export type { KeyboardAvoidingViewProps } from "./KeyboardAvoidingView";
7
8
  export type { KeyboardStickyViewProps } from "./KeyboardStickyView";
9
+ export type { KeyboardEffectsProps } from "./KeyboardEffects";
8
10
  export type { KeyboardAwareScrollViewMode, KeyboardAwareScrollViewProps, KeyboardAwareScrollViewRef, } from "./KeyboardAwareScrollView/types";
9
11
  export type { KeyboardToolbarProps } from "./KeyboardToolbar";
10
12
  export type { KeyboardChatScrollViewProps } from "./KeyboardChatScrollView/types";
@@ -15,3 +15,4 @@ export declare enum AndroidSoftInputModes {
15
15
  SOFT_INPUT_STATE_VISIBLE = 4
16
16
  }
17
17
  export declare const KEYBOARD_BORDER_RADIUS: number;
18
+ export declare const KEYBOARD_HAS_ROUNDED_CORNERS: boolean;
@@ -6,6 +6,6 @@ export * from "./constants";
6
6
  export * from "./module";
7
7
  export * from "./types";
8
8
  export * from "./compat";
9
- export { KeyboardChatScrollView, KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView, KeyboardToolbar, DefaultKeyboardToolbarTheme, } from "./components";
10
- export type { KeyboardChatScrollViewProps, KeyboardAvoidingViewProps, KeyboardStickyViewProps, KeyboardAwareScrollViewMode, KeyboardAwareScrollViewProps, KeyboardAwareScrollViewRef, KeyboardToolbarProps, } from "./components";
9
+ export { KeyboardChatScrollView, KeyboardAvoidingView, KeyboardStickyView, KeyboardAwareScrollView, KeyboardToolbar, DefaultKeyboardToolbarTheme, KeyboardEffects, } from "./components";
10
+ export type { KeyboardChatScrollViewProps, KeyboardAvoidingViewProps, KeyboardStickyViewProps, KeyboardAwareScrollViewMode, KeyboardAwareScrollViewProps, KeyboardAwareScrollViewRef, KeyboardToolbarProps, KeyboardEffectsProps, } from "./components";
11
11
  export { OverKeyboardView, KeyboardExtender } from "./views";
@@ -6,6 +6,7 @@ export interface Spec extends TurboModule {
6
6
  setInputMode(mode: number): void;
7
7
  setDefaultMode(): void;
8
8
  preload(): void;
9
+ setTranslucent(translucent: boolean): void;
9
10
  dismiss(keepFocus: boolean, animated: boolean): void;
10
11
  setFocusTo(direction: string): void;
11
12
  viewPositionInWindow(viewTag: number): Promise<object>;
@@ -71,6 +71,12 @@ export type KeyboardControllerModule = {
71
71
  * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#preload-|docs} page for more details.
72
72
  */
73
73
  preload: () => void;
74
+ /**
75
+ * Sets the keyboard backdrop translucency.
76
+ *
77
+ * @platform ios
78
+ */
79
+ setTranslucent: (translucent: boolean) => void;
74
80
  /**
75
81
  * Dismisses the active keyboard. Removes a focus by default, but allows to pass `{keepFocus: true}` to keep focus.
76
82
  * If you want to close keyboard immediately pass `{animated: false}`.
@@ -107,6 +113,7 @@ export type KeyboardControllerNativeModule = {
107
113
  setDefaultMode: () => void;
108
114
  setInputMode: (mode: number) => void;
109
115
  preload: () => void;
116
+ setTranslucent: (translucent: boolean) => void;
110
117
  dismiss: (keepFocus: boolean, animated: boolean) => void;
111
118
  setFocusTo: (direction: Direction) => void;
112
119
  viewPositionInWindow: (viewTag: number) => Promise<ViewPositionInWindowResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keyboard-controller",
3
- "version": "1.21.13",
3
+ "version": "1.22.0",
4
4
  "description": "Keyboard manager which works in identical way on both iOS and Android",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/bindings.ts CHANGED
@@ -21,6 +21,7 @@ export const KeyboardControllerNative: KeyboardControllerNativeModule = {
21
21
  setDefaultMode: NOOP,
22
22
  setInputMode: NOOP,
23
23
  preload: NOOP,
24
+ setTranslucent: NOOP,
24
25
  dismiss: NOOP,
25
26
  setFocusTo: NOOP,
26
27
  viewPositionInWindow: () =>
@@ -14,6 +14,7 @@ import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";
14
14
  import { useChatKeyboard } from "./useChatKeyboard";
15
15
  import { useEndVisible } from "./useEndVisible";
16
16
  import { useExtraContentPadding } from "./useExtraContentPadding";
17
+ import { useFrozenPadding } from "./useFrozenPadding";
17
18
 
18
19
  import type { KeyboardChatScrollViewProps } from "./types";
19
20
  import type { LayoutChangeEvent } from "react-native";
@@ -80,6 +81,12 @@ const KeyboardChatScrollView = forwardRef<
80
81
  freeze: freezeSV,
81
82
  });
82
83
 
84
+ useFrozenPadding({
85
+ freeze: freezeSV,
86
+ offset,
87
+ padding,
88
+ });
89
+
83
90
  useEndVisible({
84
91
  scroll,
85
92
  layout,
@@ -0,0 +1,83 @@
1
+ import { useAnimatedReaction, useSharedValue } from "react-native-reanimated";
2
+
3
+ import { useKeyboardHandler } from "../../../hooks";
4
+ import { getEffectiveHeight } from "../useChatKeyboard/helpers";
5
+
6
+ import type { SharedValue } from "react-native-reanimated";
7
+
8
+ type UseFrozenPaddingOptions = {
9
+ /** When `true`, keyboard-driven layout writes are skipped. */
10
+ freeze: SharedValue<boolean>;
11
+ /** The distance between the bottom of the screen and the `ScrollView`. */
12
+ offset: number;
13
+ /** Keyboard-driven padding managed by `useChatKeyboard`. */
14
+ padding: SharedValue<number>;
15
+ };
16
+
17
+ /**
18
+ * Hook that reconciles keyboard padding after a frozen interval.
19
+ *
20
+ * `useChatKeyboard` handlers skip all writes while `freeze` is enabled, so if
21
+ * the keyboard opens or closes during the frozen interval `padding` keeps a
22
+ * stale value (e.g. the open-keyboard height after a frozen dismissal). This
23
+ * hook observes keyboard events independently of `freeze` and recomputes the
24
+ * padding from the latest observed keyboard height as soon as `freeze`
25
+ * transitions back to `false`.
26
+ *
27
+ * @param options - Keyboard padding shared values plus the scroll view `offset`.
28
+ * @param options.freeze - When `true`, keyboard-driven layout writes are skipped.
29
+ * @param options.offset - The distance between the bottom of the screen and the `ScrollView`.
30
+ * @param options.padding - Keyboard-driven padding managed by `useChatKeyboard`.
31
+ * @example
32
+ * ```ts
33
+ * useFrozenPadding({ freeze, offset, padding });
34
+ * ```
35
+ */
36
+ function useFrozenPadding({
37
+ freeze,
38
+ offset,
39
+ padding,
40
+ }: UseFrozenPaddingOptions): void {
41
+ const lastHeight = useSharedValue(0);
42
+ const targetKeyboardHeight = useSharedValue(0);
43
+
44
+ useKeyboardHandler(
45
+ {
46
+ onStart: (e) => {
47
+ "worklet";
48
+
49
+ if (e.height > 0) {
50
+ // eslint-disable-next-line react-compiler/react-compiler
51
+ targetKeyboardHeight.value = e.height;
52
+ }
53
+ },
54
+ onMove: (e) => {
55
+ "worklet";
56
+
57
+ lastHeight.value = e.height;
58
+ },
59
+ onEnd: (e) => {
60
+ "worklet";
61
+
62
+ lastHeight.value = e.height;
63
+ },
64
+ },
65
+ [],
66
+ );
67
+
68
+ useAnimatedReaction(
69
+ () => freeze.value,
70
+ (isFrozen, wasFrozen) => {
71
+ if (!isFrozen && wasFrozen === true) {
72
+ padding.value = getEffectiveHeight(
73
+ lastHeight.value,
74
+ targetKeyboardHeight.value,
75
+ offset,
76
+ );
77
+ }
78
+ },
79
+ [offset],
80
+ );
81
+ }
82
+
83
+ export { useFrozenPadding };