react-native-keyboard-controller 1.21.5 → 1.21.6

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 (52) hide show
  1. package/android/src/main/java/com/reactnativekeyboardcontroller/views/ClippingScrollViewDecoratorView.kt +1 -1
  2. package/lib/commonjs/components/KeyboardChatScrollView/index.js +3 -2
  3. package/lib/commonjs/components/KeyboardChatScrollView/index.js.map +1 -1
  4. package/lib/commonjs/components/KeyboardChatScrollView/types.js.map +1 -1
  5. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +3 -3
  6. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -1
  7. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js +4 -4
  8. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -1
  9. package/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -1
  10. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js +2 -2
  11. package/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -1
  12. package/lib/commonjs/components/KeyboardToolbar/index.js +12 -3
  13. package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
  14. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js +1 -10
  15. package/lib/commonjs/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  16. package/lib/commonjs/hooks/useKeyboardState/index.js +1 -7
  17. package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
  18. package/lib/commonjs/module.js +1 -1
  19. package/lib/commonjs/module.js.map +1 -1
  20. package/lib/module/components/KeyboardChatScrollView/index.js +3 -2
  21. package/lib/module/components/KeyboardChatScrollView/index.js.map +1 -1
  22. package/lib/module/components/KeyboardChatScrollView/types.js.map +1 -1
  23. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js +3 -3
  24. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js.map +1 -1
  25. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js +4 -4
  26. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.js.map +1 -1
  27. package/lib/module/components/KeyboardChatScrollView/useChatKeyboard/types.js.map +1 -1
  28. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js +2 -2
  29. package/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js.map +1 -1
  30. package/lib/module/components/KeyboardToolbar/index.js +12 -3
  31. package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
  32. package/lib/module/components/ScrollViewWithBottomPadding/index.js +2 -11
  33. package/lib/module/components/ScrollViewWithBottomPadding/index.js.map +1 -1
  34. package/lib/module/hooks/useKeyboardState/index.js +1 -7
  35. package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
  36. package/lib/module/module.js +1 -1
  37. package/lib/module/module.js.map +1 -1
  38. package/lib/typescript/components/KeyboardChatScrollView/index.d.ts +1 -1
  39. package/lib/typescript/components/KeyboardChatScrollView/types.d.ts +1 -1
  40. package/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts +1 -1
  41. package/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts +1 -1
  42. package/package.json +1 -1
  43. package/src/components/KeyboardChatScrollView/index.tsx +5 -2
  44. package/src/components/KeyboardChatScrollView/types.ts +1 -1
  45. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts +3 -3
  46. package/src/components/KeyboardChatScrollView/useChatKeyboard/index.ts +4 -4
  47. package/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts +1 -1
  48. package/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts +3 -3
  49. package/src/components/KeyboardToolbar/index.tsx +13 -4
  50. package/src/components/ScrollViewWithBottomPadding/index.tsx +2 -12
  51. package/src/hooks/useKeyboardState/index.ts +1 -8
  52. package/src/module.ts +1 -1
@@ -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","marginLeft","marginRight","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","alignItems","width","flexDirection","height","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 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\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 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,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,EACfC,4BAA4B,EAC5BC,uBAAuB,EACvBC,aAAa,EACbC,wBAAwB,QACnB,aAAa;AAKpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,eAOL,GAAIC,KAAK,IAAK;EACb,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RmC,SAAS,EAAE,QAAQ;IACnBC,YAAY,EAAE,EAAE;IAChBC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC;AAEFjF,eAAe,CAACX,UAAU,GAAGA,UAAU;AACvCW,eAAe,CAACV,OAAO,GAAGA,OAAO;AACjCU,eAAe,CAACP,IAAI,GAAGA,IAAI;AAC3BO,eAAe,CAACR,IAAI,GAAGA,IAAI;AAC3BQ,eAAe,CAACT,IAAI,GAAGA,IAAI;AAC3BS,eAAe,CAACkF,KAAK,GAAGnG,2BAA2B;AAEnD,SAASK,MAAM,IAAI+F,2BAA2B;AAC9C,eAAenF,eAAe","ignoreList":[]}
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 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,g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A,CAAAqF,aAAA,CAAChF,IAAI,EAAAwF,QAAA,KAAKlD,IAAI;IAAE2C,KAAK,EAAE3B,YAAa;IAACmC,MAAM,EAAEvE;EAAyB,IACnEgD,iBAAiB,EACjBC,aAAa,EACbC,gBAAgB,EAChBC,WACG,CACY,CACG,CAAC;AAE9B,CAAC;AAED,MAAMd,MAAM,GAAGxD,UAAU,CAAC2F,MAAM,CAAC;EAC/BzB,MAAM,EAAE;IACN0B,QAAQ,EAAE,UAAU;IACpB/B,IAAI,EAAE,CAAC;IACPE,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,CAACX,UAAU,GAAGA,UAAU;AACvCW,eAAe,CAACV,OAAO,GAAGA,OAAO;AACjCU,eAAe,CAACP,IAAI,GAAGA,IAAI;AAC3BO,eAAe,CAACR,IAAI,GAAGA,IAAI;AAC3BQ,eAAe,CAACT,IAAI,GAAGA,IAAI;AAC3BS,eAAe,CAACiF,KAAK,GAAGlG,2BAA2B;AAEnD,SAASK,MAAM,IAAI8F,2BAA2B;AAC9C,eAAelF,eAAe","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
2
  import React, { forwardRef } from "react";
3
- import { Platform, View } from "react-native";
3
+ import { Platform } from "react-native";
4
4
  import Reanimated, { useAnimatedProps, useSharedValue } from "react-native-reanimated";
5
5
  import { ClippingScrollView } from "../../bindings";
6
6
  import styles from "./styles";
@@ -65,16 +65,7 @@ const ScrollViewWithBottomPadding = /*#__PURE__*/forwardRef(({
65
65
  }, /*#__PURE__*/React.createElement(ScrollViewComponent, _extends({
66
66
  ref: ref,
67
67
  animatedProps: animatedProps
68
- }, rest), inverted ?
69
- /*#__PURE__*/
70
- // The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists
71
- // don't support this functionality, so we can add additional view here
72
- // The correct fix would be to add a new prop in ScrollView that allows
73
- // to customize children extraction logic and skip custom view
74
- React.createElement(View, {
75
- collapsable: false,
76
- nativeID: "container"
77
- }, children) : children));
68
+ }, rest), children));
78
69
  });
79
70
  export default ScrollViewWithBottomPadding;
80
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","forwardRef","Platform","View","Reanimated","useAnimatedProps","useSharedValue","ClippingScrollView","styles","OS","ReanimatedClippingScrollView","createAnimatedComponent","ScrollViewWithBottomPadding","ScrollViewComponent","bottomPadding","scrollIndicatorPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","applyWorkaroundForContentInsetHitTestBug","children","rest","ref","prevContentOffsetY","animatedProps","insetTop","value","insetBottom","bottom","top","indicatorPadding","indicatorTop","indicatorBottom","result","right","left","contentInsetBottom","contentInsetTop","curr","contentOffset","x","y","createElement","style","container","_extends","collapsable","nativeID"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { Platform, View } from \"react-native\";\nimport Reanimated, {\n useAnimatedProps,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Padding for scroll indicator insets (excludes blankSpace). Falls back to bottomPadding when not provided. */\n scrollIndicatorPadding?: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */\n contentOffsetY?: SharedValue<number>;\n applyWorkaroundForContentInsetHitTestBug?: boolean;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n scrollIndicatorPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n applyWorkaroundForContentInsetHitTestBug,\n children,\n ...rest\n },\n ref,\n ) => {\n const prevContentOffsetY = useSharedValue<number | null>(null);\n\n const animatedProps = useAnimatedProps(() => {\n const insetTop = inverted ? bottomPadding.value : 0;\n const insetBottom = !inverted ? bottomPadding.value : 0;\n const bottom = insetBottom + (contentInset?.bottom || 0);\n const top = insetTop + (contentInset?.top || 0);\n\n const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;\n const indicatorTop =\n (inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.top || 0);\n const indicatorBottom =\n (!inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.bottom || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: {\n bottom: bottom,\n top: top,\n right: contentInset?.right,\n left: contentInset?.left,\n },\n scrollIndicatorInsets: {\n bottom: indicatorBottom,\n top: indicatorTop,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: insetBottom,\n contentInsetTop: insetTop,\n };\n\n if (contentOffsetY) {\n const curr = contentOffsetY.value;\n\n if (curr !== prevContentOffsetY.value) {\n // eslint-disable-next-line react-compiler/react-compiler\n prevContentOffsetY.value = curr;\n result.contentOffset = { x: 0, y: curr };\n }\n }\n\n return result;\n }, [\n contentInset?.bottom,\n contentInset?.top,\n contentInset?.right,\n contentInset?.left,\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n style={styles.container}\n >\n <ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>\n {inverted ? (\n // The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists\n // don't support this functionality, so we can add additional view here\n // The correct fix would be to add a new prop in ScrollView that allows\n // to customize children extraction logic and skip custom view\n <View collapsable={false} nativeID=\"container\">\n {children}\n </View>\n ) : (\n children\n )}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,cAAc;AAC7C,OAAOC,UAAU,IACfC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAEhC,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,OAAOC,MAAM,MAAM,UAAU;AAK7B,MAAMC,EAAE,GAAGP,QAAQ,CAACO,EAAE;AACtB,MAAMC,4BAA4B,GAChCD,EAAE,KAAK,SAAS,GACZL,UAA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AEmB,IAAI,EAC3BlB,QAAQ,EACRC,cAAc,CACf,CAAC;EAEF,oBACEnB,KAAA,CAAA2C,aAAA,CAACjC,4BAA4B;IAC3Be,aAAa,EAAEA,aAAc;IAC7BL,wCAAwC,EACtCA,wCACD;IACDwB,KAAK,EAAEpC,MAAM,CAACqC;EAAU,gBAExB7C,KAAA,CAAA2C,aAAA,CAAC9B,mBAAmB,EAAAiC,QAAA;IAACvB,GAAG,EAAEA,GAAI;IAACE,aAAa,EAAEA;EAAc,GAAKH,IAAI,GAClEJ,QAAQ;EAAA;EACP;EACA;EACA;EACA;EACAlB,KAAA,CAAA2C,aAAA,CAACxC,IAAI;IAAC4C,WAAW,EAAE,KAAM;IAACC,QAAQ,EAAC;EAAW,GAC3C3B,QACG,CAAC,GAEPA,QAEiB,CACO,CAAC;AAEnC,CACF,CAAC;AAED,eAAeT,2BAA2B","ignoreList":[]}
1
+ {"version":3,"names":["React","forwardRef","Platform","Reanimated","useAnimatedProps","useSharedValue","ClippingScrollView","styles","OS","ReanimatedClippingScrollView","createAnimatedComponent","ScrollViewWithBottomPadding","ScrollViewComponent","bottomPadding","scrollIndicatorPadding","contentInset","scrollIndicatorInsets","inverted","contentOffsetY","applyWorkaroundForContentInsetHitTestBug","children","rest","ref","prevContentOffsetY","animatedProps","insetTop","value","insetBottom","bottom","top","indicatorPadding","indicatorTop","indicatorBottom","result","right","left","contentInsetBottom","contentInsetTop","curr","contentOffset","x","y","createElement","style","container","_extends"],"sources":["index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport { Platform } from \"react-native\";\nimport Reanimated, {\n useAnimatedProps,\n useSharedValue,\n} from \"react-native-reanimated\";\n\nimport { ClippingScrollView } from \"../../bindings\";\n\nimport styles from \"./styles\";\n\nimport type { ScrollViewProps } from \"react-native\";\nimport type { SharedValue } from \"react-native-reanimated\";\n\nconst OS = Platform.OS;\nconst ReanimatedClippingScrollView =\n OS === \"android\"\n ? Reanimated.createAnimatedComponent(ClippingScrollView)\n : ClippingScrollView;\n\ntype AnimatedScrollViewProps = React.ComponentProps<\n typeof Reanimated.ScrollView\n>;\n\nexport type AnimatedScrollViewComponent = React.ForwardRefExoticComponent<\n AnimatedScrollViewProps & React.RefAttributes<Reanimated.ScrollView>\n>;\n\ntype ScrollViewWithBottomPaddingProps = {\n ScrollViewComponent: AnimatedScrollViewComponent;\n children?: React.ReactNode;\n inverted?: boolean;\n bottomPadding: SharedValue<number>;\n /** Padding for scroll indicator insets (excludes blankSpace). Falls back to bottomPadding when not provided. */\n scrollIndicatorPadding?: SharedValue<number>;\n /** Absolute Y content offset (iOS only, for KeyboardChatScrollView). */\n contentOffsetY?: SharedValue<number>;\n applyWorkaroundForContentInsetHitTestBug?: boolean;\n} & ScrollViewProps;\n\nconst ScrollViewWithBottomPadding = forwardRef<\n Reanimated.ScrollView,\n ScrollViewWithBottomPaddingProps\n>(\n (\n {\n ScrollViewComponent,\n bottomPadding,\n scrollIndicatorPadding,\n contentInset,\n scrollIndicatorInsets,\n inverted,\n contentOffsetY,\n applyWorkaroundForContentInsetHitTestBug,\n children,\n ...rest\n },\n ref,\n ) => {\n const prevContentOffsetY = useSharedValue<number | null>(null);\n\n const animatedProps = useAnimatedProps(() => {\n const insetTop = inverted ? bottomPadding.value : 0;\n const insetBottom = !inverted ? bottomPadding.value : 0;\n const bottom = insetBottom + (contentInset?.bottom || 0);\n const top = insetTop + (contentInset?.top || 0);\n\n const indicatorPadding = scrollIndicatorPadding ?? bottomPadding;\n const indicatorTop =\n (inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.top || 0);\n const indicatorBottom =\n (!inverted ? indicatorPadding.value : 0) +\n (scrollIndicatorInsets?.bottom || 0);\n\n const result: Record<string, unknown> = {\n // iOS prop\n contentInset: {\n bottom: bottom,\n top: top,\n right: contentInset?.right,\n left: contentInset?.left,\n },\n scrollIndicatorInsets: {\n bottom: indicatorBottom,\n top: indicatorTop,\n right: scrollIndicatorInsets?.right,\n left: scrollIndicatorInsets?.left,\n },\n // Android prop\n contentInsetBottom: insetBottom,\n contentInsetTop: insetTop,\n };\n\n if (contentOffsetY) {\n const curr = contentOffsetY.value;\n\n if (curr !== prevContentOffsetY.value) {\n // eslint-disable-next-line react-compiler/react-compiler\n prevContentOffsetY.value = curr;\n result.contentOffset = { x: 0, y: curr };\n }\n }\n\n return result;\n }, [\n contentInset?.bottom,\n contentInset?.top,\n contentInset?.right,\n contentInset?.left,\n scrollIndicatorInsets?.bottom,\n scrollIndicatorInsets?.top,\n scrollIndicatorInsets?.right,\n scrollIndicatorInsets?.left,\n inverted,\n contentOffsetY,\n ]);\n\n return (\n <ReanimatedClippingScrollView\n animatedProps={animatedProps}\n applyWorkaroundForContentInsetHitTestBug={\n applyWorkaroundForContentInsetHitTestBug\n }\n style={styles.container}\n >\n <ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>\n {children}\n </ScrollViewComponent>\n </ReanimatedClippingScrollView>\n );\n },\n);\n\nexport default ScrollViewWithBottomPadding;\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,cAAc;AACvC,OAAOC,UAAU,IACfC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAEhC,SAASC,kBAAkB,QAAQ,gBAAgB;AAEnD,OAAOC,MAAM,MAAM,UAAU;AAK7B,MAAMC,EAAE,GAAGN,QAAQ,CAACM,EAAE;AACtB,MAAMC,4BAA4B,GAChCD,EAAE,KAAK,SAAS,GACZL,UAAU,CAACO,uBAAuB,CAACJ,kBAAkB,CAAC,GACtDA,kBAAkB;AAsBxB,MAAMK,2BAA2B,gBAAGV,UAAU,CAI5C,CACE;EACEW,mBAAmB;EACnBC,aAAa;EACbC,sBAAsB;EACtBC,YAAY;EACZC,qBAAqB;EACrBC,QAAQ;EACRC,cAAc;EACdC,wCAAwC;EACxCC,QAAQ;EACR,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,kBAAk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IAACE,aAAa,EAAEA;EAAc,GAAKH,IAAI,GAClED,QACkB,CACO,CAAC;AAEnC,CACF,CAAC;AAED,eAAeT,2BAA2B","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from "react";
2
2
  import { KeyboardEvents } from "../../bindings";
3
3
  import { KeyboardController } from "../../module";
4
- const EVENTS = ["keyboardDidShow", "keyboardDidHide"];
4
+ const EVENTS = ["keyboardWillShow", "keyboardDidHide"];
5
5
  const getLatestState = () => ({
6
6
  ...KeyboardController.state(),
7
7
  isVisible: KeyboardController.isVisible()
@@ -39,11 +39,6 @@ function useKeyboardState(selector = defaultSelector) {
39
39
  // state will be updated by global listener first,
40
40
  // so we simply read it and don't derive data from the event
41
41
  setState(selector(getLatestState()))));
42
- // update `appearance` prematurely
43
- const willShowSubscription = KeyboardEvents.addListener("keyboardWillShow", e => setState(selector({
44
- ...getLatestState(),
45
- appearance: e.appearance
46
- })));
47
42
 
48
43
  // we might have missed an update between reading a value in render and
49
44
  // `addListener` in this handler, so we set it here. If there was
@@ -51,7 +46,6 @@ function useKeyboardState(selector = defaultSelector) {
51
46
  setState(selector(getLatestState()));
52
47
  return () => {
53
48
  subscriptions.forEach(subscription => subscription.remove());
54
- willShowSubscription.remove();
55
49
  };
56
50
  }, []);
57
51
  return state;
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useState","KeyboardEvents","KeyboardController","EVENTS","getLatestState","state","isVisible","defaultSelector","useKeyboardState","selector","setState","subscriptions","map","event","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 { IKeyboardState } 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: IKeyboardState) => T;\n\nconst defaultSelector: KeyboardStateSelector<IKeyboardState> = (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 = IKeyboardState>(\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,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,kBAAkB,QAAQ,cAAc;AAIjD,M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f,KAAK;AACd;AAEA,SAASG,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useState","KeyboardEvents","KeyboardController","EVENTS","getLatestState","state","isVisible","defaultSelector","useKeyboardState","selector","setState","subscriptions","map","event","addListener","forEach","subscription","remove"],"sources":["index.ts"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nimport { KeyboardEvents } from \"../../bindings\";\nimport { KeyboardController } from \"../../module\";\n\nimport type { IKeyboardState } from \"../../types\";\n\nconst EVENTS = [\"keyboardWillShow\", \"keyboardDidHide\"] as const;\n\nconst getLatestState = () => ({\n ...KeyboardController.state(),\n isVisible: KeyboardController.isVisible(),\n});\n\ntype KeyboardStateSelector<T> = (state: IKeyboardState) => T;\n\nconst defaultSelector: KeyboardStateSelector<IKeyboardState> = (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 = IKeyboardState>(\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\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 };\n }, []);\n\n return state;\n}\n\nexport { useKeyboardState };\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAE3C,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,kBAAkB,QAAQ,cAAc;AAIjD,MAAMC,MAAM,GAAG,CAAC,kBAAkB,EAAE,iBAAiB,CAAU;AAE/D,MAAMC,cAAc,GAAGA,CAAA,MAAO;EAC5B,GAAGF,kBAAkB,CAACG,KAAK,CAAC,CAAC;EAC7BC,SAAS,EAAEJ,kBAAkB,CAACI,SAAS,CAAC;AAC1C,CAAC,CAAC;AAIF,MAAMC,eAAsD,GAAIF,KAAK,IAAKA,KAAK;;AAE/E;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,GAAGV,QAAQ,CAAI,MAAMS,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC;EAEvEL,SAAS,CAAC,MAAM;IACd,MAAMY,aAAa,GAAGR,MAAM,CAACS,GAAG,CAAEC,KAAK,IACrCZ,cAAc,CAACa,WAAW,CAACD,KAAK,EAAE;IAChC;IACA;IACAH,QAAQ,CAACD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CACrC,CACF,CAAC;;IAED;IACA;IACA;IACAM,QAAQ,CAACD,QAAQ,CAACL,cAAc,CAAC,CAAC,CAAC,CAAC;IAEpC,OAAO,MAAM;MACXO,aAAa,CAACI,OAAO,CAAEC,YAAY,IAAKA,YAAY,CAACC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOZ,KAAK;AACd;AAEA,SAASG,gBAAgB","ignoreList":[]}
@@ -12,7 +12,7 @@ KeyboardEvents.addListener("keyboardDidHide", e => {
12
12
  isClosed = true;
13
13
  lastState = e;
14
14
  });
15
- KeyboardEvents.addListener("keyboardDidShow", e => {
15
+ KeyboardEvents.addListener("keyboardWillShow", e => {
16
16
  isClosed = false;
17
17
  lastState = e;
18
18
  });
@@ -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(\"keyboardDidShow\", (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 isVisible,\n state,\n};\n"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,cAAc,QAAQ,YAAY;AAQrE,IAAIC,QAAQ,GAAG,IAAI;AACnB,IAAIC,SAA4B,GAAG;EACjCC,MAAM,EAAE,CAAC;EACTC,QAAQ,EAAE,CAAC;EACXC,SAAS,EAAE,IAAIC,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CAAC;EAC/BC,MAAM,EAAE,CAAC,CAAC;EACVC,IAAI,EAAE,SAAS;EACfC,UAAU,EAAE;AACd,CAAC;AAEDV,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,IAAI;EACfC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEFZ,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAGC,CAAC,IAAK;EACnDX,QAAQ,GAAG,KAAK;EAChBC,SAAS,GAAGU,CAAC;AACf,CAAC,CAAC;AAEF,MAAMC,OAAO,GAAG,MAAOC,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;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"],"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 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;EACzCf,OAAO;EACPS,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
@@ -5,7 +5,7 @@ declare const KeyboardChatScrollView: React.ForwardRefExoticComponent<{
5
5
  inverted?: boolean;
6
6
  offset?: number;
7
7
  keyboardLiftBehavior?: import("./hooks").KeyboardLiftBehavior;
8
- freeze?: boolean;
8
+ freeze?: boolean | import("react-native-reanimated").SharedValue<boolean>;
9
9
  extraContentPadding?: import("react-native-reanimated").SharedValue<number>;
10
10
  applyWorkaroundForContentInsetHitTestBug?: boolean;
11
11
  blankSpace?: import("react-native-reanimated").SharedValue<number>;
@@ -45,7 +45,7 @@ export type KeyboardChatScrollViewProps = {
45
45
  *
46
46
  * Default is `false`.
47
47
  */
48
- freeze?: boolean;
48
+ freeze?: boolean | SharedValue<boolean>;
49
49
  /**
50
50
  * A shared value representing additional padding from external elements
51
51
  * (e.g., a growing multiline `TextInput` in a `KeyboardStickyView`).
@@ -4,7 +4,7 @@ type KeyboardLiftBehavior = "always" | "whenAtEnd" | "persistent" | "never";
4
4
  type UseChatKeyboardOptions = {
5
5
  inverted: boolean;
6
6
  keyboardLiftBehavior: KeyboardLiftBehavior;
7
- freeze: boolean;
7
+ freeze: SharedValue<boolean>;
8
8
  offset: number;
9
9
  blankSpace: SharedValue<number>;
10
10
  /** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
@@ -24,7 +24,7 @@ type UseExtraContentPaddingOptions = {
24
24
  contentOffsetY?: SharedValue<number>;
25
25
  inverted: boolean;
26
26
  keyboardLiftBehavior: KeyboardLiftBehavior;
27
- freeze: boolean;
27
+ freeze: SharedValue<boolean>;
28
28
  };
29
29
  /**
30
30
  * Hook that reacts to `extraContentPadding` changes and conditionally
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keyboard-controller",
3
- "version": "1.21.5",
3
+ "version": "1.21.6",
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",
@@ -43,6 +43,9 @@ const KeyboardChatScrollView = forwardRef<
43
43
  ) => {
44
44
  const scrollViewRef = useAnimatedRef<Reanimated.ScrollView>();
45
45
  const onRef = useCombinedRef(ref, scrollViewRef);
46
+ const freezeSV = useDerivedValue(() =>
47
+ typeof freeze === "boolean" ? freeze : freeze.value,
48
+ );
46
49
  const {
47
50
  padding,
48
51
  currentHeight,
@@ -55,7 +58,7 @@ const KeyboardChatScrollView = forwardRef<
55
58
  } = useChatKeyboard(scrollViewRef, {
56
59
  inverted,
57
60
  keyboardLiftBehavior,
58
- freeze,
61
+ freeze: freezeSV,
59
62
  offset,
60
63
  blankSpace,
61
64
  extraContentPadding,
@@ -72,7 +75,7 @@ const KeyboardChatScrollView = forwardRef<
72
75
  contentOffsetY,
73
76
  inverted,
74
77
  keyboardLiftBehavior,
75
- freeze,
78
+ freeze: freezeSV,
76
79
  });
77
80
 
78
81
  const totalPadding = useDerivedValue(() =>
@@ -46,7 +46,7 @@ export type KeyboardChatScrollViewProps = {
46
46
  *
47
47
  * Default is `false`.
48
48
  */
49
- freeze?: boolean;
49
+ freeze?: boolean | SharedValue<boolean>;
50
50
  /**
51
51
  * A shared value representing additional padding from external elements
52
52
  * (e.g., a growing multiline `TextInput` in a `KeyboardStickyView`).
@@ -64,7 +64,7 @@ function useChatKeyboard(
64
64
  onStart: (e) => {
65
65
  "worklet";
66
66
 
67
- if (freeze) {
67
+ if (freeze.value) {
68
68
  return;
69
69
  }
70
70
 
@@ -229,7 +229,7 @@ function useChatKeyboard(
229
229
  onEnd: (e) => {
230
230
  "worklet";
231
231
 
232
- if (freeze) {
232
+ if (freeze.value) {
233
233
  return;
234
234
  }
235
235
 
@@ -242,7 +242,7 @@ function useChatKeyboard(
242
242
  padding.value = effective;
243
243
  },
244
244
  },
245
- [inverted, keyboardLiftBehavior, freeze, offset, extraContentPadding],
245
+ [inverted, keyboardLiftBehavior, offset, extraContentPadding],
246
246
  );
247
247
 
248
248
  return {
@@ -82,7 +82,7 @@ function useChatKeyboard(
82
82
  onStart: (e) => {
83
83
  "worklet";
84
84
 
85
- if (freeze) {
85
+ if (freeze.value) {
86
86
  return;
87
87
  }
88
88
 
@@ -166,7 +166,7 @@ function useChatKeyboard(
166
166
  onMove: (e) => {
167
167
  "worklet";
168
168
 
169
- if (freeze) {
169
+ if (freeze.value) {
170
170
  return;
171
171
  }
172
172
 
@@ -340,7 +340,7 @@ function useChatKeyboard(
340
340
  onEnd: (e) => {
341
341
  "worklet";
342
342
 
343
- if (freeze) {
343
+ if (freeze.value) {
344
344
  return;
345
345
  }
346
346
 
@@ -358,7 +358,7 @@ function useChatKeyboard(
358
358
  }
359
359
  },
360
360
  },
361
- [inverted, keyboardLiftBehavior, freeze, offset],
361
+ [inverted, keyboardLiftBehavior, offset],
362
362
  );
363
363
 
364
364
  return {
@@ -6,7 +6,7 @@ type KeyboardLiftBehavior = "always" | "whenAtEnd" | "persistent" | "never";
6
6
  type UseChatKeyboardOptions = {
7
7
  inverted: boolean;
8
8
  keyboardLiftBehavior: KeyboardLiftBehavior;
9
- freeze: boolean;
9
+ freeze: SharedValue<boolean>;
10
10
  offset: number;
11
11
  blankSpace: SharedValue<number>;
12
12
  /** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */
@@ -26,7 +26,7 @@ type UseExtraContentPaddingOptions = {
26
26
  contentOffsetY?: SharedValue<number>;
27
27
  inverted: boolean;
28
28
  keyboardLiftBehavior: KeyboardLiftBehavior;
29
- freeze: boolean;
29
+ freeze: SharedValue<boolean>;
30
30
  };
31
31
 
32
32
  /**
@@ -81,7 +81,7 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
81
81
  useAnimatedReaction(
82
82
  () => extraContentPadding.value,
83
83
  (current, previous) => {
84
- if (freeze || previous === null) {
84
+ if (freeze.value || previous === null) {
85
85
  return;
86
86
  }
87
87
 
@@ -141,7 +141,7 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {
141
141
  scrollToTarget(target);
142
142
  }
143
143
  },
144
- [inverted, keyboardLiftBehavior, freeze],
144
+ [inverted, keyboardLiftBehavior],
145
145
  );
146
146
  }
147
147
 
@@ -99,11 +99,13 @@ const KeyboardToolbar: React.FC<KeyboardToolbarProps> & {
99
99
  );
100
100
  const containerStyle = useMemo(
101
101
  () => [
102
+ // CRUCIAL: gives the native view real bounds
103
+ styles.sticky,
102
104
  KEYBOARD_HAS_ROUNDED_CORNERS
103
- ? {
104
- marginLeft: (insets?.left ?? 0) + 16,
105
- marginRight: (insets?.right ?? 0) + 16,
106
- }
105
+ ? ({
106
+ left: (insets?.left ?? 0) + 16,
107
+ right: (insets?.right ?? 0) + 16,
108
+ } as const)
107
109
  : null,
108
110
  ],
109
111
  [insets],
@@ -207,6 +209,13 @@ const KeyboardToolbar: React.FC<KeyboardToolbarProps> & {
207
209
  };
208
210
 
209
211
  const styles = StyleSheet.create({
212
+ sticky: {
213
+ position: "absolute",
214
+ left: 0,
215
+ right: 0,
216
+ bottom: 0,
217
+ height: KEYBOARD_TOOLBAR_HEIGHT,
218
+ },
210
219
  toolbar: {
211
220
  position: "absolute",
212
221
  bottom: 0,
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef } from "react";
2
- import { Platform, View } from "react-native";
2
+ import { Platform } from "react-native";
3
3
  import Reanimated, {
4
4
  useAnimatedProps,
5
5
  useSharedValue,
@@ -125,17 +125,7 @@ const ScrollViewWithBottomPadding = forwardRef<
125
125
  style={styles.container}
126
126
  >
127
127
  <ScrollViewComponent ref={ref} animatedProps={animatedProps} {...rest}>
128
- {inverted ? (
129
- // The only thing it can break is `StickyHeader`, but it's already broken in FlatList and other lists
130
- // don't support this functionality, so we can add additional view here
131
- // The correct fix would be to add a new prop in ScrollView that allows
132
- // to customize children extraction logic and skip custom view
133
- <View collapsable={false} nativeID="container">
134
- {children}
135
- </View>
136
- ) : (
137
- children
138
- )}
128
+ {children}
139
129
  </ScrollViewComponent>
140
130
  </ReanimatedClippingScrollView>
141
131
  );
@@ -5,7 +5,7 @@ import { KeyboardController } from "../../module";
5
5
 
6
6
  import type { IKeyboardState } from "../../types";
7
7
 
8
- const EVENTS = ["keyboardDidShow", "keyboardDidHide"] as const;
8
+ const EVENTS = ["keyboardWillShow", "keyboardDidHide"] as const;
9
9
 
10
10
  const getLatestState = () => ({
11
11
  ...KeyboardController.state(),
@@ -53,12 +53,6 @@ function useKeyboardState<T = IKeyboardState>(
53
53
  setState(selector(getLatestState())),
54
54
  ),
55
55
  );
56
- // update `appearance` prematurely
57
- const willShowSubscription = KeyboardEvents.addListener(
58
- "keyboardWillShow",
59
- (e) =>
60
- setState(selector({ ...getLatestState(), appearance: e.appearance })),
61
- );
62
56
 
63
57
  // we might have missed an update between reading a value in render and
64
58
  // `addListener` in this handler, so we set it here. If there was
@@ -67,7 +61,6 @@ function useKeyboardState<T = IKeyboardState>(
67
61
 
68
62
  return () => {
69
63
  subscriptions.forEach((subscription) => subscription.remove());
70
- willShowSubscription.remove();
71
64
  };
72
65
  }, []);
73
66
 
package/src/module.ts CHANGED
@@ -21,7 +21,7 @@ KeyboardEvents.addListener("keyboardDidHide", (e) => {
21
21
  lastState = e;
22
22
  });
23
23
 
24
- KeyboardEvents.addListener("keyboardDidShow", (e) => {
24
+ KeyboardEvents.addListener("keyboardWillShow", (e) => {
25
25
  isClosed = false;
26
26
  lastState = e;
27
27
  });