@hanzogui/use-keyboard-visible 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,26 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: !0
9
+ });
10
+ },
11
+ __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
13
+ get: () => from[key],
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ return to;
17
+ };
18
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
+ value: !0
20
+ }), mod);
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ useKeyboardVisible: () => import_useKeyboardVisible.useKeyboardVisible
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var import_useKeyboardVisible = require("./useKeyboardVisible.cjs");
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
21
+ value: !0
22
+ }), mod);
23
+ var index_exports = {};
24
+ __export(index_exports, {
25
+ useKeyboardVisible: () => import_useKeyboardVisible.useKeyboardVisible
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+ var import_useKeyboardVisible = require("./useKeyboardVisible.native.js");
29
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","useKeyboardVisible","import_useKeyboardVisible","module","exports"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAC,yBAAA,CAAAD;AAAA;AAAAE,MAAA,CAAAC,OAAA,GAAAV,YAAA,CAAAK,aAAmC","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var useKeyboardVisible_exports = {};
33
+ __export(useKeyboardVisible_exports, {
34
+ useKeyboardVisible: () => useKeyboardVisible
35
+ });
36
+ module.exports = __toCommonJS(useKeyboardVisible_exports);
37
+ var import_react = __toESM(require("react"), 1),
38
+ import_react_native = require("react-native-web");
39
+ const useKeyboardVisible = () => {
40
+ const [isKeyboardVisible, setKeyboardVisible] = import_react.default.useState(!1);
41
+ return import_react.default.useEffect(() => {
42
+ const keyboardDidShowListener = import_react_native.Keyboard.addListener("keyboardDidShow", () => {
43
+ setKeyboardVisible(!0);
44
+ }),
45
+ keyboardDidHideListener = import_react_native.Keyboard.addListener("keyboardDidHide", () => {
46
+ setKeyboardVisible(!1);
47
+ });
48
+ return () => {
49
+ keyboardDidHideListener.remove(), keyboardDidShowListener.remove();
50
+ };
51
+ }, []), isKeyboardVisible;
52
+ };
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
34
+ var useKeyboardVisible_exports = {};
35
+ __export(useKeyboardVisible_exports, {
36
+ useKeyboardVisible: () => useKeyboardVisible
37
+ });
38
+ module.exports = __toCommonJS(useKeyboardVisible_exports);
39
+ var import_react = __toESM(require("react"), 1),
40
+ import_react_native = require("react-native"),
41
+ useKeyboardVisible = function () {
42
+ var [isKeyboardVisible, setKeyboardVisible] = import_react.default.useState(!1);
43
+ return import_react.default.useEffect(function () {
44
+ var keyboardDidShowListener = import_react_native.Keyboard.addListener("keyboardDidShow", function () {
45
+ setKeyboardVisible(!0);
46
+ }),
47
+ keyboardDidHideListener = import_react_native.Keyboard.addListener("keyboardDidHide", function () {
48
+ setKeyboardVisible(!1);
49
+ });
50
+ return function () {
51
+ keyboardDidHideListener.remove(), keyboardDidShowListener.remove();
52
+ };
53
+ }, []), isKeyboardVisible;
54
+ };
55
+ //# sourceMappingURL=useKeyboardVisible.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","useKeyboardVisible_exports","__export","useKeyboardVisible","module","exports","import_react","__toESM","require","import_react_native","isKeyboardVisible","setKeyboardVisible","default","useState","useEffect","keyboardDidShowListener","Keyboard","addListener","keyboardDidHideListener","remove"],"sources":["../../src/useKeyboardVisible.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAA;EAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;IAAAC,KAAA;EAAA,IAAAH,GAAA;AAAA,IAAAI,0BAAA;AAAAC,QAAA,CAAAD,0BAAA;EAAAE,kBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,0BAClB;AAEO,IAAAK,YAAM,GAAAC,OAAA,CAAqBC,OAAe;EAAAC,mBAAA,GAAAD,OAAA;EAAAL,kBAAA,YAAAA,CAAA;IAC/C,KAAAO,iBAAO,EAAAC,kBAAmB,IAAkBL,YAAI,CAAAM,OAAA,CAAAC,QAAM,GAAS;IAE/D,OAAAP,YAAA,CAAAM,OAAA,CAAME,SAAA,CAAU,YAAM;MACpB,IAAAC,uBAAM,GAAAN,mBAA0B,CAAAO,QAAA,CAAAC,WAAS,kBAAY,cAAyB;UAC5EN,kBAAA,CAAmB,EAAI;QACzB,CAAC;QACKO,uBAAA,GAA0BT,mBAAA,CAAAO,QAAA,CAASC,WAAA,CAAY,mBAAmB,YAAM;UAC5EN,kBAAA,CAAmB,EAAK;QAC1B,CAAC;MAED,OAAO,YAAM;QACXO,uBAAA,CAAwBC,MAAA,CAAO,GAC/BJ,uBAAA,CAAwBI,MAAA,CAAO;MACjC;IACF,GAAG,EAAE,GAEET,iBAAA;EACT","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { useKeyboardVisible } from "./useKeyboardVisible.mjs";
2
+ export { useKeyboardVisible };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useKeyboardVisible"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,kBAAA,QAA0B","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { useKeyboardVisible } from "./useKeyboardVisible.mjs";
2
+ export { useKeyboardVisible };
3
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useKeyboardVisible"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,kBAAA,QAA0B","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import { useKeyboardVisible } from "./useKeyboardVisible.native.js";
2
+ export { useKeyboardVisible };
3
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useKeyboardVisible"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,kBAAA,QAA0B","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { Keyboard } from "react-native-web";
3
+ const useKeyboardVisible = () => {
4
+ const [isKeyboardVisible, setKeyboardVisible] = React.useState(!1);
5
+ return React.useEffect(() => {
6
+ const keyboardDidShowListener = Keyboard.addListener("keyboardDidShow", () => {
7
+ setKeyboardVisible(!0);
8
+ }),
9
+ keyboardDidHideListener = Keyboard.addListener("keyboardDidHide", () => {
10
+ setKeyboardVisible(!1);
11
+ });
12
+ return () => {
13
+ keyboardDidHideListener.remove(), keyboardDidShowListener.remove();
14
+ };
15
+ }, []), isKeyboardVisible;
16
+ };
17
+ export { useKeyboardVisible };
18
+ //# sourceMappingURL=useKeyboardVisible.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Keyboard","useKeyboardVisible","isKeyboardVisible","setKeyboardVisible","useState","useEffect","keyboardDidShowListener","addListener","keyboardDidHideListener","remove"],"sources":["../../src/useKeyboardVisible.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,QAAA,QAAgB;AAElB,MAAMC,kBAAA,GAAqBA,CAAA,KAAe;EAC/C,MAAM,CAACC,iBAAA,EAAmBC,kBAAkB,IAAIJ,KAAA,CAAMK,QAAA,CAAS,EAAK;EAEpE,OAAAL,KAAA,CAAMM,SAAA,CAAU,MAAM;IACpB,MAAMC,uBAAA,GAA0BN,QAAA,CAASO,WAAA,CAAY,mBAAmB,MAAM;QAC5EJ,kBAAA,CAAmB,EAAI;MACzB,CAAC;MACKK,uBAAA,GAA0BR,QAAA,CAASO,WAAA,CAAY,mBAAmB,MAAM;QAC5EJ,kBAAA,CAAmB,EAAK;MAC1B,CAAC;IAED,OAAO,MAAM;MACXK,uBAAA,CAAwBC,MAAA,CAAO,GAC/BH,uBAAA,CAAwBG,MAAA,CAAO;IACjC;EACF,GAAG,EAAE,GAEEP,iBAAA;AACT","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { Keyboard } from "react-native";
3
+ var useKeyboardVisible = function () {
4
+ var [isKeyboardVisible, setKeyboardVisible] = React.useState(!1);
5
+ return React.useEffect(function () {
6
+ var keyboardDidShowListener = Keyboard.addListener("keyboardDidShow", function () {
7
+ setKeyboardVisible(!0);
8
+ }),
9
+ keyboardDidHideListener = Keyboard.addListener("keyboardDidHide", function () {
10
+ setKeyboardVisible(!1);
11
+ });
12
+ return function () {
13
+ keyboardDidHideListener.remove(), keyboardDidShowListener.remove();
14
+ };
15
+ }, []), isKeyboardVisible;
16
+ };
17
+ export { useKeyboardVisible };
18
+ //# sourceMappingURL=useKeyboardVisible.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","Keyboard","useKeyboardVisible","isKeyboardVisible","setKeyboardVisible","useState","useEffect","keyboardDidShowListener","addListener","keyboardDidHideListener","remove"],"sources":["../../src/useKeyboardVisible.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAClB,SAASC,QAAA,QAAgB;AAElB,IAAAC,kBAAM,YAAAA,CAAA,EAAoC;EAC/C,KAAAC,iBAAO,EAAAC,kBAAmB,IAAkBJ,KAAI,CAAAK,QAAM,GAAS;EAE/D,OAAAL,KAAA,CAAMM,SAAA,CAAU,YAAM;IACpB,IAAAC,uBAAM,GAAAN,QAA0B,CAAAO,WAAS,kBAAY,cAAyB;QAC5EJ,kBAAA,CAAmB,EAAI;MACzB,CAAC;MACKK,uBAAA,GAA0BR,QAAA,CAASO,WAAA,CAAY,mBAAmB,YAAM;QAC5EJ,kBAAA,CAAmB,EAAK;MAC1B,CAAC;IAED,OAAO,YAAM;MACXK,uBAAA,CAAwBC,MAAA,CAAO,GAC/BH,uBAAA,CAAwBG,MAAA,CAAO;IACjC;EACF,GAAG,EAAE,GAEEP,iBAAA;AACT","ignoreList":[]}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@hanzogui/use-keyboard-visible",
3
+ "version": "2.0.0",
4
+ "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
+ "files": [
6
+ "src",
7
+ "types",
8
+ "dist"
9
+ ],
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "main": "dist/cjs",
13
+ "module": "dist/esm",
14
+ "types": "./types/index.d.ts",
15
+ "exports": {
16
+ "./package.json": "./package.json",
17
+ ".": {
18
+ "types": "./types/index.d.ts",
19
+ "react-native": "./dist/esm/index.native.js",
20
+ "browser": "./dist/esm/index.mjs",
21
+ "module": "./dist/esm/index.mjs",
22
+ "import": "./dist/esm/index.mjs",
23
+ "require": "./dist/cjs/index.cjs",
24
+ "default": "./dist/esm/index.mjs"
25
+ }
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "hanzo-gui-build",
32
+ "watch": "hanzo-gui-build --watch",
33
+ "clean": "hanzo-gui-build clean",
34
+ "clean:build": "hanzo-gui-build clean:build"
35
+ },
36
+ "devDependencies": {
37
+ "@hanzogui/build": "workspace:*",
38
+ "react": ">=19",
39
+ "react-native": "0.83.2"
40
+ },
41
+ "peerDependencies": {
42
+ "react": ">=19",
43
+ "react-native": "*"
44
+ }
45
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { useKeyboardVisible } from './useKeyboardVisible'
@@ -0,0 +1,22 @@
1
+ import React from 'react'
2
+ import { Keyboard } from 'react-native'
3
+
4
+ export const useKeyboardVisible = (): boolean => {
5
+ const [isKeyboardVisible, setKeyboardVisible] = React.useState(false)
6
+
7
+ React.useEffect(() => {
8
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
9
+ setKeyboardVisible(true)
10
+ })
11
+ const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
12
+ setKeyboardVisible(false)
13
+ })
14
+
15
+ return () => {
16
+ keyboardDidHideListener.remove()
17
+ keyboardDidShowListener.remove()
18
+ }
19
+ }, [])
20
+
21
+ return isKeyboardVisible
22
+ }
@@ -0,0 +1,3 @@
1
+ export { useKeyboardVisible } from "./useKeyboardVisible";
2
+
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAAA,SAAS,0BAA0B",
3
+ "names": [],
4
+ "sources": [
5
+ "src/index.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "export { useKeyboardVisible } from './useKeyboardVisible'\n"
10
+ ]
11
+ }
@@ -0,0 +1,3 @@
1
+ export declare const useKeyboardVisible: () => boolean;
2
+
3
+ //# sourceMappingURL=useKeyboardVisible.d.ts.map
@@ -0,0 +1,11 @@
1
+ {
2
+ "mappings": "AAGA,OAAO,cAAM",
3
+ "names": [],
4
+ "sources": [
5
+ "src/useKeyboardVisible.ts"
6
+ ],
7
+ "version": 3,
8
+ "sourcesContent": [
9
+ "import React from 'react'\nimport { Keyboard } from 'react-native'\n\nexport const useKeyboardVisible = (): boolean => {\n const [isKeyboardVisible, setKeyboardVisible] = React.useState(false)\n\n React.useEffect(() => {\n const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {\n setKeyboardVisible(true)\n })\n const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {\n setKeyboardVisible(false)\n })\n\n return () => {\n keyboardDidHideListener.remove()\n keyboardDidShowListener.remove()\n }\n }, [])\n\n return isKeyboardVisible\n}\n"
10
+ ]
11
+ }