react-native-keyboard-controller 1.17.0 → 1.17.2
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.
- package/README.md +24 -23
- package/android/src/main/java/com/reactnativekeyboardcontroller/views/overlay/OverKeyboardViewGroup.kt +49 -15
- package/ios/delegates/KCTextInputCompositeDelegate.swift +16 -1
- package/ios/observers/FocusedInputObserver.swift +3 -1
- package/lib/commonjs/animated.js +23 -7
- package/lib/commonjs/animated.js.map +1 -1
- package/lib/commonjs/bindings.js +19 -0
- package/lib/commonjs/bindings.js.map +1 -1
- package/lib/commonjs/components/KeyboardAvoidingView/index.js +11 -2
- package/lib/commonjs/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js +54 -39
- package/lib/commonjs/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +17 -1
- package/lib/commonjs/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/commonjs/components/KeyboardStickyView/index.js +13 -0
- package/lib/commonjs/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/commonjs/components/KeyboardToolbar/index.js +31 -22
- package/lib/commonjs/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/commonjs/context.js +16 -0
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/hooks/index.js +164 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useKeyboardState/index.js +21 -0
- package/lib/commonjs/hooks/useKeyboardState/index.js.map +1 -1
- package/lib/commonjs/internal.js +23 -1
- package/lib/commonjs/internal.js.map +1 -1
- package/lib/commonjs/module.js +4 -0
- package/lib/commonjs/module.js.map +1 -1
- package/lib/commonjs/monkey-patch.android.js +0 -5
- package/lib/commonjs/monkey-patch.android.js.map +1 -1
- package/lib/commonjs/{types.js → types/hooks.js} +1 -1
- package/lib/commonjs/types/hooks.js.map +1 -0
- package/lib/commonjs/types/index.js +50 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/types/internal.js +6 -0
- package/lib/commonjs/types/internal.js.map +1 -0
- package/lib/commonjs/types/module.js +6 -0
- package/lib/commonjs/types/module.js.map +1 -0
- package/lib/commonjs/types/views.js +6 -0
- package/lib/commonjs/types/views.js.map +1 -0
- package/lib/commonjs/utils/findNodeHandle/index.js +9 -0
- package/lib/commonjs/utils/findNodeHandle/index.js.map +1 -0
- package/lib/commonjs/utils/findNodeHandle/index.native.js +13 -0
- package/lib/commonjs/utils/findNodeHandle/index.native.js.map +1 -0
- package/lib/commonjs/views/OverKeyboardView/index.js +18 -4
- package/lib/commonjs/views/OverKeyboardView/index.js.map +1 -1
- package/lib/module/animated.js +23 -7
- package/lib/module/animated.js.map +1 -1
- package/lib/module/bindings.js +19 -0
- package/lib/module/bindings.js.map +1 -1
- package/lib/module/components/KeyboardAvoidingView/index.js +11 -2
- package/lib/module/components/KeyboardAvoidingView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/index.js +53 -38
- package/lib/module/components/KeyboardAwareScrollView/index.js.map +1 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js +17 -1
- package/lib/module/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.js.map +1 -1
- package/lib/module/components/KeyboardStickyView/index.js +13 -0
- package/lib/module/components/KeyboardStickyView/index.js.map +1 -1
- package/lib/module/components/KeyboardToolbar/index.js +31 -22
- package/lib/module/components/KeyboardToolbar/index.js.map +1 -1
- package/lib/module/context.js +16 -0
- package/lib/module/context.js.map +1 -1
- package/lib/module/hooks/index.js +164 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useKeyboardState/index.js +21 -0
- package/lib/module/hooks/useKeyboardState/index.js.map +1 -1
- package/lib/module/internal.js +23 -1
- package/lib/module/internal.js.map +1 -1
- package/lib/module/module.js +4 -0
- package/lib/module/module.js.map +1 -1
- package/lib/module/monkey-patch.android.js +0 -5
- package/lib/module/monkey-patch.android.js.map +1 -1
- package/lib/module/types/hooks.js +2 -0
- package/lib/module/types/hooks.js.map +1 -0
- package/lib/module/types/index.js +5 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/types/internal.js +2 -0
- package/lib/module/types/internal.js.map +1 -0
- package/lib/module/types/module.js +2 -0
- package/lib/module/types/module.js.map +1 -0
- package/lib/module/types/views.js +2 -0
- package/lib/module/types/views.js.map +1 -0
- package/lib/module/utils/findNodeHandle/index.js +2 -0
- package/lib/module/utils/findNodeHandle/index.js.map +1 -0
- package/lib/module/utils/findNodeHandle/index.native.js +3 -0
- package/lib/module/utils/findNodeHandle/index.native.js.map +1 -0
- package/lib/module/views/OverKeyboardView/index.js +18 -4
- package/lib/module/views/OverKeyboardView/index.js.map +1 -1
- package/lib/typescript/animated.d.ts +20 -6
- package/lib/typescript/bindings.d.ts +19 -0
- package/lib/typescript/components/KeyboardAvoidingView/index.d.ts +11 -2
- package/lib/typescript/components/KeyboardAwareScrollView/index.d.ts +23 -6
- package/lib/typescript/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.d.ts +17 -1
- package/lib/typescript/components/KeyboardStickyView/index.d.ts +15 -2
- package/lib/typescript/components/KeyboardToolbar/index.d.ts +13 -2
- package/lib/typescript/context.d.ts +32 -0
- package/lib/typescript/hooks/index.d.ts +157 -0
- package/lib/typescript/hooks/useKeyboardState/index.d.ts +20 -0
- package/lib/typescript/internal.d.ts +23 -1
- package/lib/typescript/module.d.ts +3 -0
- package/lib/typescript/{types.d.ts → types/hooks.d.ts} +72 -78
- package/lib/typescript/types/index.d.ts +4 -0
- package/lib/typescript/types/internal.d.ts +17 -0
- package/lib/typescript/types/module.d.ts +91 -0
- package/lib/typescript/types/views.d.ts +45 -0
- package/lib/typescript/utils/findNodeHandle/index.d.ts +4 -0
- package/lib/typescript/utils/findNodeHandle/index.native.d.ts +2 -0
- package/lib/typescript/views/OverKeyboardView/index.d.ts +14 -1
- package/package.json +2 -1
- package/src/animated.tsx +27 -12
- package/src/bindings.ts +19 -0
- package/src/components/KeyboardAvoidingView/index.tsx +11 -2
- package/src/components/KeyboardAwareScrollView/index.tsx +56 -41
- package/src/components/KeyboardAwareScrollView/useSmoothKeyboardHandler.ts +17 -1
- package/src/components/KeyboardStickyView/index.tsx +14 -1
- package/src/components/KeyboardToolbar/index.tsx +31 -19
- package/src/context.ts +33 -0
- package/src/hooks/index.ts +157 -0
- package/src/hooks/useKeyboardState/index.ts +20 -0
- package/src/internal.ts +23 -1
- package/src/module.ts +3 -0
- package/src/monkey-patch.android.ts +3 -6
- package/src/{types.ts → types/hooks.ts} +72 -105
- package/src/types/index.ts +4 -0
- package/src/types/internal.ts +24 -0
- package/src/types/module.ts +105 -0
- package/src/types/views.ts +46 -0
- package/src/utils/findNodeHandle/index.native.ts +3 -0
- package/src/utils/findNodeHandle/index.ts +6 -0
- package/src/views/OverKeyboardView/index.tsx +15 -4
- package/lib/commonjs/types.js.map +0 -1
- package/lib/module/types.js +0 -2
- package/lib/module/types.js.map +0 -1
package/lib/module/module.js
CHANGED
|
@@ -32,6 +32,10 @@ const dismiss = async options => {
|
|
|
32
32
|
};
|
|
33
33
|
const isVisible = () => !isClosed;
|
|
34
34
|
const state = () => lastState;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* KeyboardController module. Helps to perform imperative actions/checks with keyboard.
|
|
38
|
+
*/
|
|
35
39
|
export const KeyboardController = {
|
|
36
40
|
setDefaultMode: KeyboardControllerNative.setDefaultMode,
|
|
37
41
|
setInputMode: KeyboardControllerNative.setInputMode,
|
package/lib/module/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["KeyboardControllerNative","KeyboardEvents","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","addListener","e","dismiss","options","keepFocus","Promise","resolve","subscription","undefined","remove","isVisible","state","KeyboardController","setDefaultMode","setInputMode","setFocusTo"],"sources":["module.ts"],"sourcesContent":["import { KeyboardControllerNative, KeyboardEvents } from \"./bindings\";\n\nimport type {\n DismissOptions,\n KeyboardControllerModule,\n KeyboardEventData,\n} from \"./types\";\n\nlet isClosed = true;\nlet lastState: KeyboardEventData = {\n height: 0,\n duration: 0,\n timestamp: new Date().getTime(),\n target: -1,\n type: \"default\",\n appearance: \"default\",\n};\n\nKeyboardEvents.addListener(\"keyboardDidHide\", (e) => {\n isClosed = true;\n lastState = e;\n});\n\nKeyboardEvents.addListener(\"keyboardDidShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: DismissOptions): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n\n return new Promise((resolve) => {\n if (isClosed) {\n resolve();\n\n return;\n }\n\n const subscription = KeyboardEvents.addListener(\"keyboardDidHide\", () => {\n resolve(undefined);\n subscription.remove();\n });\n\n KeyboardControllerNative.dismiss(keepFocus);\n });\n};\nconst isVisible = () => !isClosed;\nconst state = () => lastState;\n\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: KeyboardControllerNative.setDefaultMode,\n setInputMode: KeyboardControllerNative.setInputMode,\n setFocusTo: KeyboardControllerNative.setFocusTo,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":"AAAA,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,OAAwB,IAAoB;EACjE,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAE7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIhB,QAAQ,EAAE;MACZgB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGlB,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEM,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFrB,wBAAwB,CAACc,OAAO,CAACE,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC;AACD,MAAMM,SAAS,GAAGA,CAAA,KAAM,CAACpB,QAAQ;AACjC,MAAMqB,KAAK,GAAGA,CAAA,KAAMpB,SAAS;
|
|
1
|
+
{"version":3,"names":["KeyboardControllerNative","KeyboardEvents","isClosed","lastState","height","duration","timestamp","Date","getTime","target","type","appearance","addListener","e","dismiss","options","keepFocus","Promise","resolve","subscription","undefined","remove","isVisible","state","KeyboardController","setDefaultMode","setInputMode","setFocusTo"],"sources":["module.ts"],"sourcesContent":["import { KeyboardControllerNative, KeyboardEvents } from \"./bindings\";\n\nimport type {\n DismissOptions,\n KeyboardControllerModule,\n KeyboardEventData,\n} from \"./types\";\n\nlet isClosed = true;\nlet lastState: KeyboardEventData = {\n height: 0,\n duration: 0,\n timestamp: new Date().getTime(),\n target: -1,\n type: \"default\",\n appearance: \"default\",\n};\n\nKeyboardEvents.addListener(\"keyboardDidHide\", (e) => {\n isClosed = true;\n lastState = e;\n});\n\nKeyboardEvents.addListener(\"keyboardDidShow\", (e) => {\n isClosed = false;\n lastState = e;\n});\n\nconst dismiss = async (options?: DismissOptions): Promise<void> => {\n const keepFocus = options?.keepFocus ?? false;\n\n return new Promise((resolve) => {\n if (isClosed) {\n resolve();\n\n return;\n }\n\n const subscription = KeyboardEvents.addListener(\"keyboardDidHide\", () => {\n resolve(undefined);\n subscription.remove();\n });\n\n KeyboardControllerNative.dismiss(keepFocus);\n });\n};\nconst isVisible = () => !isClosed;\nconst state = () => lastState;\n\n/**\n * KeyboardController module. Helps to perform imperative actions/checks with keyboard.\n */\nexport const KeyboardController: KeyboardControllerModule = {\n setDefaultMode: KeyboardControllerNative.setDefaultMode,\n setInputMode: KeyboardControllerNative.setInputMode,\n setFocusTo: KeyboardControllerNative.setFocusTo,\n dismiss,\n isVisible,\n state,\n};\n"],"mappings":"AAAA,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,OAAwB,IAAoB;EACjE,MAAMC,SAAS,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,SAAS,KAAI,KAAK;EAE7C,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK;IAC9B,IAAIhB,QAAQ,EAAE;MACZgB,OAAO,CAAC,CAAC;MAET;IACF;IAEA,MAAMC,YAAY,GAAGlB,cAAc,CAACW,WAAW,CAAC,iBAAiB,EAAE,MAAM;MACvEM,OAAO,CAACE,SAAS,CAAC;MAClBD,YAAY,CAACE,MAAM,CAAC,CAAC;IACvB,CAAC,CAAC;IAEFrB,wBAAwB,CAACc,OAAO,CAACE,SAAS,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC;AACD,MAAMM,SAAS,GAAGA,CAAA,KAAM,CAACpB,QAAQ;AACjC,MAAMqB,KAAK,GAAGA,CAAA,KAAMpB,SAAS;;AAE7B;AACA;AACA;AACA,OAAO,MAAMqB,kBAA4C,GAAG;EAC1DC,cAAc,EAAEzB,wBAAwB,CAACyB,cAAc;EACvDC,YAAY,EAAE1B,wBAAwB,CAAC0B,YAAY;EACnDC,UAAU,EAAE3B,wBAAwB,CAAC2B,UAAU;EAC/Cb,OAAO;EACPQ,SAAS;EACTC;AACF,CAAC","ignoreList":[]}
|
|
@@ -22,11 +22,6 @@ const ModifiedNativeAndroidManager = {
|
|
|
22
22
|
setTranslucent: translucent => {
|
|
23
23
|
RCTStatusBarManagerCompat.setTranslucent(translucent);
|
|
24
24
|
},
|
|
25
|
-
/**
|
|
26
|
-
* - statusBarStyles can be:
|
|
27
|
-
* - 'default'
|
|
28
|
-
* - 'dark-content'
|
|
29
|
-
*/
|
|
30
25
|
setStyle: statusBarStyle => {
|
|
31
26
|
RCTStatusBarManagerCompat.setStyle(statusBarStyle);
|
|
32
27
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAndroidManager","RCTStatusBarManagerCompat","require","default","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","Object","assign","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\n\nconst RCTStatusBarManagerCompat =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"./specs/NativeStatusBarManagerCompat\").default;\n\n// Copy original default manager to keep its original state and methods\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\n\n// Create a new object that modifies the necessary methods\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nconst ModifiedNativeAndroidManager = {\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\n setColor: (color: number, animated: boolean): void => {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n setTranslucent: (translucent: boolean): void => {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n
|
|
1
|
+
{"version":3,"names":["NativeAndroidManager","RCTStatusBarManagerCompat","require","default","OriginalNativeAndroidManager","ModifiedNativeAndroidManager","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden","applyMonkeyPatch","Object","assign","revertMonkeyPatch"],"sources":["monkey-patch.android.ts"],"sourcesContent":["// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from \"react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid\";\n\nconst RCTStatusBarManagerCompat =\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require(\"./specs/NativeStatusBarManagerCompat\").default;\n\n// Copy original default manager to keep its original state and methods\nconst OriginalNativeAndroidManager = { ...NativeAndroidManager.default };\n\n// Create a new object that modifies the necessary methods\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nconst ModifiedNativeAndroidManager = {\n ...NativeAndroidManager.default, // Spread original properties to keep existing functionality\n setColor: (color: number, animated: boolean): void => {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n setTranslucent: (translucent: boolean): void => {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n setStyle: (\n statusBarStyle?: \"default\" | \"dark-content\" | \"light-content\",\n ): void => {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n setHidden: (hidden: boolean): void => {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n};\n\n// Define a function to apply the monkey patch\nexport const applyMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, ModifiedNativeAndroidManager);\n};\n\n// Define a function to revert changes back to the original state\nexport const revertMonkeyPatch = () => {\n Object.assign(NativeAndroidManager.default, OriginalNativeAndroidManager);\n};\n"],"mappings":"AAAA;AACA,OAAO,KAAKA,oBAAoB,MAAM,2EAA2E;AAEjH,MAAMC,yBAAyB;AAC7B;AACAC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;;AAEzD;AACA,MAAMC,4BAA4B,GAAG;EAAE,GAAGJ,oBAAoB,CAACG;AAAQ,CAAC;;AAExE;AACA;AACA;AACA;AACA,MAAME,4BAA4B,GAAG;EACnC,GAAGL,oBAAoB,CAACG,OAAO;EAAE;EACjCG,QAAQ,EAAEA,CAACC,KAAa,EAAEC,QAAiB,KAAW;IACpDP,yBAAyB,CAACK,QAAQ,CAACC,KAAK,EAAEC,QAAQ,CAAC;EACrD,CAAC;EACDC,cAAc,EAAGC,WAAoB,IAAW;IAC9CT,yBAAyB,CAACQ,cAAc,CAACC,WAAW,CAAC;EACvD,CAAC;EACDC,QAAQ,EACNC,cAA6D,IACpD;IACTX,yBAAyB,CAACU,QAAQ,CAACC,cAAc,CAAC;EACpD,CAAC;EACDC,SAAS,EAAGC,MAAe,IAAW;IACpCb,yBAAyB,CAACY,SAAS,CAACC,MAAM,CAAC;EAC7C;AACF,CAAC;;AAED;AACA,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;EACpCC,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEE,4BAA4B,CAAC;AAC3E,CAAC;;AAED;AACA,OAAO,MAAMa,iBAAiB,GAAGA,CAAA,KAAM;EACrCF,MAAM,CAACC,MAAM,CAACjB,oBAAoB,CAACG,OAAO,EAAEC,4BAA4B,CAAC;AAC3E,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["hooks.ts"],"sourcesContent":["import type { NativeSyntheticEvent, ViewProps } from \"react-native\";\n\n// DirectEventHandler events declaration\nexport type NativeEvent = {\n /** A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible. */\n progress: number;\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n};\nexport type FocusedInputLayoutChangedEvent = {\n /** Tag of the focused `TextInput`. */\n target: number;\n /** Tag of the parent `ScrollView`. */\n parentScrollViewTarget: number;\n layout: {\n /** X coordinate of the focused `TextInput`. */\n x: number;\n /** Y coordinate of the focused `TextInput`. */\n y: number;\n /** Width of the focused `TextInput`. */\n width: number;\n /** Height of the focused `TextInput`. */\n height: number;\n /** X coordinate of the focused `TextInput` relative to the screen. */\n absoluteX: number;\n /** Y coordinate of the focused `TextInput` relative to the screen. */\n absoluteY: number;\n };\n};\nexport type FocusedInputTextChangedEvent = {\n /** Text that user typed in the focused `TextInput`. */\n text: string;\n};\nexport type FocusedInputSelectionChangedEvent = {\n /** Tag of the focused `TextInput`. */\n target: number;\n selection: {\n /** Start of the selection. Represents top-left point of rectangle. */\n start: {\n /** X coordinate of the selection start (relative to the `TextInput`). */\n x: number;\n /** Y coordinate of the selection start (relative to the `TextInput`). */\n y: number;\n /** The start of selection. */\n position: number;\n };\n /** End of the selection. Represents bottom-right point of rectangle. */\n end: {\n /** X coordinate of the selection end (relative to the `TextInput`). */\n x: number;\n /** Y coordinate of the selection end (relative to the `TextInput`). */\n y: number;\n /** The end of selection. */\n position: number;\n };\n };\n};\nexport type EventWithName<T> = {\n eventName: string;\n} & T;\n\n// native View/Module declarations\nexport type KeyboardControllerProps = {\n //ref prop\n ref?: React.Ref<React.Component<KeyboardControllerProps>>;\n // callback props\n onKeyboardMoveStart?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onKeyboardMove?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onKeyboardMoveEnd?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onKeyboardMoveInteractive?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onFocusedInputLayoutChanged?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,\n ) => void;\n onFocusedInputTextChanged?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,\n ) => void;\n onFocusedInputSelectionChanged?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,\n ) => void;\n // fake props used to activate reanimated bindings\n onKeyboardMoveReanimated?: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>,\n ) => void;\n onFocusedInputLayoutChangedReanimated?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputLayoutChangedEvent>>,\n ) => void;\n onFocusedInputTextChangedReanimated?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputTextChangedEvent>>,\n ) => void;\n onFocusedInputSelectionChangedReanimated?: (\n e: NativeSyntheticEvent<EventWithName<FocusedInputSelectionChangedEvent>>,\n ) => void;\n // props\n statusBarTranslucent?: boolean;\n navigationBarTranslucent?: boolean;\n preserveEdgeToEdge?: boolean;\n enabled?: boolean;\n} & ViewProps;\n\n// reanimated hook declaration\nexport type KeyboardHandlerHook<TContext, Event> = (\n handlers: {\n onKeyboardMoveStart?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMove?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMoveEnd?: (e: NativeEvent, context: TContext) => void;\n onKeyboardMoveInteractive?: (e: NativeEvent, context: TContext) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\nexport type FocusedInputLayoutHandlerHook<TContext, Event> = (\n handlers: {\n onFocusedInputLayoutChanged?: (\n e: FocusedInputLayoutChangedEvent,\n context: TContext,\n ) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\nexport type FocusedInputTextHandlerHook<TContext, Event> = (\n handlers: {\n onFocusedInputTextChanged?: (\n e: FocusedInputTextChangedEvent,\n context: TContext,\n ) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\nexport type FocusedInputSelectionHandlerHook<TContext, Event> = (\n handlers: {\n onFocusedInputSelectionChanged?: (\n e: FocusedInputSelectionChangedEvent,\n context: TContext,\n ) => void;\n },\n dependencies?: unknown[],\n) => (e: NativeSyntheticEvent<Event>) => void;\n\n// package types\nexport type Handlers<T> = Record<string, T | undefined>;\nexport type KeyboardHandler = Partial<{\n /**\n * A callback that gets invoked when keyboard starts its movement.\n * The event contains DESTINATION values.\n *\n * @example\n * ```ts\n * onStart: (e) => {\n * \"worklet\";\n *\n * const willKeyboardAppear = e.progress === 1;\n * }\n * ```\n */\n onStart: (e: NativeEvent) => void;\n /**\n * A callback that gets involved every frame when keyboard changes its position.\n *\n * @example\n * ```ts\n * onMove: (e) => {\n * \"worklet\";\n *\n * const keyboardHeight = e.height;\n * }\n */\n onMove: (e: NativeEvent) => void;\n /**\n * A callback that gets invoked when keyboard finished its movement.\n *\n * @example\n * ```ts\n * onEnd: (e) => {\n * \"worklet\";\n *\n * const isKeyboardShown = e.progress === 1;\n * }\n * ```\n */\n onEnd: (e: NativeEvent) => void;\n /**\n * A callback that gets invoked every frame when keyboard changes its position due to interactive dismissal.\n *\n * @example\n * ```ts\n * onInteractive: (e) => {\n * \"worklet\";\n *\n * const keyboardHeight = e.height;\n * }\n */\n onInteractive: (e: NativeEvent) => void;\n}>;\nexport type KeyboardHandlers = Handlers<KeyboardHandler>;\nexport type FocusedInputHandler = Partial<{\n /** A callback that gets invoked every time when the text changes in focused input. */\n onChangeText: (e: FocusedInputTextChangedEvent) => void;\n /** A callback that gets invoked every time when the selection (cursor) coordinates change in focused input. */\n onSelectionChange: (e: FocusedInputSelectionChangedEvent) => void;\n}>;\nexport type FocusedInputHandlers = Handlers<FocusedInputHandler>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./hooks\";\nexport * from \"./views\";\nexport * from \"./module\";\nexport * from \"./internal\";\n"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["internal.ts"],"sourcesContent":["import type { EmitterSubscription } from \"react-native\";\n\nexport type FocusedInputAvailableEvents = \"focusDidSet\";\nexport type FocusedInputEventData = {\n current: number;\n count: number;\n};\nexport type FocusedInputEventsModule = {\n addListener: (\n name: FocusedInputAvailableEvents,\n cb: (e: FocusedInputEventData) => void,\n ) => EmitterSubscription;\n};\nexport type WindowDimensionsAvailableEvents = \"windowDidResize\";\nexport type WindowDimensionsEventData = {\n width: number;\n height: number;\n};\nexport type WindowDimensionsEventsModule = {\n addListener: (\n name: WindowDimensionsAvailableEvents,\n cb: (e: WindowDimensionsEventData) => void,\n ) => EmitterSubscription;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["module.ts"],"sourcesContent":["import type { EmitterSubscription, TextInputProps } from \"react-native\";\n\n// Event module declarations\nexport type KeyboardControllerEvents =\n | \"keyboardWillShow\"\n | \"keyboardDidShow\"\n | \"keyboardWillHide\"\n | \"keyboardDidHide\";\nexport type KeyboardEventData = {\n /** Height of the keyboard. */\n height: number;\n /** Duration of the keyboard animation. */\n duration: number;\n /** Timestamp of the last keyboard event. */\n timestamp: number;\n /** Tag of the focused `TextInput`. */\n target: number;\n /** `keyboardType` property from focused `TextInput`. */\n type: NonNullable<TextInputProps[\"keyboardType\"]>;\n /** Keyboard appearance. Can be one of `default`, `dark` or `light`. */\n appearance: NonNullable<TextInputProps[\"keyboardAppearance\"]>;\n};\n/**\n * An object that represent current keyboard state.\n */\nexport type KeyboardState = {\n /** Whether the keyboard is currently visible. */\n isVisible: boolean;\n} & KeyboardEventData;\nexport type KeyboardEventsModule = {\n /**\n * The `addListener` function connects a JavaScript function to an identified native\n * keyboard notification event.\n *\n * This function then returns the reference to the listener.\n *\n * `name` is the string that identifies the event you're listening for. This\n * can be any of the following:\n *\n * - `keyboardWillShow`;\n * - `keyboardDidShow`;\n * - `keyboardWillHide`;\n * - `keyboardDidHide`.\n */\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEventData) => void,\n ) => EmitterSubscription;\n};\nexport type Direction = \"next\" | \"prev\" | \"current\";\nexport type DismissOptions = {\n /**\n * A boolean property indicating whether focus should be kept on the input after dismissing the keyboard. Default is `false`.\n */\n keepFocus: boolean;\n};\nexport type KeyboardControllerModule = {\n // android only\n /**\n * Sets default `windowSoftInputMode` (the one that declared in `AndroidManifest.xml`).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setdefaultmode-|docs} page for more details.\n */\n setDefaultMode: () => void;\n /**\n * Changes `windowSoftInputMode` on Android. @see AndroidSoftInputModes for all possible values and {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setinputmode-|docs} page for more details.\n */\n setInputMode: (mode: number) => void;\n // all platforms\n /**\n * Dismisses the active keyboard. Removes a focus by default, but allows to pass `{keepFocus: true}` to keep focus.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#dismiss|docs} page for more details.\n */\n dismiss: (options?: DismissOptions) => Promise<void>;\n /**\n * Moves focus to the specified direction (`next`, `prev` or `current` to restore a focus).\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#setfocusto|docs} page for more details.\n */\n setFocusTo: (direction: Direction) => void;\n /**\n * Whether the keyboard is fully visible.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#isvisible|docs} page for more details.\n */\n isVisible: () => boolean;\n /**\n * Method that returns current keyboard state.\n *\n * @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller#state|docs} page for more details.\n */\n state: () => KeyboardEventData;\n};\nexport type KeyboardControllerNativeModule = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: number) => void;\n // all platforms\n dismiss: (keepFocus: boolean) => void;\n setFocusTo: (direction: Direction) => void;\n // native event module stuff\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["views.ts"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { ViewProps } from \"react-native\";\n\nexport type KeyboardGestureAreaProps = {\n /**\n * Determines how the keyboard position will be controlled:\n * - `ios` - keyboard will be following finger only when finger touches keyboard\n * - `linear` - keyboard will be following finger position linearly.\n *\n * @platform android\n */\n interpolator?: \"ios\" | \"linear\";\n /**\n * Whether to allow to show a keyboard from dismissed state by swipe up.\n * Default to `false`.\n *\n * @platform android\n */\n showOnSwipeUp?: boolean;\n /**\n * Whether to allow to control a keyboard by gestures. The strategy how\n * it should be controlled is determined by `interpolator` property.\n * Defaults to `true`.\n *\n * @platform android\n */\n enableSwipeToDismiss?: boolean;\n /**\n * Extra distance to the keyboard.\n */\n offset?: number;\n /**\n * A corresponding `nativeID` value from the associated `TextInput` (a string that links the `KeyboardGestureArea` to one or more `TextInput` components).\n * This is **required on iOS** in order to apply the `offset` when the keyboard is shown. Only the currently focused `TextInput` with a matching `nativeID`\n * will receive offset behavior.\n *\n * @platform ios\n */\n textInputNativeID?: string;\n} & ViewProps;\nexport type OverKeyboardViewProps = PropsWithChildren<{\n /**\n * A boolean prop indicating whether the view is visible or not. If it's true then view is shown on the screen. If it's false then view is hidden.\n */\n visible: boolean;\n}>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["findNodeHandle","componentOrHandle"],"sources":["index.ts"],"sourcesContent":["import type { findNodeHandle as findNodeHandleRN } from \"react-native\";\n\ntype FindNodeHandleRN = typeof findNodeHandleRN;\n\nexport const findNodeHandle: FindNodeHandleRN = (componentOrHandle) =>\n componentOrHandle as number | null;\n"],"mappings":"AAIA,OAAO,MAAMA,cAAgC,GAAIC,iBAAiB,IAChEA,iBAAkC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["findNodeHandle"],"sources":["index.native.ts"],"sourcesContent":["import { findNodeHandle } from \"react-native\";\n\nexport { findNodeHandle };\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,cAAc;AAE7C,SAASA,cAAc","ignoreList":[]}
|
|
@@ -2,10 +2,24 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { Platform, StyleSheet, View } from "react-native";
|
|
3
3
|
import { RCTOverKeyboardView } from "../../bindings";
|
|
4
4
|
import { useWindowDimensions } from "../../hooks";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A view component that renders its children over the keyboard without closing the keyboard.
|
|
7
|
+
* Acts similar to modal, but doesn't close the keyboard when it's visible.
|
|
8
|
+
*
|
|
9
|
+
* @param props - Component props.
|
|
10
|
+
* @returns A view component that renders over the keyboard.
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <OverKeyboardView visible={true}>
|
|
14
|
+
* <Text>This will appear over the keyboard</Text>
|
|
15
|
+
* </OverKeyboardView>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const OverKeyboardView = props => {
|
|
19
|
+
const {
|
|
20
|
+
children,
|
|
21
|
+
visible
|
|
22
|
+
} = props;
|
|
9
23
|
const {
|
|
10
24
|
height,
|
|
11
25
|
width
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","Platform","StyleSheet","View","RCTOverKeyboardView","useWindowDimensions","OverKeyboardView","children","visible","height","width","inner","style","styles","absolute","OS","undefined","stretch","createElement","collapsable","create","position","top","bottom","left","right"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Platform, StyleSheet, View } from \"react-native\";\n\nimport { RCTOverKeyboardView } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { OverKeyboardViewProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\
|
|
1
|
+
{"version":3,"names":["React","useMemo","Platform","StyleSheet","View","RCTOverKeyboardView","useWindowDimensions","OverKeyboardView","props","children","visible","height","width","inner","style","styles","absolute","OS","undefined","stretch","createElement","collapsable","create","position","top","bottom","left","right"],"sources":["index.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { Platform, StyleSheet, View } from \"react-native\";\n\nimport { RCTOverKeyboardView } from \"../../bindings\";\nimport { useWindowDimensions } from \"../../hooks\";\n\nimport type { OverKeyboardViewProps } from \"../../types\";\nimport type { PropsWithChildren } from \"react\";\n\n/**\n * A view component that renders its children over the keyboard without closing the keyboard.\n * Acts similar to modal, but doesn't close the keyboard when it's visible.\n *\n * @param props - Component props.\n * @returns A view component that renders over the keyboard.\n * @example\n * ```tsx\n * <OverKeyboardView visible={true}>\n * <Text>This will appear over the keyboard</Text>\n * </OverKeyboardView>\n * ```\n */\nconst OverKeyboardView = (props: PropsWithChildren<OverKeyboardViewProps>) => {\n const { children, visible } = props;\n const { height, width } = useWindowDimensions();\n const inner = useMemo(() => ({ height, width }), [height, width]);\n const style = useMemo(\n () => [\n styles.absolute,\n // On iOS - stretch view to full window dimensions to make yoga work\n Platform.OS === \"ios\" ? inner : undefined,\n // On Android - we are laid out by ShadowNode, so just stretch to full container\n Platform.OS === \"android\" ? styles.stretch : undefined,\n ],\n [inner],\n );\n\n return (\n <RCTOverKeyboardView visible={visible}>\n {/* `OverKeyboardView` should always have a single child */}\n <View collapsable={false} style={style}>\n {/* Match RN behavior and trigger mount/unmount when visibility changes */}\n {visible && children}\n </View>\n </RCTOverKeyboardView>\n );\n};\n\nconst styles = StyleSheet.create({\n absolute: {\n position: \"absolute\",\n },\n stretch: {\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n },\n});\n\nexport default OverKeyboardView;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAEzD,SAASC,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,mBAAmB,QAAQ,aAAa;AAKjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,gBAAgB,GAAIC,KAA+C,IAAK;EAC5E,MAAM;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGF,KAAK;EACnC,MAAM;IAAEG,MAAM;IAAEC;EAAM,CAAC,GAAGN,mBAAmB,CAAC,CAAC;EAC/C,MAAMO,KAAK,GAAGZ,OAAO,CAAC,OAAO;IAAEU,MAAM;IAAEC;EAAM,CAAC,CAAC,EAAE,CAACD,MAAM,EAAEC,KAAK,CAAC,CAAC;EACjE,MAAME,KAAK,GAAGb,OAAO,CACnB,MAAM,CACJc,MAAM,CAACC,QAAQ;EACf;EACAd,QAAQ,CAACe,EAAE,KAAK,KAAK,GAAGJ,KAAK,GAAGK,SAAS;EACzC;EACAhB,QAAQ,CAACe,EAAE,KAAK,SAAS,GAAGF,MAAM,CAACI,OAAO,GAAGD,SAAS,CACvD,EACD,CAACL,KAAK,CACR,CAAC;EAED,oBACEb,KAAA,CAAAoB,aAAA,CAACf,mBAAmB;IAACK,OAAO,EAAEA;EAAQ,gBAEpCV,KAAA,CAAAoB,aAAA,CAAChB,IAAI;IAACiB,WAAW,EAAE,KAAM;IAACP,KAAK,EAAEA;EAAM,GAEpCJ,OAAO,IAAID,QACR,CACa,CAAC;AAE1B,CAAC;AAED,MAAMM,MAAM,GAAGZ,UAAU,CAACmB,MAAM,CAAC;EAC/BN,QAAQ,EAAE;IACRO,QAAQ,EAAE;EACZ,CAAC;EACDJ,OAAO,EAAE;IACPK,GAAG,EAAE,CAAC;IACNC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAepB,gBAAgB","ignoreList":[]}
|
|
@@ -7,33 +7,47 @@ type KeyboardProviderProps = {
|
|
|
7
7
|
* or `StatusBar` component from `react-native`, you can ignore it.
|
|
8
8
|
* Defaults to `false`.
|
|
9
9
|
*
|
|
10
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
11
10
|
* @platform android
|
|
11
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/14
|
|
12
12
|
*/
|
|
13
13
|
statusBarTranslucent?: boolean;
|
|
14
14
|
/**
|
|
15
15
|
* Set the value to `true`, if you use translucent navigation bar on Android.
|
|
16
16
|
* Defaults to `false`.
|
|
17
17
|
*
|
|
18
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
19
18
|
* @platform android
|
|
19
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/119
|
|
20
20
|
*/
|
|
21
21
|
navigationBarTranslucent?: boolean;
|
|
22
22
|
/**
|
|
23
23
|
* A boolean property indicating whether to keep edge-to-edge mode always enabled (even when you disable the module).
|
|
24
24
|
* Defaults to `false`.
|
|
25
25
|
*
|
|
26
|
-
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
27
26
|
* @platform android
|
|
27
|
+
* @see https://github.com/kirillzyusko/react-native-keyboard-controller/issues/592
|
|
28
28
|
*/
|
|
29
29
|
preserveEdgeToEdge?: boolean;
|
|
30
30
|
/**
|
|
31
|
-
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
32
|
-
*
|
|
31
|
+
* A boolean prop indicating whether the module is enabled. It indicate only initial state
|
|
32
|
+
* (if you try to change this prop after component mount it will not have any effect).
|
|
33
33
|
* To change the property in runtime use `useKeyboardController` hook and `setEnabled` method.
|
|
34
34
|
* Defaults to `true`.
|
|
35
35
|
*/
|
|
36
36
|
enabled?: boolean;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
/**
|
|
39
|
+
* A component that wrap your app. Under the hood it works with {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|KeyboardControllerView} to receive events during keyboard movements,
|
|
40
|
+
* maps these events to `Animated`/`Reanimated` values and store them in context.
|
|
41
|
+
*
|
|
42
|
+
* @param props - Provider props, such as `statusBarTranslucent`, `navigationBarTranslucent`, etc.
|
|
43
|
+
* @returns A component that should be mounted in root of your App layout.
|
|
44
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-provider|Documentation} page for more details.
|
|
45
|
+
* @example
|
|
46
|
+
* ```tsx
|
|
47
|
+
* <KeyboardProvider>
|
|
48
|
+
* <NavigationContainer />
|
|
49
|
+
* </KeyboardProvider>
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare const KeyboardProvider: (props: KeyboardProviderProps) => React.JSX.Element;
|
|
39
53
|
export {};
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { FocusedInputEventsModule, KeyboardControllerNativeModule, KeyboardControllerProps, KeyboardEventsModule, KeyboardGestureAreaProps, OverKeyboardViewProps, WindowDimensionsEventsModule } from "./types";
|
|
2
2
|
export declare const KeyboardControllerNative: KeyboardControllerNativeModule;
|
|
3
|
+
/**
|
|
4
|
+
* An event emitter that provides a way to subscribe to next keyboard events:
|
|
5
|
+
* - `keyboardWillShow`;
|
|
6
|
+
* - `keyboardDidShow`;
|
|
7
|
+
* - `keyboardWillHide`;
|
|
8
|
+
* - `keyboardDidHide`.
|
|
9
|
+
*
|
|
10
|
+
* Use `addListener` function to add your event listener for a specific keyboard event.
|
|
11
|
+
*/
|
|
3
12
|
export declare const KeyboardEvents: KeyboardEventsModule;
|
|
4
13
|
/**
|
|
5
14
|
* This API is not documented, it's for internal usage only (for now), and is a subject to potential breaking changes in future.
|
|
@@ -7,6 +16,16 @@ export declare const KeyboardEvents: KeyboardEventsModule;
|
|
|
7
16
|
*/
|
|
8
17
|
export declare const FocusedInputEvents: FocusedInputEventsModule;
|
|
9
18
|
export declare const WindowDimensionsEvents: WindowDimensionsEventsModule;
|
|
19
|
+
/**
|
|
20
|
+
* A view that sends events whenever keyboard or focused events are happening.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-controller-view|Documentation} page for more details.
|
|
23
|
+
*/
|
|
10
24
|
export declare const KeyboardControllerView: React.FC<KeyboardControllerProps>;
|
|
25
|
+
/**
|
|
26
|
+
* A view that defines a region on the screen, where gestures will control the keyboard position.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/keyboard-gesture-area|Documentation} page for more details.
|
|
29
|
+
*/
|
|
11
30
|
export declare const KeyboardGestureArea: React.FC<KeyboardGestureAreaProps>;
|
|
12
31
|
export declare const RCTOverKeyboardView: React.FC<OverKeyboardViewProps>;
|
|
@@ -33,8 +33,17 @@ export type KeyboardAvoidingViewProps = KeyboardAvoidingViewBaseProps & ({
|
|
|
33
33
|
contentContainerStyle?: never;
|
|
34
34
|
});
|
|
35
35
|
/**
|
|
36
|
-
* View that
|
|
37
|
-
*
|
|
36
|
+
* A View component that automatically adjusts its height, position, or bottom padding
|
|
37
|
+
* when the keyboard appears to ensure that the content remains visible.
|
|
38
|
+
*
|
|
39
|
+
* @returns A View component that adjusts to keyboard visibility.
|
|
40
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-avoiding-view|Documentation} page for more details.
|
|
41
|
+
* @example
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <KeyboardAvoidingView behavior="padding">
|
|
44
|
+
* <TextInput />
|
|
45
|
+
* </KeyboardAvoidingView>
|
|
46
|
+
* ```
|
|
38
47
|
*/
|
|
39
48
|
declare const KeyboardAvoidingView: React.ForwardRefExoticComponent<React.PropsWithChildren<KeyboardAvoidingViewProps> & React.RefAttributes<View>>;
|
|
40
49
|
export default KeyboardAvoidingView;
|
|
@@ -5,23 +5,40 @@ export type KeyboardAwareScrollViewProps = {
|
|
|
5
5
|
bottomOffset?: number;
|
|
6
6
|
/** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */
|
|
7
7
|
disableScrollOnKeyboardHide?: boolean;
|
|
8
|
-
/** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true
|
|
8
|
+
/** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true`. */
|
|
9
9
|
enabled?: boolean;
|
|
10
|
-
/** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0
|
|
10
|
+
/** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */
|
|
11
11
|
extraKeyboardSpace?: number;
|
|
12
|
-
/** Custom component for `ScrollView`. Default is `ScrollView
|
|
12
|
+
/** Custom component for `ScrollView`. Default is `ScrollView`. */
|
|
13
13
|
ScrollViewComponent?: React.ComponentType<ScrollViewProps>;
|
|
14
14
|
} & ScrollViewProps;
|
|
15
|
+
/**
|
|
16
|
+
* A ScrollView component that automatically handles keyboard appearance and disappearance
|
|
17
|
+
* by adjusting its content position to ensure the focused input remains visible.
|
|
18
|
+
*
|
|
19
|
+
* The component uses a sophisticated animation system to smoothly handle keyboard transitions
|
|
20
|
+
* and maintain proper scroll position during keyboard interactions.
|
|
21
|
+
*
|
|
22
|
+
* @returns A ScrollView component that handles keyboard interactions.
|
|
23
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-aware-scroll-view|Documentation} page for more details.
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <KeyboardAwareScrollView bottomOffset={20}>
|
|
27
|
+
* <TextInput placeholder="Enter text" />
|
|
28
|
+
* <TextInput placeholder="Another input" />
|
|
29
|
+
* </KeyboardAwareScrollView>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
15
32
|
declare const KeyboardAwareScrollView: React.ForwardRefExoticComponent<{
|
|
16
33
|
/** The distance between keyboard and focused `TextInput` when keyboard is shown. Default is `0`. */
|
|
17
34
|
bottomOffset?: number;
|
|
18
35
|
/** Prevents automatic scrolling of the `ScrollView` when the keyboard gets hidden, maintaining the current screen position. Default is `false`. */
|
|
19
36
|
disableScrollOnKeyboardHide?: boolean;
|
|
20
|
-
/** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true
|
|
37
|
+
/** Controls whether this `KeyboardAwareScrollView` instance should take effect. Default is `true`. */
|
|
21
38
|
enabled?: boolean;
|
|
22
|
-
/** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0
|
|
39
|
+
/** Adjusting the bottom spacing of KeyboardAwareScrollView. Default is `0`. */
|
|
23
40
|
extraKeyboardSpace?: number;
|
|
24
|
-
/** Custom component for `ScrollView`. Default is `ScrollView
|
|
41
|
+
/** Custom component for `ScrollView`. Default is `ScrollView`. */
|
|
25
42
|
ScrollViewComponent?: React.ComponentType<ScrollViewProps>;
|
|
26
43
|
} & ScrollViewProps & {
|
|
27
44
|
children?: React.ReactNode | undefined;
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { useKeyboardHandler } from "../../hooks";
|
|
2
2
|
/**
|
|
3
3
|
* Hook that uses default transitions for iOS and Android > 11, and uses
|
|
4
|
-
* custom interpolation on Android < 11 to achieve more smooth animation
|
|
4
|
+
* custom interpolation on Android < 11 to achieve more smooth animation.
|
|
5
|
+
*
|
|
6
|
+
* @param handler - Object containing keyboard event handlers.
|
|
7
|
+
* @param [deps] - Dependencies array for the effect.
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* useSmoothKeyboardHandler(
|
|
11
|
+
* {
|
|
12
|
+
* onStart: (e) => {
|
|
13
|
+
* "worklet";
|
|
14
|
+
*
|
|
15
|
+
* // your handler for keyboard start
|
|
16
|
+
* },
|
|
17
|
+
* },
|
|
18
|
+
* [],
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
5
21
|
*/
|
|
6
22
|
export declare const useSmoothKeyboardHandler: typeof useKeyboardHandler;
|
|
@@ -14,9 +14,22 @@ export type KeyboardStickyViewProps = {
|
|
|
14
14
|
*/
|
|
15
15
|
opened?: number;
|
|
16
16
|
};
|
|
17
|
-
/** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true
|
|
17
|
+
/** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */
|
|
18
18
|
enabled?: boolean;
|
|
19
19
|
} & ViewProps;
|
|
20
|
+
/**
|
|
21
|
+
* A View component that sticks to the keyboard and moves with it when it appears or disappears.
|
|
22
|
+
* The view can be configured with custom offsets for both closed and open keyboard states.
|
|
23
|
+
*
|
|
24
|
+
* @returns An animated View component that sticks to the keyboard.
|
|
25
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-sticky-view|Documentation} page for more details.
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <KeyboardStickyView offset={{ closed: 0, opened: 20 }}>
|
|
29
|
+
* <Button title="Submit" />
|
|
30
|
+
* </KeyboardStickyView>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
20
33
|
declare const KeyboardStickyView: React.ForwardRefExoticComponent<{
|
|
21
34
|
/**
|
|
22
35
|
* Specify additional offset to the view for given keyboard state.
|
|
@@ -31,7 +44,7 @@ declare const KeyboardStickyView: React.ForwardRefExoticComponent<{
|
|
|
31
44
|
*/
|
|
32
45
|
opened?: number;
|
|
33
46
|
};
|
|
34
|
-
/** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true
|
|
47
|
+
/** Controls whether this `KeyboardStickyView` instance should take effect. Default is `true`. */
|
|
35
48
|
enabled?: boolean;
|
|
36
49
|
} & ViewProps & {
|
|
37
50
|
children?: React.ReactNode | undefined;
|
|
@@ -46,11 +46,22 @@ export type KeyboardToolbarProps = Omit<ViewProps, "style" | "testID" | "childre
|
|
|
46
46
|
* A value for container opacity in hexadecimal format (e.g. `ff`). Default value is `ff`.
|
|
47
47
|
*/
|
|
48
48
|
opacity?: HEX;
|
|
49
|
+
/**
|
|
50
|
+
* A object containing `left`/`right` properties. Used to specify proper container padding in landscape mode.
|
|
51
|
+
*/
|
|
49
52
|
insets?: SafeAreaInsets;
|
|
50
53
|
} & Pick<KeyboardStickyViewProps, "offset" | "enabled">;
|
|
51
54
|
/**
|
|
52
|
-
* `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` and
|
|
53
|
-
* `Done`
|
|
55
|
+
* `KeyboardToolbar` is a component that is shown above the keyboard with `Prev`/`Next` buttons from left and
|
|
56
|
+
* `Done` button from the right (to dismiss the keyboard). Allows to add customizable content (yours UI elements) in the middle.
|
|
57
|
+
*
|
|
58
|
+
* @param props - Component props.
|
|
59
|
+
* @returns A component that is shown above the keyboard with `Prev`/`Next` and `Done` buttons.
|
|
60
|
+
* @see {@link https://kirillzyusko.github.io/react-native-keyboard-controller/docs/api/components/keyboard-toolbar|Documentation} page for more details.
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* <KeyboardToolbar doneText="Close" />
|
|
64
|
+
* ```
|
|
54
65
|
*/
|
|
55
66
|
declare const KeyboardToolbar: React.FC<KeyboardToolbarProps>;
|
|
56
67
|
export { colors as DefaultKeyboardToolbarTheme };
|
|
@@ -3,21 +3,53 @@ import type { FocusedInputHandler, FocusedInputLayoutChangedEvent, KeyboardHandl
|
|
|
3
3
|
import type React from "react";
|
|
4
4
|
import type { SharedValue } from "react-native-reanimated";
|
|
5
5
|
export type AnimatedContext = {
|
|
6
|
+
/**
|
|
7
|
+
* A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.
|
|
8
|
+
* Represented as `Animated.Value`.
|
|
9
|
+
*/
|
|
6
10
|
progress: Animated.Value;
|
|
11
|
+
/** Height of the keyboard. Represented as `Animated.Value`. */
|
|
7
12
|
height: Animated.AnimatedMultiplication<number>;
|
|
8
13
|
};
|
|
9
14
|
export type ReanimatedContext = {
|
|
15
|
+
/**
|
|
16
|
+
* A value between `0` and `1` indicating keyboard position, where `0` means keyboard is closed and `1` means keyboard is fully visible.
|
|
17
|
+
* Represented as `SharedValue`.
|
|
18
|
+
*/
|
|
10
19
|
progress: SharedValue<number>;
|
|
20
|
+
/** Height of the keyboard. Represented as `SharedValue`. */
|
|
11
21
|
height: SharedValue<number>;
|
|
12
22
|
};
|
|
13
23
|
export type KeyboardAnimationContext = {
|
|
24
|
+
/** Whether KeyboardController library is active or not. */
|
|
14
25
|
enabled: boolean;
|
|
26
|
+
/** Object that stores animated values that reflect the keyboard’s current position and movement. */
|
|
15
27
|
animated: AnimatedContext;
|
|
28
|
+
/** Object that stores reanimated values that reflect the keyboard’s current position and movement. */
|
|
16
29
|
reanimated: ReanimatedContext;
|
|
30
|
+
/** Layout of the focused `TextInput` represented as `SharedValue`. */
|
|
17
31
|
layout: SharedValue<FocusedInputLayoutChangedEvent | null>;
|
|
32
|
+
/** Method for setting workletized keyboard handlers. */
|
|
18
33
|
setKeyboardHandlers: (handlers: KeyboardHandler) => () => void;
|
|
34
|
+
/** Method for setting workletized handlers for tracking focused input events. */
|
|
19
35
|
setInputHandlers: (handlers: FocusedInputHandler) => () => void;
|
|
36
|
+
/** Method to enable/disable KeyboardController library. */
|
|
20
37
|
setEnabled: React.Dispatch<React.SetStateAction<boolean>>;
|
|
21
38
|
};
|
|
22
39
|
export declare const KeyboardContext: React.Context<KeyboardAnimationContext>;
|
|
40
|
+
/**
|
|
41
|
+
* A hook that returns a reference to {@link KeyboardAnimationContext} object.
|
|
42
|
+
*
|
|
43
|
+
* @returns Object {@link KeyboardAnimationContext|containing} keyboard-controller context.
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const context = useKeyboardContext();
|
|
47
|
+
*
|
|
48
|
+
* useLayoutEffect(() => {
|
|
49
|
+
* const cleanup = context.setInputHandlers(handler);
|
|
50
|
+
*
|
|
51
|
+
* return () => cleanup();
|
|
52
|
+
* }, deps);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
23
55
|
export declare const useKeyboardContext: () => KeyboardAnimationContext;
|