@delacour/react-native-ui 0.6.0-alpha.20261102152426 → 0.6.0-alpha.20261103132733

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.20261102152426",
3
+ "version": "0.6.0-alpha.20261103132733",
4
4
  "description": "React Native UI components — Uniwind, Reanimated, Gesture Handler",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -181,10 +181,10 @@
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.20261102152426",
185
- "@delacour/react-native-charts": "0.6.0-alpha.20261102152426",
184
+ "@delacour/react-native-bottom-sheet": "0.6.0-alpha.20261103132733",
185
+ "@delacour/react-native-charts": "0.6.0-alpha.20261103132733",
186
186
  "@legendapp/list": ">=3.3",
187
- "react-native-skia": ">=3.7.3",
187
+ "react-native-skia": ">=3.9.0",
188
188
  "expo-linear-gradient": ">=15",
189
189
  "expo-router": ">=57",
190
190
  "react": ">=19",
@@ -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] = useState(false);
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((next: boolean) => {
167
- setOpen(next);
168
- if (!next) setQuery("");
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
  >
@@ -126,8 +126,9 @@ standalone SVG document, or as a PNG.
126
126
  `resolveSignatureExport`, so the same options give the same box, the same
127
127
  literal ink and the same background or none — a PNG is transparent unless
128
128
  `background` is set. It renders the cached stroke paths off screen on a CPU
129
- surface (`Skia.Surface.MakeRaster`) at `scale` pixels per point (default the screen's ratio) and returns
130
- base64 with no `data:` prefix, as `Sketch.toPNG` does. Off screen rather than a
129
+ surface (`Skia.Surface.MakeRaster`) at `scale` pixels per point (default the screen's ratio) and resolves to
130
+ base64 with no `data:` prefix, as `Sketch.toPNG` does — a promise, because
131
+ react-native-skia 3.9 made `encodeToBase64` asynchronous. Off screen rather than a
131
132
  snapshot of the pad, so the guideline, the placeholder and the pad's fill never
132
133
  reach the file. `""` before the pad is measured. The point's `t` is stored so
133
134
  a speed-eased stroke width can follow without a format change.
@@ -69,10 +69,13 @@ function drawSignatureStrokes(canvas: SkCanvas, strokes: readonly SignatureStrok
69
69
  * uses, so the PNG is the SVG rasterised: the same box, the same literal ink,
70
70
  * the same background or none. Off screen rather than a snapshot of the pad, so
71
71
  * the guideline, the placeholder and the pad's own fill never reach the file.
72
- * The strokes are the cached paths the pad draws. Returns `""` when the frame
72
+ * The strokes are the cached paths the pad draws. Resolves to `""` when the frame
73
73
  * has no pixels — an unmeasured pad.
74
74
  */
75
- export function renderSignaturePng(value: SignatureValue, options: SignaturePngOptions & { scale: number }): string {
75
+ export async function renderSignaturePng(
76
+ value: SignatureValue,
77
+ options: SignaturePngOptions & { scale: number }
78
+ ): Promise<string> {
76
79
  const { background, box, strokeColor, strokeWidth } = resolveSignatureExport(value, options);
77
80
  const size = signaturePngSize(box, options.scale);
78
81
  if (size === null) return "";
@@ -369,7 +369,7 @@ function SignatureRoot({
369
369
  *
370
370
  * @example
371
371
  * const svg = pad.current?.toSVG({ viewBox: "tight", background: "#ffffff" });
372
- * const png = pad.current?.toPNG({ viewBox: "tight", background: "#ffffff" }); // base64
372
+ * const png = await pad.current?.toPNG({ viewBox: "tight", background: "#ffffff" }); // base64
373
373
  */
374
374
  export const Signature = Object.assign(SignatureRoot, {
375
375
  /** The drawing surface — the gesture, the ink, the guideline and the accessibility surface. */
@@ -67,11 +67,11 @@ export type SignatureHandle = {
67
67
  /** The signature as a standalone SVG document. Valid, if blank, when empty. */
68
68
  toSVG: (options?: SignatureExportOptions) => string;
69
69
  /**
70
- * The signature as a base64-encoded PNG (no `data:` prefix), framed and
70
+ * Resolves to the signature as a base64-encoded PNG (no `data:` prefix), framed and
71
71
  * coloured as `toSVG` with the same options would be, at `scale` pixels per
72
72
  * point. Transparent unless `background` is set. `""` before the pad is measured.
73
73
  */
74
- toPNG: (options?: SignaturePngOptions) => string;
74
+ toPNG: (options?: SignaturePngOptions) => Promise<string>;
75
75
  /** One smoothed SVG path `d` per stroke, in pad coordinates. */
76
76
  toPaths: () => readonly string[];
77
77
  };
@@ -140,7 +140,8 @@ DisplayNames: `DelacourUI.Sketch`, `.Sketch.Canvas`, `.Toolbar`, `.Tool`,
140
140
  to the canvas times `scale` (default the screen's pixel ratio), by the same
141
141
  `drawSketchItems` the picture records — not a snapshot of the visible canvas,
142
142
  which would need the view mounted and would capture nothing of the background
143
- option. It is synchronous and returns base64 without a `data:` prefix; `""`
143
+ option. It resolves to base64 without a `data:` prefix — asynchronous, because
144
+ react-native-skia 3.9 made `encodeToBase64` return a promise; `""`
144
145
  before the canvas is measured. Saving or sharing it is the app's job.
145
146
 
146
147
  ## Layout
@@ -70,9 +70,9 @@ type SketchPngTarget = SketchArea & { background: string | null; scale: number }
70
70
  *
71
71
  * Off screen rather than a snapshot of the visible canvas, so the file holds the
72
72
  * marks and the background only — never the image being annotated under them —
73
- * matching `toSVG`. Returns `""` before the canvas is measured.
73
+ * matching `toSVG`. Resolves to `""` before the canvas is measured.
74
74
  */
75
- export function renderSketchPng(items: readonly SketchItem[], target: SketchPngTarget): string {
75
+ export async function renderSketchPng(items: readonly SketchItem[], target: SketchPngTarget): Promise<string> {
76
76
  const pixelWidth = Math.round(target.width * target.scale);
77
77
  const pixelHeight = Math.round(target.height * target.scale);
78
78
  if (pixelWidth <= 0 || pixelHeight <= 0) return "";
@@ -26,11 +26,11 @@ export type SketchHandle = {
26
26
  /** Self-contained SVG: the viewBox is the canvas, an optional background rect, masks inlined. */
27
27
  toSVG: (options?: SketchExportOptions) => string;
28
28
  /**
29
- * The drawing as a base64-encoded PNG (no `data:` prefix), the canvas's size
29
+ * Resolves to the drawing as a base64-encoded PNG (no `data:` prefix), the canvas's size
30
30
  * times `scale`. Holds the marks and the background only — never what
31
31
  * `Sketch.Canvas` children paint under them. `""` before the canvas is measured.
32
32
  */
33
- toPNG: (options?: SketchPngOptions) => string;
33
+ toPNG: (options?: SketchPngOptions) => Promise<string>;
34
34
  };
35
35
 
36
36
  /**