@draftbit/core 49.0.4-81e29e.2 → 49.0.5-0fbb07.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "49.0.4-81e29e.2+81e29e3",
3
+ "version": "49.0.5-0fbb07.2+0fbb075",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "types": "lib/typescript/src/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^49.0.4-81e29e.2+81e29e3",
44
+ "@draftbit/types": "^49.0.5-0fbb07.2+0fbb075",
45
45
  "@expo/vector-icons": "^13.0.0",
46
46
  "@gorhom/bottom-sheet": "^5.0.0-alpha.4",
47
47
  "@material-ui/core": "^4.11.0",
@@ -57,7 +57,6 @@
57
57
  "lodash.isnumber": "^3.0.3",
58
58
  "lodash.omit": "^4.5.0",
59
59
  "lodash.tonumber": "^4.0.3",
60
- "react-native-avoid-softinput": "^4.0.1",
61
60
  "react-native-confirmation-code-field": "^7.3.1",
62
61
  "react-native-deck-swiper": "^2.0.12",
63
62
  "react-native-dropdown-picker": "^5.4.7-beta.1",
@@ -75,6 +74,14 @@
75
74
  "react-native-youtube-iframe": "^2.2.2",
76
75
  "react-youtube": "^10.1.0"
77
76
  },
77
+ "peerDependencies": {
78
+ "react-native-avoid-softinput": "^4.0.1"
79
+ },
80
+ "peerDependenciesMeta": {
81
+ "react-native-avoid-softinput": {
82
+ "optional": true
83
+ }
84
+ },
78
85
  "devDependencies": {
79
86
  "@babel/plugin-proposal-class-properties": "^7.18.6",
80
87
  "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
@@ -82,7 +89,8 @@
82
89
  "@types/dateformat": "^3.0.1",
83
90
  "@types/lodash.isnumber": "^3.0.6",
84
91
  "@types/lodash.omit": "^4.5.6",
85
- "@types/lodash.tonumber": "^4.0.6"
92
+ "@types/lodash.tonumber": "^4.0.6",
93
+ "react-native-avoid-softinput": "^4.0.1"
86
94
  },
87
95
  "eslintIgnore": [
88
96
  "node_modules/",
@@ -104,5 +112,5 @@
104
112
  ],
105
113
  "testEnvironment": "node"
106
114
  },
107
- "gitHead": "81e29e319d1f2436960c6938162f4b07854ea648"
115
+ "gitHead": "0fbb0757b225caa1fe643c96a3c47bf878879deb"
108
116
  }
@@ -1,13 +1,33 @@
1
1
  import React from "react";
2
- import { AvoidSoftInput, AvoidSoftInputView, } from "react-native-avoid-softinput";
2
+ import { View } from "react-native";
3
+ // `react-native-avoid-softinput` is an optional dependency and there is a possibility that it is not installed resulting in undefined references
4
+ let AvoidSoftInput = null;
5
+ let AvoidSoftInputView = null;
6
+ try {
7
+ const avoidSoftInputPackage = require("react-native-avoid-softinput");
8
+ AvoidSoftInput = avoidSoftInputPackage.AvoidSoftInput;
9
+ AvoidSoftInputView = avoidSoftInputPackage.AvoidSoftInputView;
10
+ }
11
+ catch (_) {
12
+ console.warn("`react-native-avoid-softinput` is not installed, falling back to `View`. No keyboard avoiding capabilties will be used.");
13
+ }
3
14
  const AvoidKeyboardView = ({ onKeyboardHidden, onKeyboardShown, ...rest }) => {
4
15
  React.useEffect(() => {
5
- AvoidSoftInput.setShouldMimicIOSBehavior(true);
16
+ if (AvoidSoftInput) {
17
+ AvoidSoftInput.setShouldMimicIOSBehavior(true);
18
+ }
6
19
  return () => {
7
- AvoidSoftInput.setShouldMimicIOSBehavior(false);
20
+ if (AvoidSoftInput) {
21
+ AvoidSoftInput.setShouldMimicIOSBehavior(false);
22
+ }
8
23
  };
9
24
  }, []);
10
- return (React.createElement(AvoidSoftInputView, { onSoftInputHidden: onKeyboardHidden, onSoftInputShown: onKeyboardShown, ...rest }));
25
+ if (AvoidSoftInputView) {
26
+ return (React.createElement(AvoidSoftInputView, { onSoftInputHidden: onKeyboardHidden, onSoftInputShown: onKeyboardShown, ...rest }));
27
+ }
28
+ else {
29
+ return React.createElement(View, { ...rest });
30
+ }
11
31
  };
12
32
  export default AvoidKeyboardView;
13
33
  //# sourceMappingURL=AvoidKeyboardView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvoidKeyboardView.js","sourceRoot":"","sources":["AvoidKeyboardView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,kBAAkB,GAEnB,MAAM,8BAA8B,CAAC;AAiBtC,MAAM,iBAAiB,GAAqC,CAAC,EAC3D,gBAAgB,EAChB,eAAe,EACf,GAAG,IAAI,EACR,EAAE,EAAE;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,cAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE;YACV,cAAc,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,oBAAC,kBAAkB,IACjB,iBAAiB,EAAE,gBAAgB,EACnC,gBAAgB,EAAE,eAAe,KAC7B,IAAI,GACR,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"AvoidKeyboardView.js","sourceRoot":"","sources":["AvoidKeyboardView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAOpC,iJAAiJ;AACjJ,IAAI,cAAc,GAAqC,IAAI,CAAC;AAC5D,IAAI,kBAAkB,GAAyC,IAAI,CAAC;AAEpE,IAAI;IACF,MAAM,qBAAqB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IACtE,cAAc,GAAG,qBAAqB,CAAC,cAAc,CAAC;IACtD,kBAAkB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC;CAC/D;AAAC,OAAO,CAAC,EAAE;IACV,OAAO,CAAC,IAAI,CACV,yHAAyH,CAC1H,CAAC;CACH;AAiBD,MAAM,iBAAiB,GAAqC,CAAC,EAC3D,gBAAgB,EAChB,eAAe,EACf,GAAG,IAAI,EACR,EAAE,EAAE;IACH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,cAAc,EAAE;YAClB,cAAc,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;SAChD;QACD,OAAO,GAAG,EAAE;YACV,IAAI,cAAc,EAAE;gBAClB,cAAc,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC;aACjD;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,kBAAkB,EAAE;QACtB,OAAO,CACL,oBAAC,kBAAkB,IACjB,iBAAiB,EAAE,gBAAgB,EACnC,gBAAgB,EAAE,eAAe,KAC7B,IAAI,GACR,CACH,CAAC;KACH;SAAM;QACL,OAAO,oBAAC,IAAI,OAAK,IAAI,GAAI,CAAC;KAC3B;AACH,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -1,10 +1,25 @@
1
1
  import React from "react";
2
- import {
3
- AvoidSoftInput,
4
- AvoidSoftInputView,
2
+ import { View } from "react-native";
3
+ import type {
4
+ AvoidSoftInput as AvoidSoftInputType,
5
+ AvoidSoftInputView as AvoidSoftInputViewType,
5
6
  AvoidSoftInputViewProps,
6
7
  } from "react-native-avoid-softinput";
7
8
 
9
+ // `react-native-avoid-softinput` is an optional dependency and there is a possibility that it is not installed resulting in undefined references
10
+ let AvoidSoftInput: typeof AvoidSoftInputType | null = null;
11
+ let AvoidSoftInputView: typeof AvoidSoftInputViewType | null = null;
12
+
13
+ try {
14
+ const avoidSoftInputPackage = require("react-native-avoid-softinput");
15
+ AvoidSoftInput = avoidSoftInputPackage.AvoidSoftInput;
16
+ AvoidSoftInputView = avoidSoftInputPackage.AvoidSoftInputView;
17
+ } catch (_) {
18
+ console.warn(
19
+ "`react-native-avoid-softinput` is not installed, falling back to `View`. No keyboard avoiding capabilties will be used."
20
+ );
21
+ }
22
+
8
23
  /**
9
24
  * Requires additional setup: https://mateusz1913.github.io/react-native-avoid-softinput/docs/guides
10
25
  * Cannot be used with Expo Go
@@ -26,19 +41,27 @@ const AvoidKeyboardView: React.FC<AvoidKeyboardViewProps> = ({
26
41
  ...rest
27
42
  }) => {
28
43
  React.useEffect(() => {
29
- AvoidSoftInput.setShouldMimicIOSBehavior(true);
44
+ if (AvoidSoftInput) {
45
+ AvoidSoftInput.setShouldMimicIOSBehavior(true);
46
+ }
30
47
  return () => {
31
- AvoidSoftInput.setShouldMimicIOSBehavior(false);
48
+ if (AvoidSoftInput) {
49
+ AvoidSoftInput.setShouldMimicIOSBehavior(false);
50
+ }
32
51
  };
33
52
  }, []);
34
53
 
35
- return (
36
- <AvoidSoftInputView
37
- onSoftInputHidden={onKeyboardHidden}
38
- onSoftInputShown={onKeyboardShown}
39
- {...rest}
40
- />
41
- );
54
+ if (AvoidSoftInputView) {
55
+ return (
56
+ <AvoidSoftInputView
57
+ onSoftInputHidden={onKeyboardHidden}
58
+ onSoftInputShown={onKeyboardShown}
59
+ {...rest}
60
+ />
61
+ );
62
+ } else {
63
+ return <View {...rest} />;
64
+ }
42
65
  };
43
66
 
44
67
  export default AvoidKeyboardView;