@draftbit/core 46.7.9-d12897.2 → 46.7.9-e67976.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/lib/commonjs/components/DatePicker/DatePicker.js +14 -1
- package/lib/commonjs/components/Divider.js +14 -1
- package/lib/commonjs/components/Elevation.js +14 -2
- package/lib/commonjs/components/Picker/Picker.js +10 -3
- package/lib/commonjs/index.js +0 -13
- package/lib/commonjs/mappings/DatePicker.js +8 -2
- package/lib/commonjs/mappings/Picker.js +5 -0
- package/lib/module/components/DatePicker/DatePicker.js +15 -2
- package/lib/module/components/Picker/Picker.js +11 -4
- package/lib/module/index.js +0 -1
- package/lib/module/mappings/DatePicker.js +9 -3
- package/lib/module/mappings/Picker.js +6 -1
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts +1 -0
- package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts +1 -0
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/mappings/DatePicker.d.ts +10 -0
- package/lib/typescript/src/mappings/DatePicker.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Picker.d.ts +10 -0
- package/lib/typescript/src/mappings/Picker.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/components/DatePicker/DatePicker.js +8 -3
- package/src/components/DatePicker/DatePicker.tsx +10 -1
- package/src/components/Picker/Picker.js +9 -3
- package/src/components/Picker/Picker.tsx +14 -2
- package/src/index.js +0 -1
- package/src/index.tsx +0 -2
- package/src/mappings/DatePicker.js +8 -2
- package/src/mappings/DatePicker.ts +8 -1
- package/src/mappings/Picker.js +6 -1
- package/src/mappings/Picker.ts +6 -0
- package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +0 -74
- package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +0 -35
- package/lib/commonjs/components/DeckSwiper/index.js +0 -20
- package/lib/commonjs/mappings/DeckSwiper.js +0 -52
- package/lib/commonjs/mappings/DeckSwiperCard.js +0 -16
- package/lib/module/components/DeckSwiper/DeckSwiper.js +0 -66
- package/lib/module/components/DeckSwiper/DeckSwiperCard.js +0 -27
- package/lib/module/components/DeckSwiper/index.js +0 -2
- package/lib/module/mappings/DeckSwiper.js +0 -45
- package/lib/module/mappings/DeckSwiperCard.js +0 -9
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts +0 -15
- package/lib/typescript/src/components/DeckSwiper/DeckSwiper.d.ts.map +0 -1
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts +0 -13
- package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +0 -1
- package/lib/typescript/src/components/DeckSwiper/index.d.ts +0 -3
- package/lib/typescript/src/components/DeckSwiper/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/DeckSwiper.d.ts +0 -83
- package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +0 -1
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +0 -9
- package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +0 -1
- package/src/components/DeckSwiper/DeckSwiper.js +0 -35
- package/src/components/DeckSwiper/DeckSwiper.tsx +0 -94
- package/src/components/DeckSwiper/DeckSwiperCard.js +0 -22
- package/src/components/DeckSwiper/DeckSwiperCard.tsx +0 -42
- package/src/components/DeckSwiper/index.js +0 -2
- package/src/components/DeckSwiper/index.tsx +0 -2
- package/src/mappings/DeckSwiper.js +0 -45
- package/src/mappings/DeckSwiper.ts +0 -54
- package/src/mappings/DeckSwiperCard.js +0 -9
- package/src/mappings/DeckSwiperCard.ts +0 -13
|
@@ -48,6 +48,7 @@ const DatePicker = _ref => {
|
|
|
48
48
|
placeholder,
|
|
49
49
|
borderColor: inputBorderColor,
|
|
50
50
|
borderColorActive: inputBorderColorActive,
|
|
51
|
+
autoDismissKeyboard = true,
|
|
51
52
|
...props
|
|
52
53
|
} = _ref;
|
|
53
54
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -143,6 +144,11 @@ const DatePicker = _ref => {
|
|
|
143
144
|
clearTimeout(_showPlaceholder());
|
|
144
145
|
};
|
|
145
146
|
}, [focused, label, placeholder]);
|
|
147
|
+
React.useEffect(() => {
|
|
148
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
149
|
+
_reactNative.Keyboard.dismiss();
|
|
150
|
+
}
|
|
151
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
146
152
|
const _handleFocus = () => {
|
|
147
153
|
if (disabled) {
|
|
148
154
|
return;
|
|
@@ -160,7 +166,14 @@ const DatePicker = _ref => {
|
|
|
160
166
|
const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
|
|
161
167
|
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
162
168
|
const hasActiveOutline = focused;
|
|
163
|
-
let inputTextColor,
|
|
169
|
+
let inputTextColor,
|
|
170
|
+
activeColor,
|
|
171
|
+
underlineColor,
|
|
172
|
+
borderColor = inputBorderColor,
|
|
173
|
+
placeholderColor,
|
|
174
|
+
containerStyle,
|
|
175
|
+
backgroundColor,
|
|
176
|
+
inputStyle;
|
|
164
177
|
inputTextColor = colors.strong;
|
|
165
178
|
if (disabled) {
|
|
166
179
|
activeColor = colors.light;
|
|
@@ -9,7 +9,6 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
var _theming = require("../theming");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
12
|
const Divider = _ref => {
|
|
14
13
|
let {
|
|
15
14
|
style,
|
|
@@ -19,6 +18,20 @@ const Divider = _ref => {
|
|
|
19
18
|
},
|
|
20
19
|
...rest
|
|
21
20
|
} = _ref;
|
|
21
|
+
return /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
22
|
+
style: [{
|
|
23
|
+
backgroundColor: color || colors.divider,
|
|
24
|
+
height: _reactNative.StyleSheet.hairlineWidth
|
|
25
|
+
}, style],
|
|
26
|
+
...rest
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
var _default = (0, _theming.withTheme)(Divider);
|
|
30
|
+
exports.default = _default;eme: {
|
|
31
|
+
colors
|
|
32
|
+
},
|
|
33
|
+
...rest
|
|
34
|
+
} = _ref;
|
|
22
35
|
return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
|
|
23
36
|
style: [{
|
|
24
37
|
backgroundColor: color || colors.divider,
|
|
@@ -11,7 +11,6 @@ var _theming = require("../theming");
|
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
13
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
15
14
|
/* directly copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx#L62 */
|
|
16
15
|
const Elevation = _ref => {
|
|
17
16
|
let {
|
|
@@ -28,11 +27,24 @@ const Elevation = _ref => {
|
|
|
28
27
|
colors
|
|
29
28
|
} = theme;
|
|
30
29
|
const borderRadius = radius;
|
|
31
|
-
return /*#__PURE__*/React.createElement(_reactNative.Animated.View,
|
|
30
|
+
return /*#__PURE__*/React.createElement(_reactNative.Animated.View, {
|
|
31
|
+
...rest,
|
|
32
32
|
style: [{
|
|
33
33
|
borderRadius,
|
|
34
34
|
backgroundColor: colors.surface
|
|
35
35
|
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
36
|
+
}, /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
37
|
+
style: {
|
|
38
|
+
overflow: "hidden",
|
|
39
|
+
borderRadius
|
|
40
|
+
}
|
|
41
|
+
}, children));
|
|
42
|
+
};
|
|
43
|
+
var _default = (0, _theming.withTheme)(Elevation);
|
|
44
|
+
exports.default = _default;
|
|
45
|
+
borderRadius,
|
|
46
|
+
backgroundColor: colors.surface
|
|
47
|
+
}, elevation ? (0, _shadow.default)(elevation) : null, style]
|
|
36
48
|
}), /*#__PURE__*/React.createElement(_reactNative.View, {
|
|
37
49
|
style: {
|
|
38
50
|
overflow: "hidden",
|
|
@@ -42,6 +42,7 @@ const {
|
|
|
42
42
|
height: deviceHeight
|
|
43
43
|
} = _reactNative.Dimensions.get("screen");
|
|
44
44
|
const isIos = _reactNative.Platform.OS === "ios";
|
|
45
|
+
const isWeb = _reactNative.Platform.OS === "web";
|
|
45
46
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
46
47
|
const disabledColor = "rgb(240, 240, 240)";
|
|
47
48
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -65,7 +66,8 @@ const Picker = _ref => {
|
|
|
65
66
|
leftIconName,
|
|
66
67
|
placeholderTextColor = unstyledColor,
|
|
67
68
|
rightIconName,
|
|
68
|
-
type = "solid"
|
|
69
|
+
type = "solid",
|
|
70
|
+
autoDismissKeyboard = true
|
|
69
71
|
} = _ref;
|
|
70
72
|
const androidPickerRef = React.useRef(undefined);
|
|
71
73
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -89,6 +91,11 @@ const Picker = _ref => {
|
|
|
89
91
|
androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
|
|
90
92
|
}
|
|
91
93
|
}, [pickerVisible, androidPickerRef]);
|
|
94
|
+
React.useEffect(() => {
|
|
95
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
96
|
+
_reactNative.Keyboard.dismiss();
|
|
97
|
+
}
|
|
98
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
92
99
|
const normalizedOptions = normalizeOptions(options);
|
|
93
100
|
const pickerOptions = placeholder ? [{
|
|
94
101
|
value: placeholder,
|
|
@@ -233,8 +240,8 @@ const Picker = _ref => {
|
|
|
233
240
|
label: option.label,
|
|
234
241
|
value: option.value,
|
|
235
242
|
key: option.value
|
|
236
|
-
})))))) : null, !isIos && pickerVisible ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
237
|
-
enabled:
|
|
243
|
+
})))))) : null, !isIos && (pickerVisible || isWeb) ? /*#__PURE__*/React.createElement(_picker.Picker, {
|
|
244
|
+
enabled: !disabled,
|
|
238
245
|
selectedValue: internalValue,
|
|
239
246
|
onValueChange: handleValueChange,
|
|
240
247
|
style: styles.nonIosPicker,
|
package/lib/commonjs/index.js
CHANGED
|
@@ -123,18 +123,6 @@ Object.defineProperty(exports, "DatePicker", {
|
|
|
123
123
|
return _DatePicker.default;
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
|
-
Object.defineProperty(exports, "DeckSwiper", {
|
|
127
|
-
enumerable: true,
|
|
128
|
-
get: function () {
|
|
129
|
-
return _DeckSwiper.DeckSwiper;
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
Object.defineProperty(exports, "DeckSwiperCard", {
|
|
133
|
-
enumerable: true,
|
|
134
|
-
get: function () {
|
|
135
|
-
return _DeckSwiper.DeckSwiperCard;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
126
|
Object.defineProperty(exports, "DefaultTheme", {
|
|
139
127
|
enumerable: true,
|
|
140
128
|
get: function () {
|
|
@@ -413,7 +401,6 @@ var _ActionSheet = require("./components/ActionSheet");
|
|
|
413
401
|
var _Swiper = require("./components/Swiper");
|
|
414
402
|
var _Layout = require("./components/Layout");
|
|
415
403
|
var _index = require("./components/RadioButton/index");
|
|
416
|
-
var _DeckSwiper = require("./components/DeckSwiper");
|
|
417
404
|
var _DatePicker = _interopRequireDefault(require("./components/DatePicker/DatePicker"));
|
|
418
405
|
var _Picker = _interopRequireDefault(require("./components/Picker/Picker"));
|
|
419
406
|
var _ProgressBar = _interopRequireDefault(require("./components/ProgressBar"));
|
|
@@ -37,7 +37,8 @@ const SEED_DATA_PROPS = {
|
|
|
37
37
|
label: "Border Color"
|
|
38
38
|
}),
|
|
39
39
|
borderColorActive: (0, _types.createColorProp)({
|
|
40
|
-
label: "Border Color"
|
|
40
|
+
label: "Active Border Color",
|
|
41
|
+
description: "Color of border when date picker is active"
|
|
41
42
|
}),
|
|
42
43
|
format: {
|
|
43
44
|
label: "Format",
|
|
@@ -169,7 +170,12 @@ const SEED_DATA = [{
|
|
|
169
170
|
editable: true,
|
|
170
171
|
required: true,
|
|
171
172
|
group: _types.GROUPS.basic
|
|
172
|
-
}
|
|
173
|
+
},
|
|
174
|
+
autoDismissKeyboard: (0, _types.createStaticBoolProp)({
|
|
175
|
+
label: "Auto dismiss keyboard",
|
|
176
|
+
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
177
|
+
defaultValue: true
|
|
178
|
+
})
|
|
173
179
|
}
|
|
174
180
|
}];
|
|
175
181
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -142,6 +142,11 @@ const SEED_DATA = [{
|
|
|
142
142
|
}),
|
|
143
143
|
iconColor: (0, _types.createColorProp)({
|
|
144
144
|
label: "Icon Color"
|
|
145
|
+
}),
|
|
146
|
+
autoDismissKeyboard: (0, _types.createStaticBoolProp)({
|
|
147
|
+
label: "Auto dismiss keyboard",
|
|
148
|
+
description: "Automatically dismiss keyboard when Picker is opened",
|
|
149
|
+
defaultValue: true
|
|
145
150
|
})
|
|
146
151
|
},
|
|
147
152
|
layout: {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput } from "react-native";
|
|
3
|
+
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, Keyboard } from "react-native";
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import dateFormat from "dateformat";
|
|
6
6
|
import { withTheme } from "../../theming";
|
|
@@ -39,6 +39,7 @@ const DatePicker = _ref => {
|
|
|
39
39
|
placeholder,
|
|
40
40
|
borderColor: inputBorderColor,
|
|
41
41
|
borderColorActive: inputBorderColorActive,
|
|
42
|
+
autoDismissKeyboard = true,
|
|
42
43
|
...props
|
|
43
44
|
} = _ref;
|
|
44
45
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
@@ -134,6 +135,11 @@ const DatePicker = _ref => {
|
|
|
134
135
|
clearTimeout(_showPlaceholder());
|
|
135
136
|
};
|
|
136
137
|
}, [focused, label, placeholder]);
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
140
|
+
Keyboard.dismiss();
|
|
141
|
+
}
|
|
142
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
137
143
|
const _handleFocus = () => {
|
|
138
144
|
if (disabled) {
|
|
139
145
|
return;
|
|
@@ -151,7 +157,14 @@ const DatePicker = _ref => {
|
|
|
151
157
|
const MAXIMIZED_LABEL_FONT_SIZE = textStyles.fontSize || typography.subtitle1.fontSize;
|
|
152
158
|
const MINIMIZED_LABEL_FONT_SIZE = labelSize ? labelSize : typography.caption.fontSize;
|
|
153
159
|
const hasActiveOutline = focused;
|
|
154
|
-
let inputTextColor,
|
|
160
|
+
let inputTextColor,
|
|
161
|
+
activeColor,
|
|
162
|
+
underlineColor,
|
|
163
|
+
borderColor = inputBorderColor,
|
|
164
|
+
placeholderColor,
|
|
165
|
+
containerStyle,
|
|
166
|
+
backgroundColor,
|
|
167
|
+
inputStyle;
|
|
155
168
|
inputTextColor = colors.strong;
|
|
156
169
|
if (disabled) {
|
|
157
170
|
activeColor = colors.light;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions } from "react-native";
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions, Keyboard } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -33,6 +33,7 @@ const {
|
|
|
33
33
|
height: deviceHeight
|
|
34
34
|
} = Dimensions.get("screen");
|
|
35
35
|
const isIos = Platform.OS === "ios";
|
|
36
|
+
const isWeb = Platform.OS === "web";
|
|
36
37
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
37
38
|
const disabledColor = "rgb(240, 240, 240)";
|
|
38
39
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -56,7 +57,8 @@ const Picker = _ref => {
|
|
|
56
57
|
leftIconName,
|
|
57
58
|
placeholderTextColor = unstyledColor,
|
|
58
59
|
rightIconName,
|
|
59
|
-
type = "solid"
|
|
60
|
+
type = "solid",
|
|
61
|
+
autoDismissKeyboard = true
|
|
60
62
|
} = _ref;
|
|
61
63
|
const androidPickerRef = React.useRef(undefined);
|
|
62
64
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -80,6 +82,11 @@ const Picker = _ref => {
|
|
|
80
82
|
androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
|
|
81
83
|
}
|
|
82
84
|
}, [pickerVisible, androidPickerRef]);
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
87
|
+
Keyboard.dismiss();
|
|
88
|
+
}
|
|
89
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
83
90
|
const normalizedOptions = normalizeOptions(options);
|
|
84
91
|
const pickerOptions = placeholder ? [{
|
|
85
92
|
value: placeholder,
|
|
@@ -224,8 +231,8 @@ const Picker = _ref => {
|
|
|
224
231
|
label: option.label,
|
|
225
232
|
value: option.value,
|
|
226
233
|
key: option.value
|
|
227
|
-
})))))) : null, !isIos && pickerVisible ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
228
|
-
enabled:
|
|
234
|
+
})))))) : null, !isIos && (pickerVisible || isWeb) ? /*#__PURE__*/React.createElement(NativePicker, {
|
|
235
|
+
enabled: !disabled,
|
|
229
236
|
selectedValue: internalValue,
|
|
230
237
|
onValueChange: handleValueChange,
|
|
231
238
|
style: styles.nonIosPicker,
|
package/lib/module/index.js
CHANGED
|
@@ -31,7 +31,6 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/Ac
|
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup } from "./components/RadioButton/index";
|
|
34
|
-
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
34
|
|
|
36
35
|
/* Deprecated: Fix or Delete! */
|
|
37
36
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, FORM_TYPES, PROP_TYPES, FIELD_NAME, GROUPS, Triggers, StylesPanelSections, createNumberProp, createColorProp, createStaticBoolProp } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
mode: {
|
|
4
4
|
label: "Mode",
|
|
@@ -31,7 +31,8 @@ const SEED_DATA_PROPS = {
|
|
|
31
31
|
label: "Border Color"
|
|
32
32
|
}),
|
|
33
33
|
borderColorActive: createColorProp({
|
|
34
|
-
label: "Border Color"
|
|
34
|
+
label: "Active Border Color",
|
|
35
|
+
description: "Color of border when date picker is active"
|
|
35
36
|
}),
|
|
36
37
|
format: {
|
|
37
38
|
label: "Format",
|
|
@@ -163,6 +164,11 @@ export const SEED_DATA = [{
|
|
|
163
164
|
editable: true,
|
|
164
165
|
required: true,
|
|
165
166
|
group: GROUPS.basic
|
|
166
|
-
}
|
|
167
|
+
},
|
|
168
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
169
|
+
label: "Auto dismiss keyboard",
|
|
170
|
+
description: "Automatically dismiss keyboard when DatePicker is opened",
|
|
171
|
+
defaultValue: true
|
|
172
|
+
})
|
|
167
173
|
}
|
|
168
174
|
}];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, Triggers, GROUPS, FORM_TYPES, PROP_TYPES, FIELD_NAME, createIconSizeProp, createColorProp, StylesPanelSections, createStaticBoolProp } from "@draftbit/types";
|
|
2
2
|
const SEED_DATA_PROPS = {
|
|
3
3
|
label: {
|
|
4
4
|
group: GROUPS.data,
|
|
@@ -136,6 +136,11 @@ export const SEED_DATA = [{
|
|
|
136
136
|
}),
|
|
137
137
|
iconColor: createColorProp({
|
|
138
138
|
label: "Icon Color"
|
|
139
|
+
}),
|
|
140
|
+
autoDismissKeyboard: createStaticBoolProp({
|
|
141
|
+
label: "Auto dismiss keyboard",
|
|
142
|
+
description: "Automatically dismiss keyboard when Picker is opened",
|
|
143
|
+
defaultValue: true
|
|
139
144
|
})
|
|
140
145
|
},
|
|
141
146
|
layout: {}
|
|
@@ -23,6 +23,7 @@ declare type Props = {
|
|
|
23
23
|
rightIconName?: string;
|
|
24
24
|
borderColor?: string;
|
|
25
25
|
borderColorActive?: string;
|
|
26
|
+
autoDismissKeyboard?: boolean;
|
|
26
27
|
} & IconSlot & TextInputProps;
|
|
27
28
|
declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
|
|
28
29
|
theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EACT,SAAS,EACT,cAAc,EAMf,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAStD,aAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,KAAK,EAAE,KAAK,CAAC;IAMb,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,KAAK,IAAI,CAAC;IACrC,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,QAAQ,GACV,cAAc,CAAC;;;;AAsgBjB,wBAAqC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAGV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAAC;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACxB,CAAC;;;;AA2aF,wBAAiC"}
|
|
@@ -31,7 +31,6 @@ export { ActionSheet, ActionSheetItem, ActionSheetCancel, } from "./components/A
|
|
|
31
31
|
export { Swiper, SwiperItem } from "./components/Swiper";
|
|
32
32
|
export { Center, Circle, Square, Row, Stack, Spacer, } from "./components/Layout";
|
|
33
33
|
export { RadioButton, RadioButtonGroup, RadioButtonRow, RadioButtonFieldGroup, } from "./components/RadioButton/index";
|
|
34
|
-
export { DeckSwiper, DeckSwiperCard } from "./components/DeckSwiper";
|
|
35
34
|
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
36
35
|
export { default as Picker } from "./components/Picker/Picker";
|
|
37
36
|
export { default as ProgressBar } from "./components/ProgressBar";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,OAA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AC;AAClE,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -18,6 +18,16 @@ export declare const SEED_DATA: {
|
|
|
18
18
|
required: boolean;
|
|
19
19
|
group: string;
|
|
20
20
|
};
|
|
21
|
+
autoDismissKeyboard: {
|
|
22
|
+
label: string;
|
|
23
|
+
description: string;
|
|
24
|
+
formType: string;
|
|
25
|
+
propType: string;
|
|
26
|
+
defaultValue: boolean;
|
|
27
|
+
editable: boolean;
|
|
28
|
+
required: boolean;
|
|
29
|
+
group: string;
|
|
30
|
+
};
|
|
21
31
|
mode: {
|
|
22
32
|
label: string;
|
|
23
33
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePicker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePicker.ts"],"names":[],"mappings":"AAiKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCrB,CAAC"}
|
|
@@ -40,6 +40,16 @@ export declare const SEED_DATA: {
|
|
|
40
40
|
formType: string;
|
|
41
41
|
propType: string;
|
|
42
42
|
};
|
|
43
|
+
autoDismissKeyboard: {
|
|
44
|
+
label: string;
|
|
45
|
+
description: string;
|
|
46
|
+
formType: string;
|
|
47
|
+
propType: string;
|
|
48
|
+
defaultValue: boolean;
|
|
49
|
+
editable: boolean;
|
|
50
|
+
required: boolean;
|
|
51
|
+
group: string;
|
|
52
|
+
};
|
|
43
53
|
label: {
|
|
44
54
|
group: string;
|
|
45
55
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Picker.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Picker.ts"],"names":[],"mappings":"AA+HA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.7.9-
|
|
3
|
+
"version": "46.7.9-e67976.2+e679764",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -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": "^46.7.9-
|
|
44
|
+
"@draftbit/types": "^46.7.9-e67976.2+e679764",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"lodash.isnumber": "^3.0.3",
|
|
54
54
|
"lodash.omit": "^4.5.0",
|
|
55
55
|
"lodash.tonumber": "^4.0.3",
|
|
56
|
-
"react-native-deck-swiper": "^2.0.12",
|
|
57
56
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
58
57
|
"react-native-svg": "12.3.0",
|
|
59
58
|
"react-native-typography": "^1.4.1",
|
|
@@ -92,5 +91,5 @@
|
|
|
92
91
|
]
|
|
93
92
|
]
|
|
94
93
|
},
|
|
95
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "e679764813b38f028b6898d27fd6b2c967634c9b"
|
|
96
95
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, } from "react-native";
|
|
2
|
+
import { View, Animated, Text, StyleSheet, I18nManager, TextInput as NativeTextInput, Keyboard, } from "react-native";
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import dateFormat from "dateformat";
|
|
5
5
|
import { withTheme } from "../../theming";
|
|
@@ -25,7 +25,7 @@ const MONTHS = [
|
|
|
25
25
|
"November",
|
|
26
26
|
"December",
|
|
27
27
|
];
|
|
28
|
-
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, ...props }) => {
|
|
28
|
+
const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disabledOpacity }, date, onDateChange = () => { }, defaultValue, disabled = false, mode = "date", format, type = "underline", leftIconName, rightIconName, leftIconMode = "inset", label, labelSize, labelColor, placeholder, borderColor: inputBorderColor, borderColorActive: inputBorderColorActive, autoDismissKeyboard = true, ...props }) => {
|
|
29
29
|
const [value, setValue] = React.useState(date || defaultValue);
|
|
30
30
|
React.useEffect(() => {
|
|
31
31
|
if (defaultValue != null) {
|
|
@@ -113,6 +113,11 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
113
113
|
clearTimeout(_showPlaceholder());
|
|
114
114
|
};
|
|
115
115
|
}, [focused, label, placeholder]);
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
118
|
+
Keyboard.dismiss();
|
|
119
|
+
}
|
|
120
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
116
121
|
const _handleFocus = () => {
|
|
117
122
|
if (disabled) {
|
|
118
123
|
return;
|
|
@@ -132,7 +137,7 @@ const DatePicker = ({ Icon, style, theme: { colors, typography, roundness, disab
|
|
|
132
137
|
? labelSize
|
|
133
138
|
: typography.caption.fontSize;
|
|
134
139
|
const hasActiveOutline = focused;
|
|
135
|
-
let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
140
|
+
let inputTextColor, activeColor, underlineColor, borderColor = inputBorderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
|
|
136
141
|
inputTextColor = colors.strong;
|
|
137
142
|
if (disabled) {
|
|
138
143
|
activeColor = colors.light;
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
I18nManager,
|
|
13
13
|
LayoutChangeEvent,
|
|
14
14
|
TextInput as NativeTextInput,
|
|
15
|
+
Keyboard,
|
|
15
16
|
} from "react-native";
|
|
16
17
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
17
18
|
|
|
@@ -55,6 +56,7 @@ type Props = {
|
|
|
55
56
|
rightIconName?: string;
|
|
56
57
|
borderColor?: string;
|
|
57
58
|
borderColorActive?: string;
|
|
59
|
+
autoDismissKeyboard?: boolean;
|
|
58
60
|
} & IconSlot &
|
|
59
61
|
TextInputProps;
|
|
60
62
|
|
|
@@ -93,6 +95,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
93
95
|
placeholder,
|
|
94
96
|
borderColor: inputBorderColor,
|
|
95
97
|
borderColorActive: inputBorderColorActive,
|
|
98
|
+
autoDismissKeyboard = true,
|
|
96
99
|
...props
|
|
97
100
|
}) => {
|
|
98
101
|
const [value, setValue] = React.useState<any>(date || defaultValue);
|
|
@@ -204,6 +207,12 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
204
207
|
};
|
|
205
208
|
}, [focused, label, placeholder]);
|
|
206
209
|
|
|
210
|
+
React.useEffect(() => {
|
|
211
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
212
|
+
Keyboard.dismiss();
|
|
213
|
+
}
|
|
214
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
215
|
+
|
|
207
216
|
const _handleFocus = () => {
|
|
208
217
|
if (disabled) {
|
|
209
218
|
return;
|
|
@@ -232,7 +241,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
|
|
|
232
241
|
let inputTextColor,
|
|
233
242
|
activeColor,
|
|
234
243
|
underlineColor,
|
|
235
|
-
borderColor,
|
|
244
|
+
borderColor = inputBorderColor,
|
|
236
245
|
placeholderColor,
|
|
237
246
|
containerStyle: StyleProp<ViewStyle>,
|
|
238
247
|
backgroundColor,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions, } from "react-native";
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions, Keyboard, } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
@@ -32,10 +32,11 @@ function normalizeOptions(options) {
|
|
|
32
32
|
}
|
|
33
33
|
const { width: deviceWidth, height: deviceHeight } = Dimensions.get("screen");
|
|
34
34
|
const isIos = Platform.OS === "ios";
|
|
35
|
+
const isWeb = Platform.OS === "web";
|
|
35
36
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
36
37
|
const disabledColor = "rgb(240, 240, 240)";
|
|
37
38
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
38
|
-
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", }) => {
|
|
39
|
+
const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style, placeholder, value, disabled = false, assistiveText, label, iconColor = unstyledColor, iconSize = 24, leftIconMode = "inset", leftIconName, placeholderTextColor = unstyledColor, rightIconName, type = "solid", autoDismissKeyboard = true, }) => {
|
|
39
40
|
var _a, _b;
|
|
40
41
|
const androidPickerRef = React.useRef(undefined);
|
|
41
42
|
const [internalValue, setInternalValue] = React.useState(value || defaultValue);
|
|
@@ -59,6 +60,11 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
59
60
|
(_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
60
61
|
}
|
|
61
62
|
}, [pickerVisible, androidPickerRef]);
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
if (pickerVisible && autoDismissKeyboard) {
|
|
65
|
+
Keyboard.dismiss();
|
|
66
|
+
}
|
|
67
|
+
}, [pickerVisible, autoDismissKeyboard]);
|
|
62
68
|
const normalizedOptions = normalizeOptions(options);
|
|
63
69
|
const pickerOptions = placeholder
|
|
64
70
|
? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
|
|
@@ -186,7 +192,7 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
|
|
|
186
192
|
React.createElement(View, { style: styles.iosPickerContent },
|
|
187
193
|
React.createElement(Button, { Icon: Icon, type: "text", onPress: togglePickerVisible, style: styles.iosButton }, "Close"),
|
|
188
194
|
React.createElement(NativePicker, { style: styles.iosNativePicker, selectedValue: internalValue, onValueChange: handleValueChange }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value })))))))) : null,
|
|
189
|
-
!isIos && pickerVisible ? (React.createElement(NativePicker, { enabled:
|
|
195
|
+
!isIos && (pickerVisible || isWeb) ? (React.createElement(NativePicker, { enabled: !disabled, selectedValue: internalValue, onValueChange: handleValueChange, style: styles.nonIosPicker, ref: androidPickerRef, onBlur: () => setPickerVisible(false) }, pickerOptions.map((option) => (React.createElement(NativePicker.Item, { label: option.label, value: option.value, key: option.value }))))) : null));
|
|
190
196
|
};
|
|
191
197
|
const styles = StyleSheet.create({
|
|
192
198
|
marginsContainer: {
|