@draftbit/core 46.7.9-9a1f8c.2 → 46.7.9-9ade8f.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.
@@ -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,14 +166,7 @@ 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,
164
- activeColor,
165
- underlineColor,
166
- borderColor = inputBorderColor,
167
- placeholderColor,
168
- containerStyle,
169
- backgroundColor,
170
- inputStyle;
169
+ let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
171
170
  inputTextColor = colors.strong;
172
171
  if (disabled) {
173
172
  activeColor = colors.light;
@@ -65,7 +65,8 @@ const Picker = _ref => {
65
65
  leftIconName,
66
66
  placeholderTextColor = unstyledColor,
67
67
  rightIconName,
68
- type = "solid"
68
+ type = "solid",
69
+ autoDismissKeyboard = true
69
70
  } = _ref;
70
71
  const androidPickerRef = React.useRef(undefined);
71
72
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
@@ -89,6 +90,11 @@ const Picker = _ref => {
89
90
  androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
90
91
  }
91
92
  }, [pickerVisible, androidPickerRef]);
93
+ React.useEffect(() => {
94
+ if (pickerVisible && autoDismissKeyboard) {
95
+ _reactNative.Keyboard.dismiss();
96
+ }
97
+ }, [pickerVisible, autoDismissKeyboard]);
92
98
  const normalizedOptions = normalizeOptions(options);
93
99
  const pickerOptions = placeholder ? [{
94
100
  value: placeholder,
@@ -37,8 +37,7 @@ const SEED_DATA_PROPS = {
37
37
  label: "Border Color"
38
38
  }),
39
39
  borderColorActive: (0, _types.createColorProp)({
40
- label: "Active Border Color",
41
- description: "Color of border when date picker is active"
40
+ label: "Border Color"
42
41
  }),
43
42
  format: {
44
43
  label: "Format",
@@ -170,7 +169,12 @@ const SEED_DATA = [{
170
169
  editable: true,
171
170
  required: true,
172
171
  group: _types.GROUPS.basic
173
- }
172
+ },
173
+ autoDismissKeyboard: (0, _types.createStaticBoolProp)({
174
+ label: "Auto dismiss keyboard",
175
+ description: "Automatically dismiss keyboard when DatePicker is opened",
176
+ defaultValue: true
177
+ })
174
178
  }
175
179
  }];
176
180
  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,4 +1,3 @@
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
1
  import * as React from "react";
3
2
  import { Animated, Easing } from "react-native";
4
3
  import CircularProgress from "./CircularProgress";
@@ -46,6 +45,19 @@ const AnimatedCircularProgress = _ref => {
46
45
  React.useEffect(() => {
47
46
  animate();
48
47
  }, [fill, animate]);
48
+ return /*#__PURE__*/React.createElement(AnimatedProgress, {
49
+ ...other,
50
+ style: other.style,
51
+ childrenContainerStyle: other.childrenContainerStyle,
52
+ fill: fillAnimation,
53
+ tintColor: animateColor()
54
+ });
55
+ };
56
+ export default AnimatedCircularProgress;imation;
57
+ };
58
+ React.useEffect(() => {
59
+ animate();
60
+ }, [fill, animate]);
49
61
  return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
50
62
  style: other.style,
51
63
  childrenContainerStyle: other.childrenContainerStyle,
@@ -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,14 +157,7 @@ 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,
155
- activeColor,
156
- underlineColor,
157
- borderColor = inputBorderColor,
158
- placeholderColor,
159
- containerStyle,
160
- backgroundColor,
161
- inputStyle;
160
+ let inputTextColor, activeColor, underlineColor, borderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
162
161
  inputTextColor = colors.strong;
163
162
  if (disabled) {
164
163
  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";
@@ -56,7 +56,8 @@ const Picker = _ref => {
56
56
  leftIconName,
57
57
  placeholderTextColor = unstyledColor,
58
58
  rightIconName,
59
- type = "solid"
59
+ type = "solid",
60
+ autoDismissKeyboard = true
60
61
  } = _ref;
61
62
  const androidPickerRef = React.useRef(undefined);
62
63
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
@@ -80,6 +81,11 @@ const Picker = _ref => {
80
81
  androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
81
82
  }
82
83
  }, [pickerVisible, androidPickerRef]);
84
+ React.useEffect(() => {
85
+ if (pickerVisible && autoDismissKeyboard) {
86
+ Keyboard.dismiss();
87
+ }
88
+ }, [pickerVisible, autoDismissKeyboard]);
83
89
  const normalizedOptions = normalizeOptions(options);
84
90
  const pickerOptions = placeholder ? [{
85
91
  value: placeholder,
@@ -6,4 +6,5 @@ const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.C
6
6
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
7
7
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
8
8
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
9
+ });O : 0
9
10
  });
@@ -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,8 +31,7 @@ const SEED_DATA_PROPS = {
31
31
  label: "Border Color"
32
32
  }),
33
33
  borderColorActive: createColorProp({
34
- label: "Active Border Color",
35
- description: "Color of border when date picker is active"
34
+ label: "Border Color"
36
35
  }),
37
36
  format: {
38
37
  label: "Format",
@@ -164,6 +163,11 @@ export const SEED_DATA = [{
164
163
  editable: true,
165
164
  required: true,
166
165
  group: GROUPS.basic
167
- }
166
+ },
167
+ autoDismissKeyboard: createStaticBoolProp({
168
+ label: "Auto dismiss keyboard",
169
+ description: "Automatically dismiss keyboard when DatePicker is opened",
170
+ defaultValue: true
171
+ })
168
172
  }
169
173
  }];
@@ -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,EAKf,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,YA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,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"}
@@ -26,6 +26,7 @@ export declare type PickerProps = {
26
26
  placeholderTextColor?: string;
27
27
  rightIconName?: string;
28
28
  type?: "solid" | "underline";
29
+ autoDismissKeyboard?: boolean;
29
30
  theme: Theme;
30
31
  Icon: IconSlot["Icon"];
31
32
  };
@@ -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,EAEV,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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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;;;;AAuaF,wBAAiC"}
@@ -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":"AAgKA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BrB,CAAC"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/mappings/DatePicker.ts"],"names":[],"mappings":"AAgKA,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":"AA8HA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCrB,CAAC"}
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-9a1f8c.2+9a1f8c6",
3
+ "version": "46.7.9-9ade8f.2+9ade8fc",
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-9a1f8c.2+9a1f8c6",
44
+ "@draftbit/types": "^46.7.9-9ade8f.2+9ade8fc",
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",
@@ -91,5 +91,5 @@
91
91
  ]
92
92
  ]
93
93
  },
94
- "gitHead": "9a1f8c61263c43031edbf650cefccb40ac43ab4d"
94
+ "gitHead": "9ade8fc93de8d4203db4b4a34a7cf2cc6618bcc2"
95
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 = inputBorderColor, placeholderColor, containerStyle, backgroundColor, inputStyle;
140
+ let inputTextColor, activeColor, underlineColor, borderColor, 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 = inputBorderColor,
244
+ borderColor,
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";
@@ -35,7 +35,7 @@ const isIos = Platform.OS === "ios";
35
35
  const unstyledColor = "rgba(165, 173, 183, 1)";
36
36
  const disabledColor = "rgb(240, 240, 240)";
37
37
  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", }) => {
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", autoDismissKeyboard = true, }) => {
39
39
  var _a, _b;
40
40
  const androidPickerRef = React.useRef(undefined);
41
41
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
@@ -59,6 +59,11 @@ const Picker = ({ error, options = [], onValueChange, defaultValue, Icon, style,
59
59
  (_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
60
60
  }
61
61
  }, [pickerVisible, androidPickerRef]);
62
+ React.useEffect(() => {
63
+ if (pickerVisible && autoDismissKeyboard) {
64
+ Keyboard.dismiss();
65
+ }
66
+ }, [pickerVisible, autoDismissKeyboard]);
62
67
  const normalizedOptions = normalizeOptions(options);
63
68
  const pickerOptions = placeholder
64
69
  ? [{ value: placeholder, label: placeholder }, ...normalizedOptions]
@@ -7,6 +7,7 @@ import {
7
7
  ViewStyle,
8
8
  StyleProp,
9
9
  Dimensions,
10
+ Keyboard,
10
11
  } from "react-native";
11
12
  import { omit, pickBy, identity, isObject } from "lodash";
12
13
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -48,6 +49,7 @@ export type PickerProps = {
48
49
  placeholderTextColor?: string;
49
50
  rightIconName?: string;
50
51
  type?: "solid" | "underline";
52
+ autoDismissKeyboard?: boolean;
51
53
  theme: Theme;
52
54
  Icon: IconSlot["Icon"];
53
55
  };
@@ -107,13 +109,13 @@ const Picker: React.FC<PickerProps> = ({
107
109
  placeholderTextColor = unstyledColor,
108
110
  rightIconName,
109
111
  type = "solid",
112
+ autoDismissKeyboard = true,
110
113
  }) => {
111
114
  const androidPickerRef = React.useRef<any | undefined>(undefined);
112
115
 
113
116
  const [internalValue, setInternalValue] = React.useState<string | undefined>(
114
117
  value || defaultValue
115
118
  );
116
-
117
119
  const [pickerVisible, setPickerVisible] = React.useState(false);
118
120
 
119
121
  const togglePickerVisible = () => {
@@ -138,6 +140,12 @@ const Picker: React.FC<PickerProps> = ({
138
140
  }
139
141
  }, [pickerVisible, androidPickerRef]);
140
142
 
143
+ React.useEffect(() => {
144
+ if (pickerVisible && autoDismissKeyboard) {
145
+ Keyboard.dismiss();
146
+ }
147
+ }, [pickerVisible, autoDismissKeyboard]);
148
+
141
149
  const normalizedOptions = normalizeOptions(options);
142
150
 
143
151
  const pickerOptions = placeholder
@@ -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,8 +31,7 @@ const SEED_DATA_PROPS = {
31
31
  label: "Border Color",
32
32
  }),
33
33
  borderColorActive: createColorProp({
34
- label: "Active Border Color",
35
- description: "Color of border when date picker is active",
34
+ label: "Border Color",
36
35
  }),
37
36
  format: {
38
37
  label: "Format",
@@ -172,6 +171,11 @@ export const SEED_DATA = [
172
171
  required: true,
173
172
  group: GROUPS.basic,
174
173
  },
174
+ autoDismissKeyboard: createStaticBoolProp({
175
+ label: "Auto dismiss keyboard",
176
+ description: "Automatically dismiss keyboard when DatePicker is opened",
177
+ defaultValue: true,
178
+ }),
175
179
  },
176
180
  },
177
181
  ];
@@ -8,6 +8,7 @@ import {
8
8
  StylesPanelSections,
9
9
  createNumberProp,
10
10
  createColorProp,
11
+ createStaticBoolProp,
11
12
  } from "@draftbit/types";
12
13
 
13
14
  const SEED_DATA_PROPS = {
@@ -42,8 +43,7 @@ const SEED_DATA_PROPS = {
42
43
  label: "Border Color",
43
44
  }),
44
45
  borderColorActive: createColorProp({
45
- label: "Active Border Color",
46
- description: "Color of border when date picker is active",
46
+ label: "Border Color",
47
47
  }),
48
48
  format: {
49
49
  label: "Format",
@@ -186,6 +186,11 @@ export const SEED_DATA = [
186
186
  required: true,
187
187
  group: GROUPS.basic,
188
188
  },
189
+ autoDismissKeyboard: createStaticBoolProp({
190
+ label: "Auto dismiss keyboard",
191
+ description: "Automatically dismiss keyboard when DatePicker is opened",
192
+ defaultValue: true,
193
+ }),
189
194
  },
190
195
  },
191
196
  ];
@@ -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,
@@ -142,6 +142,11 @@ export const SEED_DATA = [
142
142
  },
143
143
  iconSize: createIconSizeProp({ defaultValue: 24 }),
144
144
  iconColor: createColorProp({ label: "Icon Color" }),
145
+ autoDismissKeyboard: createStaticBoolProp({
146
+ label: "Auto dismiss keyboard",
147
+ description: "Automatically dismiss keyboard when Picker is opened",
148
+ defaultValue: true,
149
+ }),
145
150
  },
146
151
  layout: {},
147
152
  },
@@ -8,6 +8,7 @@ import {
8
8
  createIconSizeProp,
9
9
  createColorProp,
10
10
  StylesPanelSections,
11
+ createStaticBoolProp,
11
12
  } from "@draftbit/types";
12
13
 
13
14
  const SEED_DATA_PROPS = {
@@ -157,6 +158,11 @@ export const SEED_DATA = [
157
158
  },
158
159
  iconSize: createIconSizeProp({ defaultValue: 24 }),
159
160
  iconColor: createColorProp({ label: "Icon Color" }),
161
+ autoDismissKeyboard: createStaticBoolProp({
162
+ label: "Auto dismiss keyboard",
163
+ description: "Automatically dismiss keyboard when Picker is opened",
164
+ defaultValue: true,
165
+ }),
160
166
  },
161
167
  layout: {},
162
168
  },