@draftbit/core 48.4.9-85e6e7.2 → 48.4.9-a58004.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/Picker/PickerInputContainer.js +1 -1
- package/lib/commonjs/components/Picker/dropdown/DropDownPicker.js +1 -0
- package/lib/commonjs/components/Picker/dropdown/MultiSelectPicker.js +1 -0
- package/lib/commonjs/components/Picker/index.js +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/typescript/src/components/Picker/NativePicker.d.ts +2 -2
- package/lib/typescript/src/components/Picker/NativePicker.js +1 -1
- package/lib/typescript/src/components/Picker/NativePicker.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerCommon.d.ts +25 -2
- package/lib/typescript/src/components/Picker/PickerCommon.js.map +1 -1
- package/lib/typescript/src/components/Picker/PickerInputContainer.d.ts +1 -1
- package/lib/typescript/src/components/Picker/PickerInputContainer.js +16 -5
- package/lib/typescript/src/components/Picker/PickerInputContainer.js.map +1 -1
- package/lib/typescript/src/components/Picker/dropdown/DropDownPicker.d.ts +6 -0
- package/lib/typescript/src/components/Picker/dropdown/DropDownPicker.js +44 -0
- package/lib/typescript/src/components/Picker/dropdown/DropDownPicker.js.map +1 -0
- package/lib/typescript/src/components/Picker/dropdown/MultiSelectPicker.d.ts +6 -0
- package/lib/typescript/src/components/Picker/dropdown/MultiSelectPicker.js +9 -0
- package/lib/typescript/src/components/Picker/dropdown/MultiSelectPicker.js.map +1 -0
- package/lib/typescript/src/components/Picker/index.d.ts +6 -4
- package/lib/typescript/src/components/Picker/index.js +6 -3
- package/lib/typescript/src/components/Picker/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.js +1 -1
- package/lib/typescript/src/index.js.map +1 -1
- package/lib/typescript/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/Picker/NativePicker.js +1 -1
- package/src/components/Picker/NativePicker.js.map +1 -1
- package/src/components/Picker/NativePicker.tsx +6 -2
- package/src/components/Picker/PickerCommon.js.map +1 -1
- package/src/components/Picker/PickerCommon.ts +28 -2
- package/src/components/Picker/PickerInputContainer.js +16 -5
- package/src/components/Picker/PickerInputContainer.js.map +1 -1
- package/src/components/Picker/PickerInputContainer.tsx +17 -8
- package/src/components/Picker/dropdown/DropDownPicker.js +44 -0
- package/src/components/Picker/dropdown/DropDownPicker.js.map +1 -0
- package/src/components/Picker/dropdown/DropDownPicker.tsx +122 -0
- package/src/components/Picker/dropdown/MultiSelectPicker.js +9 -0
- package/src/components/Picker/dropdown/MultiSelectPicker.js.map +1 -0
- package/src/components/Picker/dropdown/MultiSelectPicker.tsx +16 -0
- package/src/components/Picker/index.js +6 -3
- package/src/components/Picker/index.js.map +1 -1
- package/src/components/Picker/index.tsx +8 -5
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/index.tsx +1 -1
- package/lib/commonjs/components/Picker/DropDownPicker.js +0 -1
- package/lib/typescript/src/components/Picker/DropDownPicker.d.ts +0 -4
- package/lib/typescript/src/components/Picker/DropDownPicker.js +0 -27
- package/lib/typescript/src/components/Picker/DropDownPicker.js.map +0 -1
- package/src/components/Picker/DropDownPicker.js +0 -27
- package/src/components/Picker/DropDownPicker.js.map +0 -1
- package/src/components/Picker/DropDownPicker.tsx +0 -66
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { Keyboard } from "react-native";
|
|
3
|
-
import { useDeepCompareEffect, useDeepCompareMemo } from "../../utilities";
|
|
4
|
-
import { CommonPickerProps, normalizeToPickerOptions } from "./PickerCommon";
|
|
5
|
-
import PickerInputContainer from "./PickerInputContainer";
|
|
6
|
-
import DropDownPickerComponent from "react-native-dropdown-picker";
|
|
7
|
-
|
|
8
|
-
const DropDownPicker: React.FC<CommonPickerProps> = ({
|
|
9
|
-
options: optionsProp = [],
|
|
10
|
-
onValueChange,
|
|
11
|
-
Icon,
|
|
12
|
-
placeholder,
|
|
13
|
-
value,
|
|
14
|
-
autoDismissKeyboard = true,
|
|
15
|
-
...rest
|
|
16
|
-
}) => {
|
|
17
|
-
const [pickerVisible, setPickerVisible] = React.useState(false);
|
|
18
|
-
const [internalValue, setInternalValue] = React.useState<string | number>();
|
|
19
|
-
|
|
20
|
-
const options = useDeepCompareMemo(
|
|
21
|
-
() =>
|
|
22
|
-
normalizeToPickerOptions(optionsProp).map((option) => ({
|
|
23
|
-
label: option.label.toString(),
|
|
24
|
-
value: option.value,
|
|
25
|
-
})),
|
|
26
|
-
[optionsProp]
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
useDeepCompareEffect(() => {
|
|
30
|
-
onValueChange?.(internalValue || "");
|
|
31
|
-
}, [internalValue, onValueChange]);
|
|
32
|
-
|
|
33
|
-
React.useEffect(() => {
|
|
34
|
-
if (pickerVisible && autoDismissKeyboard) {
|
|
35
|
-
Keyboard.dismiss();
|
|
36
|
-
}
|
|
37
|
-
}, [pickerVisible, autoDismissKeyboard]);
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<PickerInputContainer
|
|
41
|
-
Icon={Icon}
|
|
42
|
-
placeholder={placeholder}
|
|
43
|
-
selectedValue={value}
|
|
44
|
-
options={options}
|
|
45
|
-
onPress={() => setPickerVisible(!pickerVisible)}
|
|
46
|
-
zIndex={pickerVisible ? 100 : undefined} // Guarantees drop down is rendered above all sibling components
|
|
47
|
-
{...rest}
|
|
48
|
-
>
|
|
49
|
-
<DropDownPickerComponent
|
|
50
|
-
open={pickerVisible}
|
|
51
|
-
setOpen={setPickerVisible}
|
|
52
|
-
value={value || null}
|
|
53
|
-
setValue={setInternalValue}
|
|
54
|
-
items={options}
|
|
55
|
-
placeholder={placeholder}
|
|
56
|
-
listMode="SCROLLVIEW"
|
|
57
|
-
style={{ display: "none" }} // This is the style of the input container
|
|
58
|
-
dropDownContainerStyle={{}}
|
|
59
|
-
/>
|
|
60
|
-
</PickerInputContainer>
|
|
61
|
-
);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
// const styles = StyleSheet.create({});
|
|
65
|
-
|
|
66
|
-
export default DropDownPicker;
|