@multiplatform.one/components 7.47.4 → 7.49.0

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.
Files changed (189) hide show
  1. package/dist/cjs/Dialog.cjs +5 -2
  2. package/dist/cjs/Dialog.native.js +5 -2
  3. package/dist/cjs/Dialog.native.js.map +1 -1
  4. package/dist/cjs/Popover.cjs +6 -3
  5. package/dist/cjs/Popover.native.js +7 -3
  6. package/dist/cjs/Popover.native.js.map +1 -1
  7. package/dist/cjs/Sheet.cjs +59 -0
  8. package/dist/cjs/Sheet.native.js +63 -0
  9. package/dist/cjs/Sheet.native.js.map +1 -0
  10. package/dist/cjs/SheetModal/index.cjs +28 -21
  11. package/dist/cjs/SheetModal/index.native.js +126 -121
  12. package/dist/cjs/SheetModal/index.native.js.map +1 -1
  13. package/dist/cjs/Tabs/index.cjs +113 -11
  14. package/dist/cjs/Tabs/index.native.js +117 -12
  15. package/dist/cjs/Tabs/index.native.js.map +1 -1
  16. package/dist/cjs/Tooltip/index.cjs +2 -1
  17. package/dist/cjs/Tooltip/index.native.js +3 -2
  18. package/dist/cjs/Tooltip/index.native.js.map +1 -1
  19. package/dist/cjs/TreeSelect/index.cjs +2 -1
  20. package/dist/cjs/TreeSelect/index.native.js +2 -1
  21. package/dist/cjs/TreeSelect/index.native.js.map +1 -1
  22. package/dist/cjs/charts/ChartDataView.cjs +7 -6
  23. package/dist/cjs/charts/ChartDataView.native.js +7 -6
  24. package/dist/cjs/charts/ChartDataView.native.js.map +1 -1
  25. package/dist/cjs/feedback/ConfirmDialog.cjs +5 -4
  26. package/dist/cjs/feedback/ConfirmDialog.native.js +5 -4
  27. package/dist/cjs/feedback/ConfirmDialog.native.js.map +1 -1
  28. package/dist/cjs/knobImmuneExports.cjs +0 -1
  29. package/dist/cjs/knobImmuneExports.native.js +0 -1
  30. package/dist/cjs/knobImmuneExports.native.js.map +1 -1
  31. package/dist/cjs/layouts/attachments.cjs +4 -3
  32. package/dist/cjs/layouts/attachments.native.js +4 -3
  33. package/dist/cjs/layouts/attachments.native.js.map +1 -1
  34. package/dist/cjs/surfaces.cjs +4 -2
  35. package/dist/cjs/surfaces.native.js +4 -2
  36. package/dist/cjs/surfaces.native.js.map +1 -1
  37. package/dist/cjs/tamagui.cjs +2 -1
  38. package/dist/cjs/tamagui.native.js +2 -1
  39. package/dist/cjs/tamagui.native.js.map +1 -1
  40. package/dist/esm/Dialog.mjs +5 -2
  41. package/dist/esm/Dialog.mjs.map +1 -1
  42. package/dist/esm/Dialog.native.js +5 -2
  43. package/dist/esm/Dialog.native.js.map +1 -1
  44. package/dist/esm/Popover.mjs +7 -4
  45. package/dist/esm/Popover.mjs.map +1 -1
  46. package/dist/esm/Popover.native.js +8 -4
  47. package/dist/esm/Popover.native.js.map +1 -1
  48. package/dist/esm/Sheet.mjs +34 -0
  49. package/dist/esm/Sheet.mjs.map +1 -0
  50. package/dist/esm/Sheet.native.js +35 -0
  51. package/dist/esm/Sheet.native.js.map +1 -0
  52. package/dist/esm/SheetModal/index.mjs +29 -22
  53. package/dist/esm/SheetModal/index.mjs.map +1 -1
  54. package/dist/esm/SheetModal/index.native.js +126 -121
  55. package/dist/esm/SheetModal/index.native.js.map +1 -1
  56. package/dist/esm/Tabs/index.mjs +113 -14
  57. package/dist/esm/Tabs/index.mjs.map +1 -1
  58. package/dist/esm/Tabs/index.native.js +117 -15
  59. package/dist/esm/Tabs/index.native.js.map +1 -1
  60. package/dist/esm/Tooltip/index.mjs +3 -2
  61. package/dist/esm/Tooltip/index.mjs.map +1 -1
  62. package/dist/esm/Tooltip/index.native.js +4 -3
  63. package/dist/esm/Tooltip/index.native.js.map +1 -1
  64. package/dist/esm/TreeSelect/index.mjs +3 -2
  65. package/dist/esm/TreeSelect/index.mjs.map +1 -1
  66. package/dist/esm/TreeSelect/index.native.js +3 -2
  67. package/dist/esm/TreeSelect/index.native.js.map +1 -1
  68. package/dist/esm/charts/ChartDataView.mjs +2 -1
  69. package/dist/esm/charts/ChartDataView.mjs.map +1 -1
  70. package/dist/esm/charts/ChartDataView.native.js +2 -1
  71. package/dist/esm/charts/ChartDataView.native.js.map +1 -1
  72. package/dist/esm/feedback/ConfirmDialog.mjs +2 -1
  73. package/dist/esm/feedback/ConfirmDialog.mjs.map +1 -1
  74. package/dist/esm/feedback/ConfirmDialog.native.js +2 -1
  75. package/dist/esm/feedback/ConfirmDialog.native.js.map +1 -1
  76. package/dist/esm/knobImmuneExports.mjs +0 -1
  77. package/dist/esm/knobImmuneExports.mjs.map +1 -1
  78. package/dist/esm/knobImmuneExports.native.js +0 -1
  79. package/dist/esm/knobImmuneExports.native.js.map +1 -1
  80. package/dist/esm/layouts/attachments.mjs +2 -1
  81. package/dist/esm/layouts/attachments.mjs.map +1 -1
  82. package/dist/esm/layouts/attachments.native.js +2 -1
  83. package/dist/esm/layouts/attachments.native.js.map +1 -1
  84. package/dist/esm/surfaces.mjs +5 -3
  85. package/dist/esm/surfaces.mjs.map +1 -1
  86. package/dist/esm/surfaces.native.js +5 -3
  87. package/dist/esm/surfaces.native.js.map +1 -1
  88. package/dist/esm/tamagui.mjs +2 -1
  89. package/dist/esm/tamagui.mjs.map +1 -1
  90. package/dist/esm/tamagui.native.js +2 -1
  91. package/dist/esm/tamagui.native.js.map +1 -1
  92. package/dist/jsx/Dialog.mjs +5 -2
  93. package/dist/jsx/Dialog.mjs.map +1 -1
  94. package/dist/jsx/Dialog.native.js +5 -2
  95. package/dist/jsx/Dialog.native.js.map +1 -1
  96. package/dist/jsx/Popover.mjs +7 -4
  97. package/dist/jsx/Popover.mjs.map +1 -1
  98. package/dist/jsx/Popover.native.js +7 -3
  99. package/dist/jsx/Popover.native.js.map +1 -1
  100. package/dist/jsx/Sheet.mjs +34 -0
  101. package/dist/jsx/Sheet.mjs.map +1 -0
  102. package/dist/jsx/Sheet.native.js +63 -0
  103. package/dist/jsx/Sheet.native.js.map +1 -0
  104. package/dist/jsx/SheetModal/index.mjs +29 -22
  105. package/dist/jsx/SheetModal/index.mjs.map +1 -1
  106. package/dist/jsx/SheetModal/index.native.js +126 -121
  107. package/dist/jsx/SheetModal/index.native.js.map +1 -1
  108. package/dist/jsx/Tabs/index.mjs +113 -14
  109. package/dist/jsx/Tabs/index.mjs.map +1 -1
  110. package/dist/jsx/Tabs/index.native.js +117 -12
  111. package/dist/jsx/Tabs/index.native.js.map +1 -1
  112. package/dist/jsx/Tooltip/index.mjs +3 -2
  113. package/dist/jsx/Tooltip/index.mjs.map +1 -1
  114. package/dist/jsx/Tooltip/index.native.js +3 -2
  115. package/dist/jsx/Tooltip/index.native.js.map +1 -1
  116. package/dist/jsx/TreeSelect/index.mjs +3 -2
  117. package/dist/jsx/TreeSelect/index.mjs.map +1 -1
  118. package/dist/jsx/TreeSelect/index.native.js +2 -1
  119. package/dist/jsx/TreeSelect/index.native.js.map +1 -1
  120. package/dist/jsx/charts/ChartDataView.mjs +2 -1
  121. package/dist/jsx/charts/ChartDataView.mjs.map +1 -1
  122. package/dist/jsx/charts/ChartDataView.native.js +7 -6
  123. package/dist/jsx/charts/ChartDataView.native.js.map +1 -1
  124. package/dist/jsx/feedback/ConfirmDialog.mjs +2 -1
  125. package/dist/jsx/feedback/ConfirmDialog.mjs.map +1 -1
  126. package/dist/jsx/feedback/ConfirmDialog.native.js +5 -4
  127. package/dist/jsx/feedback/ConfirmDialog.native.js.map +1 -1
  128. package/dist/jsx/knobImmuneExports.mjs +0 -1
  129. package/dist/jsx/knobImmuneExports.mjs.map +1 -1
  130. package/dist/jsx/knobImmuneExports.native.js +0 -1
  131. package/dist/jsx/knobImmuneExports.native.js.map +1 -1
  132. package/dist/jsx/layouts/attachments.mjs +2 -1
  133. package/dist/jsx/layouts/attachments.mjs.map +1 -1
  134. package/dist/jsx/layouts/attachments.native.js +4 -3
  135. package/dist/jsx/layouts/attachments.native.js.map +1 -1
  136. package/dist/jsx/surfaces.mjs +5 -3
  137. package/dist/jsx/surfaces.mjs.map +1 -1
  138. package/dist/jsx/surfaces.native.js +4 -2
  139. package/dist/jsx/surfaces.native.js.map +1 -1
  140. package/dist/jsx/tamagui.mjs +2 -1
  141. package/dist/jsx/tamagui.mjs.map +1 -1
  142. package/dist/jsx/tamagui.native.js +2 -1
  143. package/dist/jsx/tamagui.native.js.map +1 -1
  144. package/package.json +9 -9
  145. package/src/Button.native-press.spec.tsx +86 -0
  146. package/src/Dialog.spec.tsx +6 -5
  147. package/src/Dialog.tsx +9 -1
  148. package/src/Popover.coverTrigger.spec.tsx +1 -1
  149. package/src/Popover.tsx +17 -4
  150. package/src/Sheet.tsx +35 -0
  151. package/src/SheetModal/index.native.tsx +117 -113
  152. package/src/SheetModal/index.tsx +30 -26
  153. package/src/Tabs/Tabs.fades.native.spec.tsx +201 -0
  154. package/src/Tabs/Tabs.gutter.spec.tsx +95 -0
  155. package/src/Tabs/Tabs.stories.tsx +37 -0
  156. package/src/Tabs/index.tsx +149 -12
  157. package/src/Tooltip/index.native.tsx +4 -3
  158. package/src/Tooltip/index.tsx +3 -2
  159. package/src/TreeSelect/index.tsx +3 -2
  160. package/src/charts/ChartDataView.tsx +2 -1
  161. package/src/feedback/ConfirmDialog.stories.tsx +48 -0
  162. package/src/feedback/ConfirmDialog.tsx +2 -1
  163. package/src/knobImmuneExports.ts +0 -1
  164. package/src/layouts/attachments.tsx +1 -1
  165. package/src/layouts/layouts.spec.tsx +4 -2
  166. package/src/overlayStack.native-press.spec.tsx +214 -0
  167. package/src/surfaces.spec.tsx +2 -1
  168. package/src/surfaces.tsx +5 -2
  169. package/src/tamagui.spec.ts +4 -4
  170. package/src/tamagui.ts +3 -1
  171. package/types/Dialog.d.ts.map +1 -1
  172. package/types/Popover.d.ts.map +1 -1
  173. package/types/Sheet.d.ts +3 -0
  174. package/types/Sheet.d.ts.map +1 -0
  175. package/types/SheetModal/index.d.ts.map +1 -1
  176. package/types/SheetModal/index.native.d.ts.map +1 -1
  177. package/types/Tabs/index.d.ts +15 -0
  178. package/types/Tabs/index.d.ts.map +1 -1
  179. package/types/Tooltip/index.d.ts.map +1 -1
  180. package/types/Tooltip/index.native.d.ts.map +1 -1
  181. package/types/TreeSelect/index.d.ts.map +1 -1
  182. package/types/charts/ChartDataView.d.ts.map +1 -1
  183. package/types/feedback/ConfirmDialog.d.ts.map +1 -1
  184. package/types/knobImmuneExports.d.ts.map +1 -1
  185. package/types/layouts/attachments.d.ts.map +1 -1
  186. package/types/surfaces.d.ts +6 -1
  187. package/types/surfaces.d.ts.map +1 -1
  188. package/types/tamagui.d.ts +2 -1
  189. package/types/tamagui.d.ts.map +1 -1
@@ -121,9 +121,10 @@ describe("house Dialog.Close is named by what it shows (MPO-476)", () => {
121
121
  await waitFor(() => expect(screen.queryByText("Edit profile")).toBeNull());
122
122
  });
123
123
 
124
- it("changes only Close; every other part is tamagui's", () => {
124
+ it("changes only Close and the overlay-stacked Portal; every other part is tamagui's", () => {
125
125
  expect(Dialog.Close).not.toBe(TamaguiDialog.Close);
126
- for (const part of ["Trigger", "Portal", "Overlay", "Content", "Title", "Description"]) {
126
+ expect(Dialog.Portal).not.toBe(TamaguiDialog.Portal);
127
+ for (const part of ["Trigger", "Overlay", "Content", "Title", "Description"]) {
127
128
  expect(Dialog[part as keyof typeof Dialog]).toBe(
128
129
  TamaguiDialog[part as keyof typeof TamaguiDialog],
129
130
  );
@@ -152,11 +153,11 @@ describe("house AlertDialog Cancel and Action are named by what they show (MPO-4
152
153
  noDialogClose();
153
154
  });
154
155
 
155
- it("changes only the close parts; every other part is tamagui's", () => {
156
- for (const part of ["Cancel", "Action", "Destructive"] as const) {
156
+ it("changes only the close parts and the overlay-stacked Portal; every other part is tamagui's", () => {
157
+ for (const part of ["Cancel", "Action", "Destructive", "Portal"] as const) {
157
158
  expect(AlertDialog[part]).not.toBe(TamaguiAlertDialog[part]);
158
159
  }
159
- for (const part of ["Trigger", "Portal", "Overlay", "Content", "Title", "Description"]) {
160
+ for (const part of ["Trigger", "Overlay", "Content", "Title", "Description"]) {
160
161
  expect(AlertDialog[part as keyof typeof AlertDialog]).toBe(
161
162
  TamaguiAlertDialog[part as keyof typeof TamaguiAlertDialog],
162
163
  );
package/src/Dialog.tsx CHANGED
@@ -11,8 +11,14 @@
11
11
  * Here a close part with text (its own, or its asChild child's) is named by
12
12
  * that text. One with no text and no label of its own, an icon-only X, gets
13
13
  * the catalog's localized "Close". An explicit label on the part or on its
14
- * child still wins. Every other part is the tamagui one.
14
+ * child still wins.
15
+ *
16
+ * Their Portal binds the overlay stack (FZ-7869): a dialog opened from a sheet
17
+ * or another dialog sits one `$zIndex` step above it, and on native it would
18
+ * otherwise reach the root host with no zIndex and mount under the sheet.
19
+ * Every other part is the tamagui one.
15
20
  */
21
+ import { withOverlayStack } from "@multiplatform.one/forms";
16
22
  import { isValidElement, type ComponentType, type ReactNode } from "react";
17
23
  import {
18
24
  AlertDialog as TamaguiAlertDialog,
@@ -71,10 +77,12 @@ function namedByContent<C extends ComponentType<any>>(Part: C, displayName: stri
71
77
 
72
78
  export const Dialog: typeof TamaguiDialog = withStaticProperties(TamaguiDialog, {
73
79
  Close: namedByContent(TamaguiDialog.Close, "DialogClose"),
80
+ Portal: withOverlayStack(TamaguiDialog.Portal, "dropdown", "DialogPortal"),
74
81
  });
75
82
 
76
83
  export const AlertDialog: typeof TamaguiAlertDialog = withStaticProperties(TamaguiAlertDialog, {
77
84
  Cancel: namedByContent(TamaguiAlertDialog.Cancel, "AlertDialogCancel"),
78
85
  Action: namedByContent(TamaguiAlertDialog.Action, "AlertDialogAction"),
79
86
  Destructive: namedByContent(TamaguiAlertDialog.Destructive, "AlertDialogDestructive"),
87
+ Portal: withOverlayStack(TamaguiAlertDialog.Portal, "dropdown", "AlertDialogPortal"),
80
88
  });
@@ -10,9 +10,9 @@ afterEach(() => vi.restoreAllMocks());
10
10
 
11
11
  describe("Popover cover-trigger adapter", () => {
12
12
  it("preserves all published composition helpers", () => {
13
+ expect(Popover.Content).not.toBe(TamaguiPopover.Content);
13
14
  for (const key of [
14
15
  "Trigger",
15
- "Content",
16
16
  "Anchor",
17
17
  "Arrow",
18
18
  "ScrollView",
package/src/Popover.tsx CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  type ReactElement,
15
15
  type ReactNode,
16
16
  } from "react";
17
- import { FloatingPanel } from "@multiplatform.one/forms";
17
+ import { FloatingPanel, useOverlayZIndex, withOverlayStack } from "@multiplatform.one/forms";
18
18
  import {
19
19
  Popover as TamaguiPopover,
20
20
  View,
@@ -37,6 +37,12 @@ export type Popover = {
37
37
  setOpen: (open: boolean) => void;
38
38
  };
39
39
 
40
+ const StackedPopoverContent = withOverlayStack(
41
+ TamaguiPopover.Content,
42
+ "dropdown",
43
+ "PopoverContent",
44
+ );
45
+
40
46
  const CoverPopoverContext = createContext<(() => void) | null>(null);
41
47
 
42
48
  const PopoverClose = forwardRef<
@@ -96,7 +102,10 @@ const CoverPopover = forwardRef<Popover, PopoverProps>(function CoverPopover(
96
102
  const childrenParts = parts(children);
97
103
  const triggerPart = childrenParts.find((child) => child.type === TamaguiPopover.Trigger);
98
104
  const content = childrenParts.filter(
99
- (child) => child.type === TamaguiPopover.Content || child.type === PopoverContent,
105
+ (child) =>
106
+ child.type === TamaguiPopover.Content ||
107
+ child.type === StackedPopoverContent ||
108
+ child.type === PopoverContent,
100
109
  );
101
110
  const unsupported = [
102
111
  "onOpenAutoFocus",
@@ -159,18 +168,22 @@ const PopoverRoot = forwardRef<Popover, PopoverProps>(function PopoverRoot(
159
168
  { anchorMode, triggerRow, ...props },
160
169
  ref,
161
170
  ) {
171
+ const stacked = useOverlayZIndex("dropdown");
162
172
  if (anchorMode === "cover-trigger")
163
173
  return <CoverPopover ref={ref} {...props} anchorMode={anchorMode} triggerRow={triggerRow} />;
174
+ // FZ-7869: tamagui hands the root's zIndex to the content's portal, so a
175
+ // popover opened in a sheet or a dialog sits above it on native too. The
176
+ // content parts carry the stack to what opens inside them.
164
177
  return (
165
178
  <CoverPopoverContext.Provider value={null}>
166
- <TamaguiPopover ref={ref} {...props} />
179
+ <TamaguiPopover ref={ref} {...props} zIndex={props.zIndex ?? stacked} />
167
180
  </CoverPopoverContext.Provider>
168
181
  );
169
182
  });
170
183
 
171
184
  export const Popover = withStaticProperties(PopoverRoot, {
172
185
  Trigger: TamaguiPopover.Trigger,
173
- Content: TamaguiPopover.Content,
186
+ Content: StackedPopoverContent,
174
187
  Close: PopoverClose,
175
188
  Anchor: TamaguiPopover.Anchor,
176
189
  Adapt: TamaguiPopover.Adapt,
package/src/Sheet.tsx ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * House Sheet: the tamagui root, with a modal sheet bound to the overlay
3
+ * stack (FZ-7869, Axiom 14). It binds its tier, or one `$zIndex` step above
4
+ * the overlay it was opened from, and what it contains (a ConfirmDialog, a
5
+ * Popover, another sheet) opens above it. The parts are the tamagui ones.
6
+ */
7
+ import { OverlayStackProvider, useOverlayZIndex } from "@multiplatform.one/forms";
8
+ import { forwardRef, type ComponentRef } from "react";
9
+ import { Sheet as TamaguiSheet, withStaticProperties, type SheetProps } from "tamagui";
10
+
11
+ const SheetRoot = forwardRef<ComponentRef<typeof TamaguiSheet>, SheetProps>(
12
+ function Sheet(props, ref) {
13
+ const stacked = useOverlayZIndex("sheet");
14
+ if (!props.modal) return <TamaguiSheet ref={ref} {...props} />;
15
+ const zIndex = props.zIndex ?? stacked;
16
+ return (
17
+ <TamaguiSheet
18
+ ref={ref}
19
+ {...props}
20
+ zIndex={zIndex}
21
+ portalProps={{ zIndex, ...props.portalProps }}
22
+ >
23
+ <OverlayStackProvider zIndex={zIndex}>{props.children}</OverlayStackProvider>
24
+ </TamaguiSheet>
25
+ );
26
+ },
27
+ );
28
+
29
+ export const Sheet: typeof TamaguiSheet = withStaticProperties(SheetRoot, {
30
+ Frame: TamaguiSheet.Frame,
31
+ Overlay: TamaguiSheet.Overlay,
32
+ Handle: TamaguiSheet.Handle,
33
+ ScrollView: TamaguiSheet.ScrollView,
34
+ Controlled: TamaguiSheet.Controlled,
35
+ }) as unknown as typeof TamaguiSheet;
@@ -10,6 +10,7 @@
10
10
  * height with a large-detent cap. LC-71: the frame is not a control.
11
11
  */
12
12
 
13
+ import { OverlayWindow, useOverlayZIndex } from "@multiplatform.one/forms";
13
14
  import {
14
15
  motionDurationMs,
15
16
  useResolvedKnobs,
@@ -83,6 +84,7 @@ export function SheetModal({
83
84
  }: SheetModalProps) {
84
85
  const { t } = useTranslation();
85
86
  const { knobProps } = useResolvedKnobs();
87
+ const windowZIndex = useOverlayZIndex("sheet");
86
88
  const slideTransition = knobProps.motion.slide.transition;
87
89
  const slideDuration = motionDurationMs(slideTransition);
88
90
  const scrimDuration = motionDurationMs(knobProps.motion.scrim.transition);
@@ -384,107 +386,124 @@ export function SheetModal({
384
386
  onRequestClose={close}
385
387
  onShow={enter}
386
388
  >
387
- <RNView
388
- style={{ flex: 1, justifyContent: "flex-end", paddingBottom: keyboardInset }}
389
- onTouchStart={stopAtModal}
390
- onTouchMove={stopAtModal}
391
- onTouchEnd={stopAtModal}
392
- onTouchCancel={stopAtModal}
393
- >
394
- <Pressable
395
- style={StyleSheet.absoluteFill}
396
- onPress={handleBackdropPress}
397
- accessibilityRole="button"
398
- accessibilityLabel={t("Close")}
389
+ <OverlayWindow zIndex={windowZIndex}>
390
+ <RNView
391
+ style={{ flex: 1, justifyContent: "flex-end", paddingBottom: keyboardInset }}
392
+ onTouchStart={stopAtModal}
393
+ onTouchMove={stopAtModal}
394
+ onTouchEnd={stopAtModal}
395
+ onTouchCancel={stopAtModal}
399
396
  >
400
- <View flex={1} backgroundColor="$shadow6" />
401
- </Pressable>
402
- <Animated.View
403
- onLayout={(e) => {
404
- if (restHeightRef.current !== null) return;
405
- const h = Math.round(e.nativeEvent.layout.height);
406
- if (h <= 0) return;
407
- naturalRef.current = h;
408
- filledRef.current = h >= maxHeightRef.current - 1;
409
- if (h !== measuredHeight) setMeasuredHeight(h);
410
- }}
411
- testID="sheet-modal-frame"
412
- style={{
413
- // MPO-64: flex children default to flexShrink 0, so without this
414
- // the sheet cannot give way to the keyboard.
415
- flexShrink: 1,
416
- minHeight: 0,
417
- maxHeight: frameCap,
418
- // The cap is already keyboard- and window-aware; fill only asks
419
- // for it as a definite height rather than an upper bound.
420
- ...(fill ? { height: frameCap } : null),
421
- transform: [{ translateY }],
422
- }}
423
- >
424
- <YStack
425
- testID="sheet-modal-surface"
426
- {...knobProps.surface}
427
- {...knobProps.borderRadius}
428
- borderBottomLeftRadius={0}
429
- borderBottomRightRadius={0}
430
- elevation={knobProps.elevation}
431
- maxHeight={maxHeight}
432
- flexShrink={1}
433
- minHeight={0}
434
- {...(fill ? fillSlot : null)}
435
- paddingTop="$2"
436
- paddingBottom={keyboardInset > 0 ? 8 : bottomInset}
437
- overflow="hidden"
438
- // No focus or press pseudo on this surface: on native tamagui
439
- // turns one into a touch-responder claim, and a responder here
440
- // takes every drag from the ScrollView inside (MPO-299).
441
- accessibilityViewIsModal
442
- onAccessibilityEscape={close}
397
+ <Pressable
398
+ style={StyleSheet.absoluteFill}
399
+ onPress={handleBackdropPress}
400
+ accessibilityRole="button"
401
+ accessibilityLabel={t("Close")}
402
+ >
403
+ <View flex={1} backgroundColor="$shadow6" />
404
+ </Pressable>
405
+ <Animated.View
406
+ onLayout={(e) => {
407
+ if (restHeightRef.current !== null) return;
408
+ const h = Math.round(e.nativeEvent.layout.height);
409
+ if (h <= 0) return;
410
+ naturalRef.current = h;
411
+ filledRef.current = h >= maxHeightRef.current - 1;
412
+ if (h !== measuredHeight) setMeasuredHeight(h);
413
+ }}
414
+ testID="sheet-modal-frame"
415
+ style={{
416
+ // MPO-64: flex children default to flexShrink 0, so without this
417
+ // the sheet cannot give way to the keyboard.
418
+ flexShrink: 1,
419
+ minHeight: 0,
420
+ maxHeight: frameCap,
421
+ // The cap is already keyboard- and window-aware; fill only asks
422
+ // for it as a definite height rather than an upper bound.
423
+ ...(fill ? { height: frameCap } : null),
424
+ transform: [{ translateY }],
425
+ }}
443
426
  >
444
- {/*
427
+ <YStack
428
+ testID="sheet-modal-surface"
429
+ {...knobProps.surface}
430
+ {...knobProps.borderRadius}
431
+ borderBottomLeftRadius={0}
432
+ borderBottomRightRadius={0}
433
+ elevation={knobProps.elevation}
434
+ maxHeight={maxHeight}
435
+ flexShrink={1}
436
+ minHeight={0}
437
+ {...(fill ? fillSlot : null)}
438
+ paddingTop="$2"
439
+ paddingBottom={keyboardInset > 0 ? 8 : bottomInset}
440
+ overflow="hidden"
441
+ // No focus or press pseudo on this surface: on native tamagui
442
+ // turns one into a touch-responder claim, and a responder here
443
+ // takes every drag from the ScrollView inside (MPO-299).
444
+ accessibilityViewIsModal
445
+ onAccessibilityEscape={close}
446
+ >
447
+ {/*
445
448
  The grabber is the grab ZONE, not the 5pt pill inside it. LC-71
446
449
  says the frame is not a control; the grabber is the one part of
447
450
  it that is, so it is the only thing that takes the gesture, and
448
451
  it never fights the ScrollView below.
449
452
  */}
450
- <RNView
451
- {...panResponder.panHandlers}
452
- accessibilityRole="adjustable"
453
- accessibilityLabel={t("Drag to resize")}
454
- testID="sheet-modal-grabber"
455
- style={{
456
- alignSelf: "stretch",
457
- alignItems: "center",
458
- paddingTop: 3,
459
- paddingBottom: 11,
460
- ...(fill ? nonShrinking : null),
461
- }}
462
- >
463
- <View
464
- width={36}
465
- height={5}
466
- borderRadius={100}
467
- backgroundColor="$color8"
468
- opacity={0.45}
469
- accessible={false}
470
- />
471
- </RNView>
472
- <DialogRegionContext.Provider value={IN_DIALOG_REGION}>
473
- <YStack
474
- testID="sheet-modal-content"
475
- padding={knobProps.panelPadding.padding}
476
- gap={knobProps.gap.gap}
477
- flexShrink={1}
478
- {...(fill ? fillSlot : null)}
453
+ <RNView
454
+ {...panResponder.panHandlers}
455
+ accessibilityRole="adjustable"
456
+ accessibilityLabel={t("Drag to resize")}
457
+ testID="sheet-modal-grabber"
458
+ style={{
459
+ alignSelf: "stretch",
460
+ alignItems: "center",
461
+ paddingTop: 3,
462
+ paddingBottom: 11,
463
+ ...(fill ? nonShrinking : null),
464
+ }}
479
465
  >
480
- {fill ? (
481
- <>
482
- {header ? <RNView style={nonShrinking}>{header}</RNView> : null}
483
- <RNView testID="sheet-modal-body" style={fillSlot}>
466
+ <View
467
+ width={36}
468
+ height={5}
469
+ borderRadius={100}
470
+ backgroundColor="$color8"
471
+ opacity={0.45}
472
+ accessible={false}
473
+ />
474
+ </RNView>
475
+ <DialogRegionContext.Provider value={IN_DIALOG_REGION}>
476
+ <YStack
477
+ testID="sheet-modal-content"
478
+ padding={knobProps.panelPadding.padding}
479
+ gap={knobProps.gap.gap}
480
+ flexShrink={1}
481
+ {...(fill ? fillSlot : null)}
482
+ >
483
+ {fill ? (
484
+ <>
485
+ {header ? <RNView style={nonShrinking}>{header}</RNView> : null}
486
+ <RNView testID="sheet-modal-body" style={fillSlot}>
487
+ {scrollable ? (
488
+ <RNScrollView
489
+ testID="sheet-modal-scroll"
490
+ style={fillSlot}
491
+ keyboardShouldPersistTaps="handled"
492
+ >
493
+ {children}
494
+ </RNScrollView>
495
+ ) : (
496
+ children
497
+ )}
498
+ </RNView>
499
+ </>
500
+ ) : (
501
+ <>
502
+ {header}
484
503
  {scrollable ? (
485
504
  <RNScrollView
486
505
  testID="sheet-modal-scroll"
487
- style={fillSlot}
506
+ style={{ flexGrow: 0 }}
488
507
  keyboardShouldPersistTaps="handled"
489
508
  >
490
509
  {children}
@@ -492,29 +511,14 @@ export function SheetModal({
492
511
  ) : (
493
512
  children
494
513
  )}
495
- </RNView>
496
- </>
497
- ) : (
498
- <>
499
- {header}
500
- {scrollable ? (
501
- <RNScrollView
502
- testID="sheet-modal-scroll"
503
- style={{ flexGrow: 0 }}
504
- keyboardShouldPersistTaps="handled"
505
- >
506
- {children}
507
- </RNScrollView>
508
- ) : (
509
- children
510
- )}
511
- </>
512
- )}
513
- </YStack>
514
- </DialogRegionContext.Provider>
515
- </YStack>
516
- </Animated.View>
517
- </RNView>
514
+ </>
515
+ )}
516
+ </YStack>
517
+ </DialogRegionContext.Provider>
518
+ </YStack>
519
+ </Animated.View>
520
+ </RNView>
521
+ </OverlayWindow>
518
522
  </Modal>
519
523
  );
520
524
  }
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  import { transitionProps, useResolvedKnobs, wasKeyboardFocus } from "@multiplatform.one/theme";
13
- import { zIndex } from "@multiplatform.one/forms";
13
+ import { OverlayStackProvider, useOverlayZIndex } from "@multiplatform.one/forms";
14
14
  import { useEffect, useId, useRef, type ReactNode, type RefObject } from "react";
15
15
  import { isWeb, Sheet, View } from "tamagui";
16
16
  import { DialogRegionContext, SheetFrame } from "../surfaces";
@@ -158,6 +158,7 @@ export function SheetModal({
158
158
  fill = false,
159
159
  }: SheetModalProps) {
160
160
  const { knobProps } = useResolvedKnobs();
161
+ const sheetZIndex = useOverlayZIndex("sheet");
161
162
  const transition = knobProps.motion.slide.transition;
162
163
  const titleId = useId();
163
164
  const frameRef = useRef<HTMLElement | null>(null);
@@ -174,7 +175,8 @@ export function SheetModal({
174
175
  snapPointsMode="percent"
175
176
  snapPoints={[snapPoint]}
176
177
  transition={transition}
177
- zIndex={zIndex.sheet}
178
+ zIndex={sheetZIndex}
179
+ portalProps={{ zIndex: sheetZIndex }}
178
180
  >
179
181
  <Sheet.Overlay
180
182
  backgroundColor="$shadow6"
@@ -206,30 +208,32 @@ export function SheetModal({
206
208
  {...frameRingReset}
207
209
  >
208
210
  <DialogRegionContext.Provider value={IN_DIALOG_REGION}>
209
- {header ? (
210
- <View id={titleId} {...(fill ? nonShrinking : null)}>
211
- {header}
212
- </View>
213
- ) : null}
214
- {fill ? (
215
- <View testID="sheet-modal-body" {...fillSlot}>
216
- {scrollable ? (
217
- <Sheet.ScrollView testID="sheet-modal-scroll" {...fillSlot}>
218
- {children}
219
- </Sheet.ScrollView>
220
- ) : (
221
- children
222
- )}
223
- </View>
224
- ) : scrollable ? (
225
- <Sheet.ScrollView testID="sheet-modal-scroll">{children}</Sheet.ScrollView>
226
- ) : (
227
- children
228
- )}
229
- <View
230
- style={{ height: "env(safe-area-inset-bottom)" }}
231
- {...(fill ? nonShrinking : null)}
232
- />
211
+ <OverlayStackProvider zIndex={sheetZIndex}>
212
+ {header ? (
213
+ <View id={titleId} {...(fill ? nonShrinking : null)}>
214
+ {header}
215
+ </View>
216
+ ) : null}
217
+ {fill ? (
218
+ <View testID="sheet-modal-body" {...fillSlot}>
219
+ {scrollable ? (
220
+ <Sheet.ScrollView testID="sheet-modal-scroll" {...fillSlot}>
221
+ {children}
222
+ </Sheet.ScrollView>
223
+ ) : (
224
+ children
225
+ )}
226
+ </View>
227
+ ) : scrollable ? (
228
+ <Sheet.ScrollView testID="sheet-modal-scroll">{children}</Sheet.ScrollView>
229
+ ) : (
230
+ children
231
+ )}
232
+ <View
233
+ style={{ height: "env(safe-area-inset-bottom)" }}
234
+ {...(fill ? nonShrinking : null)}
235
+ />
236
+ </OverlayStackProvider>
233
237
  </DialogRegionContext.Provider>
234
238
  </SheetFrame>
235
239
  </Sheet>