@expo/ui 58.0.15 → 58.0.16

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 (100) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +3 -0
  4. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +2 -2
  5. package/android/src/main/java/expo/modules/ui/RNHostView.kt +95 -0
  6. package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +8 -1
  7. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +13 -1
  8. package/build/NativeTreeContext.d.ts +10 -0
  9. package/build/NativeTreeContext.js +25 -0
  10. package/build/NativeTreeContext.js.map +1 -0
  11. package/build/community/bottom-sheet/BottomSheet.ios.js +11 -4
  12. package/build/community/bottom-sheet/BottomSheet.ios.js.map +1 -1
  13. package/build/community/menu/MenuView.android.js +6 -0
  14. package/build/community/menu/MenuView.android.js.map +1 -1
  15. package/build/jetpack-compose/DropdownMenu/index.d.ts +8 -1
  16. package/build/jetpack-compose/DropdownMenu/index.js.map +1 -1
  17. package/build/jetpack-compose/Host/index.js +8 -2
  18. package/build/jetpack-compose/Host/index.js.map +1 -1
  19. package/build/jetpack-compose/RNHostView/index.js +5 -1
  20. package/build/jetpack-compose/RNHostView/index.js.map +1 -1
  21. package/build/swift-ui/Chart/index.d.ts +10 -0
  22. package/build/swift-ui/Chart/index.js.map +1 -1
  23. package/build/swift-ui/Host/index.js +8 -2
  24. package/build/swift-ui/Host/index.js.map +1 -1
  25. package/build/swift-ui/RNHostView.js +5 -1
  26. package/build/swift-ui/RNHostView.js.map +1 -1
  27. package/build/swift-ui/modifiers/presentationModifiers.d.ts +17 -1
  28. package/build/swift-ui/modifiers/presentationModifiers.js +4 -2
  29. package/build/swift-ui/modifiers/presentationModifiers.js.map +1 -1
  30. package/build/types.d.ts +27 -0
  31. package/build/types.js +1 -1
  32. package/build/types.js.map +1 -1
  33. package/build/universal/BottomSheet/index.android.js +26 -18
  34. package/build/universal/BottomSheet/index.android.js.map +1 -1
  35. package/build/universal/BottomSheet/index.ios.js +20 -12
  36. package/build/universal/BottomSheet/index.ios.js.map +1 -1
  37. package/ios/ChartView.swift +7 -4
  38. package/ios/DataListForEachView.swift +1 -0
  39. package/ios/GridView.swift +1 -0
  40. package/ios/HostView.swift +27 -4
  41. package/ios/Modifiers/PresentationModifiers.swift +20 -4
  42. package/ios/NamespaceView.swift +1 -0
  43. package/ios/RNHostView.swift +19 -4
  44. package/ios/SlotView.swift +1 -0
  45. package/ios/TabView/TabView.swift +2 -0
  46. package/ios/ToolbarView.swift +2 -1
  47. package/ios/UIBaseView.swift +13 -0
  48. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.15/expo.modules.ui-58.0.15-sources.jar → 58.0.16/expo.modules.ui-58.0.16-sources.jar} +0 -0
  49. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16-sources.jar.md5 +1 -0
  50. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16-sources.jar.sha1 +1 -0
  51. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16-sources.jar.sha256 +1 -0
  52. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16-sources.jar.sha512 +1 -0
  53. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.aar +0 -0
  54. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.aar.md5 +1 -0
  55. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.aar.sha1 +1 -0
  56. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.aar.sha256 +1 -0
  57. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.aar.sha512 +1 -0
  58. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.15/expo.modules.ui-58.0.15.module → 58.0.16/expo.modules.ui-58.0.16.module} +22 -22
  59. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.module.md5 +1 -0
  60. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.module.sha1 +1 -0
  61. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.module.sha256 +1 -0
  62. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.module.sha512 +1 -0
  63. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.15/expo.modules.ui-58.0.15.pom → 58.0.16/expo.modules.ui-58.0.16.pom} +1 -1
  64. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.pom.md5 +1 -0
  65. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.pom.sha1 +1 -0
  66. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.pom.sha256 +1 -0
  67. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.16/expo.modules.ui-58.0.16.pom.sha512 +1 -0
  68. package/package.json +1 -1
  69. package/prebuilds/output/debug/xcframeworks/ExpoUI.tar.gz +0 -0
  70. package/prebuilds/output/release/xcframeworks/ExpoUI.tar.gz +0 -0
  71. package/src/NativeTreeContext.tsx +31 -0
  72. package/src/community/bottom-sheet/BottomSheet.ios.tsx +7 -6
  73. package/src/community/menu/MenuView.android.tsx +12 -2
  74. package/src/jetpack-compose/DropdownMenu/index.tsx +12 -1
  75. package/src/jetpack-compose/Host/index.tsx +6 -2
  76. package/src/jetpack-compose/RNHostView/index.tsx +3 -1
  77. package/src/swift-ui/Chart/index.tsx +10 -0
  78. package/src/swift-ui/Host/index.tsx +6 -2
  79. package/src/swift-ui/RNHostView.tsx +3 -1
  80. package/src/swift-ui/modifiers/presentationModifiers.ts +18 -2
  81. package/src/types.ts +28 -0
  82. package/src/universal/BottomSheet/index.android.tsx +23 -12
  83. package/src/universal/BottomSheet/index.ios.tsx +20 -9
  84. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15-sources.jar.md5 +0 -1
  85. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15-sources.jar.sha1 +0 -1
  86. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15-sources.jar.sha256 +0 -1
  87. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15-sources.jar.sha512 +0 -1
  88. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.aar +0 -0
  89. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.aar.md5 +0 -1
  90. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.aar.sha1 +0 -1
  91. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.aar.sha256 +0 -1
  92. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.aar.sha512 +0 -1
  93. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.module.md5 +0 -1
  94. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.module.sha1 +0 -1
  95. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.module.sha256 +0 -1
  96. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.module.sha512 +0 -1
  97. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.pom.md5 +0 -1
  98. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.pom.sha1 +0 -1
  99. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.pom.sha256 +0 -1
  100. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.15/expo.modules.ui-58.0.15.pom.sha512 +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["swift-ui/Host/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","I18nManager","TextInputHostProvider","useTextInputHostRef","useMergeRefs","createViewModifierEventListener","HostNativeView","Host","props","matchContents","onLayoutContent","ignoreSafeArea","modifiers","layoutDirection","seedColor","ref","restProps","hostRef","mergedRef","undefined","matchContentsVertical","vertical","matchContentsHorizontal","horizontal","getConstants","isRTL"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAEzC,SAASC,WAAW,QAAyD,eAAe;AAE5F,SAASC,qBAAqB,EAAEC,mBAAmB,QAAQ,iBAAiB;AAC5E,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,+BAA+B,QAAQ,qBAAqB;AAyDrE,MAAMC,iBAMFN,kBAAkB,UAAU;AAEhC;;CAEC,GACD,OAAO,SAASO,KAAKC,KAAgB;IACnC,MAAM,EACJC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,eAAe,EACfC,SAAS,EACTC,GAAG,EACH,GAAGC,WACJ,GAAGR;IACJ,MAAMS,UAAUd;IAChB,MAAMe,YAAYd,aAAaW,KAAKE;IAEpC,qBACE,KAACf;QAAsBe,SAASA;kBAC9B,cAAA,KAACX;YACCM,WAAWA;YACV,GAAIA,YAAYP,gCAAgCO,aAAaO,SAAS;YACvEC,uBACE,OAAOX,kBAAkB,WAAWA,cAAcY,QAAQ,GAAGZ;YAE/Da,yBACE,OAAOb,kBAAkB,WAAWA,cAAcc,UAAU,GAAGd;YAEjEC,iBAAiBA;YACjBG,iBACEA,mBAAoBZ,CAAAA,YAAYuB,YAAY,GAAGC,KAAK,GAAG,gBAAgB,aAAY;YAErFd,gBAAgBA;YAChBG,WAAWA;YACV,GAAGE,SAAS;YACbD,KAAKG;;;AAIb"}
1
+ {"version":3,"sources":["swift-ui/Host/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","I18nManager","NativeTreeContext","useWarnIfNestedHost","TextInputHostProvider","useTextInputHostRef","useMergeRefs","createViewModifierEventListener","HostNativeView","Host","props","matchContents","onLayoutContent","ignoreSafeArea","modifiers","layoutDirection","seedColor","ref","children","restProps","hostRef","mergedRef","undefined","matchContentsVertical","vertical","matchContentsHorizontal","horizontal","getConstants","isRTL","Provider","value"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAEzC,SAASC,WAAW,QAAyD,eAAe;AAE5F,SAASC,iBAAiB,EAAEC,mBAAmB,QAAQ,0BAA0B;AACjF,SAASC,qBAAqB,EAAEC,mBAAmB,QAAQ,iBAAiB;AAC5E,SAASC,YAAY,QAAQ,2BAA2B;AACxD,SAASC,+BAA+B,QAAQ,qBAAqB;AAyDrE,MAAMC,iBAMFR,kBAAkB,UAAU;AAEhC;;CAEC,GACD,OAAO,SAASS,KAAKC,KAAgB;IACnC,MAAM,EACJC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,SAAS,EACTC,eAAe,EACfC,SAAS,EACTC,GAAG,EACHC,QAAQ,EACR,GAAGC,WACJ,GAAGT;IACJ,MAAMU,UAAUf;IAChB,MAAMgB,YAAYf,aAAaW,KAAKG;IACpCjB,oBAAoB;IAEpB,qBACE,KAACC;QAAsBgB,SAASA;kBAC9B,cAAA,KAACZ;YACCM,WAAWA;YACV,GAAIA,YAAYP,gCAAgCO,aAAaQ,SAAS;YACvEC,uBACE,OAAOZ,kBAAkB,WAAWA,cAAca,QAAQ,GAAGb;YAE/Dc,yBACE,OAAOd,kBAAkB,WAAWA,cAAce,UAAU,GAAGf;YAEjEC,iBAAiBA;YACjBG,iBACEA,mBAAoBd,CAAAA,YAAY0B,YAAY,GAAGC,KAAK,GAAG,gBAAgB,aAAY;YAErFf,gBAAgBA;YAChBG,WAAWA;YACV,GAAGG,SAAS;YACbF,KAAKI;sBACL,cAAA,KAACnB,kBAAkB2B,QAAQ;gBAACC,KAAK;0BAAEZ;;;;AAI3C"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createElement as _createElement } from "react";
3
3
  import { requireNativeView } from 'expo';
4
+ import { NativeTreeContext } from '../NativeTreeContext';
4
5
  import { PresentedContentContext, useIsPresentedInOwnWindow } from '../PresentedContentContext';
5
6
  import { resolveMatchContents } from '../utils/matchContents';
6
7
  const RNHostNativeView = requireNativeView('ExpoUI', 'RNHostView');
@@ -22,7 +23,10 @@ export function RNHostView({ matchContents, ...props }) {
22
23
  key: `${matchContentsHorizontal}-${matchContentsVertical}`
23
24
  }, /*#__PURE__*/ _jsx(PresentedContentContext.Provider, {
24
25
  value: false,
25
- children: props.children
26
+ children: /*#__PURE__*/ _jsx(NativeTreeContext.Provider, {
27
+ value: false,
28
+ children: props.children
29
+ })
26
30
  }));
27
31
  }
28
32
 
@@ -1 +1 @@
1
- {"version":3,"sources":["swift-ui/RNHostView.tsx"],"sourcesContent":[null],"names":["requireNativeView","PresentedContentContext","useIsPresentedInOwnWindow","resolveMatchContents","RNHostNativeView","RNHostView","matchContents","props","layoutRoot","horizontal","matchContentsHorizontal","vertical","matchContentsVertical","expoInternalSizeFromChildren","key","Provider","value","children"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SAASC,uBAAuB,EAAEC,yBAAyB,QAAQ,6BAA6B;AAChG,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,MAAMC,mBAA6CJ,kBAAkB,UAAU;AAoB/E,OAAO,SAASK,WAAW,EAAEC,aAAa,EAAE,GAAGC,OAAwB;IACrE,6FAA6F;IAC7F,sEAAsE;IACtE,4FAA4F;IAC5F,0BAA0B;IAC1B,MAAMC,aAAaN;IACnB,MAAM,EAAEO,YAAYC,uBAAuB,EAAEC,UAAUC,qBAAqB,EAAE,GAC5ET,qBAAqBG;IAEvB,qBACE,eAACF;QACE,GAAGG,KAAK;QACTC,YAAYA;QACZE,yBAAyBA;QACzBE,uBAAuBA;QACvBC,8BAA8BH,2BAA2BE;QACzD,iDAAiD;QACjD,mEAAmE;QACnEE,KAAK,GAAGJ,wBAAwB,CAAC,EAAEE,uBAAuB;qBAE1D,KAACX,wBAAwBc,QAAQ;QAACC,OAAO;kBACtCT,MAAMU,QAAQ;;AAIvB"}
1
+ {"version":3,"sources":["swift-ui/RNHostView.tsx"],"sourcesContent":[null],"names":["requireNativeView","NativeTreeContext","PresentedContentContext","useIsPresentedInOwnWindow","resolveMatchContents","RNHostNativeView","RNHostView","matchContents","props","layoutRoot","horizontal","matchContentsHorizontal","vertical","matchContentsVertical","expoInternalSizeFromChildren","key","Provider","value","children"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAGzC,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,uBAAuB,EAAEC,yBAAyB,QAAQ,6BAA6B;AAChG,SAASC,oBAAoB,QAAQ,yBAAyB;AAE9D,MAAMC,mBAA6CL,kBAAkB,UAAU;AAoB/E,OAAO,SAASM,WAAW,EAAEC,aAAa,EAAE,GAAGC,OAAwB;IACrE,6FAA6F;IAC7F,sEAAsE;IACtE,4FAA4F;IAC5F,0BAA0B;IAC1B,MAAMC,aAAaN;IACnB,MAAM,EAAEO,YAAYC,uBAAuB,EAAEC,UAAUC,qBAAqB,EAAE,GAC5ET,qBAAqBG;IAEvB,qBACE,eAACF;QACE,GAAGG,KAAK;QACTC,YAAYA;QACZE,yBAAyBA;QACzBE,uBAAuBA;QACvBC,8BAA8BH,2BAA2BE;QACzD,iDAAiD;QACjD,mEAAmE;QACnEE,KAAK,GAAGJ,wBAAwB,CAAC,EAAEE,uBAAuB;qBAE1D,KAACX,wBAAwBc,QAAQ;QAACC,OAAO;kBAEvC,cAAA,KAAChB,kBAAkBe,QAAQ;YAACC,OAAO;sBAAQT,MAAMU,QAAQ;;;AAIjE"}
@@ -87,11 +87,27 @@ export declare const interactiveDismissDisabled: (isDisabled?: boolean) => Modif
87
87
  * sheets remain edge-attached and detents drive the height.
88
88
  */
89
89
  export type PresentationSizingType = 'automatic' | 'fitted' | 'form' | 'page';
90
+ /**
91
+ * Options for the `presentationSizing` modifier.
92
+ */
93
+ export type PresentationSizingOptions = {
94
+ /**
95
+ * The axes on which the sheet fits its content. An axis that is not set keeps the size from
96
+ * `sizing`. For example, `{ horizontal: false, vertical: true }` fits the height to the content
97
+ * and lets the system choose the width.
98
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/presentationsizing/fitted(horizontal:vertical:)).
99
+ */
100
+ fitted?: {
101
+ horizontal?: boolean;
102
+ vertical?: boolean;
103
+ };
104
+ };
90
105
  /**
91
106
  * Sets the sizing of a sheet presentation.
92
107
  * @param sizing - The sizing behavior to apply.
108
+ * @param options - Additional sizing options.
93
109
  * @platform ios 18.0+
94
110
  * @platform tvos 18.0+
95
111
  * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationsizing(_:)).
96
112
  */
97
- export declare const presentationSizing: (sizing: PresentationSizingType) => ModifierConfig;
113
+ export declare const presentationSizing: (sizing: PresentationSizingType, options?: PresentationSizingOptions) => ModifierConfig;
@@ -81,11 +81,13 @@ documentation](https://developer.apple.com/documentation/swiftui/view/presentati
81
81
  /**
82
82
  * Sets the sizing of a sheet presentation.
83
83
  * @param sizing - The sizing behavior to apply.
84
+ * @param options - Additional sizing options.
84
85
  * @platform ios 18.0+
85
86
  * @platform tvos 18.0+
86
87
  * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/presentationsizing(_:)).
87
- */ export const presentationSizing = (sizing)=>createModifier('presentationSizing', {
88
- sizing
88
+ */ export const presentationSizing = (sizing, options)=>createModifier('presentationSizing', {
89
+ sizing,
90
+ ...options
89
91
  });
90
92
 
91
93
  //# sourceMappingURL=presentationModifiers.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["swift-ui/modifiers/presentationModifiers.ts"],"sourcesContent":[null],"names":["createModifier","createModifierWithEventListener","resolveShapeStyle","presentationDetents","detents","options","params","selection","onSelectionChange","args","detent","presentationDragIndicator","visibility","presentationCornerRadius","cornerRadius","presentationBackgroundInteraction","interaction","interactionType","presentationBackground","style","interactiveDismissDisabled","isDisabled","presentationSizing","sizing"],"mappings":"AAAA,SACEA,cAAc,EACdC,+BAA+B,QAE1B,mBAAmB;AAC1B,SAASC,iBAAiB,QAAyB,eAAe;AAWlE;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SACAC;IAKA,MAAMC,SAAS;QAAEF;QAASG,WAAWF,SAASE;IAAU;IAExD,MAAM,EAAEC,iBAAiB,EAAE,GAAGH,WAAW,CAAC;IAC1C,IAAIG,mBAAmB;QACrB,OAAOP,gCACL,uBACA,CAACQ;YACCD,kBAAkBC,KAAKC,MAAM;QAC/B,GACAJ;IAEJ;IAEA,OAAON,eAAe,uBAAuBM;AAC/C,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMK,4BAA4B,CAACC,aACxCZ,eAAe,6BAA6B;QAAEY;IAAW,GAAG;AAE9D;;;;;;CAMC,GACD,OAAO,MAAMC,2BAA2B,CAACC,eACvCd,eAAe,4BAA4B;QAAEc;IAAa,GAAG;AAW/D;;;;;;CAMC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC;IAEA,IAAI,OAAOA,gBAAgB,UAAU;QACnC,OAAOhB,eAAe,qCAAqC;YAAEiB,iBAAiBD;QAAY;IAC5F;IACA,OAAOhB,eAAe,qCAAqC;QACzDiB,iBAAiB;QACjBP,QAAQM,YAAYN,MAAM;IAC5B;AACF,EAAE;AAEF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMQ,yBAAyB,CAACC,QACrCnB,eAAe,0BAA0B;QAAEmB,OAAOjB,kBAAkBiB;IAAO,GAAG;AAEhF;;;;CAIC,GACD,OAAO,MAAMC,6BAA6B,CAACC,aAAsB,IAAI,GACnErB,eAAe,8BAA8B;QAAEqB;IAAW,GAAG;AAc/D;;;;;;CAMC,GACD,OAAO,MAAMC,qBAAqB,CAACC,SACjCvB,eAAe,sBAAsB;QAAEuB;IAAO,GAAG"}
1
+ {"version":3,"sources":["swift-ui/modifiers/presentationModifiers.ts"],"sourcesContent":[null],"names":["createModifier","createModifierWithEventListener","resolveShapeStyle","presentationDetents","detents","options","params","selection","onSelectionChange","args","detent","presentationDragIndicator","visibility","presentationCornerRadius","cornerRadius","presentationBackgroundInteraction","interaction","interactionType","presentationBackground","style","interactiveDismissDisabled","isDisabled","presentationSizing","sizing"],"mappings":"AAAA,SACEA,cAAc,EACdC,+BAA+B,QAE1B,mBAAmB;AAC1B,SAASC,iBAAiB,QAAyB,eAAe;AAWlE;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SACAC;IAKA,MAAMC,SAAS;QAAEF;QAASG,WAAWF,SAASE;IAAU;IAExD,MAAM,EAAEC,iBAAiB,EAAE,GAAGH,WAAW,CAAC;IAC1C,IAAIG,mBAAmB;QACrB,OAAOP,gCACL,uBACA,CAACQ;YACCD,kBAAkBC,KAAKC,MAAM;QAC/B,GACAJ;IAEJ;IAEA,OAAON,eAAe,uBAAuBM;AAC/C,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMK,4BAA4B,CAACC,aACxCZ,eAAe,6BAA6B;QAAEY;IAAW,GAAG;AAE9D;;;;;;CAMC,GACD,OAAO,MAAMC,2BAA2B,CAACC,eACvCd,eAAe,4BAA4B;QAAEc;IAAa,GAAG;AAW/D;;;;;;CAMC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC;IAEA,IAAI,OAAOA,gBAAgB,UAAU;QACnC,OAAOhB,eAAe,qCAAqC;YAAEiB,iBAAiBD;QAAY;IAC5F;IACA,OAAOhB,eAAe,qCAAqC;QACzDiB,iBAAiB;QACjBP,QAAQM,YAAYN,MAAM;IAC5B;AACF,EAAE;AAEF;;;;;;;;;;;CAWC,GACD,OAAO,MAAMQ,yBAAyB,CAACC,QACrCnB,eAAe,0BAA0B;QAAEmB,OAAOjB,kBAAkBiB;IAAO,GAAG;AAEhF;;;;CAIC,GACD,OAAO,MAAMC,6BAA6B,CAACC,aAAsB,IAAI,GACnErB,eAAe,8BAA8B;QAAEqB;IAAW,GAAG;AA2B/D;;;;;;;CAOC,GACD,OAAO,MAAMC,qBAAqB,CAChCC,QACAlB,UACGL,eAAe,sBAAsB;QAAEuB;QAAQ,GAAGlB,OAAO;IAAC,GAAG"}
package/build/types.d.ts CHANGED
@@ -44,3 +44,30 @@ export type DialogProperties = {
44
44
  */
45
45
  decorFitsSystemWindows?: boolean;
46
46
  };
47
+ /**
48
+ * Properties for the popup window, matching `PopupProperties` in Compose.
49
+ */
50
+ export type PopupProperties = {
51
+ /**
52
+ * Whether the popup is focusable. When `true`, the popup receives IME events and key presses,
53
+ * such as the back button.
54
+ * @default true
55
+ */
56
+ focusable?: boolean;
57
+ /**
58
+ * Whether the popup can be dismissed by pressing the back button. Has no effect when `focusable` is `false`.
59
+ * @default true
60
+ */
61
+ dismissOnBackPress?: boolean;
62
+ /**
63
+ * Whether the popup can be dismissed by clicking outside of its bounds.
64
+ * @default true
65
+ */
66
+ dismissOnClickOutside?: boolean;
67
+ /**
68
+ * Whether the popup window is clipped to the screen boundaries. Set to `false` to let it extend
69
+ * beyond them, which positions the popup accurately.
70
+ * @default true
71
+ */
72
+ clippingEnabled?: boolean;
73
+ };
package/build/types.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @hidden
3
3
  */ /**
4
- * Properties for the dialog window, matching `DialogProperties` in Compose.
4
+ * Properties for the popup window, matching `PopupProperties` in Compose.
5
5
  */ export { };
6
6
 
7
7
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;CAEC,GAwBD;;CAEC,GACD,WAsBE"}
1
+ {"version":3,"sources":["types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;CAEC,GAmDD;;CAEC,GACD,WAuBE"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Column, Host, ModalBottomSheet } from '@expo/ui/jetpack-compose';
3
3
  import { fillMaxHeight, padding, testID as testIDModifier } from '@expo/ui/jetpack-compose/modifiers';
4
4
  import { useEffect, useRef, useState } from 'react';
5
+ import { useIsInsideNativeTree } from '../../NativeTreeContext';
5
6
  import { resolveContentPadding } from './utils';
6
7
  // M3 `ModalBottomSheet` only has partial/expanded states.
7
8
  // Only allow the partial state when the consumer requested a partial-friendly snap point.
@@ -16,6 +17,7 @@ function shouldFillMaxHeight(snapPoints) {
16
17
  return snapPoints.some((sp)=>sp === 'full' || typeof sp === 'object' && 'fraction' in sp && sp.fraction >= 1);
17
18
  }
18
19
  export function BottomSheet({ children, isPresented, onDismiss, showDragIndicator = true, snapPoints, testID, modifiers, shouldDismissOnBackPress = true, shouldDismissOnClickOutside = true, scrimColor, contentPadding, containerColor, contentColor }) {
20
+ const isInsideHost = useIsInsideNativeTree();
19
21
  const sheetRef = useRef(null);
20
22
  const [mount, setMount] = useState(isPresented);
21
23
  useEffect(()=>{
@@ -49,29 +51,35 @@ export function BottomSheet({ children, isPresented, onDismiss, showDragIndicato
49
51
  ];
50
52
  if (shouldFillMaxHeight(snapPoints)) contentModifiers.push(fillMaxHeight());
51
53
  if (testID) contentModifiers.push(testIDModifier(testID));
54
+ const sheet = /*#__PURE__*/ _jsx(ModalBottomSheet, {
55
+ ref: sheetRef,
56
+ onDismissRequest: onDismiss,
57
+ showDragHandle: showDragIndicator,
58
+ skipPartiallyExpanded: shouldSkipPartiallyExpanded(snapPoints),
59
+ properties: {
60
+ shouldDismissOnBackPress,
61
+ shouldDismissOnClickOutside
62
+ },
63
+ scrimColor: scrimColor,
64
+ containerColor: containerColor,
65
+ contentColor: contentColor,
66
+ modifiers: modifiers,
67
+ children: /*#__PURE__*/ _jsx(Column, {
68
+ modifiers: contentModifiers,
69
+ children: children
70
+ })
71
+ });
72
+ // Already inside a `Host`, for example nested in another sheet's content: a `Host` of its own
73
+ // would be a `Host` directly inside Compose.
74
+ if (isInsideHost) {
75
+ return sheet;
76
+ }
52
77
  return /*#__PURE__*/ _jsx(Host, {
53
78
  style: {
54
79
  position: 'absolute'
55
80
  },
56
81
  pointerEvents: "none",
57
- children: /*#__PURE__*/ _jsx(ModalBottomSheet, {
58
- ref: sheetRef,
59
- onDismissRequest: onDismiss,
60
- showDragHandle: showDragIndicator,
61
- skipPartiallyExpanded: shouldSkipPartiallyExpanded(snapPoints),
62
- properties: {
63
- shouldDismissOnBackPress,
64
- shouldDismissOnClickOutside
65
- },
66
- scrimColor: scrimColor,
67
- containerColor: containerColor,
68
- contentColor: contentColor,
69
- modifiers: modifiers,
70
- children: /*#__PURE__*/ _jsx(Column, {
71
- modifiers: contentModifiers,
72
- children: children
73
- })
74
- })
82
+ children: sheet
75
83
  });
76
84
  }
77
85
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/BottomSheet/index.android.tsx"],"sourcesContent":[null],"names":["Column","Host","ModalBottomSheet","fillMaxHeight","padding","testID","testIDModifier","useEffect","useRef","useState","resolveContentPadding","shouldSkipPartiallyExpanded","snapPoints","length","some","sp","fraction","shouldFillMaxHeight","BottomSheet","children","isPresented","onDismiss","showDragIndicator","modifiers","shouldDismissOnBackPress","shouldDismissOnClickOutside","scrimColor","contentPadding","containerColor","contentColor","sheetRef","mount","setMount","cancelled","current","hide","then","top","bottom","left","right","contentModifiers","push","style","position","pointerEvents","ref","onDismissRequest","showDragHandle","skipPartiallyExpanded","properties"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,EAAEC,gBAAgB,QAAkC,2BAA2B;AACpG,SACEC,aAAa,EACbC,OAAO,EACPC,UAAUC,cAAc,QAEnB,qCAAqC;AAC5C,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAGpD,SAASC,qBAAqB,QAAQ,UAAU;AAEhD,0DAA0D;AAC1D,0FAA0F;AAC1F,SAASC,4BAA4BC,UAAmC;IACtE,IAAI,CAACA,cAAcA,WAAWC,MAAM,KAAK,GAAG,OAAO;IACnD,OAAO,CAACD,WAAWE,IAAI,CACrB,CAACC,KACCA,OAAO,UACN,OAAOA,OAAO,YAAY,cAAcA,MAAMA,GAAGC,QAAQ,GAAG,KAC5D,OAAOD,OAAO,YAAY,YAAYA;AAE7C;AAEA,wCAAwC;AACxC,uGAAuG;AACvG,SAASE,oBAAoBL,UAAmC;IAC9D,IAAI,CAACA,cAAcA,WAAWC,MAAM,KAAK,GAAG,OAAO;IACnD,OAAOD,WAAWE,IAAI,CACpB,CAACC,KAAOA,OAAO,UAAW,OAAOA,OAAO,YAAY,cAAcA,MAAMA,GAAGC,QAAQ,IAAI;AAE3F;AAEA,OAAO,SAASE,YAAY,EAC1BC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,oBAAoB,IAAI,EACxBV,UAAU,EACVP,MAAM,EACNkB,SAAS,EACTC,2BAA2B,IAAI,EAC/BC,8BAA8B,IAAI,EAClCC,UAAU,EACVC,cAAc,EACdC,cAAc,EACdC,YAAY,EACK;IACjB,MAAMC,WAAWtB,OAA4B;IAC7C,MAAM,CAACuB,OAAOC,SAAS,GAAGvB,SAASW;IAEnCb,UAAU;QACR,IAAIa,aAAa;YACfY,SAAS;YACT;QACF;QACA,IAAIC,YAAY;QAChBH,SAASI,OAAO,EAAEC,OAAOC,KAAK;YAC5B,IAAI,CAACH,WAAWD,SAAS;QAC3B;QACA,OAAO;YACLC,YAAY;QACd;IACF,GAAG;QAACb;KAAY;IAEhB,IAAI,CAACW,OAAO;QACV,OAAO;IACT;IAEA,6FAA6F;IAC7F,qCAAqC;IACrC,MAAM,EAAEM,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAG9B,sBAAsBiB,gBAAgB;QACzEU,KAAKf,oBAAoB,IAAI;QAC7BgB,QAAQ;QACRC,MAAM;QACNC,OAAO;IACT;IACA,MAAMC,mBAAqC;QAACrC,QAAQmC,MAAMF,KAAKG,OAAOF;KAAQ;IAC9E,IAAIrB,oBAAoBL,aAAa6B,iBAAiBC,IAAI,CAACvC;IAC3D,IAAIE,QAAQoC,iBAAiBC,IAAI,CAACpC,eAAeD;IAEjD,qBACE,KAACJ;QAAK0C,OAAO;YAAEC,UAAU;QAAW;QAAGC,eAAc;kBACnD,cAAA,KAAC3C;YACC4C,KAAKhB;YACLiB,kBAAkB1B;YAClB2B,gBAAgB1B;YAChB2B,uBAAuBtC,4BAA4BC;YACnDsC,YAAY;gBAAE1B;gBAA0BC;YAA4B;YACpEC,YAAYA;YACZE,gBAAgBA;YAChBC,cAAcA;YACdN,WAAWA;sBACX,cAAA,KAACvB;gBAAOuB,WAAWkB;0BAAmBtB;;;;AAI9C;AAEA,cAAc,UAAU"}
1
+ {"version":3,"sources":["universal/BottomSheet/index.android.tsx"],"sourcesContent":[null],"names":["Column","Host","ModalBottomSheet","fillMaxHeight","padding","testID","testIDModifier","useEffect","useRef","useState","useIsInsideNativeTree","resolveContentPadding","shouldSkipPartiallyExpanded","snapPoints","length","some","sp","fraction","shouldFillMaxHeight","BottomSheet","children","isPresented","onDismiss","showDragIndicator","modifiers","shouldDismissOnBackPress","shouldDismissOnClickOutside","scrimColor","contentPadding","containerColor","contentColor","isInsideHost","sheetRef","mount","setMount","cancelled","current","hide","then","top","bottom","left","right","contentModifiers","push","sheet","ref","onDismissRequest","showDragHandle","skipPartiallyExpanded","properties","style","position","pointerEvents"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,EAAEC,gBAAgB,QAAkC,2BAA2B;AACpG,SACEC,aAAa,EACbC,OAAO,EACPC,UAAUC,cAAc,QAEnB,qCAAqC;AAC5C,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAEpD,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE,SAASC,qBAAqB,QAAQ,UAAU;AAEhD,0DAA0D;AAC1D,0FAA0F;AAC1F,SAASC,4BAA4BC,UAAmC;IACtE,IAAI,CAACA,cAAcA,WAAWC,MAAM,KAAK,GAAG,OAAO;IACnD,OAAO,CAACD,WAAWE,IAAI,CACrB,CAACC,KACCA,OAAO,UACN,OAAOA,OAAO,YAAY,cAAcA,MAAMA,GAAGC,QAAQ,GAAG,KAC5D,OAAOD,OAAO,YAAY,YAAYA;AAE7C;AAEA,wCAAwC;AACxC,uGAAuG;AACvG,SAASE,oBAAoBL,UAAmC;IAC9D,IAAI,CAACA,cAAcA,WAAWC,MAAM,KAAK,GAAG,OAAO;IACnD,OAAOD,WAAWE,IAAI,CACpB,CAACC,KAAOA,OAAO,UAAW,OAAOA,OAAO,YAAY,cAAcA,MAAMA,GAAGC,QAAQ,IAAI;AAE3F;AAEA,OAAO,SAASE,YAAY,EAC1BC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,oBAAoB,IAAI,EACxBV,UAAU,EACVR,MAAM,EACNmB,SAAS,EACTC,2BAA2B,IAAI,EAC/BC,8BAA8B,IAAI,EAClCC,UAAU,EACVC,cAAc,EACdC,cAAc,EACdC,YAAY,EACK;IACjB,MAAMC,eAAerB;IACrB,MAAMsB,WAAWxB,OAA4B;IAC7C,MAAM,CAACyB,OAAOC,SAAS,GAAGzB,SAASY;IAEnCd,UAAU;QACR,IAAIc,aAAa;YACfa,SAAS;YACT;QACF;QACA,IAAIC,YAAY;QAChBH,SAASI,OAAO,EAAEC,OAAOC,KAAK;YAC5B,IAAI,CAACH,WAAWD,SAAS;QAC3B;QACA,OAAO;YACLC,YAAY;QACd;IACF,GAAG;QAACd;KAAY;IAEhB,IAAI,CAACY,OAAO;QACV,OAAO;IACT;IAEA,6FAA6F;IAC7F,qCAAqC;IACrC,MAAM,EAAEM,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAG/B,sBAAsBiB,gBAAgB;QACzEW,KAAKhB,oBAAoB,IAAI;QAC7BiB,QAAQ;QACRC,MAAM;QACNC,OAAO;IACT;IACA,MAAMC,mBAAqC;QAACvC,QAAQqC,MAAMF,KAAKG,OAAOF;KAAQ;IAC9E,IAAItB,oBAAoBL,aAAa8B,iBAAiBC,IAAI,CAACzC;IAC3D,IAAIE,QAAQsC,iBAAiBC,IAAI,CAACtC,eAAeD;IAEjD,MAAMwC,sBACJ,KAAC3C;QACC4C,KAAKd;QACLe,kBAAkBzB;QAClB0B,gBAAgBzB;QAChB0B,uBAAuBrC,4BAA4BC;QACnDqC,YAAY;YAAEzB;YAA0BC;QAA4B;QACpEC,YAAYA;QACZE,gBAAgBA;QAChBC,cAAcA;QACdN,WAAWA;kBACX,cAAA,KAACxB;YAAOwB,WAAWmB;sBAAmBvB;;;IAI1C,8FAA8F;IAC9F,6CAA6C;IAC7C,IAAIW,cAAc;QAChB,OAAOc;IACT;IACA,qBACE,KAAC5C;QAAKkD,OAAO;YAAEC,UAAU;QAAW;QAAGC,eAAc;kBAClDR;;AAGP;AAEA,cAAc,UAAU"}
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { BottomSheet as SwiftUIBottomSheet, Group, Host } from '@expo/ui/swift-ui';
3
3
  import { frame, padding, presentationBackground, presentationDetents, presentationDragIndicator } from '@expo/ui/swift-ui/modifiers';
4
+ import { useIsInsideNativeTree } from '../../NativeTreeContext';
4
5
  import { resolveContentPadding } from './utils';
5
6
  function snapPointToDetent(snapPoint) {
6
7
  if (snapPoint === 'half') return 'medium';
@@ -8,6 +9,7 @@ function snapPointToDetent(snapPoint) {
8
9
  return snapPoint;
9
10
  }
10
11
  export function BottomSheet({ children, isPresented, onDismiss, showDragIndicator = true, snapPoints, testID, modifiers, contentPadding, containerColor }) {
12
+ const isInsideHost = useIsInsideNativeTree();
11
13
  const { top, bottom, left, right } = resolveContentPadding(contentPadding, {
12
14
  top: 16,
13
15
  bottom: 0,
@@ -36,23 +38,29 @@ export function BottomSheet({ children, isPresented, onDismiss, showDragIndicato
36
38
  if (modifiers?.length) {
37
39
  presentationModifiers.push(...modifiers);
38
40
  }
41
+ const sheet = /*#__PURE__*/ _jsx(SwiftUIBottomSheet, {
42
+ isPresented: isPresented,
43
+ onIsPresentedChange: (presented)=>{
44
+ if (!presented) onDismiss();
45
+ },
46
+ fitToContents: !snapPoints || snapPoints.length === 0,
47
+ testID: testID,
48
+ children: /*#__PURE__*/ _jsx(Group, {
49
+ modifiers: presentationModifiers,
50
+ children: children
51
+ })
52
+ });
53
+ // Already inside a `Host`, for example nested in another sheet's content: a `Host` of its own
54
+ // would be a `Host` directly inside SwiftUI.
55
+ if (isInsideHost) {
56
+ return sheet;
57
+ }
39
58
  return /*#__PURE__*/ _jsx(Host, {
40
59
  style: {
41
60
  position: 'absolute'
42
61
  },
43
62
  pointerEvents: "none",
44
- children: /*#__PURE__*/ _jsx(SwiftUIBottomSheet, {
45
- isPresented: isPresented,
46
- onIsPresentedChange: (presented)=>{
47
- if (!presented) onDismiss();
48
- },
49
- fitToContents: !snapPoints || snapPoints.length === 0,
50
- testID: testID,
51
- children: /*#__PURE__*/ _jsx(Group, {
52
- modifiers: presentationModifiers,
53
- children: children
54
- })
55
- })
63
+ children: sheet
56
64
  });
57
65
  }
58
66
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/BottomSheet/index.ios.tsx"],"sourcesContent":[null],"names":["BottomSheet","SwiftUIBottomSheet","Group","Host","frame","padding","presentationBackground","presentationDetents","presentationDragIndicator","resolveContentPadding","snapPointToDetent","snapPoint","children","isPresented","onDismiss","showDragIndicator","snapPoints","testID","modifiers","contentPadding","containerColor","top","bottom","left","right","presentationModifiers","maxWidth","Infinity","alignment","leading","trailing","length","push","map","style","position","pointerEvents","onIsPresentedChange","presented","fitToContents"],"mappings":";AAAA,SAASA,eAAeC,kBAAkB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AACnF,SACEC,KAAK,EACLC,OAAO,EACPC,sBAAsB,EACtBC,mBAAmB,EACnBC,yBAAyB,QAGpB,8BAA8B;AAGrC,SAASC,qBAAqB,QAAQ,UAAU;AAEhD,SAASC,kBAAkBC,SAAoB;IAC7C,IAAIA,cAAc,QAAQ,OAAO;IACjC,IAAIA,cAAc,QAAQ,OAAO;IACjC,OAAOA;AACT;AAEA,OAAO,SAASX,YAAY,EAC1BY,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,oBAAoB,IAAI,EACxBC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,cAAc,EACG;IACjB,MAAM,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGf,sBAAsBU,gBAAgB;QACzEE,KAAK;QACLC,QAAQ;QACRC,MAAM;QACNC,OAAO;IACT;IACA,MAAMC,wBAA0C;QAC9CrB,MAAM;YAAEsB,UAAUC;YAAUC,WAAW;QAAa;QACpDvB,QAAQ;YAAEgB;YAAKC;YAAQO,SAASN;YAAMO,UAAUN;QAAM;QACtDhB,0BAA0BO,oBAAoB,YAAY;KAC3D;IACD,IAAIC,cAAcA,WAAWe,MAAM,GAAG,GAAG;QACvCN,sBAAsBO,IAAI,CAACzB,oBAAoBS,WAAWiB,GAAG,CAACvB;IAChE;IACA,IAAIU,gBAAgB;QAClBK,sBAAsBO,IAAI,CAAC1B,uBAAuBc;IACpD;IACA,IAAIF,WAAWa,QAAQ;QACrBN,sBAAsBO,IAAI,IAAId;IAChC;IAEA,qBACE,KAACf;QAAK+B,OAAO;YAAEC,UAAU;QAAW;QAAGC,eAAc;kBACnD,cAAA,KAACnC;YACCY,aAAaA;YACbwB,qBAAqB,CAACC;gBACpB,IAAI,CAACA,WAAWxB;YAClB;YACAyB,eAAe,CAACvB,cAAcA,WAAWe,MAAM,KAAK;YACpDd,QAAQA;sBACR,cAAA,KAACf;gBAAMgB,WAAWO;0BAAwBb;;;;AAIlD;AAEA,cAAc,UAAU"}
1
+ {"version":3,"sources":["universal/BottomSheet/index.ios.tsx"],"sourcesContent":[null],"names":["BottomSheet","SwiftUIBottomSheet","Group","Host","frame","padding","presentationBackground","presentationDetents","presentationDragIndicator","useIsInsideNativeTree","resolveContentPadding","snapPointToDetent","snapPoint","children","isPresented","onDismiss","showDragIndicator","snapPoints","testID","modifiers","contentPadding","containerColor","isInsideHost","top","bottom","left","right","presentationModifiers","maxWidth","Infinity","alignment","leading","trailing","length","push","map","sheet","onIsPresentedChange","presented","fitToContents","style","position","pointerEvents"],"mappings":";AAAA,SAASA,eAAeC,kBAAkB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,oBAAoB;AACnF,SACEC,KAAK,EACLC,OAAO,EACPC,sBAAsB,EACtBC,mBAAmB,EACnBC,yBAAyB,QAGpB,8BAA8B;AAErC,SAASC,qBAAqB,QAAQ,0BAA0B;AAEhE,SAASC,qBAAqB,QAAQ,UAAU;AAEhD,SAASC,kBAAkBC,SAAoB;IAC7C,IAAIA,cAAc,QAAQ,OAAO;IACjC,IAAIA,cAAc,QAAQ,OAAO;IACjC,OAAOA;AACT;AAEA,OAAO,SAASZ,YAAY,EAC1Ba,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,oBAAoB,IAAI,EACxBC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,cAAc,EACdC,cAAc,EACG;IACjB,MAAMC,eAAeb;IACrB,MAAM,EAAEc,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGhB,sBAAsBU,gBAAgB;QACzEG,KAAK;QACLC,QAAQ;QACRC,MAAM;QACNC,OAAO;IACT;IACA,MAAMC,wBAA0C;QAC9CvB,MAAM;YAAEwB,UAAUC;YAAUC,WAAW;QAAa;QACpDzB,QAAQ;YAAEkB;YAAKC;YAAQO,SAASN;YAAMO,UAAUN;QAAM;QACtDlB,0BAA0BQ,oBAAoB,YAAY;KAC3D;IACD,IAAIC,cAAcA,WAAWgB,MAAM,GAAG,GAAG;QACvCN,sBAAsBO,IAAI,CAAC3B,oBAAoBU,WAAWkB,GAAG,CAACxB;IAChE;IACA,IAAIU,gBAAgB;QAClBM,sBAAsBO,IAAI,CAAC5B,uBAAuBe;IACpD;IACA,IAAIF,WAAWc,QAAQ;QACrBN,sBAAsBO,IAAI,IAAIf;IAChC;IAEA,MAAMiB,sBACJ,KAACnC;QACCa,aAAaA;QACbuB,qBAAqB,CAACC;YACpB,IAAI,CAACA,WAAWvB;QAClB;QACAwB,eAAe,CAACtB,cAAcA,WAAWgB,MAAM,KAAK;QACpDf,QAAQA;kBACR,cAAA,KAAChB;YAAMiB,WAAWQ;sBAAwBd;;;IAI9C,8FAA8F;IAC9F,6CAA6C;IAC7C,IAAIS,cAAc;QAChB,OAAOc;IACT;IACA,qBACE,KAACjC;QAAKqC,OAAO;YAAEC,UAAU;QAAW;QAAGC,eAAc;kBAClDN;;AAGP;AAEA,cAAc,UAAU"}
@@ -59,6 +59,8 @@ struct BarChartStyle: Record {
59
59
  struct PieChartStyle: Record {
60
60
  @Field var innerRadius: Double = 0.3
61
61
  @Field var angularInset: Double = 2.0
62
+ @Field var cornerRadius: Double = 0.0
63
+ @Field var opacity: Double = 0.8
62
64
  }
63
65
 
64
66
  struct PointChartStyle: Record {
@@ -115,10 +117,11 @@ public struct ChartView: ExpoSwiftUI.View {
115
117
 
116
118
  @available(iOS 17.0, tvOS 17.0, *)
117
119
  private func createBasePieMark(for dataPoint: ChartDataPoint) -> SectorMark {
118
- let style = props.pieStyle ?? PieChartStyle()
119
- return SectorMark(angle: .value("Value", dataPoint.y), innerRadius: .ratio(style.innerRadius), angularInset: style.angularInset)
120
+ return SectorMark(angle: .value("Value", dataPoint.y), innerRadius: .ratio(pieStyle.innerRadius), angularInset: pieStyle.angularInset)
120
121
  }
121
122
 
123
+ private var pieStyle: PieChartStyle { props.pieStyle ?? PieChartStyle() }
124
+
122
125
  @available(iOS 16.0, tvOS 16.0, *)
123
126
  private func createAreaMark(for dataPoint: ChartDataPoint) -> some ChartContent {
124
127
  if let numericX = dataPoint.xNumericValue {
@@ -212,9 +215,9 @@ public struct ChartView: ExpoSwiftUI.View {
212
215
  case .pie:
213
216
  if #available(iOS 17.0, tvOS 17.0, *) {
214
217
  if hasIndividualColors {
215
- createBasePieMark(for: dataPoint).foregroundStyle(dataPoint.color ?? .blue).opacity(0.8)
218
+ createBasePieMark(for: dataPoint).foregroundStyle(dataPoint.color ?? .blue).cornerRadius(CGFloat(pieStyle.cornerRadius)).opacity(pieStyle.opacity)
216
219
  } else {
217
- createBasePieMark(for: dataPoint).foregroundStyle(by: .value("Category", dataPoint.xValue)).opacity(0.8)
220
+ createBasePieMark(for: dataPoint).foregroundStyle(by: .value("Category", dataPoint.xValue)).cornerRadius(CGFloat(pieStyle.cornerRadius)).opacity(pieStyle.opacity)
218
221
  }
219
222
  }
220
223
  case .rectangle:
@@ -48,6 +48,7 @@ struct DataListForEachItemView: ExpoSwiftUI.View {
48
48
 
49
49
  var body: some View {
50
50
  Children()
51
+ .publishZeroContentOrigin(props.shadowNodeProxy)
51
52
  }
52
53
  }
53
54
 
@@ -41,6 +41,7 @@ public struct GridRowView: ExpoSwiftUI.View {
41
41
  if #available(iOS 16.0, macOS 13.0, tvOS 16.0, *) {
42
42
  GridRow {
43
43
  Children()
44
+ .publishZeroContentOrigin(props.shadowNodeProxy)
44
45
  }
45
46
  } else {
46
47
  EmptyView()
@@ -3,11 +3,28 @@
3
3
  import SwiftUI
4
4
  import ExpoModulesCore
5
5
 
6
- /// Coordinate space anchored at the `Host`, so hosted React Native views can report where SwiftUI
7
- /// actually placed them. Name it last in the chain: Yoga measures a hosted view from the `Host`
8
- /// component view, so any `Host` inset or alignment has to be inside this space, not outside it.
6
+ /// Coordinate space anchored at the `Host`'s SwiftUI root, which macOS measures hosted React Native
7
+ /// views from. iOS uses `HostingViewReference` instead, because this space starts after the
8
+ /// safe-area inset that `UIHostingController` applies to the root.
9
9
  internal let expoHostCoordinateSpace = "expo.ui.host"
10
10
 
11
+ /// The enclosing `Host`'s UIKit view, which Yoga laid out. iOS measures hosted React Native views
12
+ /// from it.
13
+ internal final class HostingViewReference {
14
+ weak var view: UIView?
15
+ }
16
+
17
+ private struct HostingViewEnvironmentKey: EnvironmentKey {
18
+ static let defaultValue: HostingViewReference? = nil
19
+ }
20
+
21
+ extension EnvironmentValues {
22
+ var expoHostingView: HostingViewReference? {
23
+ get { self[HostingViewEnvironmentKey.self] }
24
+ set { self[HostingViewEnvironmentKey.self] = newValue }
25
+ }
26
+ }
27
+
11
28
  internal enum ExpoColorScheme: String, Enumerable {
12
29
  case light
13
30
  case dark
@@ -46,7 +63,11 @@ internal final class HostViewProps: ExpoSwiftUI.ViewProps, ExpoSwiftUI.SafeAreaC
46
63
  @Field var ignoreSafeArea: ExpoSwiftUI.IgnoreSafeArea?
47
64
  @Field var modifiers: ModifierArray?
48
65
  var onLayoutContent = EventDispatcher()
49
- weak var hostingView: UIView?
66
+ let hostingViewReference = HostingViewReference()
67
+ var hostingView: UIView? {
68
+ get { hostingViewReference.view }
69
+ set { hostingViewReference.view = newValue }
70
+ }
50
71
  }
51
72
 
52
73
  struct HostView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
@@ -68,6 +89,7 @@ struct HostView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
68
89
  HostLayout {
69
90
  Children()
70
91
  }
92
+ .environment(\.expoHostingView, props.hostingViewReference)
71
93
  .fixedSize(horizontal: props.matchContentsHorizontal, vertical: props.matchContentsVertical)
72
94
  .modifier(LayoutDirectionModifier(layoutDirection: layoutDirection))
73
95
  .modifier(ColorSchemeModifier(colorScheme: props.colorScheme?.toColorScheme()))
@@ -90,6 +112,7 @@ struct HostView: ExpoSwiftUI.View, ExpoSwiftUI.WithHostingView {
90
112
  ZStack(alignment: alignment) {
91
113
  Children()
92
114
  }
115
+ .environment(\.expoHostingView, props.hostingViewReference)
93
116
  .fixedSize(horizontal: props.matchContentsHorizontal, vertical: props.matchContentsVertical)
94
117
  .modifier(LayoutDirectionModifier(layoutDirection: layoutDirection))
95
118
  .modifier(ColorSchemeModifier(colorScheme: props.colorScheme?.toColorScheme()))
@@ -238,23 +238,39 @@ internal enum PresentationSizingOption: String, Enumerable {
238
238
  case page
239
239
  }
240
240
 
241
+ internal struct PresentationSizingFittedAxes: Record {
242
+ @Field var horizontal: Bool = false
243
+ @Field var vertical: Bool = false
244
+ }
245
+
241
246
  internal struct PresentationSizingModifier: ViewModifier, Record {
242
247
  @Field var sizing: PresentationSizingOption = .automatic
248
+ @Field var fitted: PresentationSizingFittedAxes?
243
249
 
244
250
  func body(content: Content) -> some View {
245
251
  if #available(iOS 18.0, tvOS 18.0, macOS 15.0, *) {
246
252
  switch sizing {
247
253
  case .automatic:
248
- content.presentationSizing(.automatic)
254
+ applySizing(content, .automatic)
249
255
  case .fitted:
250
- content.presentationSizing(.fitted)
256
+ applySizing(content, .fitted)
251
257
  case .form:
252
- content.presentationSizing(.form)
258
+ applySizing(content, .form)
253
259
  case .page:
254
- content.presentationSizing(.page)
260
+ applySizing(content, .page)
255
261
  }
256
262
  } else {
257
263
  content
258
264
  }
259
265
  }
266
+
267
+ @available(iOS 18.0, tvOS 18.0, macOS 15.0, *)
268
+ @ViewBuilder
269
+ private func applySizing(_ content: Content, _ sizing: some PresentationSizing) -> some View {
270
+ if let fitted {
271
+ content.presentationSizing(sizing.fitted(horizontal: fitted.horizontal, vertical: fitted.vertical))
272
+ } else {
273
+ content.presentationSizing(sizing)
274
+ }
275
+ }
260
276
  }
@@ -21,6 +21,7 @@ internal struct NamespaceView: ExpoSwiftUI.View {
21
21
  NamespaceRegistry.shared.registerNamespace(namespace, forKey: props.id)
22
22
 
23
23
  return Children()
24
+ .publishZeroContentOrigin(props.shadowNodeProxy)
24
25
  .onDisappear {
25
26
  NamespaceRegistry.shared.unregisterNamespace(forKey: props.id)
26
27
  }
@@ -107,14 +107,17 @@ struct RNHostView: ExpoSwiftUI.View {
107
107
  private struct PublishContentOriginModifier: ViewModifier {
108
108
  let shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy
109
109
  let isEnabled: Bool
110
+ @Environment(\.expoHostingView) private var hostingView
110
111
 
111
112
  func body(content: Content) -> some View {
112
113
  if isEnabled {
113
114
  content
114
- .onGeometryChange(for: CGRect.self) { proxy in
115
- proxy.frame(in: .named(expoHostCoordinateSpace))
116
- } action: { frame in
117
- shadowNodeProxy.setContentOrigin?(frame.origin)
115
+ .onGeometryChange(for: CGPoint?.self) { proxy in
116
+ originInHost(proxy)
117
+ } action: { origin in
118
+ if let origin {
119
+ shadowNodeProxy.setContentOrigin?(origin)
120
+ }
118
121
  }
119
122
  .onDisappear {
120
123
  shadowNodeProxy.clearContentOrigin?()
@@ -123,6 +126,18 @@ private struct PublishContentOriginModifier: ViewModifier {
123
126
  content
124
127
  }
125
128
  }
129
+
130
+ // Relative to the `Host`'s UIKit view, which Yoga laid out, so a safe-area inset is included.
131
+ private func originInHost(_ proxy: GeometryProxy) -> CGPoint? {
132
+ #if os(macOS)
133
+ return proxy.frame(in: .named(expoHostCoordinateSpace)).origin
134
+ #else
135
+ guard let hostView = hostingView?.view, let window = hostView.window else {
136
+ return nil
137
+ }
138
+ return hostView.convert(proxy.frame(in: .global).origin, from: window)
139
+ #endif
140
+ }
126
141
  }
127
142
 
128
143
  // Tracks the `RCTSurfaceTouchHandler` attached to a hosted RN view so it can be detached when the
@@ -17,6 +17,7 @@ public struct SlotView: ExpoSwiftUI.View {
17
17
 
18
18
  public var body: some View {
19
19
  Children()
20
+ .publishZeroContentOrigin(props.shadowNodeProxy)
20
21
  }
21
22
 
22
23
  func extra<T>(_ key: String, as type: T.Type = T.self) -> T? {
@@ -56,7 +56,9 @@ internal struct TabView: ExpoSwiftUI.View {
56
56
  systemImage: tab.props.systemImage ?? "",
57
57
  value: tab.props.value
58
58
  ) {
59
+ // The tab's own body does not run here, so publish its zero content origin on its content.
59
60
  Self.tabContent(for: tab.props.children ?? [])
61
+ .publishZeroContentOrigin(tab.props.shadowNodeProxy)
60
62
  }
61
63
  #if !os(tvOS)
62
64
  .badge(Self.badgeText(from: tab.props.modifiers))
@@ -15,7 +15,8 @@ private struct ToolbarContentView: View {
15
15
  let children = props.children ?? []
16
16
 
17
17
  if children.contains(where: isItem) {
18
- children.reduce(base) { view, child in
18
+ // The content slot's own body does not run here, so publish its zero content origin on the base.
19
+ children.reduce(AnyView(base.publishZeroContentOrigin(props.shadowNodeProxy))) { view, child in
19
20
  let childView: any View = child.childView
20
21
 
21
22
  guard let slot = child.childView as? SlotView, slot.props.name == "item" else {
@@ -19,6 +19,19 @@ public struct UIBaseView<Props: UIBaseViewProps, Content: ExpoSwiftUI.View<Props
19
19
  innerView
20
20
  .applyAccessibilityIdentifier(props.testID)
21
21
  .applyModifiers(props.modifiers, appContext: props.appContext, globalEventDispatcher: props.globalEventDispatcher)
22
+ .publishZeroContentOrigin(props.shadowNodeProxy)
23
+ }
24
+ }
25
+
26
+ extension View {
27
+ /**
28
+ SwiftUI places this view, so `measure()` must skip its Yoga origin. A zero content origin does that,
29
+ and `RNHostView` reports its own position inside the `Host`. Core clears the entry on teardown.
30
+ */
31
+ func publishZeroContentOrigin(_ shadowNodeProxy: ExpoSwiftUI.ShadowNodeProxy) -> some View {
32
+ onAppear {
33
+ shadowNodeProxy.setContentOrigin?(.zero)
34
+ }
22
35
  }
23
36
  }
24
37
 
@@ -0,0 +1 @@
1
+ 101a40d45fc8e73887c9518fbc88c31e2a700ca6e62d2cc96dd65f72459a9d69
@@ -0,0 +1 @@
1
+ 79141ef63c1b975a30858d8c1ca7bccde8d14a64d337883063b3c1cbe44f977cc40e0fda89d3076fd84b5e47308e86b3659c71744a4fc3cac2b858a0686f38c6
@@ -0,0 +1 @@
1
+ 64369f3b1f16363a28412ac36309b53dc2a29752
@@ -0,0 +1 @@
1
+ b8e480f4d8449359c2f5686c3614c9aa82ef98af9b7ce0edd4d839d14de7696f
@@ -0,0 +1 @@
1
+ 9e42c8a718971e6d77015353c6747570385fe0c1d901cf388a50509e00c9ee8581a81ba88d0e83a611b7ec5a6d1dff4280ecf81ed92776d2cf7c26f48c0048c5