@retor/react-native 0.3.4 → 0.3.6

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/dist/index.d.mts CHANGED
@@ -165,16 +165,26 @@ declare const Viewer: React.ForwardRefExoticComponent<ViewerProps & React.RefAtt
165
165
 
166
166
  interface HudProps {
167
167
  children: React.ReactNode;
168
+ /**
169
+ * Maximum top inset for all sheets (in pixels). The sheets won't expand
170
+ * past `screenHeight - topInset`. Use this to leave room for your app's
171
+ * floating header buttons. Defaults to 0 (sheets can extend to the very top).
172
+ *
173
+ * Per-sheet `topInset` props override this default.
174
+ */
175
+ topInset?: number;
168
176
  }
169
177
  /**
170
178
  * Sets up the bottom-sheet provider tree for the SDK's UI components
171
179
  * (`<ProjectSheet>`, `<LineDetailSheet>`, `<AddNoteSheet>`).
172
180
  *
173
- * Place inside `<Viewer>` so the sheets can read scene state from the bridge:
181
+ * Place inside `<Viewer>` so the sheets can read scene state from the bridge.
182
+ * Pass `topInset` to set a global ceiling so the sheets won't overlap your
183
+ * app's floating header buttons.
174
184
  *
175
185
  * ```tsx
176
186
  * <Viewer projectId="...">
177
- * <Hud>
187
+ * <Hud topInset={160}>
178
188
  * <ProjectSheet />
179
189
  * <LineDetailSheet />
180
190
  * <AddNoteSheet />
@@ -182,11 +192,16 @@ interface HudProps {
182
192
  * </Viewer>
183
193
  * ```
184
194
  */
185
- declare function Hud({ children }: HudProps): React.JSX.Element;
195
+ declare function Hud({ children, topInset }: HudProps): React.JSX.Element;
186
196
 
187
197
  interface ProjectSheetProps {
188
198
  /** Snap points. Defaults to ["35%", "75%"]. */
189
199
  snapPoints?: (string | number)[];
200
+ /**
201
+ * Top inset in pixels — the sheet won't expand past `screenHeight - topInset`.
202
+ * Overrides the default set on `<Hud>`.
203
+ */
204
+ topInset?: number;
190
205
  /** Override the default header (project name + description + arrow button). */
191
206
  renderHeader?: (project: {
192
207
  name?: string;
@@ -198,7 +213,7 @@ interface ProjectSheetProps {
198
213
  /**
199
214
  * Browse-mode bottom sheet — auto-presents whenever no line is open.
200
215
  */
201
- declare function ProjectSheet({ snapPoints, renderHeader, children }: ProjectSheetProps): React.JSX.Element;
216
+ declare function ProjectSheet({ snapPoints, topInset, renderHeader, children }: ProjectSheetProps): React.JSX.Element;
202
217
  interface LinesCarouselProps {
203
218
  children: (line: RetorLine, index: number) => React.ReactNode;
204
219
  gap?: number;
@@ -209,12 +224,17 @@ declare function LinesCarousel({ children, gap, paddingHorizontal }: LinesCarous
209
224
  interface LineDetailSheetProps {
210
225
  /** Snap points. Defaults to ["35%", "75%"]. */
211
226
  snapPoints?: (string | number)[];
227
+ /**
228
+ * Top inset in pixels — the sheet won't expand past `screenHeight - topInset`.
229
+ * Overrides the default set on `<Hud>`.
230
+ */
231
+ topInset?: number;
212
232
  /** Override the header. */
213
233
  renderHeader?: (line: RetorLine) => React.ReactNode;
214
234
  /** Custom content (typically a `<LineTagList>`). */
215
235
  children?: React.ReactNode;
216
236
  }
217
- declare function LineDetailSheet({ snapPoints, renderHeader, children }: LineDetailSheetProps): React.JSX.Element;
237
+ declare function LineDetailSheet({ snapPoints, topInset, renderHeader, children }: LineDetailSheetProps): React.JSX.Element;
218
238
  interface LineTagListProps {
219
239
  children: (tag: RetorTag, isActive: boolean) => React.ReactNode;
220
240
  /** Optional header rendered above the list (used internally for the default header). */
@@ -231,6 +251,11 @@ declare function LineTagList({ children, listHeader }: LineTagListProps): React.
231
251
  interface AddNoteSheetProps {
232
252
  /** Snap points. Defaults to ["50%"]. */
233
253
  snapPoints?: (string | number)[];
254
+ /**
255
+ * Top inset in pixels — the sheet won't expand past `screenHeight - topInset`.
256
+ * Overrides the default set on `<Hud>`.
257
+ */
258
+ topInset?: number;
234
259
  /** Max characters allowed. Defaults to 280. */
235
260
  maxLength?: number;
236
261
  /** Placeholder text. */
@@ -251,7 +276,7 @@ interface AddNoteFormApi {
251
276
  * Sheet for adding a note. Auto-presents when `useAddNote().open()` is called.
252
277
  * On submit, fires `onNoteSubmit` on the parent `<Viewer>` with the text + position.
253
278
  */
254
- declare function AddNoteSheet({ snapPoints, maxLength, placeholder, renderForm, }: AddNoteSheetProps): React.JSX.Element;
279
+ declare function AddNoteSheet({ snapPoints, topInset, maxLength, placeholder, renderForm, }: AddNoteSheetProps): React.JSX.Element;
255
280
 
256
281
  interface CoverPhotoProps {
257
282
  projectId: string;
package/dist/index.d.ts CHANGED
@@ -165,16 +165,26 @@ declare const Viewer: React.ForwardRefExoticComponent<ViewerProps & React.RefAtt
165
165
 
166
166
  interface HudProps {
167
167
  children: React.ReactNode;
168
+ /**
169
+ * Maximum top inset for all sheets (in pixels). The sheets won't expand
170
+ * past `screenHeight - topInset`. Use this to leave room for your app's
171
+ * floating header buttons. Defaults to 0 (sheets can extend to the very top).
172
+ *
173
+ * Per-sheet `topInset` props override this default.
174
+ */
175
+ topInset?: number;
168
176
  }
169
177
  /**
170
178
  * Sets up the bottom-sheet provider tree for the SDK's UI components
171
179
  * (`<ProjectSheet>`, `<LineDetailSheet>`, `<AddNoteSheet>`).
172
180
  *
173
- * Place inside `<Viewer>` so the sheets can read scene state from the bridge:
181
+ * Place inside `<Viewer>` so the sheets can read scene state from the bridge.
182
+ * Pass `topInset` to set a global ceiling so the sheets won't overlap your
183
+ * app's floating header buttons.
174
184
  *
175
185
  * ```tsx
176
186
  * <Viewer projectId="...">
177
- * <Hud>
187
+ * <Hud topInset={160}>
178
188
  * <ProjectSheet />
179
189
  * <LineDetailSheet />
180
190
  * <AddNoteSheet />
@@ -182,11 +192,16 @@ interface HudProps {
182
192
  * </Viewer>
183
193
  * ```
184
194
  */
185
- declare function Hud({ children }: HudProps): React.JSX.Element;
195
+ declare function Hud({ children, topInset }: HudProps): React.JSX.Element;
186
196
 
187
197
  interface ProjectSheetProps {
188
198
  /** Snap points. Defaults to ["35%", "75%"]. */
189
199
  snapPoints?: (string | number)[];
200
+ /**
201
+ * Top inset in pixels — the sheet won't expand past `screenHeight - topInset`.
202
+ * Overrides the default set on `<Hud>`.
203
+ */
204
+ topInset?: number;
190
205
  /** Override the default header (project name + description + arrow button). */
191
206
  renderHeader?: (project: {
192
207
  name?: string;
@@ -198,7 +213,7 @@ interface ProjectSheetProps {
198
213
  /**
199
214
  * Browse-mode bottom sheet — auto-presents whenever no line is open.
200
215
  */
201
- declare function ProjectSheet({ snapPoints, renderHeader, children }: ProjectSheetProps): React.JSX.Element;
216
+ declare function ProjectSheet({ snapPoints, topInset, renderHeader, children }: ProjectSheetProps): React.JSX.Element;
202
217
  interface LinesCarouselProps {
203
218
  children: (line: RetorLine, index: number) => React.ReactNode;
204
219
  gap?: number;
@@ -209,12 +224,17 @@ declare function LinesCarousel({ children, gap, paddingHorizontal }: LinesCarous
209
224
  interface LineDetailSheetProps {
210
225
  /** Snap points. Defaults to ["35%", "75%"]. */
211
226
  snapPoints?: (string | number)[];
227
+ /**
228
+ * Top inset in pixels — the sheet won't expand past `screenHeight - topInset`.
229
+ * Overrides the default set on `<Hud>`.
230
+ */
231
+ topInset?: number;
212
232
  /** Override the header. */
213
233
  renderHeader?: (line: RetorLine) => React.ReactNode;
214
234
  /** Custom content (typically a `<LineTagList>`). */
215
235
  children?: React.ReactNode;
216
236
  }
217
- declare function LineDetailSheet({ snapPoints, renderHeader, children }: LineDetailSheetProps): React.JSX.Element;
237
+ declare function LineDetailSheet({ snapPoints, topInset, renderHeader, children }: LineDetailSheetProps): React.JSX.Element;
218
238
  interface LineTagListProps {
219
239
  children: (tag: RetorTag, isActive: boolean) => React.ReactNode;
220
240
  /** Optional header rendered above the list (used internally for the default header). */
@@ -231,6 +251,11 @@ declare function LineTagList({ children, listHeader }: LineTagListProps): React.
231
251
  interface AddNoteSheetProps {
232
252
  /** Snap points. Defaults to ["50%"]. */
233
253
  snapPoints?: (string | number)[];
254
+ /**
255
+ * Top inset in pixels — the sheet won't expand past `screenHeight - topInset`.
256
+ * Overrides the default set on `<Hud>`.
257
+ */
258
+ topInset?: number;
234
259
  /** Max characters allowed. Defaults to 280. */
235
260
  maxLength?: number;
236
261
  /** Placeholder text. */
@@ -251,7 +276,7 @@ interface AddNoteFormApi {
251
276
  * Sheet for adding a note. Auto-presents when `useAddNote().open()` is called.
252
277
  * On submit, fires `onNoteSubmit` on the parent `<Viewer>` with the text + position.
253
278
  */
254
- declare function AddNoteSheet({ snapPoints, maxLength, placeholder, renderForm, }: AddNoteSheetProps): React.JSX.Element;
279
+ declare function AddNoteSheet({ snapPoints, topInset, maxLength, placeholder, renderForm, }: AddNoteSheetProps): React.JSX.Element;
255
280
 
256
281
  interface CoverPhotoProps {
257
282
  projectId: string;
package/dist/index.js CHANGED
@@ -370,8 +370,12 @@ var styles = import_react_native.StyleSheet.create({
370
370
  var import_react3 = __toESM(require("react"));
371
371
  var import_react_native2 = require("react-native");
372
372
  var import_bottom_sheet = require("@gorhom/bottom-sheet");
373
- function Hud({ children }) {
374
- return /* @__PURE__ */ import_react3.default.createElement(import_react_native2.View, { pointerEvents: "box-none", style: import_react_native2.StyleSheet.absoluteFill }, /* @__PURE__ */ import_react3.default.createElement(import_bottom_sheet.BottomSheetModalProvider, null, children));
373
+ var HudContext = (0, import_react3.createContext)({ topInset: 0 });
374
+ function useHudContext() {
375
+ return (0, import_react3.useContext)(HudContext);
376
+ }
377
+ function Hud({ children, topInset = 0 }) {
378
+ return /* @__PURE__ */ import_react3.default.createElement(HudContext.Provider, { value: { topInset } }, /* @__PURE__ */ import_react3.default.createElement(import_react_native2.View, { pointerEvents: "box-none", style: import_react_native2.StyleSheet.absoluteFill }, /* @__PURE__ */ import_react3.default.createElement(import_bottom_sheet.BottomSheetModalProvider, null, children)));
375
379
  }
376
380
 
377
381
  // src/ProjectSheet.tsx
@@ -389,8 +393,20 @@ function BlurBackground({ style }) {
389
393
  }
390
394
 
391
395
  // src/ProjectSheet.tsx
392
- function ProjectSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
396
+ var renderBackdrop = (props) => /* @__PURE__ */ import_react5.default.createElement(
397
+ import_bottom_sheet2.BottomSheetBackdrop,
398
+ {
399
+ ...props,
400
+ appearsOnIndex: 1,
401
+ disappearsOnIndex: 0,
402
+ opacity: 0.4,
403
+ pressBehavior: "collapse"
404
+ }
405
+ );
406
+ function ProjectSheet({ snapPoints = ["35%", "75%"], topInset, renderHeader, children }) {
393
407
  const { project, activeLineId, isAddNoteOpen } = useRetorBridge();
408
+ const { topInset: hudTopInset } = useHudContext();
409
+ const effectiveTopInset = topInset ?? hudTopInset;
394
410
  const sheetRef = (0, import_react5.useRef)(null);
395
411
  const snapPointsArr = (0, import_react5.useMemo)(() => snapPoints, [snapPoints]);
396
412
  const [minimized, setMinimized] = (0, import_react5.useState)(false);
@@ -425,18 +441,10 @@ function ProjectSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
425
441
  enableDismissOnClose: false,
426
442
  enableOverDrag: false,
427
443
  onChange: handleSheetChange,
428
- backdropComponent: (props) => /* @__PURE__ */ import_react5.default.createElement(
429
- import_bottom_sheet2.BottomSheetBackdrop,
430
- {
431
- ...props,
432
- appearsOnIndex: 1,
433
- disappearsOnIndex: 0,
434
- opacity: 0.4,
435
- pressBehavior: "collapse"
436
- }
437
- ),
444
+ backdropComponent: renderBackdrop,
438
445
  handleIndicatorStyle: styles2.handle,
439
- backgroundComponent: BlurBackground
446
+ backgroundComponent: BlurBackground,
447
+ topInset: effectiveTopInset
440
448
  },
441
449
  /* @__PURE__ */ import_react5.default.createElement(import_bottom_sheet2.BottomSheetView, { style: styles2.content }, renderHeader ? renderHeader({ name: project?.name, description: project?.description }) : /* @__PURE__ */ import_react5.default.createElement(import_react_native4.View, { style: styles2.header }, /* @__PURE__ */ import_react5.default.createElement(import_react_native4.View, { style: { flex: 1, minWidth: 0 } }, project?.name && /* @__PURE__ */ import_react5.default.createElement(import_react_native4.Text, { style: styles2.title, numberOfLines: 1 }, project.name), project?.description && /* @__PURE__ */ import_react5.default.createElement(import_react_native4.Text, { style: styles2.subtitle, numberOfLines: 4 }, project.description)), /* @__PURE__ */ import_react5.default.createElement(import_react_native4.Pressable, { style: styles2.iconBtn, onPress: toggleMinimize }, minimized ? /* @__PURE__ */ import_react5.default.createElement(import_lucide_react_native.ArrowUp, { size: 14, color: "rgba(255,255,255,0.6)" }) : /* @__PURE__ */ import_react5.default.createElement(import_lucide_react_native.ArrowDown, { size: 14, color: "rgba(255,255,255,0.6)" }))), children ?? /* @__PURE__ */ import_react5.default.createElement(DefaultLinesCarousel, null))
442
450
  );
@@ -515,8 +523,20 @@ var import_react_native5 = require("react-native");
515
523
  var import_bottom_sheet3 = require("@gorhom/bottom-sheet");
516
524
  var import_react_native_svg = __toESM(require("react-native-svg"));
517
525
  var import_lucide_react_native2 = require("lucide-react-native");
518
- function LineDetailSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
526
+ var renderBackdrop2 = (props) => /* @__PURE__ */ import_react6.default.createElement(
527
+ import_bottom_sheet3.BottomSheetBackdrop,
528
+ {
529
+ ...props,
530
+ appearsOnIndex: 1,
531
+ disappearsOnIndex: 0,
532
+ opacity: 0.4,
533
+ pressBehavior: "collapse"
534
+ }
535
+ );
536
+ function LineDetailSheet({ snapPoints = ["35%", "75%"], topInset, renderHeader, children }) {
519
537
  const { activeLine, isAddNoteOpen, controls } = useRetorBridge();
538
+ const { topInset: hudTopInset } = useHudContext();
539
+ const effectiveTopInset = topInset ?? hudTopInset;
520
540
  const sheetRef = (0, import_react6.useRef)(null);
521
541
  const snapPointsArr = (0, import_react6.useMemo)(() => snapPoints, [snapPoints]);
522
542
  const [minimized, setMinimized] = (0, import_react6.useState)(false);
@@ -557,18 +577,10 @@ function LineDetailSheet({ snapPoints = ["35%", "75%"], renderHeader, children }
557
577
  enableOverDrag: false,
558
578
  onChange: handleSheetChange,
559
579
  footerComponent: renderFooter,
560
- backdropComponent: (props) => /* @__PURE__ */ import_react6.default.createElement(
561
- import_bottom_sheet3.BottomSheetBackdrop,
562
- {
563
- ...props,
564
- appearsOnIndex: 1,
565
- disappearsOnIndex: 0,
566
- opacity: 0.4,
567
- pressBehavior: "collapse"
568
- }
569
- ),
580
+ backdropComponent: renderBackdrop2,
570
581
  handleIndicatorStyle: styles3.handle,
571
- backgroundComponent: BlurBackground
582
+ backgroundComponent: BlurBackground,
583
+ topInset: effectiveTopInset
572
584
  },
573
585
  activeLine && (children ?? /* @__PURE__ */ import_react6.default.createElement(DefaultLineTagList, { listHeader: header }))
574
586
  );
@@ -613,13 +625,18 @@ function LineTagList({ children, listHeader }) {
613
625
  }, [activeLine?._id]);
614
626
  (0, import_react6.useEffect)(() => {
615
627
  if (!closestTagId) return;
616
- const t = setTimeout(() => {
628
+ let attempts = 0;
629
+ const tick = () => {
617
630
  const y = offsetsRef.current.get(closestTagId);
618
631
  if (y != null) {
619
- scrollRef.current?.scrollTo({ y, animated: true });
632
+ scrollRef.current?.scrollTo?.({ y, animated: true });
633
+ return;
620
634
  }
621
- }, 60);
622
- return () => clearTimeout(t);
635
+ attempts += 1;
636
+ if (attempts < 10) raf = requestAnimationFrame(tick);
637
+ };
638
+ let raf = requestAnimationFrame(tick);
639
+ return () => cancelAnimationFrame(raf);
623
640
  }, [closestTagId]);
624
641
  if (!activeLine) return null;
625
642
  const handleItemLayout = (id, e) => {
@@ -727,13 +744,25 @@ var import_react7 = __toESM(require("react"));
727
744
  var import_react_native6 = require("react-native");
728
745
  var import_bottom_sheet4 = require("@gorhom/bottom-sheet");
729
746
  var import_lucide_react_native3 = require("lucide-react-native");
747
+ var renderBackdrop3 = (props) => /* @__PURE__ */ import_react7.default.createElement(
748
+ import_bottom_sheet4.BottomSheetBackdrop,
749
+ {
750
+ ...props,
751
+ appearsOnIndex: 0,
752
+ disappearsOnIndex: -1,
753
+ opacity: 0.6
754
+ }
755
+ );
730
756
  function AddNoteSheet({
731
757
  snapPoints = ["50%"],
758
+ topInset,
732
759
  maxLength = 280,
733
760
  placeholder = "Write a note...",
734
761
  renderForm
735
762
  }) {
736
763
  const { isAddNoteOpen, addNoteTagId, activeLine, closeAddNote, submitNote } = useRetorBridge();
764
+ const { topInset: hudTopInset } = useHudContext();
765
+ const effectiveTopInset = topInset ?? hudTopInset;
737
766
  const sheetRef = (0, import_react7.useRef)(null);
738
767
  const snapPointsArr = (0, import_react7.useMemo)(() => snapPoints, [snapPoints]);
739
768
  const [text, setText] = (0, import_react7.useState)("");
@@ -775,17 +804,10 @@ function AddNoteSheet({
775
804
  enablePanDownToClose: true,
776
805
  enableOverDrag: false,
777
806
  onDismiss: closeAddNote,
778
- backdropComponent: (props) => /* @__PURE__ */ import_react7.default.createElement(
779
- import_bottom_sheet4.BottomSheetBackdrop,
780
- {
781
- ...props,
782
- appearsOnIndex: 0,
783
- disappearsOnIndex: -1,
784
- opacity: 0.6
785
- }
786
- ),
807
+ backdropComponent: renderBackdrop3,
787
808
  handleIndicatorStyle: styles4.handle,
788
- backgroundComponent: BlurBackground
809
+ backgroundComponent: BlurBackground,
810
+ topInset: effectiveTopInset
789
811
  },
790
812
  /* @__PURE__ */ import_react7.default.createElement(import_bottom_sheet4.BottomSheetView, { style: styles4.content }, renderForm ? renderForm(formApi) : /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: styles4.form }, /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: styles4.headerRow }, /* @__PURE__ */ import_react7.default.createElement(import_react_native6.View, { style: { flex: 1 } }, activeLine && /* @__PURE__ */ import_react7.default.createElement(import_react_native6.Text, { style: styles4.title, numberOfLines: 1 }, activeLine.name), tag && /* @__PURE__ */ import_react7.default.createElement(import_react_native6.Text, { style: styles4.subtitle, numberOfLines: 1 }, tag.name)), /* @__PURE__ */ import_react7.default.createElement(import_react_native6.Pressable, { onPress: closeAddNote, style: styles4.closeBtn }, /* @__PURE__ */ import_react7.default.createElement(import_lucide_react_native3.X, { size: 14, color: "rgba(255,255,255,0.6)" }))), /* @__PURE__ */ import_react7.default.createElement(
791
813
  import_bottom_sheet4.BottomSheetTextInput,
package/dist/index.mjs CHANGED
@@ -323,11 +323,15 @@ var styles = StyleSheet.create({
323
323
  });
324
324
 
325
325
  // src/Hud.tsx
326
- import React3 from "react";
326
+ import React3, { createContext as createContext2, useContext as useContext2 } from "react";
327
327
  import { StyleSheet as StyleSheet2, View as View2 } from "react-native";
328
328
  import { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
329
- function Hud({ children }) {
330
- return /* @__PURE__ */ React3.createElement(View2, { pointerEvents: "box-none", style: StyleSheet2.absoluteFill }, /* @__PURE__ */ React3.createElement(BottomSheetModalProvider, null, children));
329
+ var HudContext = createContext2({ topInset: 0 });
330
+ function useHudContext() {
331
+ return useContext2(HudContext);
332
+ }
333
+ function Hud({ children, topInset = 0 }) {
334
+ return /* @__PURE__ */ React3.createElement(HudContext.Provider, { value: { topInset } }, /* @__PURE__ */ React3.createElement(View2, { pointerEvents: "box-none", style: StyleSheet2.absoluteFill }, /* @__PURE__ */ React3.createElement(BottomSheetModalProvider, null, children)));
331
335
  }
332
336
 
333
337
  // src/ProjectSheet.tsx
@@ -345,8 +349,20 @@ function BlurBackground({ style }) {
345
349
  }
346
350
 
347
351
  // src/ProjectSheet.tsx
348
- function ProjectSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
352
+ var renderBackdrop = (props) => /* @__PURE__ */ React5.createElement(
353
+ BottomSheetBackdrop,
354
+ {
355
+ ...props,
356
+ appearsOnIndex: 1,
357
+ disappearsOnIndex: 0,
358
+ opacity: 0.4,
359
+ pressBehavior: "collapse"
360
+ }
361
+ );
362
+ function ProjectSheet({ snapPoints = ["35%", "75%"], topInset, renderHeader, children }) {
349
363
  const { project, activeLineId, isAddNoteOpen } = useRetorBridge();
364
+ const { topInset: hudTopInset } = useHudContext();
365
+ const effectiveTopInset = topInset ?? hudTopInset;
350
366
  const sheetRef = useRef2(null);
351
367
  const snapPointsArr = useMemo3(() => snapPoints, [snapPoints]);
352
368
  const [minimized, setMinimized] = useState2(false);
@@ -381,18 +397,10 @@ function ProjectSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
381
397
  enableDismissOnClose: false,
382
398
  enableOverDrag: false,
383
399
  onChange: handleSheetChange,
384
- backdropComponent: (props) => /* @__PURE__ */ React5.createElement(
385
- BottomSheetBackdrop,
386
- {
387
- ...props,
388
- appearsOnIndex: 1,
389
- disappearsOnIndex: 0,
390
- opacity: 0.4,
391
- pressBehavior: "collapse"
392
- }
393
- ),
400
+ backdropComponent: renderBackdrop,
394
401
  handleIndicatorStyle: styles2.handle,
395
- backgroundComponent: BlurBackground
402
+ backgroundComponent: BlurBackground,
403
+ topInset: effectiveTopInset
396
404
  },
397
405
  /* @__PURE__ */ React5.createElement(BottomSheetView, { style: styles2.content }, renderHeader ? renderHeader({ name: project?.name, description: project?.description }) : /* @__PURE__ */ React5.createElement(View4, { style: styles2.header }, /* @__PURE__ */ React5.createElement(View4, { style: { flex: 1, minWidth: 0 } }, project?.name && /* @__PURE__ */ React5.createElement(Text, { style: styles2.title, numberOfLines: 1 }, project.name), project?.description && /* @__PURE__ */ React5.createElement(Text, { style: styles2.subtitle, numberOfLines: 4 }, project.description)), /* @__PURE__ */ React5.createElement(Pressable, { style: styles2.iconBtn, onPress: toggleMinimize }, minimized ? /* @__PURE__ */ React5.createElement(ArrowUp, { size: 14, color: "rgba(255,255,255,0.6)" }) : /* @__PURE__ */ React5.createElement(ArrowDown, { size: 14, color: "rgba(255,255,255,0.6)" }))), children ?? /* @__PURE__ */ React5.createElement(DefaultLinesCarousel, null))
398
406
  );
@@ -476,8 +484,20 @@ import {
476
484
  } from "@gorhom/bottom-sheet";
477
485
  import Svg, { Circle } from "react-native-svg";
478
486
  import { ArrowDown as ArrowDown2, ArrowUp as ArrowUp2, Pause, Play, Plus } from "lucide-react-native";
479
- function LineDetailSheet({ snapPoints = ["35%", "75%"], renderHeader, children }) {
487
+ var renderBackdrop2 = (props) => /* @__PURE__ */ React6.createElement(
488
+ BottomSheetBackdrop2,
489
+ {
490
+ ...props,
491
+ appearsOnIndex: 1,
492
+ disappearsOnIndex: 0,
493
+ opacity: 0.4,
494
+ pressBehavior: "collapse"
495
+ }
496
+ );
497
+ function LineDetailSheet({ snapPoints = ["35%", "75%"], topInset, renderHeader, children }) {
480
498
  const { activeLine, isAddNoteOpen, controls } = useRetorBridge();
499
+ const { topInset: hudTopInset } = useHudContext();
500
+ const effectiveTopInset = topInset ?? hudTopInset;
481
501
  const sheetRef = useRef3(null);
482
502
  const snapPointsArr = useMemo4(() => snapPoints, [snapPoints]);
483
503
  const [minimized, setMinimized] = useState3(false);
@@ -518,18 +538,10 @@ function LineDetailSheet({ snapPoints = ["35%", "75%"], renderHeader, children }
518
538
  enableOverDrag: false,
519
539
  onChange: handleSheetChange,
520
540
  footerComponent: renderFooter,
521
- backdropComponent: (props) => /* @__PURE__ */ React6.createElement(
522
- BottomSheetBackdrop2,
523
- {
524
- ...props,
525
- appearsOnIndex: 1,
526
- disappearsOnIndex: 0,
527
- opacity: 0.4,
528
- pressBehavior: "collapse"
529
- }
530
- ),
541
+ backdropComponent: renderBackdrop2,
531
542
  handleIndicatorStyle: styles3.handle,
532
- backgroundComponent: BlurBackground
543
+ backgroundComponent: BlurBackground,
544
+ topInset: effectiveTopInset
533
545
  },
534
546
  activeLine && (children ?? /* @__PURE__ */ React6.createElement(DefaultLineTagList, { listHeader: header }))
535
547
  );
@@ -574,13 +586,18 @@ function LineTagList({ children, listHeader }) {
574
586
  }, [activeLine?._id]);
575
587
  useEffect3(() => {
576
588
  if (!closestTagId) return;
577
- const t = setTimeout(() => {
589
+ let attempts = 0;
590
+ const tick = () => {
578
591
  const y = offsetsRef.current.get(closestTagId);
579
592
  if (y != null) {
580
- scrollRef.current?.scrollTo({ y, animated: true });
593
+ scrollRef.current?.scrollTo?.({ y, animated: true });
594
+ return;
581
595
  }
582
- }, 60);
583
- return () => clearTimeout(t);
596
+ attempts += 1;
597
+ if (attempts < 10) raf = requestAnimationFrame(tick);
598
+ };
599
+ let raf = requestAnimationFrame(tick);
600
+ return () => cancelAnimationFrame(raf);
584
601
  }, [closestTagId]);
585
602
  if (!activeLine) return null;
586
603
  const handleItemLayout = (id, e) => {
@@ -693,13 +710,25 @@ import {
693
710
  BottomSheetView as BottomSheetView2
694
711
  } from "@gorhom/bottom-sheet";
695
712
  import { ArrowUp as ArrowUp3, X } from "lucide-react-native";
713
+ var renderBackdrop3 = (props) => /* @__PURE__ */ React7.createElement(
714
+ BottomSheetBackdrop3,
715
+ {
716
+ ...props,
717
+ appearsOnIndex: 0,
718
+ disappearsOnIndex: -1,
719
+ opacity: 0.6
720
+ }
721
+ );
696
722
  function AddNoteSheet({
697
723
  snapPoints = ["50%"],
724
+ topInset,
698
725
  maxLength = 280,
699
726
  placeholder = "Write a note...",
700
727
  renderForm
701
728
  }) {
702
729
  const { isAddNoteOpen, addNoteTagId, activeLine, closeAddNote, submitNote } = useRetorBridge();
730
+ const { topInset: hudTopInset } = useHudContext();
731
+ const effectiveTopInset = topInset ?? hudTopInset;
703
732
  const sheetRef = useRef4(null);
704
733
  const snapPointsArr = useMemo5(() => snapPoints, [snapPoints]);
705
734
  const [text, setText] = useState4("");
@@ -741,17 +770,10 @@ function AddNoteSheet({
741
770
  enablePanDownToClose: true,
742
771
  enableOverDrag: false,
743
772
  onDismiss: closeAddNote,
744
- backdropComponent: (props) => /* @__PURE__ */ React7.createElement(
745
- BottomSheetBackdrop3,
746
- {
747
- ...props,
748
- appearsOnIndex: 0,
749
- disappearsOnIndex: -1,
750
- opacity: 0.6
751
- }
752
- ),
773
+ backdropComponent: renderBackdrop3,
753
774
  handleIndicatorStyle: styles4.handle,
754
- backgroundComponent: BlurBackground
775
+ backgroundComponent: BlurBackground,
776
+ topInset: effectiveTopInset
755
777
  },
756
778
  /* @__PURE__ */ React7.createElement(BottomSheetView2, { style: styles4.content }, renderForm ? renderForm(formApi) : /* @__PURE__ */ React7.createElement(View6, { style: styles4.form }, /* @__PURE__ */ React7.createElement(View6, { style: styles4.headerRow }, /* @__PURE__ */ React7.createElement(View6, { style: { flex: 1 } }, activeLine && /* @__PURE__ */ React7.createElement(Text3, { style: styles4.title, numberOfLines: 1 }, activeLine.name), tag && /* @__PURE__ */ React7.createElement(Text3, { style: styles4.subtitle, numberOfLines: 1 }, tag.name)), /* @__PURE__ */ React7.createElement(Pressable3, { onPress: closeAddNote, style: styles4.closeBtn }, /* @__PURE__ */ React7.createElement(X, { size: 14, color: "rgba(255,255,255,0.6)" }))), /* @__PURE__ */ React7.createElement(
757
779
  BottomSheetTextInput,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@retor/react-native",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "React Native SDK for embedding Retor 3D experiences",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",