@delacour/react-native-ui 0.6.0-alpha.20261102152426 → 0.6.0-alpha.20261103104147
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": "@delacour/react-native-ui",
|
|
3
|
-
"version": "0.6.0-alpha.
|
|
3
|
+
"version": "0.6.0-alpha.20261103104147",
|
|
4
4
|
"description": "React Native UI components — Uniwind, Reanimated, Gesture Handler",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -181,8 +181,8 @@
|
|
|
181
181
|
"expo-blur": ">=15",
|
|
182
182
|
"@maplibre/maplibre-react-native": "^11.5.0",
|
|
183
183
|
"@central-icons-react-native/round-outlined-radius-1-stroke-1.5": "^1.1",
|
|
184
|
-
"@delacour/react-native-bottom-sheet": "0.6.0-alpha.
|
|
185
|
-
"@delacour/react-native-charts": "0.6.0-alpha.
|
|
184
|
+
"@delacour/react-native-bottom-sheet": "0.6.0-alpha.20261103104147",
|
|
185
|
+
"@delacour/react-native-charts": "0.6.0-alpha.20261103104147",
|
|
186
186
|
"@legendapp/list": ">=3.3",
|
|
187
187
|
"react-native-skia": ">=3.7.3",
|
|
188
188
|
"expo-linear-gradient": ">=15",
|
|
@@ -71,6 +71,7 @@ engine. An app that imports no picker still never resolves it.
|
|
|
71
71
|
disables a chosen row for `maxSelected`, or the selection could not be undone.
|
|
72
72
|
A row disabled by the limit with no description of its own says "Limit
|
|
73
73
|
reached" (`limitReachedText`).
|
|
74
|
+
- **`onClose` is the sheet's, not the state's.** It is passed straight to `BottomSheet` and runs once the sheet has finished sliding down, later than `onValueChange` or the open state turning false. Move focus from here, never from the pick.
|
|
74
75
|
- **Multiple never closes on a pick.** A sticky `Done` footer closes it; every
|
|
75
76
|
close path — a pick, Done, a swipe, the overlay, the close button — runs
|
|
76
77
|
through one `handleOpenChange`, which is where the query is cleared.
|
|
@@ -61,6 +61,14 @@ type SelectBaseProps = {
|
|
|
61
61
|
emptyText?: string;
|
|
62
62
|
/** Where the options open. Only `sheet` today. */
|
|
63
63
|
presentation?: SelectPresentation;
|
|
64
|
+
/** Whether the sheet is open. Pair with `onOpenChange` to control it, for a form that opens the select when focus moves to it. */
|
|
65
|
+
isOpen?: boolean;
|
|
66
|
+
/** Whether the sheet starts open, while `isOpen` is left off. @default false */
|
|
67
|
+
defaultOpen?: boolean;
|
|
68
|
+
/** Called with the sheet's next open state, from a press on the trigger, a pick, or any dismissal. */
|
|
69
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
70
|
+
/** Runs once the sheet has slid fully closed, after any pick or dismissal. */
|
|
71
|
+
onClose?: () => void;
|
|
64
72
|
/** Forwarded to the sheet. Leave it off and the sheet sizes to its rows — or, searchable, opens at its cap and holds it while you type. */
|
|
65
73
|
snapPoints?: BottomSheetProps["snapPoints"];
|
|
66
74
|
/** Custom trigger content for a non-empty selection. */
|
|
@@ -117,6 +125,10 @@ function SelectRoot(props: SelectProps): ReactElement {
|
|
|
117
125
|
isSearchable = false,
|
|
118
126
|
searchPlaceholder = "Search",
|
|
119
127
|
emptyText = "No results",
|
|
128
|
+
onClose,
|
|
129
|
+
isOpen: isOpenProp,
|
|
130
|
+
defaultOpen = false,
|
|
131
|
+
onOpenChange,
|
|
120
132
|
snapPoints,
|
|
121
133
|
renderValue,
|
|
122
134
|
maxLabels,
|
|
@@ -153,20 +165,27 @@ function SelectRoot(props: SelectProps): ReactElement {
|
|
|
153
165
|
value: controlled,
|
|
154
166
|
});
|
|
155
167
|
|
|
156
|
-
const [isOpen, setOpen] =
|
|
168
|
+
const [isOpen, setOpen] = useControllableState<boolean>({
|
|
169
|
+
defaultValue: defaultOpen,
|
|
170
|
+
onChange: onOpenChange,
|
|
171
|
+
value: isOpenProp,
|
|
172
|
+
});
|
|
157
173
|
const [query, setQuery] = useState("");
|
|
158
174
|
const canOpen = !resolvedIsDisabled && !isReadOnly;
|
|
159
175
|
|
|
160
176
|
const open = useCallback(() => {
|
|
161
177
|
if (canOpen) setOpen(true);
|
|
162
|
-
}, [canOpen]);
|
|
178
|
+
}, [canOpen, setOpen]);
|
|
163
179
|
|
|
164
180
|
// One path for every close — a pick, Done, a swipe, the overlay, the close
|
|
165
181
|
// button — and each one clears the search, so the next open starts whole.
|
|
166
|
-
const handleOpenChange = useCallback(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
182
|
+
const handleOpenChange = useCallback(
|
|
183
|
+
(next: boolean) => {
|
|
184
|
+
setOpen(next);
|
|
185
|
+
if (!next) setQuery("");
|
|
186
|
+
},
|
|
187
|
+
[setOpen]
|
|
188
|
+
);
|
|
170
189
|
const close = useCallback(() => handleOpenChange(false), [handleOpenChange]);
|
|
171
190
|
|
|
172
191
|
const maxSelected = multiple?.maxSelected;
|
|
@@ -308,6 +327,7 @@ function SelectRoot(props: SelectProps): ReactElement {
|
|
|
308
327
|
isOpen={isOpen}
|
|
309
328
|
keyboardLiftLimit="maxDynamicContentSize"
|
|
310
329
|
maxDynamicContentSize={sheetMaxHeight}
|
|
330
|
+
onClose={onClose}
|
|
311
331
|
onOpenChange={handleOpenChange}
|
|
312
332
|
snapPoints={snapPoints}
|
|
313
333
|
>
|