@draftbit/core 44.1.11 → 44.1.12-8b7606.4
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/Config.js.map +1 -1
- package/lib/commonjs/components/HeaderMedium.js.map +1 -1
- package/lib/commonjs/components/Layout.js +19 -38
- package/lib/commonjs/components/Layout.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +38 -16
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/mappings/KeyboardAwareScrollView.js +6 -0
- package/lib/commonjs/mappings/KeyboardAwareScrollView.js.map +1 -1
- package/lib/commonjs/mappings/Picker.js +6 -2
- package/lib/commonjs/mappings/Picker.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +38 -11
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/ToggleButton.js +15 -3
- package/lib/module/components/ToggleButton.js.map +1 -1
- package/lib/module/components/Touchable.js +16 -3
- package/lib/module/components/Touchable.js.map +1 -1
- package/lib/module/mappings/Accordion.js.map +1 -1
- package/lib/module/mappings/KeyboardAwareScrollView.js +7 -1
- package/lib/module/mappings/KeyboardAwareScrollView.js.map +1 -1
- package/lib/module/mappings/Picker.js +6 -2
- package/lib/module/mappings/Picker.js.map +1 -1
- package/lib/typescript/src/mappings/KeyboardAwareScrollView.d.ts +11 -0
- package/package.json +2 -2
- package/src/components/Picker/Picker.js +23 -5
- package/src/components/Picker/Picker.tsx +29 -9
- package/src/mappings/KeyboardAwareScrollView.js +7 -1
- package/src/mappings/KeyboardAwareScrollView.ts +8 -0
- package/src/mappings/Picker.js +2 -2
- package/src/mappings/Picker.ts +2 -2
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Platform,
|
|
7
7
|
ViewStyle,
|
|
8
8
|
StyleProp,
|
|
9
|
+
Dimensions,
|
|
9
10
|
} from "react-native";
|
|
10
11
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
11
12
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
@@ -81,6 +82,8 @@ function normalizeOptions(options: PickerProps["options"]): PickerOption[] {
|
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
84
|
|
|
85
|
+
const { width: deviceWidth, height: deviceHeight } = Dimensions.get("screen");
|
|
86
|
+
const isIos = Platform.OS === "ios";
|
|
84
87
|
const unstyledColor = "rgba(165, 173, 183, 1)";
|
|
85
88
|
const disabledColor = "rgb(240, 240, 240)";
|
|
86
89
|
const errorColor = "rgba(255, 69, 100, 1)";
|
|
@@ -106,14 +109,17 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
106
109
|
rightIconName,
|
|
107
110
|
type = "solid",
|
|
108
111
|
}) => {
|
|
112
|
+
const androidPickerRef = React.useRef<any | undefined>(undefined);
|
|
113
|
+
|
|
109
114
|
const [internalValue, setInternalValue] = React.useState<string | undefined>(
|
|
110
115
|
value || defaultValue
|
|
111
116
|
);
|
|
112
117
|
|
|
113
|
-
const [pickerVisible,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
const [pickerVisible, setPickerVisible] = React.useState(false);
|
|
119
|
+
|
|
120
|
+
const togglePickerVisible = () => {
|
|
121
|
+
setPickerVisible(!pickerVisible);
|
|
122
|
+
};
|
|
117
123
|
|
|
118
124
|
React.useEffect(() => {
|
|
119
125
|
if (value != null) {
|
|
@@ -127,6 +133,12 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
127
133
|
}
|
|
128
134
|
}, [defaultValue]);
|
|
129
135
|
|
|
136
|
+
React.useEffect(() => {
|
|
137
|
+
if (pickerVisible && androidPickerRef.current) {
|
|
138
|
+
androidPickerRef?.current?.focus();
|
|
139
|
+
}
|
|
140
|
+
}, [pickerVisible, androidPickerRef]);
|
|
141
|
+
|
|
130
142
|
const normalizedOptions = normalizeOptions(options);
|
|
131
143
|
|
|
132
144
|
const pickerOptions = placeholder
|
|
@@ -193,8 +205,6 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
193
205
|
...extractedMarginStyles,
|
|
194
206
|
};
|
|
195
207
|
|
|
196
|
-
const platform = Platform.OS;
|
|
197
|
-
|
|
198
208
|
const stylesWithoutBordersAndMargins = omit(viewStyles, [
|
|
199
209
|
...borderStyleNames,
|
|
200
210
|
...marginStyleNames,
|
|
@@ -335,7 +345,7 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
335
345
|
</Touchable>
|
|
336
346
|
|
|
337
347
|
{/* iosPicker */}
|
|
338
|
-
{
|
|
348
|
+
{isIos && pickerVisible ? (
|
|
339
349
|
<Portal>
|
|
340
350
|
<View
|
|
341
351
|
style={[
|
|
@@ -374,12 +384,14 @@ const Picker: React.FC<PickerProps> = ({
|
|
|
374
384
|
) : null}
|
|
375
385
|
|
|
376
386
|
{/* nonIosPicker */}
|
|
377
|
-
{
|
|
387
|
+
{!isIos && pickerVisible ? (
|
|
378
388
|
<NativePicker
|
|
379
|
-
enabled={
|
|
389
|
+
enabled={pickerVisible}
|
|
380
390
|
selectedValue={internalValue}
|
|
381
391
|
onValueChange={handleValueChange}
|
|
382
392
|
style={styles.nonIosPicker}
|
|
393
|
+
ref={androidPickerRef}
|
|
394
|
+
onBlur={() => setPickerVisible(false)}
|
|
383
395
|
>
|
|
384
396
|
{(pickerOptions as unknown as PickerOption[]).map((option) => (
|
|
385
397
|
<NativePicker.Item
|
|
@@ -400,6 +412,8 @@ const styles = StyleSheet.create({
|
|
|
400
412
|
marginsContainer: {
|
|
401
413
|
alignSelf: "stretch",
|
|
402
414
|
alignItems: "center",
|
|
415
|
+
width: "100%",
|
|
416
|
+
maxWidth: deviceWidth,
|
|
403
417
|
},
|
|
404
418
|
touchableContainer: {
|
|
405
419
|
flex: 1,
|
|
@@ -436,11 +450,15 @@ const styles = StyleSheet.create({
|
|
|
436
450
|
right: 0,
|
|
437
451
|
flexDirection: "row",
|
|
438
452
|
justifyContent: "center",
|
|
453
|
+
width: "100%",
|
|
454
|
+
maxWidth: deviceWidth,
|
|
455
|
+
maxHeight: deviceHeight,
|
|
439
456
|
},
|
|
440
457
|
iosSafeArea: {
|
|
441
458
|
backgroundColor: "white",
|
|
442
459
|
flexDirection: "column",
|
|
443
460
|
width: "100%",
|
|
461
|
+
maxWidth: deviceWidth,
|
|
444
462
|
},
|
|
445
463
|
iosButton: {
|
|
446
464
|
alignSelf: "flex-end",
|
|
@@ -456,5 +474,7 @@ const styles = StyleSheet.create({
|
|
|
456
474
|
right: 0,
|
|
457
475
|
bottom: 0,
|
|
458
476
|
width: "100%",
|
|
477
|
+
maxWidth: deviceWidth,
|
|
478
|
+
maxHeight: deviceHeight,
|
|
459
479
|
},
|
|
460
480
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createStaticBoolProp, createStaticNumberProp, } from "@draftbit/types";
|
|
1
|
+
import { COMPONENT_TYPES, createStaticBoolProp, createStaticNumberProp, createTextEnumProp, } from "@draftbit/types";
|
|
2
2
|
export const SEED_DATA = {
|
|
3
3
|
name: "Keyboard Aware Scroll View",
|
|
4
4
|
tag: "KeyboardAwareScrollView",
|
|
@@ -39,5 +39,11 @@ export const SEED_DATA = {
|
|
|
39
39
|
description: "Show or hide the vertical scroll indicator",
|
|
40
40
|
defaultValue: true,
|
|
41
41
|
}),
|
|
42
|
+
keyboardShouldPersistTaps: createTextEnumProp({
|
|
43
|
+
label: "Allow Touch Events",
|
|
44
|
+
description: "Allows touch events on visible components to be processed while the keyboard is open",
|
|
45
|
+
defaultValue: "never",
|
|
46
|
+
options: ["never", "always"],
|
|
47
|
+
}),
|
|
42
48
|
},
|
|
43
49
|
};
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
COMPONENT_TYPES,
|
|
3
3
|
createStaticBoolProp,
|
|
4
4
|
createStaticNumberProp,
|
|
5
|
+
createTextEnumProp,
|
|
5
6
|
} from "@draftbit/types";
|
|
6
7
|
|
|
7
8
|
export const SEED_DATA = {
|
|
@@ -49,5 +50,12 @@ export const SEED_DATA = {
|
|
|
49
50
|
description: "Show or hide the vertical scroll indicator",
|
|
50
51
|
defaultValue: true,
|
|
51
52
|
}),
|
|
53
|
+
keyboardShouldPersistTaps: createTextEnumProp({
|
|
54
|
+
label: "Allow Touch Events",
|
|
55
|
+
description:
|
|
56
|
+
"Allows touch events on visible components to be processed while the keyboard is open",
|
|
57
|
+
defaultValue: "never",
|
|
58
|
+
options: ["never", "always"],
|
|
59
|
+
}),
|
|
52
60
|
},
|
|
53
61
|
};
|
package/src/mappings/Picker.js
CHANGED
|
@@ -131,8 +131,8 @@ export const SEED_DATA = [
|
|
|
131
131
|
required: true,
|
|
132
132
|
group: GROUPS.basic,
|
|
133
133
|
},
|
|
134
|
-
iconSize: createIconSizeProp(),
|
|
135
|
-
iconColor: createColorProp(),
|
|
134
|
+
iconSize: createIconSizeProp({ defaultValue: 24 }),
|
|
135
|
+
iconColor: createColorProp({ label: "Icon Color" }),
|
|
136
136
|
},
|
|
137
137
|
layout: {},
|
|
138
138
|
},
|
package/src/mappings/Picker.ts
CHANGED
|
@@ -145,8 +145,8 @@ export const SEED_DATA = [
|
|
|
145
145
|
required: true,
|
|
146
146
|
group: GROUPS.basic,
|
|
147
147
|
},
|
|
148
|
-
iconSize: createIconSizeProp(),
|
|
149
|
-
iconColor: createColorProp(),
|
|
148
|
+
iconSize: createIconSizeProp({ defaultValue: 24 }),
|
|
149
|
+
iconColor: createColorProp({ label: "Icon Color" }),
|
|
150
150
|
},
|
|
151
151
|
layout: {},
|
|
152
152
|
},
|