@expo/ui 58.0.8 → 58.0.10

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 (160) hide show
  1. package/CHANGELOG.md +14 -5
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +40 -8
  4. package/android/src/main/java/expo/modules/ui/ComposeViews.kt +21 -3
  5. package/android/src/main/java/expo/modules/ui/DatePickerView.kt +12 -4
  6. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +5 -1
  7. package/android/src/main/java/expo/modules/ui/HorizontalPagerView.kt +3 -1
  8. package/android/src/main/java/expo/modules/ui/HostView.kt +64 -12
  9. package/android/src/main/java/expo/modules/ui/LazyItemsView.kt +14 -2
  10. package/android/src/main/java/expo/modules/ui/ModalBottomSheetView.kt +5 -1
  11. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +29 -4
  12. package/android/src/main/java/expo/modules/ui/RNHostView.kt +68 -17
  13. package/android/src/main/java/expo/modules/ui/ShapeView.kt +3 -1
  14. package/android/src/main/java/expo/modules/ui/SlotView.kt +3 -1
  15. package/android/src/main/java/expo/modules/ui/SnackbarView.kt +5 -1
  16. package/android/src/main/java/expo/modules/ui/TextView.kt +3 -1
  17. package/android/src/main/java/expo/modules/ui/Utils.kt +3 -1
  18. package/android/src/main/java/expo/modules/ui/colors/MaterialColors.kt +5 -1
  19. package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +3 -1
  20. package/android/src/main/java/expo/modules/ui/graphics/ImageLoader.kt +6 -2
  21. package/android/src/main/java/expo/modules/ui/icon/IconView.kt +5 -1
  22. package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +3 -1
  23. package/android/src/main/java/expo/modules/ui/textfield/BasicTextField.kt +10 -2
  24. package/android/src/main/java/expo/modules/ui/textfield/TextField.kt +20 -4
  25. package/android/src/main/java/expo/modules/ui/textfield/TextFieldShared.kt +3 -1
  26. package/build/community/picker/Picker.android.js +7 -0
  27. package/build/community/picker/Picker.android.js.map +1 -1
  28. package/build/jetpack-compose/LazyColumn/index.d.ts +2 -1
  29. package/build/jetpack-compose/LazyColumn/index.js +1 -0
  30. package/build/jetpack-compose/LazyColumn/index.js.map +1 -1
  31. package/build/jetpack-compose/LazyItems/index.d.ts +19 -18
  32. package/build/jetpack-compose/LazyItems/index.js +1 -2
  33. package/build/jetpack-compose/LazyItems/index.js.map +1 -1
  34. package/build/jetpack-compose/LazyRow/index.d.ts +2 -1
  35. package/build/jetpack-compose/LazyRow/index.js +1 -0
  36. package/build/jetpack-compose/LazyRow/index.js.map +1 -1
  37. package/build/jetpack-compose/RNHostView/index.d.ts +6 -1
  38. package/build/jetpack-compose/RNHostView/index.js +9 -4
  39. package/build/jetpack-compose/RNHostView/index.js.map +1 -1
  40. package/build/jetpack-compose/index.d.ts +0 -1
  41. package/build/jetpack-compose/index.js.map +1 -1
  42. package/build/jetpack-compose/modifiers/index.d.ts +18 -3
  43. package/build/jetpack-compose/modifiers/index.js +15 -2
  44. package/build/jetpack-compose/modifiers/index.js.map +1 -1
  45. package/build/swift-ui/LazyHStack/index.d.ts +45 -0
  46. package/build/swift-ui/LazyHStack/index.js +9 -0
  47. package/build/swift-ui/LazyHStack/index.js.map +1 -1
  48. package/build/swift-ui/LazyStackForEach/index.d.ts +44 -0
  49. package/build/swift-ui/LazyStackForEach/index.js +54 -0
  50. package/build/swift-ui/LazyStackForEach/index.js.map +1 -0
  51. package/build/swift-ui/LazyVStack/index.d.ts +45 -0
  52. package/build/swift-ui/LazyVStack/index.js +9 -0
  53. package/build/swift-ui/LazyVStack/index.js.map +1 -1
  54. package/build/swift-ui/List/DataListForEach.d.ts +6 -7
  55. package/build/swift-ui/List/DataListForEach.js.map +1 -1
  56. package/build/swift-ui/List/ListForEach.d.ts +7 -1
  57. package/build/swift-ui/List/ListForEach.js +1 -5
  58. package/build/swift-ui/List/ListForEach.js.map +1 -1
  59. package/build/swift-ui/RNHostView.d.ts +7 -2
  60. package/build/swift-ui/RNHostView.js +7 -3
  61. package/build/swift-ui/RNHostView.js.map +1 -1
  62. package/build/swift-ui/index.d.ts +1 -0
  63. package/build/swift-ui/index.js.map +1 -1
  64. package/build/swift-ui/modifiers/containerBackground.d.ts +2 -2
  65. package/build/swift-ui/modifiers/containerBackground.js +2 -2
  66. package/build/swift-ui/modifiers/index.d.ts +9 -1
  67. package/build/swift-ui/modifiers/index.js +9 -0
  68. package/build/swift-ui/modifiers/index.js.map +1 -1
  69. package/build/universal/ListItem/ListItem.js +11 -2
  70. package/build/universal/ListItem/ListItem.js.map +1 -1
  71. package/build/universal/RNHostView/index.js +12 -5
  72. package/build/universal/RNHostView/index.js.map +1 -1
  73. package/build/universal/RNHostView/types.d.ts +9 -4
  74. package/build/universal/RNHostView/types.js.map +1 -1
  75. package/build/universal/Switch/index.android.js +5 -1
  76. package/build/universal/Switch/index.android.js.map +1 -1
  77. package/build/utils/matchContents.d.ts +10 -0
  78. package/build/utils/matchContents.js +16 -0
  79. package/build/utils/matchContents.js.map +1 -0
  80. package/expo-module.config.json +0 -1
  81. package/ios/DataListForEachView.swift +65 -28
  82. package/ios/ExpoUIModule.swift +0 -1
  83. package/ios/LazyHStackView.swift +3 -0
  84. package/ios/LazyVStackView.swift +3 -0
  85. package/ios/ListView.swift +8 -0
  86. package/ios/Modifiers/ContainerBackgroundModifier.swift +23 -16
  87. package/ios/Modifiers/PreferredColorSchemeModifier.swift +12 -0
  88. package/ios/Modifiers/View+ModifierArray.swift +3 -3
  89. package/ios/Modifiers/ViewModifierRegistry.swift +11 -9
  90. package/ios/Modifiers/WidgetKitModifiers.swift +13 -0
  91. package/ios/RNHostView.swift +55 -9
  92. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10-sources.jar +0 -0
  93. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10-sources.jar.md5 +1 -0
  94. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10-sources.jar.sha1 +1 -0
  95. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10-sources.jar.sha256 +1 -0
  96. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10-sources.jar.sha512 +1 -0
  97. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.aar +0 -0
  98. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.aar.md5 +1 -0
  99. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.aar.sha1 +1 -0
  100. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.aar.sha256 +1 -0
  101. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.aar.sha512 +1 -0
  102. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.8/expo.modules.ui-58.0.8.module → 58.0.10/expo.modules.ui-58.0.10.module} +22 -22
  103. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.module.md5 +1 -0
  104. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.module.sha1 +1 -0
  105. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.module.sha256 +1 -0
  106. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.module.sha512 +1 -0
  107. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.8/expo.modules.ui-58.0.8.pom → 58.0.10/expo.modules.ui-58.0.10.pom} +1 -1
  108. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.pom.md5 +1 -0
  109. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.pom.sha1 +1 -0
  110. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.pom.sha256 +1 -0
  111. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.10/expo.modules.ui-58.0.10.pom.sha512 +1 -0
  112. package/package.json +3 -3
  113. package/prebuilds/output/debug/xcframeworks/ExpoUI.tar.gz +0 -0
  114. package/prebuilds/output/release/xcframeworks/ExpoUI.tar.gz +0 -0
  115. package/src/community/picker/Picker.android.tsx +5 -0
  116. package/src/jetpack-compose/LazyColumn/index.tsx +2 -0
  117. package/src/jetpack-compose/LazyItems/index.tsx +18 -21
  118. package/src/jetpack-compose/LazyRow/index.tsx +2 -0
  119. package/src/jetpack-compose/RNHostView/index.tsx +17 -6
  120. package/src/jetpack-compose/index.ts +0 -1
  121. package/src/jetpack-compose/modifiers/index.ts +16 -3
  122. package/src/swift-ui/LazyHStack/index.tsx +45 -0
  123. package/src/swift-ui/LazyStackForEach/index.tsx +110 -0
  124. package/src/swift-ui/LazyVStack/index.tsx +45 -0
  125. package/src/swift-ui/List/DataListForEach.tsx +7 -8
  126. package/src/swift-ui/List/ListForEach.tsx +10 -3
  127. package/src/swift-ui/RNHostView.tsx +11 -4
  128. package/src/swift-ui/index.tsx +1 -0
  129. package/src/swift-ui/modifiers/containerBackground.ts +2 -2
  130. package/src/swift-ui/modifiers/index.ts +11 -0
  131. package/src/universal/ListItem/ListItem.tsx +10 -1
  132. package/src/universal/RNHostView/index.tsx +8 -3
  133. package/src/universal/RNHostView/types.ts +6 -4
  134. package/src/universal/Switch/index.android.tsx +11 -2
  135. package/src/utils/matchContents.ts +14 -0
  136. package/ios/AccessoryWidgetBackgroundView.swift +0 -27
  137. package/ios/Modifiers/WidgetModifiers.swift +0 -70
  138. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar +0 -0
  139. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.md5 +0 -1
  140. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha1 +0 -1
  141. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha256 +0 -1
  142. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha512 +0 -1
  143. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar +0 -0
  144. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.md5 +0 -1
  145. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha1 +0 -1
  146. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha256 +0 -1
  147. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha512 +0 -1
  148. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.md5 +0 -1
  149. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha1 +0 -1
  150. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha256 +0 -1
  151. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha512 +0 -1
  152. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.md5 +0 -1
  153. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha1 +0 -1
  154. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha256 +0 -1
  155. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha512 +0 -1
  156. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +0 -13
  157. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +0 -1
  158. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +0 -1
  159. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +0 -1
  160. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +0 -1
@@ -10,7 +10,7 @@ import { type ViewEvent } from '../../types';
10
10
  import { createViewModifierEventListener } from '../modifiers/utils';
11
11
  import { type CommonViewModifierProps } from '../types';
12
12
 
13
- export interface ListForEachProps<ItemT> extends CommonViewModifierProps {
13
+ export interface ListForEachProps<T> extends CommonViewModifierProps {
14
14
  /** Called with deleted indices from this group's `data` array. */
15
15
  onDelete?: (indices: number[]) => void;
16
16
  /**
@@ -19,16 +19,16 @@ export interface ListForEachProps<ItemT> extends CommonViewModifierProps {
19
19
  */
20
20
  onMove?: (sourceIndices: number[], destination: number) => void;
21
21
  /** Items to display. Replace the array when updating data. */
22
- data: readonly ItemT[];
22
+ data: readonly T[];
23
23
  /** Returns a stable, unique string key, also used for `List` selection. */
24
- keyExtractor: (item: ItemT, index: number) => string;
24
+ keyExtractor: (item: T, index: number) => string;
25
25
  /**
26
26
  * Renders a row. When `recycling` is `true`, wrap it in `useCallback`, or every row
27
27
  * re-renders on each parent render.
28
28
  * Recycled rows are reused for other items, so their local state (`useState`) carries over.
29
29
  * Reset it when the item changes, or keep the state outside the row.
30
30
  */
31
- children: (info: { item: ItemT; index: number }) => ReactElement;
31
+ children: (info: { item: T; index: number }) => ReactElement;
32
32
  /**
33
33
  * Renders only the rows near the visible range and reuses them while scrolling. Set to `false` to
34
34
  * render every row at once. Set it once; changing it remounts the rows.
@@ -43,8 +43,7 @@ export interface ListForEachProps<ItemT> extends CommonViewModifierProps {
43
43
  overscanCount?: number;
44
44
  /**
45
45
  * Placeholder height in points, excluding `List` insets, until a row is measured.
46
- * Must be positive. Measurements reset when `data` or width changes.
47
- * Ignored when `recycling` is `false`.
46
+ * Must be positive. Ignored when `recycling` is `false`.
48
47
  * @default 64
49
48
  */
50
49
  estimatedItemSize?: number;
@@ -74,7 +73,7 @@ const NativePool = requireNativeView<{ children: ReactElement[] }>(
74
73
  * Rows show placeholders while JS prepares content. Native keys still cover the full data set.
75
74
  * @platform ios
76
75
  */
77
- export function DataListForEach<ItemT>({
76
+ export function DataListForEach<T>({
78
77
  data,
79
78
  keyExtractor,
80
79
  children: renderItem,
@@ -84,7 +83,7 @@ export function DataListForEach<ItemT>({
84
83
  onDelete,
85
84
  onMove,
86
85
  ...props
87
- }: ListForEachProps<ItemT>) {
86
+ }: ListForEachProps<T>) {
88
87
  const { itemKeys, revision, rows, onWindowChange, isCurrentRevision } = useRecycledRows({
89
88
  componentName: 'List.ForEach',
90
89
  Slot: NativeSlot,
@@ -1,4 +1,5 @@
1
1
  import { requireNativeView } from 'expo';
2
+ import { type ReactElement } from 'react';
2
3
 
3
4
  import { useItemKeys } from '../../recycling/useRecycledRows';
4
5
  import { type ViewEvent } from '../../types';
@@ -56,7 +57,13 @@ let warnedElements = false;
56
57
  * Pass `data` with `keyExtractor`, and render each row from a `children` function.
57
58
  * Recycles rows unless `recycling` is `false`.
58
59
  */
59
- export function ListForEach<ItemT>(props: ListForEachProps<ItemT> | ListForEachElementsProps) {
60
+ export function ListForEach<T>(props: ListForEachProps<T>): ReactElement;
61
+ /**
62
+ * @hidden
63
+ * @deprecated Pass `data` and `keyExtractor`, and render each row from a `children` function.
64
+ */
65
+ export function ListForEach(props: ListForEachElementsProps): ReactElement;
66
+ export function ListForEach<T>(props: ListForEachProps<T> | ListForEachElementsProps) {
60
67
  if (props.data === undefined) {
61
68
  if (__DEV__ && !warnedElements) {
62
69
  warnedElements = true;
@@ -87,14 +94,14 @@ function ChildrenListForEach({ children, onDelete, onMove, ...props }: ListForEa
87
94
  );
88
95
  }
89
96
 
90
- function StaticListForEach<ItemT>({
97
+ function StaticListForEach<T>({
91
98
  data,
92
99
  keyExtractor,
93
100
  children: renderItem,
94
101
  overscanCount: _overscanCount,
95
102
  estimatedItemSize: _estimatedItemSize,
96
103
  ...props
97
- }: Omit<ListForEachProps<ItemT>, 'recycling'>) {
104
+ }: Omit<ListForEachProps<T>, 'recycling'>) {
98
105
  const itemKeys = useItemKeys('List.ForEach', data, keyExtractor);
99
106
  return (
100
107
  <ChildrenListForEach {...props}>
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
2
2
  import type { LayoutChangeEvent } from 'react-native';
3
3
 
4
4
  import { PresentedContentContext, useIsPresentedInOwnWindow } from '../PresentedContentContext';
5
+ import { resolveMatchContents } from '../utils/matchContents';
5
6
 
6
7
  const RNHostNativeView: React.ComponentType<any> = requireNativeView('ExpoUI', 'RNHostView');
7
8
 
@@ -10,10 +11,12 @@ export interface RNHostViewProps {
10
11
  * When `true`, the RNHost will update its size in the React Native view tree to match the
11
12
  * children's size.
12
13
  * When `false`, the RNHost will use the size of the parent SwiftUI View.
14
+ * Pass an object to choose per axis. For example, `{ vertical: true }` takes the width from the
15
+ * parent and the height from the children, so text wraps and grows vertically.
13
16
  * Can be only set once on mount.
14
17
  * @default false
15
18
  */
16
- matchContents?: boolean;
19
+ matchContents?: boolean | { vertical?: boolean; horizontal?: boolean };
17
20
  onLayout?: (event: LayoutChangeEvent) => void;
18
21
  /**
19
22
  * The RN View to be hosted.
@@ -21,21 +24,25 @@ export interface RNHostViewProps {
21
24
  children: React.ReactElement;
22
25
  }
23
26
 
24
- export function RNHostView(props: RNHostViewProps) {
27
+ export function RNHostView({ matchContents, ...props }: RNHostViewProps) {
25
28
  // A sheet or popover presents its content in its own view controller, where the React Native
26
29
  // surface root is not an ancestor and so touch dispatches don't work.
27
30
  // Hosted content there owns its touches and is the origin it is measured from; native reads
28
31
  // this one prop for both.
29
32
  const layoutRoot = useIsPresentedInOwnWindow();
33
+ const { horizontal: matchContentsHorizontal, vertical: matchContentsVertical } =
34
+ resolveMatchContents(matchContents);
30
35
 
31
36
  return (
32
37
  <RNHostNativeView
33
38
  {...props}
34
39
  layoutRoot={layoutRoot}
35
- expoInternalSizeFromChildren={props.matchContents}
40
+ matchContentsHorizontal={matchContentsHorizontal}
41
+ matchContentsVertical={matchContentsVertical}
42
+ expoInternalSizeFromChildren={matchContentsHorizontal || matchContentsVertical}
36
43
  // `matchContents` can only be used once on mount
37
44
  // So we force unmount when it changes to prevent unexpected layout
38
- key={props.matchContents ? 'matchContents' : 'noMatchContents'}>
45
+ key={`${matchContentsHorizontal}-${matchContentsVertical}`}>
39
46
  {/* Reset context here so only nearest RNHostView becomes the layout root for its children, and not any other RNHostView above it in the tree. */}
40
47
  <PresentedContentContext.Provider value={false}>
41
48
  {props.children}
@@ -20,6 +20,7 @@ export * from './LabeledContent';
20
20
  export * from './HStack';
21
21
  export * from './LazyHStack';
22
22
  export * from './LazyVStack';
23
+ export { type LazyStackForEachProps } from './LazyStackForEach';
23
24
  export * from './VStack';
24
25
  export * from './ZStack';
25
26
  export * from './Group';
@@ -6,8 +6,8 @@ export type ContainerBackgroundPlacement = 'widget' | 'navigation' | 'navigation
6
6
  /**
7
7
  * Sets the container background of the enclosing container.
8
8
  *
9
- * > **Note:** `navigation` and `navigationSplitView` require iOS 18. On iOS 17 they fall back to
10
- * > the `widget` placement.
9
+ * > **Note:** `navigation` and `navigationSplitView` require iOS 18. The `widget` placement works
10
+ * > only in `expo-widgets` widgets, where the other placements fall back to it on iOS 17.
11
11
  *
12
12
  * @param style - Any [`ShapeStyle`](#shapestyle): a color, a hierarchical style, a material, or a gradient.
13
13
  * @param container - The type of container to apply the background to.
@@ -826,6 +826,16 @@ export const scrollDismissesKeyboard = (
826
826
  export const scrollDisabled = (disabled: boolean = true) =>
827
827
  createModifier('scrollDisabled', { disabled });
828
828
 
829
+ /**
830
+ * Sets the preferred color scheme for the nearest enclosing presentation, such as a `BottomSheet`,
831
+ * including its background. The value overrides the device's light or dark appearance for that
832
+ * presentation.
833
+ * @param colorScheme - The preferred color scheme, or `null` to indicate no preference.
834
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/preferredcolorscheme(_:)).
835
+ */
836
+ export const preferredColorScheme = (colorScheme: 'light' | 'dark' | null) =>
837
+ createModifier('preferredColorScheme', { colorScheme });
838
+
829
839
  /**
830
840
  * Disables or enables clipping of a scrollable view's content to its bounds.
831
841
  * Content drawn outside those bounds, such as a shadow or a view scaled up past the edge, is
@@ -1839,6 +1849,7 @@ export type BuiltInModifier =
1839
1849
  | ReturnType<typeof containerRelativeFrame>
1840
1850
  | ReturnType<typeof scrollContentBackground>
1841
1851
  | ReturnType<typeof scrollDisabled>
1852
+ | ReturnType<typeof preferredColorScheme>
1842
1853
  | ReturnType<typeof scrollClipDisabled>
1843
1854
  | ReturnType<typeof scrollIndicators>
1844
1855
  | ReturnType<typeof scrollEdgeEffectStyle>
@@ -33,7 +33,10 @@ export function ListItem(props: ListItemProps) {
33
33
  const supporting = slots.supporting ?? supportingText;
34
34
 
35
35
  return (
36
- <Pressable onPress={onPress} style={styles.row} testID={testID}>
36
+ <Pressable
37
+ onPress={onPress}
38
+ style={[styles.row, onPress != null ? styles.rowIsPressable : styles.rowIsStatic]}
39
+ testID={testID}>
37
40
  {leading != null ? <View style={styles.slot}>{leading}</View> : null}
38
41
  <View style={styles.main}>
39
42
  <Text style={isDark && styles.darkText}>{slots.headline}</Text>
@@ -52,8 +55,14 @@ const styles = StyleSheet.create({
52
55
  width: '100%',
53
56
  paddingVertical: 12,
54
57
  paddingHorizontal: 16,
58
+ },
59
+ // Pressable defaults to cursor: pointer; override it when not pressable.
60
+ rowIsPressable: {
55
61
  cursor: 'pointer',
56
62
  },
63
+ rowIsStatic: {
64
+ cursor: 'auto',
65
+ },
57
66
  main: {
58
67
  flexDirection: 'column',
59
68
  gap: 2,
@@ -1,11 +1,14 @@
1
1
  import { StyleSheet, View } from 'react-native';
2
2
 
3
+ import { resolveMatchContents } from '../../utils/matchContents';
3
4
  import { useUniversalLifecycle } from '../hooks';
4
5
  import type { RNHostViewProps } from './types';
5
6
 
6
7
  const styles = StyleSheet.create({
7
- fillParent: { width: '100%', height: '100%' },
8
- matchContents: { width: 'fit-content', height: 'fit-content' },
8
+ fillWidth: { width: '100%' },
9
+ fillHeight: { height: '100%' },
10
+ fitWidth: { width: 'fit-content' },
11
+ fitHeight: { height: 'fit-content' },
9
12
  hidden: { display: 'none' },
10
13
  });
11
14
 
@@ -23,13 +26,15 @@ export function RNHostView({
23
26
  onLayout,
24
27
  }: RNHostViewProps) {
25
28
  useUniversalLifecycle(onAppear, onDisappear);
29
+ const { horizontal, vertical } = resolveMatchContents(matchContents);
26
30
 
27
31
  return (
28
32
  <View
29
33
  testID={testID}
30
34
  onLayout={onLayout}
31
35
  style={[
32
- matchContents ? styles.matchContents : styles.fillParent,
36
+ horizontal ? styles.fitWidth : styles.fillWidth,
37
+ vertical ? styles.fitHeight : styles.fillHeight,
33
38
  style,
34
39
  hidden && styles.hidden,
35
40
  ]}>
@@ -8,16 +8,18 @@ import type { UniversalBaseProps } from '../types';
8
8
  */
9
9
  export interface RNHostViewProps extends UniversalBaseProps {
10
10
  /**
11
- * When `true`, the host updates its size in the native view tree to match
12
- * the children's size. When `false`, the host uses the size of the parent
13
- * native view.
11
+ * When `true`, the host updates its size in the SwiftUI or Compose view tree to
12
+ * match the children's size. When `false`, the host uses the size of the parent
13
+ * SwiftUI or Compose view. Pass an object to choose per axis. For example,
14
+ * `{ vertical: true }` takes the width from the parent and the height from the
15
+ * children, so text wraps and grows vertically.
14
16
  *
15
17
  * Can only be set once on mount; changing it remounts the component.
16
18
  * @default false
17
19
  * @platform android
18
20
  * @platform ios
19
21
  */
20
- matchContents?: boolean;
22
+ matchContents?: boolean | { vertical?: boolean; horizontal?: boolean };
21
23
 
22
24
  onLayout?: (event: LayoutChangeEvent) => void;
23
25
 
@@ -1,5 +1,11 @@
1
1
  import { Row, Switch as ComposeSwitch, Text } from '@expo/ui/jetpack-compose';
2
- import { testID as testIDModifier, weight } from '@expo/ui/jetpack-compose/modifiers';
2
+ import {
3
+ fillMaxWidth,
4
+ IntrinsicSize,
5
+ testID as testIDModifier,
6
+ weight,
7
+ width,
8
+ } from '@expo/ui/jetpack-compose/modifiers';
3
9
 
4
10
  import type { SwitchProps } from './types';
5
11
 
@@ -16,7 +22,10 @@ export function Switch({ value, onValueChange, label, disabled, testID, modifier
16
22
  if (label == null) return toggle;
17
23
 
18
24
  return (
19
- <Row verticalAlignment="center" horizontalArrangement={{ spacedBy: 8 }}>
25
+ <Row
26
+ verticalAlignment="center"
27
+ horizontalArrangement={{ spacedBy: 8 }}
28
+ modifiers={[fillMaxWidth(), width(IntrinsicSize.Max)]}>
20
29
  <Text modifiers={[weight(1)]}>{label}</Text>
21
30
  {toggle}
22
31
  </Row>
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Resolves `RNHostView`'s `matchContents` prop to one flag per axis.
3
+ */
4
+ export function resolveMatchContents(
5
+ matchContents: boolean | { vertical?: boolean; horizontal?: boolean } | null | undefined
6
+ ): { horizontal: boolean; vertical: boolean } {
7
+ if (matchContents != null && typeof matchContents === 'object') {
8
+ return {
9
+ horizontal: matchContents.horizontal ?? false,
10
+ vertical: matchContents.vertical ?? false,
11
+ };
12
+ }
13
+ return { horizontal: matchContents ?? false, vertical: matchContents ?? false };
14
+ }
@@ -1,27 +0,0 @@
1
- import SwiftUI
2
- import ExpoModulesCore
3
- #if !os(tvOS)
4
- import WidgetKit
5
- #endif
6
-
7
- public final class AccessoryWidgetBackgroundProps: UIBaseViewProps {}
8
-
9
- public struct AccessoryWidgetBackgroundView: ExpoSwiftUI.View {
10
- @ObservedObject public var props: AccessoryWidgetBackgroundProps
11
-
12
- public init(props: AccessoryWidgetBackgroundProps) {
13
- self.props = props
14
- }
15
-
16
- public var body: some View {
17
- #if !os(tvOS)
18
- if #available(iOS 16.0, *) {
19
- AccessoryWidgetBackground()
20
- } else {
21
- Color.clear
22
- }
23
- #else
24
- EmptyView()
25
- #endif
26
- }
27
- }
@@ -1,70 +0,0 @@
1
- // Copyright 2015-present 650 Industries. All rights reserved.
2
-
3
- import ExpoModulesCore
4
- import SwiftUI
5
- #if !os(tvOS)
6
- import WidgetKit
7
- #endif
8
-
9
- internal enum WidgetAccentedRenderingModeOptions: String, Enumerable {
10
- case accented
11
- case desaturated
12
- case accentedDesaturated
13
- case fullColor
14
-
15
- #if !os(tvOS)
16
- @available(iOS 18.0, macOS 15.0, *)
17
- var toWidgetAccentedRenderingMode: WidgetAccentedRenderingMode {
18
- switch self {
19
- case .accented: return .accented
20
- case .accentedDesaturated: return .accentedDesaturated
21
- case .desaturated: return .desaturated
22
- case .fullColor: return .fullColor
23
- }
24
- }
25
- #endif
26
- }
27
-
28
- /**
29
- * This is a unique modifier that exists only on Image, but returns some View, and for this reason it cannot be a ViewModifier.
30
- */
31
- internal struct WidgetAccentedRenderingModeModifier: Record {
32
- @Field var renderingMode: WidgetAccentedRenderingModeOptions?
33
-
34
- @ViewBuilder
35
- func apply(to image: Image) -> some View {
36
- #if !os(tvOS)
37
- if #available(iOS 18.0, macOS 15.0, *), renderingMode != nil {
38
- image.widgetAccentedRenderingMode(renderingMode?.toWidgetAccentedRenderingMode)
39
- } else {
40
- image
41
- }
42
- #else
43
- image
44
- #endif
45
- }
46
- }
47
-
48
- internal struct WidgetURLModifier: ViewModifier, Record {
49
- @Field var url: URL?
50
-
51
- func body(content: Content) -> some View {
52
- #if !os(tvOS)
53
- content.widgetURL(url)
54
- #else
55
- content
56
- #endif
57
- }
58
- }
59
-
60
- internal struct ActivityBackgroundTintModifier: ViewModifier, Record {
61
- @Field var color: Color?
62
-
63
- func body(content: Content) -> some View {
64
- #if !os(tvOS) && !os(macOS) && !targetEnvironment(macCatalyst)
65
- content.activityBackgroundTint(color)
66
- #else
67
- content
68
- #endif
69
- }
70
- }
@@ -1 +0,0 @@
1
- c96c6c3f5dc0911a893274646c0cf2096a610423
@@ -1 +0,0 @@
1
- 02ee570f6a4a03679186bf43c56875eebf84f15abb7e79bb7040eddad7da908d
@@ -1 +0,0 @@
1
- fe7df10c6d11c1f95ca7de35f60911401b64bd4b258c6c7956611f973bd062a367c0aea2693298e3d703e58a89b70cfd2c47851400299d035ea28499e595fb8e
@@ -1 +0,0 @@
1
- 31be76a409dceed307ca47e9e66c8348
@@ -1 +0,0 @@
1
- 94aec72d27a48e827dbb31b9d734150334b08662
@@ -1 +0,0 @@
1
- 315787d05711205c64b7245b046f29efe369b50f4e86866afef62b2b2474e537
@@ -1 +0,0 @@
1
- e5ced1751f3e2e90a7320abf88d98bea0a578fbcabcf73c0aca0e9997efe4d0313375d810c789fe2d96f6f6d5cdb9f36c21c2b82f67db8626149105938f29523
@@ -1 +0,0 @@
1
- 04e6aa44f454389ad4bdd5cf30bd1d86bae120ad
@@ -1 +0,0 @@
1
- dc6fa612aeec16b9c3aeda4837e935cdeeb84368a021a3f44def2a1f95101945
@@ -1 +0,0 @@
1
- 576894a57cc60ce514c66e1cabe503a43173905290c5982e5268be4c8cf344b915e5320d628c809ce8b1fa8d199bca5293717a98be66f0ade834a7a3f2dbb57c
@@ -1 +0,0 @@
1
- bc00f54a242aca990d0c2de2c183ebc5
@@ -1 +0,0 @@
1
- 1796327cd18b03ab779e31706ba31eae75368745
@@ -1 +0,0 @@
1
- f2ca3168b9cef1803d4210547ea66a36803383de87fcbb41f0dccb5b7505d34d
@@ -1 +0,0 @@
1
- ce4c6350bbf8c0e67d3e2d2bc08434e67d236e63cb336a35b82962d1842dec854ddfe8e78c45e4b09d43e48e2dee4b8a8f18cce0520e95df65ddcb16721742cd
@@ -1,13 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <metadata>
3
- <groupId>expo.modules.ui</groupId>
4
- <artifactId>expo.modules.ui</artifactId>
5
- <versioning>
6
- <latest>58.0.8</latest>
7
- <release>58.0.8</release>
8
- <versions>
9
- <version>58.0.8</version>
10
- </versions>
11
- <lastUpdated>20260928121125</lastUpdated>
12
- </versioning>
13
- </metadata>
@@ -1 +0,0 @@
1
- e688c2de104d33044dd1efbb0fb077a5
@@ -1 +0,0 @@
1
- c07aaec5e802705f3098f5318af20765f1b90eaf
@@ -1 +0,0 @@
1
- 7d1dc7ca750e3904d57d825eed29663ed37a41fa992e790bd198f2fe23579db2
@@ -1 +0,0 @@
1
- d47c70eb9cd8b56d5ff5494bd9fca491c4a71662d618fa6a0dc0b82394a129c8bf18ab740bf4eea86f8fe115c41fc2251d0fb53f8b0f51ff9cd094e2f50472fa