@expo/ui 58.0.8 → 58.0.9

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 (119) hide show
  1. package/CHANGELOG.md +6 -7
  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 +3 -1
  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/jetpack-compose/LazyColumn/index.d.ts +2 -1
  27. package/build/jetpack-compose/LazyColumn/index.js +1 -0
  28. package/build/jetpack-compose/LazyColumn/index.js.map +1 -1
  29. package/build/jetpack-compose/LazyItems/index.d.ts +19 -18
  30. package/build/jetpack-compose/LazyItems/index.js +1 -2
  31. package/build/jetpack-compose/LazyItems/index.js.map +1 -1
  32. package/build/jetpack-compose/LazyRow/index.d.ts +2 -1
  33. package/build/jetpack-compose/LazyRow/index.js +1 -0
  34. package/build/jetpack-compose/LazyRow/index.js.map +1 -1
  35. package/build/jetpack-compose/index.d.ts +0 -1
  36. package/build/jetpack-compose/index.js.map +1 -1
  37. package/build/jetpack-compose/modifiers/index.d.ts +18 -3
  38. package/build/jetpack-compose/modifiers/index.js +15 -2
  39. package/build/jetpack-compose/modifiers/index.js.map +1 -1
  40. package/build/swift-ui/LazyHStack/index.d.ts +45 -0
  41. package/build/swift-ui/LazyHStack/index.js +9 -0
  42. package/build/swift-ui/LazyHStack/index.js.map +1 -1
  43. package/build/swift-ui/LazyStackForEach/index.d.ts +44 -0
  44. package/build/swift-ui/LazyStackForEach/index.js +54 -0
  45. package/build/swift-ui/LazyStackForEach/index.js.map +1 -0
  46. package/build/swift-ui/LazyVStack/index.d.ts +45 -0
  47. package/build/swift-ui/LazyVStack/index.js +9 -0
  48. package/build/swift-ui/LazyVStack/index.js.map +1 -1
  49. package/build/swift-ui/List/DataListForEach.d.ts +6 -7
  50. package/build/swift-ui/List/DataListForEach.js.map +1 -1
  51. package/build/swift-ui/List/ListForEach.d.ts +7 -1
  52. package/build/swift-ui/List/ListForEach.js +1 -5
  53. package/build/swift-ui/List/ListForEach.js.map +1 -1
  54. package/build/swift-ui/index.d.ts +1 -0
  55. package/build/swift-ui/index.js.map +1 -1
  56. package/build/universal/Switch/index.android.js +5 -1
  57. package/build/universal/Switch/index.android.js.map +1 -1
  58. package/expo-module.config.json +0 -1
  59. package/ios/DataListForEachView.swift +65 -28
  60. package/ios/LazyHStackView.swift +3 -0
  61. package/ios/LazyVStackView.swift +3 -0
  62. package/ios/ListView.swift +8 -0
  63. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.8/expo.modules.ui-58.0.8-sources.jar → 58.0.9/expo.modules.ui-58.0.9-sources.jar} +0 -0
  64. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9-sources.jar.md5 +1 -0
  65. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9-sources.jar.sha1 +1 -0
  66. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9-sources.jar.sha256 +1 -0
  67. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9-sources.jar.sha512 +1 -0
  68. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.aar +0 -0
  69. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.aar.md5 +1 -0
  70. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.aar.sha1 +1 -0
  71. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.aar.sha256 +1 -0
  72. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.aar.sha512 +1 -0
  73. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.8/expo.modules.ui-58.0.8.module → 58.0.9/expo.modules.ui-58.0.9.module} +22 -22
  74. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.module.md5 +1 -0
  75. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.module.sha1 +1 -0
  76. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.module.sha256 +1 -0
  77. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.module.sha512 +1 -0
  78. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.8/expo.modules.ui-58.0.8.pom → 58.0.9/expo.modules.ui-58.0.9.pom} +1 -1
  79. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.pom.md5 +1 -0
  80. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.pom.sha1 +1 -0
  81. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.pom.sha256 +1 -0
  82. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.9/expo.modules.ui-58.0.9.pom.sha512 +1 -0
  83. package/package.json +3 -3
  84. package/prebuilds/output/debug/xcframeworks/ExpoUI.tar.gz +0 -0
  85. package/prebuilds/output/release/xcframeworks/ExpoUI.tar.gz +0 -0
  86. package/src/jetpack-compose/LazyColumn/index.tsx +2 -0
  87. package/src/jetpack-compose/LazyItems/index.tsx +18 -21
  88. package/src/jetpack-compose/LazyRow/index.tsx +2 -0
  89. package/src/jetpack-compose/index.ts +0 -1
  90. package/src/jetpack-compose/modifiers/index.ts +16 -3
  91. package/src/swift-ui/LazyHStack/index.tsx +45 -0
  92. package/src/swift-ui/LazyStackForEach/index.tsx +110 -0
  93. package/src/swift-ui/LazyVStack/index.tsx +45 -0
  94. package/src/swift-ui/List/DataListForEach.tsx +7 -8
  95. package/src/swift-ui/List/ListForEach.tsx +10 -3
  96. package/src/swift-ui/index.tsx +1 -0
  97. package/src/universal/Switch/index.android.tsx +11 -2
  98. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.md5 +0 -1
  99. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha1 +0 -1
  100. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha256 +0 -1
  101. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8-sources.jar.sha512 +0 -1
  102. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar +0 -0
  103. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.md5 +0 -1
  104. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha1 +0 -1
  105. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha256 +0 -1
  106. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.aar.sha512 +0 -1
  107. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.md5 +0 -1
  108. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha1 +0 -1
  109. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha256 +0 -1
  110. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.module.sha512 +0 -1
  111. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.md5 +0 -1
  112. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha1 +0 -1
  113. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha256 +0 -1
  114. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.8/expo.modules.ui-58.0.8.pom.sha512 +0 -1
  115. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +0 -13
  116. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +0 -1
  117. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +0 -1
  118. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +0 -1
  119. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +0 -1
@@ -79,10 +79,23 @@ export const fillMaxWidth = (fraction?: number) => createModifier('fillMaxWidth'
79
79
  export const fillMaxHeight = (fraction?: number) => createModifier('fillMaxHeight', { fraction });
80
80
 
81
81
  /**
82
- * Sets the exact width of the view.
83
- * @param value - Width in dp.
82
+ * Intrinsic width values for the `width` modifier. `Min` is the smallest width at which the content
83
+ * still draws correctly, and `Max` is the width the content needs when nothing limits it.
84
84
  */
85
- export const width = (value: number) => createModifier('width', { width: value });
85
+ export const IntrinsicSize = { Min: 'min', Max: 'max' } as const;
86
+ export type IntrinsicSize = (typeof IntrinsicSize)[keyof typeof IntrinsicSize];
87
+
88
+ /**
89
+ * Sets the width of the view to an exact value, or to the minimum or maximum intrinsic width of its
90
+ * content. The incoming constraints can still make the view narrower or wider than that width.
91
+ * @param value - Width in dp, or an `IntrinsicSize`. `IntrinsicSize.Min` uses the minimum intrinsic
92
+ * width, the smallest width at which the content still draws correctly (for a text, its widest word).
93
+ * `IntrinsicSize.Max` uses the maximum intrinsic width, the width the content needs when nothing
94
+ * limits it (for a text, a single line).
95
+ * @see [Compose `width(IntrinsicSize)` modifier](https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/width.modifier#(androidx.compose.ui.Modifier).width(androidx.compose.foundation.layout.IntrinsicSize))
96
+ * @see [Intrinsic measurements in Compose layouts](https://developer.android.com/develop/ui/compose/layouts/intrinsic-measurements)
97
+ */
98
+ export const width = (value: number | IntrinsicSize) => createModifier('width', { width: value });
86
99
 
87
100
  /**
88
101
  * Sets the exact height of the view.
@@ -1,8 +1,41 @@
1
1
  import { requireNativeView } from 'expo';
2
+ import { type ReactElement } from 'react';
2
3
 
4
+ import { createLazyStackForEach } from '../LazyStackForEach';
3
5
  import { createViewModifierEventListener } from '../modifiers/utils';
4
6
  import { type CommonViewModifierProps } from '../types';
5
7
 
8
+ export interface LazyHStackForEachProps<T> {
9
+ /** Items to display. Replace the array when updating data. */
10
+ data: readonly T[];
11
+ /** Returns a stable, unique string key for each item. */
12
+ keyExtractor: (item: T, index: number) => string;
13
+ /**
14
+ * Renders an item. Wrap it in `useCallback`, or every item re-renders on each parent render.
15
+ * Recycled views are reused for other items, so their local state (`useState`) carries over.
16
+ * Reset it when the item changes, or keep the state outside the view.
17
+ */
18
+ children: (info: { item: T; index: number }) => ReactElement;
19
+ /**
20
+ * Renders only the items near the visible range and reuses them while scrolling. Set to `false`
21
+ * to render every item at once. Set it once; changing it remounts the items.
22
+ * @default true
23
+ */
24
+ recycling?: boolean;
25
+ /**
26
+ * Extra items to prepare on each side of the visible items. Must be a non-negative integer.
27
+ * Ignored when `recycling` is `false`.
28
+ * @default 10
29
+ */
30
+ overscanCount?: number;
31
+ /**
32
+ * Placeholder size in points along the stack axis, until an item is measured. Must be positive.
33
+ * Ignored when `recycling` is `false`.
34
+ * @default 64
35
+ */
36
+ estimatedItemSize?: number;
37
+ }
38
+
6
39
  export interface LazyHStackProps extends CommonViewModifierProps {
7
40
  children: React.ReactNode;
8
41
  /**
@@ -30,3 +63,15 @@ export function LazyHStack(props: LazyHStackProps) {
30
63
  />
31
64
  );
32
65
  }
66
+
67
+ /**
68
+ * A block of recycled items inside `LazyHStack`. Only a small pool of items around the visible
69
+ * range is mounted. Items that are not ready yet show a placeholder of `estimatedItemSize`, or of
70
+ * the size last measured for that item.
71
+ *
72
+ * Mount it as a direct child of `LazyHStack`.
73
+ */
74
+ export const LazyHStackForEach: <T>(props: LazyHStackForEachProps<T>) => ReactElement =
75
+ createLazyStackForEach('LazyHStack.ForEach', 'horizontal');
76
+
77
+ LazyHStack.ForEach = LazyHStackForEach;
@@ -0,0 +1,110 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { Fragment, type ReactElement } from 'react';
3
+
4
+ import {
5
+ useItemKeys,
6
+ useRecycledRows,
7
+ type WindowChangeEvent,
8
+ } from '../../recycling/useRecycledRows';
9
+ import { type ViewEvent } from '../../types';
10
+ import { NativeSlot } from '../List/DataListForEach';
11
+
12
+ export interface LazyStackForEachProps<T> {
13
+ /** Items to display. Replace the array when updating data. */
14
+ data: readonly T[];
15
+ /** Returns a stable, unique string key for each item. */
16
+ keyExtractor: (item: T, index: number) => string;
17
+ /**
18
+ * Renders a row. Wrap it in `useCallback`, or every row re-renders on each parent render.
19
+ * Recycled rows are reused for other items, so their local state (`useState`) carries over.
20
+ * Reset it when the item changes, or keep the state outside the row.
21
+ */
22
+ children: (info: { item: T; index: number }) => ReactElement;
23
+ /**
24
+ * Renders only the rows near the visible range and reuses them while scrolling. Set to `false` to
25
+ * render every row at once. Set it once; changing it remounts the rows.
26
+ * @default true
27
+ */
28
+ recycling?: boolean;
29
+ /**
30
+ * Extra rows to prepare on each side of the visible rows. Must be a non-negative integer.
31
+ * Ignored when `recycling` is `false`.
32
+ * @default 10
33
+ */
34
+ overscanCount?: number;
35
+ /**
36
+ * Placeholder size in points along the stack axis, until a row is measured. Must be positive.
37
+ * Ignored when `recycling` is `false`.
38
+ * @default 64
39
+ */
40
+ estimatedItemSize?: number;
41
+ }
42
+
43
+ type Axis = 'vertical' | 'horizontal';
44
+
45
+ type NativeProps = ViewEvent<'onWindowChange', WindowChangeEvent> & {
46
+ axis: Axis;
47
+ itemKeys: string[];
48
+ revision: number;
49
+ estimatedItemSize: number;
50
+ children: ReactElement;
51
+ };
52
+
53
+ const NativeForEach = requireNativeView<NativeProps>('ExpoUI', 'DataListForEachView');
54
+ const NativePool = requireNativeView<{ children: ReactElement[] }>(
55
+ 'ExpoUI',
56
+ 'DataListForEachPoolView'
57
+ );
58
+
59
+ /**
60
+ * @hidden
61
+ * Creates the `ForEach` component of one lazy stack, so its errors name that stack.
62
+ */
63
+ export function createLazyStackForEach(componentName: string, axis: Axis) {
64
+ function ForEach<T>({ recycling = true, ...props }: LazyStackForEachProps<T>) {
65
+ return recycling ? <RecycledForEach {...props} /> : <StaticForEach {...props} />;
66
+ }
67
+
68
+ // Each row is a plain child of the lazy stack.
69
+ function StaticForEach<T>({
70
+ data,
71
+ keyExtractor,
72
+ children: renderItem,
73
+ }: Omit<LazyStackForEachProps<T>, 'recycling'>) {
74
+ const itemKeys = useItemKeys(componentName, data, keyExtractor);
75
+ return data.map((item, index) => (
76
+ <Fragment key={itemKeys[index]}>{renderItem({ item, index })}</Fragment>
77
+ ));
78
+ }
79
+
80
+ function RecycledForEach<T>({
81
+ data,
82
+ keyExtractor,
83
+ children: renderItem,
84
+ overscanCount,
85
+ estimatedItemSize = 64,
86
+ }: Omit<LazyStackForEachProps<T>, 'recycling'>) {
87
+ const { itemKeys, revision, rows, onWindowChange } = useRecycledRows({
88
+ componentName,
89
+ Slot: NativeSlot,
90
+ data,
91
+ keyExtractor,
92
+ renderItem,
93
+ overscanCount,
94
+ estimatedItemSize,
95
+ });
96
+
97
+ return (
98
+ <NativeForEach
99
+ axis={axis}
100
+ itemKeys={itemKeys}
101
+ revision={revision}
102
+ estimatedItemSize={estimatedItemSize}
103
+ onWindowChange={({ nativeEvent }) => onWindowChange(nativeEvent)}>
104
+ <NativePool>{rows}</NativePool>
105
+ </NativeForEach>
106
+ );
107
+ }
108
+ ForEach.displayName = componentName;
109
+ return ForEach;
110
+ }
@@ -1,8 +1,41 @@
1
1
  import { requireNativeView } from 'expo';
2
+ import { type ReactElement } from 'react';
2
3
 
4
+ import { createLazyStackForEach } from '../LazyStackForEach';
3
5
  import { createViewModifierEventListener } from '../modifiers/utils';
4
6
  import { type CommonViewModifierProps } from '../types';
5
7
 
8
+ export interface LazyVStackForEachProps<T> {
9
+ /** Items to display. Replace the array when updating data. */
10
+ data: readonly T[];
11
+ /** Returns a stable, unique string key for each item. */
12
+ keyExtractor: (item: T, index: number) => string;
13
+ /**
14
+ * Renders a row. Wrap it in `useCallback`, or every row re-renders on each parent render.
15
+ * Recycled rows are reused for other items, so their local state (`useState`) carries over.
16
+ * Reset it when the item changes, or keep the state outside the row.
17
+ */
18
+ children: (info: { item: T; index: number }) => ReactElement;
19
+ /**
20
+ * Renders only the rows near the visible range and reuses them while scrolling. Set to `false` to
21
+ * render every row at once. Set it once; changing it remounts the rows.
22
+ * @default true
23
+ */
24
+ recycling?: boolean;
25
+ /**
26
+ * Extra rows to prepare on each side of the visible rows. Must be a non-negative integer.
27
+ * Ignored when `recycling` is `false`.
28
+ * @default 10
29
+ */
30
+ overscanCount?: number;
31
+ /**
32
+ * Placeholder size in points along the stack axis, until a row is measured. Must be positive.
33
+ * Ignored when `recycling` is `false`.
34
+ * @default 64
35
+ */
36
+ estimatedItemSize?: number;
37
+ }
38
+
6
39
  export interface LazyVStackProps extends CommonViewModifierProps {
7
40
  children: React.ReactNode;
8
41
  /**
@@ -30,3 +63,15 @@ export function LazyVStack(props: LazyVStackProps) {
30
63
  />
31
64
  );
32
65
  }
66
+
67
+ /**
68
+ * A block of recycled rows inside `LazyVStack`. Only a small pool of rows around the visible
69
+ * range is mounted. Rows that are not ready yet show a placeholder of `estimatedItemSize`, or of
70
+ * the size last measured for that row.
71
+ *
72
+ * Mount it as a direct child of `LazyVStack`.
73
+ */
74
+ export const LazyVStackForEach: <T>(props: LazyVStackForEachProps<T>) => ReactElement =
75
+ createLazyStackForEach('LazyVStack.ForEach', 'vertical');
76
+
77
+ LazyVStack.ForEach = LazyVStackForEach;
@@ -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}>
@@ -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';
@@ -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>
@@ -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