@expo/ui 58.0.21 → 58.0.23

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 (262) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +86 -2
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/expo/modules/ui/ComposeViews.kt +53 -29
  5. package/android/src/main/java/expo/modules/ui/CompositionLocalProviderView.kt +26 -0
  6. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +12 -0
  7. package/android/src/main/java/expo/modules/ui/HostView.kt +56 -9
  8. package/android/src/main/java/expo/modules/ui/MaskView.kt +3 -2
  9. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +43 -13
  10. package/android/src/main/java/expo/modules/ui/RNHostView.kt +11 -7
  11. package/android/src/main/java/expo/modules/ui/SwitchView.kt +6 -1
  12. package/android/src/main/java/expo/modules/ui/TopAppBarView.kt +62 -0
  13. package/android/src/main/java/expo/modules/ui/UniversalLayout.kt +610 -0
  14. package/android/src/main/java/expo/modules/ui/colors/MaterialColors.kt +61 -0
  15. package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +2 -0
  16. package/android/src/main/java/expo/modules/ui/state/WorkletCallback.kt +2 -0
  17. package/build/community/bottom-sheet/BottomSheet.ios.js +8 -3
  18. package/build/community/bottom-sheet/BottomSheet.ios.js.map +1 -1
  19. package/build/community/pager-view/PagerView.ios.js +25 -8
  20. package/build/community/pager-view/PagerView.ios.js.map +1 -1
  21. package/build/community/segmented-control/SegmentedControl.ios.js +11 -2
  22. package/build/community/segmented-control/SegmentedControl.ios.js.map +1 -1
  23. package/build/community/segmented-control/types.d.ts +5 -1
  24. package/build/community/segmented-control/types.js.map +1 -1
  25. package/build/jetpack-compose/Column/index.d.ts +5 -0
  26. package/build/jetpack-compose/Column/index.js.map +1 -1
  27. package/build/jetpack-compose/CompositionLocalProvider/index.d.ts +28 -0
  28. package/build/jetpack-compose/CompositionLocalProvider/index.js +15 -0
  29. package/build/jetpack-compose/CompositionLocalProvider/index.js.map +1 -0
  30. package/build/jetpack-compose/Host/index.d.ts +8 -0
  31. package/build/jetpack-compose/Host/index.js +38 -5
  32. package/build/jetpack-compose/Host/index.js.map +1 -1
  33. package/build/jetpack-compose/Row/index.d.ts +5 -0
  34. package/build/jetpack-compose/Row/index.js.map +1 -1
  35. package/build/jetpack-compose/Switch/index.d.ts +2 -0
  36. package/build/jetpack-compose/Switch/index.js +1 -0
  37. package/build/jetpack-compose/Switch/index.js.map +1 -1
  38. package/build/jetpack-compose/TopAppBar/index.d.ts +72 -0
  39. package/build/jetpack-compose/TopAppBar/index.js +45 -0
  40. package/build/jetpack-compose/TopAppBar/index.js.map +1 -0
  41. package/build/jetpack-compose/index.d.ts +2 -0
  42. package/build/jetpack-compose/index.js +2 -0
  43. package/build/jetpack-compose/index.js.map +1 -1
  44. package/build/jetpack-compose/modifiers/index.d.ts +5 -1
  45. package/build/jetpack-compose/modifiers/index.js +6 -2
  46. package/build/jetpack-compose/modifiers/index.js.map +1 -1
  47. package/build/recycling/useRecycledRows.d.ts +2 -0
  48. package/build/recycling/useRecycledRows.js +1 -0
  49. package/build/recycling/useRecycledRows.js.map +1 -1
  50. package/build/swift-ui/BottomSheet/index.d.ts +6 -0
  51. package/build/swift-ui/BottomSheet/index.js +9 -3
  52. package/build/swift-ui/BottomSheet/index.js.map +1 -1
  53. package/build/swift-ui/HStack/index.d.ts +6 -0
  54. package/build/swift-ui/HStack/index.js.map +1 -1
  55. package/build/swift-ui/VStack/index.d.ts +6 -0
  56. package/build/swift-ui/VStack/index.js.map +1 -1
  57. package/build/universal/Button/index.android.js +3 -1
  58. package/build/universal/Button/index.android.js.map +1 -1
  59. package/build/universal/Button/index.ios.js +3 -1
  60. package/build/universal/Button/index.ios.js.map +1 -1
  61. package/build/universal/Checkbox/index.android.js +16 -4
  62. package/build/universal/Checkbox/index.android.js.map +1 -1
  63. package/build/universal/Collapsible/index.ios.js +1 -0
  64. package/build/universal/Collapsible/index.ios.js.map +1 -1
  65. package/build/universal/Column/index.android.js +4 -1
  66. package/build/universal/Column/index.android.js.map +1 -1
  67. package/build/universal/Column/index.ios.js +2 -0
  68. package/build/universal/Column/index.ios.js.map +1 -1
  69. package/build/universal/Column/index.js +13 -4
  70. package/build/universal/Column/index.js.map +1 -1
  71. package/build/universal/FieldGroup/FieldGroup.android.js +3 -1
  72. package/build/universal/FieldGroup/FieldGroup.android.js.map +1 -1
  73. package/build/universal/FieldGroup/FieldGroup.ios.js +3 -1
  74. package/build/universal/FieldGroup/FieldGroup.ios.js.map +1 -1
  75. package/build/universal/FieldGroup/FieldSection.android.js +13 -4
  76. package/build/universal/FieldGroup/FieldSection.android.js.map +1 -1
  77. package/build/universal/FieldGroup/FieldSection.ios.js +3 -1
  78. package/build/universal/FieldGroup/FieldSection.ios.js.map +1 -1
  79. package/build/universal/Icon/index.android.js +3 -1
  80. package/build/universal/Icon/index.android.js.map +1 -1
  81. package/build/universal/Icon/index.ios.js +3 -1
  82. package/build/universal/Icon/index.ios.js.map +1 -1
  83. package/build/universal/List/ListForEach.android.d.ts +7 -0
  84. package/build/universal/List/ListForEach.android.js +6 -0
  85. package/build/universal/List/ListForEach.android.js.map +1 -0
  86. package/build/universal/List/ListForEach.d.ts +5 -0
  87. package/build/universal/List/ListForEach.ios.d.ts +5 -0
  88. package/build/universal/List/ListForEach.ios.js +11 -0
  89. package/build/universal/List/ListForEach.ios.js.map +1 -0
  90. package/build/universal/List/ListForEach.js +263 -0
  91. package/build/universal/List/ListForEach.js.map +1 -0
  92. package/build/universal/List/ListScrollContext.d.ts +5 -0
  93. package/build/universal/List/ListScrollContext.js +6 -0
  94. package/build/universal/List/ListScrollContext.js.map +1 -0
  95. package/build/universal/List/index.android.d.ts +5 -0
  96. package/build/universal/List/index.android.js +3 -0
  97. package/build/universal/List/index.android.js.map +1 -1
  98. package/build/universal/List/index.d.ts +5 -0
  99. package/build/universal/List/index.ios.d.ts +5 -0
  100. package/build/universal/List/index.ios.js +3 -0
  101. package/build/universal/List/index.ios.js.map +1 -1
  102. package/build/universal/List/index.js +12 -1
  103. package/build/universal/List/index.js.map +1 -1
  104. package/build/universal/List/types.d.ts +42 -1
  105. package/build/universal/List/types.js +1 -3
  106. package/build/universal/List/types.js.map +1 -1
  107. package/build/universal/RNHostView/index.android.js +3 -1
  108. package/build/universal/RNHostView/index.android.js.map +1 -1
  109. package/build/universal/Row/index.android.js +4 -1
  110. package/build/universal/Row/index.android.js.map +1 -1
  111. package/build/universal/Row/index.ios.js +2 -0
  112. package/build/universal/Row/index.ios.js.map +1 -1
  113. package/build/universal/Row/index.js +13 -7
  114. package/build/universal/Row/index.js.map +1 -1
  115. package/build/universal/ScrollView/index.android.js +8 -1
  116. package/build/universal/ScrollView/index.android.js.map +1 -1
  117. package/build/universal/ScrollView/index.ios.js +15 -7
  118. package/build/universal/ScrollView/index.ios.js.map +1 -1
  119. package/build/universal/Spacer/index.android.js +3 -1
  120. package/build/universal/Spacer/index.android.js.map +1 -1
  121. package/build/universal/Spacer/index.ios.js +3 -1
  122. package/build/universal/Spacer/index.ios.js.map +1 -1
  123. package/build/universal/Switch/index.android.js +17 -4
  124. package/build/universal/Switch/index.android.js.map +1 -1
  125. package/build/universal/Switch/index.js +1 -0
  126. package/build/universal/Switch/index.js.map +1 -1
  127. package/build/universal/Text/index.android.js +3 -1
  128. package/build/universal/Text/index.android.js.map +1 -1
  129. package/build/universal/Text/index.ios.js +3 -1
  130. package/build/universal/Text/index.ios.js.map +1 -1
  131. package/build/universal/Text/index.js +2 -2
  132. package/build/universal/Text/index.js.map +1 -1
  133. package/build/universal/TextInput/index.android.js +22 -7
  134. package/build/universal/TextInput/index.android.js.map +1 -1
  135. package/build/universal/TextInput/index.ios.js +1 -0
  136. package/build/universal/TextInput/index.ios.js.map +1 -1
  137. package/build/universal/index.d.ts +1 -1
  138. package/build/universal/modifierUtils.d.ts +34 -1
  139. package/build/universal/modifierUtils.js +98 -2
  140. package/build/universal/modifierUtils.js.map +1 -1
  141. package/build/universal/stackAxis.d.ts +9 -0
  142. package/build/universal/stackAxis.js +11 -0
  143. package/build/universal/stackAxis.js.map +1 -0
  144. package/build/universal/transformStyle.android.d.ts +6 -2
  145. package/build/universal/transformStyle.android.js +18 -11
  146. package/build/universal/transformStyle.android.js.map +1 -1
  147. package/build/universal/transformStyle.ios.d.ts +5 -1
  148. package/build/universal/transformStyle.ios.js +29 -11
  149. package/build/universal/transformStyle.ios.js.map +1 -1
  150. package/build/universal/types.d.ts +26 -1
  151. package/build/universal/types.js.map +1 -1
  152. package/build/universal/webUtils.js +4 -0
  153. package/build/universal/webUtils.js.map +1 -1
  154. package/ios/BottomSheetView.swift +11 -2
  155. package/ios/DatePickerView.swift +134 -9
  156. package/ios/GroupView.swift +3 -0
  157. package/ios/HStackView.swift +26 -2
  158. package/ios/HostView.swift +21 -12
  159. package/ios/Modifiers/SelectedSegmentTintColorModifier.swift +86 -0
  160. package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
  161. package/ios/RNHostView.swift +34 -16
  162. package/ios/ScrollViewComponent.swift +20 -0
  163. package/ios/UIBaseView.swift +4 -1
  164. package/ios/UniversalLayout.swift +691 -0
  165. package/ios/VStackView.swift +26 -2
  166. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21-sources.jar → 58.0.23/expo.modules.ui-58.0.23-sources.jar} +0 -0
  167. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.md5 +1 -0
  168. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha1 +1 -0
  169. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha256 +1 -0
  170. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha512 +1 -0
  171. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar +0 -0
  172. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.md5 +1 -0
  173. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha1 +1 -0
  174. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha256 +1 -0
  175. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha512 +1 -0
  176. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21.module → 58.0.23/expo.modules.ui-58.0.23.module} +22 -22
  177. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.md5 +1 -0
  178. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha1 +1 -0
  179. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha256 +1 -0
  180. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha512 +1 -0
  181. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21.pom → 58.0.23/expo.modules.ui-58.0.23.pom} +1 -1
  182. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.md5 +1 -0
  183. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha1 +1 -0
  184. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha256 +1 -0
  185. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha512 +1 -0
  186. package/package.json +2 -2
  187. package/src/community/bottom-sheet/BottomSheet.ios.tsx +7 -3
  188. package/src/community/pager-view/PagerView.ios.tsx +25 -8
  189. package/src/community/segmented-control/SegmentedControl.ios.tsx +13 -1
  190. package/src/community/segmented-control/types.tsx +5 -1
  191. package/src/jetpack-compose/Column/index.tsx +5 -0
  192. package/src/jetpack-compose/CompositionLocalProvider/index.tsx +43 -0
  193. package/src/jetpack-compose/Host/index.tsx +50 -4
  194. package/src/jetpack-compose/Row/index.tsx +5 -0
  195. package/src/jetpack-compose/Switch/index.tsx +4 -0
  196. package/src/jetpack-compose/TopAppBar/index.tsx +113 -0
  197. package/src/jetpack-compose/index.ts +2 -0
  198. package/src/jetpack-compose/modifiers/index.ts +11 -3
  199. package/src/recycling/useRecycledRows.tsx +3 -0
  200. package/src/swift-ui/BottomSheet/index.tsx +24 -3
  201. package/src/swift-ui/HStack/index.tsx +6 -0
  202. package/src/swift-ui/VStack/index.tsx +6 -0
  203. package/src/universal/Button/index.android.tsx +3 -1
  204. package/src/universal/Button/index.ios.tsx +2 -1
  205. package/src/universal/Checkbox/index.android.tsx +24 -5
  206. package/src/universal/Collapsible/index.ios.tsx +4 -1
  207. package/src/universal/Column/index.android.tsx +3 -1
  208. package/src/universal/Column/index.ios.tsx +2 -1
  209. package/src/universal/Column/index.tsx +9 -4
  210. package/src/universal/FieldGroup/FieldGroup.android.tsx +8 -1
  211. package/src/universal/FieldGroup/FieldGroup.ios.tsx +2 -1
  212. package/src/universal/FieldGroup/FieldSection.android.tsx +17 -4
  213. package/src/universal/FieldGroup/FieldSection.ios.tsx +2 -1
  214. package/src/universal/Icon/index.android.tsx +2 -1
  215. package/src/universal/Icon/index.ios.tsx +2 -1
  216. package/src/universal/List/ListForEach.android.tsx +6 -0
  217. package/src/universal/List/ListForEach.ios.tsx +9 -0
  218. package/src/universal/List/ListForEach.tsx +246 -0
  219. package/src/universal/List/ListScrollContext.ts +6 -0
  220. package/src/universal/List/index.android.tsx +5 -0
  221. package/src/universal/List/index.ios.tsx +5 -0
  222. package/src/universal/List/index.tsx +11 -2
  223. package/src/universal/List/types.ts +45 -1
  224. package/src/universal/RNHostView/index.android.tsx +2 -1
  225. package/src/universal/Row/index.android.tsx +3 -1
  226. package/src/universal/Row/index.ios.tsx +2 -1
  227. package/src/universal/Row/index.tsx +9 -10
  228. package/src/universal/ScrollView/index.android.tsx +15 -3
  229. package/src/universal/ScrollView/index.ios.tsx +16 -4
  230. package/src/universal/Spacer/index.android.tsx +6 -4
  231. package/src/universal/Spacer/index.ios.tsx +2 -1
  232. package/src/universal/Switch/index.android.tsx +23 -4
  233. package/src/universal/Switch/index.tsx +1 -0
  234. package/src/universal/Text/index.android.tsx +2 -1
  235. package/src/universal/Text/index.ios.tsx +2 -1
  236. package/src/universal/Text/index.tsx +2 -2
  237. package/src/universal/TextInput/index.android.tsx +26 -5
  238. package/src/universal/TextInput/index.ios.tsx +1 -1
  239. package/src/universal/index.ts +6 -1
  240. package/src/universal/modifierUtils.ts +159 -2
  241. package/src/universal/stackAxis.ts +17 -0
  242. package/src/universal/transformStyle.android.ts +30 -12
  243. package/src/universal/transformStyle.ios.ts +41 -13
  244. package/src/universal/types.ts +27 -3
  245. package/src/universal/webUtils.ts +4 -0
  246. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.md5 +0 -1
  247. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha1 +0 -1
  248. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha256 +0 -1
  249. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha512 +0 -1
  250. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar +0 -0
  251. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.md5 +0 -1
  252. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha1 +0 -1
  253. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha256 +0 -1
  254. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha512 +0 -1
  255. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.md5 +0 -1
  256. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha1 +0 -1
  257. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha256 +0 -1
  258. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha512 +0 -1
  259. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.md5 +0 -1
  260. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha1 +0 -1
  261. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha256 +0 -1
  262. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha512 +0 -1
@@ -0,0 +1,6 @@
1
+ import { createContext, type RefObject } from 'react';
2
+
3
+ /**
4
+ * The web `List` node. `List.ForEach` uses it to find its visible rows.
5
+ */
6
+ export const ListScrollContext = createContext<RefObject<unknown> | null>(null);
@@ -2,6 +2,7 @@ import { LazyColumn, PullToRefreshBox } from '@expo/ui/jetpack-compose';
2
2
  import { testID as testIDModifier, type ModifierConfig } from '@expo/ui/jetpack-compose/modifiers';
3
3
  import { useCallback, useState } from 'react';
4
4
 
5
+ import { ListForEach } from './ListForEach';
5
6
  import type { ListProps } from './types';
6
7
 
7
8
  /**
@@ -41,4 +42,8 @@ export function List({ children, onRefresh, testID }: ListProps) {
41
42
  );
42
43
  }
43
44
 
45
+ List.ForEach = ListForEach;
46
+
47
+ export { ListForEach } from './ListForEach';
48
+
44
49
  export * from './types';
@@ -1,6 +1,7 @@
1
1
  import { List as SwiftUIList } from '@expo/ui/swift-ui';
2
2
  import { refreshable, type ModifierConfig } from '@expo/ui/swift-ui/modifiers';
3
3
 
4
+ import { ListForEach } from './ListForEach';
4
5
  import type { ListProps } from './types';
5
6
 
6
7
  /**
@@ -16,4 +17,8 @@ export function List({ children, onRefresh, testID }: ListProps) {
16
17
  );
17
18
  }
18
19
 
20
+ List.ForEach = ListForEach;
21
+
22
+ export { ListForEach } from './ListForEach';
23
+
19
24
  export * from './types';
@@ -1,5 +1,8 @@
1
+ import { useRef } from 'react';
1
2
  import { StyleSheet, View } from 'react-native';
2
3
 
4
+ import { ListForEach } from './ListForEach';
5
+ import { ListScrollContext } from './ListScrollContext';
3
6
  import type { ListProps } from './types';
4
7
 
5
8
  /**
@@ -7,15 +10,17 @@ import type { ListProps } from './types';
7
10
  * Typically populated with [`ListItem`](#listitem) children.
8
11
  */
9
12
  export function List({ children, testID }: ListProps) {
13
+ const ref = useRef(null);
10
14
  return (
11
- <View style={styles.container} testID={testID}>
12
- {children}
15
+ <View ref={ref} style={styles.container} testID={testID}>
16
+ <ListScrollContext.Provider value={ref}>{children}</ListScrollContext.Provider>
13
17
  </View>
14
18
  );
15
19
  }
16
20
 
17
21
  const styles = StyleSheet.create({
18
22
  container: {
23
+ flex: 1,
19
24
  flexDirection: 'column',
20
25
  width: '100%',
21
26
  overflowX: 'auto',
@@ -23,4 +28,8 @@ const styles = StyleSheet.create({
23
28
  },
24
29
  });
25
30
 
31
+ List.ForEach = ListForEach;
32
+
33
+ export { ListForEach } from './ListForEach';
34
+
26
35
  export * from './types';
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ReactElement, ReactNode } from 'react';
2
2
 
3
3
  /**
4
4
  * Props for the [`List`](#list) component.
@@ -26,3 +26,47 @@ export interface ListProps {
26
26
  */
27
27
  testID?: string;
28
28
  }
29
+
30
+ /**
31
+ * Props for the `List.ForEach` component.
32
+ */
33
+ export interface ListForEachProps<T> {
34
+ /**
35
+ * Items to display. Pass a new array to update.
36
+ */
37
+ data: readonly T[];
38
+
39
+ /**
40
+ * Returns a stable, unique string key for each item.
41
+ */
42
+ keyExtractor: (item: T, index: number) => string;
43
+
44
+ /**
45
+ * Renders a row. Wrap it in `useCallback`, or every row re-renders on each parent render.
46
+ * A recycled row keeps its local state (`useState`) when it shows another item.
47
+ */
48
+ children: (info: { item: T; index: number }) => ReactElement;
49
+
50
+ /**
51
+ * Renders only the rows near the visible range. Set to `false` to render every row.
52
+ * Changing it remounts the rows.
53
+ *
54
+ * @default true
55
+ */
56
+ recycling?: boolean;
57
+
58
+ /**
59
+ * Extra rows to render above and below the visible rows.
60
+ *
61
+ * @default 10
62
+ */
63
+ overscanCount?: number;
64
+
65
+ /**
66
+ * Row height to use until a row is measured: dp on Android, points on iOS (without the row
67
+ * insets), and pixels on web.
68
+ *
69
+ * @default 64
70
+ */
71
+ estimatedItemSize?: number;
72
+ }
@@ -21,7 +21,8 @@ export function RNHostView({
21
21
  const modifiers = transformToModifiers(
22
22
  style,
23
23
  { onAppear, onDisappear, disabled, hidden, testID },
24
- extraModifiers
24
+ extraModifiers,
25
+ { componentName: 'RNHostView' }
25
26
  );
26
27
 
27
28
  return (
@@ -31,13 +31,15 @@ export function Row({
31
31
  const modifiers = transformToModifiers(
32
32
  style,
33
33
  { onPress: disabled ? undefined : onPress, disabled, hidden, testID },
34
- extraModifiers
34
+ extraModifiers,
35
+ { componentName: 'Row' }
35
36
  );
36
37
 
37
38
  return (
38
39
  <ComposeRow
39
40
  verticalAlignment={alignmentMap[alignment]}
40
41
  horizontalArrangement={spacing != null ? { spacedBy: spacing } : undefined}
42
+ resolvesChildPercentages
41
43
  modifiers={modifiers}>
42
44
  {children}
43
45
  </ComposeRow>
@@ -33,7 +33,7 @@ export function Row({
33
33
  style,
34
34
  { onPress, onAppear, onDisappear, disabled, hidden, testID },
35
35
  extraModifiers,
36
- { frameAlignment: frameAlignmentMap[alignment] }
36
+ { componentName: 'Row', frameAlignment: frameAlignmentMap[alignment] }
37
37
  );
38
38
 
39
39
  return (
@@ -41,6 +41,7 @@ export function Row({
41
41
  alignment={alignmentMap[alignment]}
42
42
  spacing={spacing}
43
43
  modifiers={modifiers}
44
+ resolvesChildPercentages
44
45
  testID={testID}>
45
46
  {children}
46
47
  </HStack>
@@ -1,19 +1,16 @@
1
1
  import { Pressable, StyleSheet, View, type ViewStyle } from 'react-native';
2
2
 
3
3
  import { useUniversalLifecycle } from '../hooks';
4
+ import { StackAxisContext, useCrossAxisSize } from '../stackAxis';
4
5
  import type { UniversalAlignment } from '../types';
5
6
  import type { RowProps } from './types';
6
7
 
7
8
  const styles = StyleSheet.create({
8
- row: {
9
- // Fill the parent's cross-axis by default so a `<Spacer flexible />`
10
- // child has room to grow. Without this, a Row placed inside a `Column`
11
- // with alignment other than 'stretch' is content-sized on web, which
12
- // leaves flex children with no leftover space. SwiftUI and Compose
13
- // achieve the same effect via their own layout phases.
14
- alignSelf: 'stretch',
15
- flexDirection: 'row',
16
- },
9
+ row: { flexDirection: 'row' },
10
+ // Fill the parent's cross axis when this row has no size of its own on that axis,
11
+ // so a flexible child still has leftover space. A set size must not use
12
+ // stretch, or the parent's alignment cannot move it.
13
+ stretch: { alignSelf: 'stretch' },
17
14
  hidden: { display: 'none' },
18
15
  disabled: {
19
16
  opacity: 0.5,
@@ -43,6 +40,7 @@ export function Row({
43
40
  testID,
44
41
  }: RowProps) {
45
42
  useUniversalLifecycle(onAppear, onDisappear);
43
+ const crossAxisSize = useCrossAxisSize(style);
46
44
 
47
45
  const Container = onPress ? Pressable : View;
48
46
 
@@ -53,13 +51,14 @@ export function Row({
53
51
  testID={testID}
54
52
  style={[
55
53
  styles.row,
54
+ crossAxisSize == null && styles.stretch,
56
55
  alignmentStyles[alignment],
57
56
  spacing != null && { gap: spacing },
58
57
  style,
59
58
  hidden && styles.hidden,
60
59
  disabled && styles.disabled,
61
60
  ]}>
62
- {children}
61
+ <StackAxisContext.Provider value="horizontal">{children}</StackAxisContext.Provider>
63
62
  </Container>
64
63
  );
65
64
  }
@@ -24,14 +24,26 @@ export function ScrollView({
24
24
  const modifiers = transformToModifiers(
25
25
  style,
26
26
  { onPress: disabled ? undefined : onPress, disabled, hidden, testID },
27
- extraModifiers
27
+ extraModifiers,
28
+ { componentName: 'ScrollView' }
28
29
  );
29
30
 
31
+ // verticalScroll and horizontalScroll clear the main-axis max before measure.
32
+ // A percentage on the scroll axis has no definite parent, so it is ignored.
33
+ // The cross axis still resolves.
30
34
  if (direction === 'horizontal') {
31
- return <Row modifiers={[...modifiers, horizontalScroll()]}>{children}</Row>;
35
+ return (
36
+ <Row resolvesChildPercentages modifiers={[...modifiers, horizontalScroll()]}>
37
+ {children}
38
+ </Row>
39
+ );
32
40
  }
33
41
 
34
- return <Column modifiers={[...modifiers, verticalScroll()]}>{children}</Column>;
42
+ return (
43
+ <Column resolvesChildPercentages modifiers={[...modifiers, verticalScroll()]}>
44
+ {children}
45
+ </Column>
46
+ );
35
47
  }
36
48
 
37
49
  export * from './types';
@@ -1,4 +1,4 @@
1
- import { Group, ScrollView as SwiftUIScrollView } from '@expo/ui/swift-ui';
1
+ import { HStack, ScrollView as SwiftUIScrollView, VStack } from '@expo/ui/swift-ui';
2
2
  import { frame, padding } from '@expo/ui/swift-ui/modifiers';
3
3
  import type { ModifierConfig } from '@expo/ui/swift-ui/modifiers';
4
4
 
@@ -18,7 +18,7 @@ export function ScrollView({
18
18
  testID,
19
19
  modifiers: extraModifiers,
20
20
  }: ScrollViewProps) {
21
- // Extract padding from style — it goes on the inner Group so content is
21
+ // Extract padding from style — it goes on the inner stack so content is
22
22
  // inset after stretching to full width.
23
23
  const {
24
24
  padding: paddingAll,
@@ -34,7 +34,8 @@ export function ScrollView({
34
34
  const scrollModifiers = transformToModifiers(
35
35
  Object.keys(styleWithoutPadding).length > 0 ? (styleWithoutPadding as typeof style) : undefined,
36
36
  { onPress, onAppear, onDisappear, disabled, hidden, testID },
37
- extraModifiers
37
+ extraModifiers,
38
+ { componentName: 'ScrollView' }
38
39
  );
39
40
 
40
41
  // SwiftUI ScrollView centers content by default. Stretch content to fill
@@ -64,13 +65,24 @@ export function ScrollView({
64
65
  );
65
66
  }
66
67
 
68
+ const stack =
69
+ direction === 'horizontal' ? (
70
+ <HStack alignment="top" modifiers={innerModifiers}>
71
+ {children}
72
+ </HStack>
73
+ ) : (
74
+ <VStack alignment="leading" modifiers={innerModifiers}>
75
+ {children}
76
+ </VStack>
77
+ );
78
+
67
79
  return (
68
80
  <SwiftUIScrollView
69
81
  axes={direction}
70
82
  showsIndicators={showsIndicators}
71
83
  modifiers={scrollModifiers}
72
84
  testID={testID}>
73
- <Group modifiers={innerModifiers}>{children}</Group>
85
+ {stack}
74
86
  </SwiftUIScrollView>
75
87
  );
76
88
  }
@@ -48,10 +48,12 @@ export function Spacer({
48
48
  layoutMods.push(sizeModifier(size, size));
49
49
  }
50
50
 
51
- const modifiers = transformToModifiers(style, { disabled, hidden, testID }, [
52
- ...layoutMods,
53
- ...(extraModifiers ?? []),
54
- ]);
51
+ const modifiers = transformToModifiers(
52
+ style,
53
+ { disabled, hidden, testID },
54
+ [...layoutMods, ...(extraModifiers ?? [])],
55
+ { componentName: 'Spacer' }
56
+ );
55
57
 
56
58
  return <ComposeSpacer modifiers={modifiers} />;
57
59
  }
@@ -30,7 +30,8 @@ export function Spacer({
30
30
  const baseModifiers = transformToModifiers(
31
31
  style,
32
32
  { onAppear, onDisappear, disabled, hidden, testID },
33
- extraModifiers
33
+ extraModifiers,
34
+ { componentName: 'Spacer' }
34
35
  );
35
36
 
36
37
  if (flexible) {
@@ -1,31 +1,50 @@
1
1
  import { Row, Switch as ComposeSwitch, Text } from '@expo/ui/jetpack-compose';
2
2
  import {
3
+ defaultMinSize,
3
4
  fillMaxWidth,
4
5
  IntrinsicSize,
5
6
  testID as testIDModifier,
7
+ toggleable,
6
8
  weight,
7
9
  width,
8
10
  } from '@expo/ui/jetpack-compose/modifiers';
9
11
 
10
12
  import type { SwitchProps } from './types';
11
13
 
14
+ // Material's minimum touch target.
15
+ const MIN_INTERACTIVE_SIZE = 48;
16
+
12
17
  export function Switch({ value, onValueChange, label, disabled, testID, modifiers }: SwitchProps) {
18
+ const isLabeled = label != null;
13
19
  const toggle = (
14
20
  <ComposeSwitch
15
21
  value={value}
16
- onCheckedChange={disabled ? undefined : onValueChange}
22
+ onCheckedChange={isLabeled ? undefined : onValueChange}
17
23
  enabled={!disabled}
18
- modifiers={[...(modifiers ?? []), ...(testID ? [testIDModifier(testID)] : [])]}
24
+ modifiers={[
25
+ ...(modifiers ?? []),
26
+ ...(isLabeled
27
+ ? [defaultMinSize({ minWidth: MIN_INTERACTIVE_SIZE, minHeight: MIN_INTERACTIVE_SIZE })]
28
+ : []),
29
+ ...(testID ? [testIDModifier(testID)] : []),
30
+ ]}
19
31
  />
20
32
  );
21
33
 
22
- if (label == null) return toggle;
34
+ if (!isLabeled) return toggle;
23
35
 
24
36
  return (
25
37
  <Row
26
38
  verticalAlignment="center"
27
39
  horizontalArrangement={{ spacedBy: 8 }}
28
- modifiers={[fillMaxWidth(), width(IntrinsicSize.Max)]}>
40
+ modifiers={[
41
+ fillMaxWidth(),
42
+ width(IntrinsicSize.Max),
43
+ toggleable(value, () => !disabled && onValueChange(!value), {
44
+ role: 'switch',
45
+ enabled: !disabled,
46
+ }),
47
+ ]}>
29
48
  <Text modifiers={[weight(1)]}>{label}</Text>
30
49
  {toggle}
31
50
  </Row>
@@ -28,6 +28,7 @@ const styles = StyleSheet.create({
28
28
  },
29
29
  text: {
30
30
  color: colors.foreground,
31
+ flexGrow: 1,
31
32
  userSelect: 'none',
32
33
  },
33
34
  track: {
@@ -30,7 +30,8 @@ export function Text({
30
30
  const modifiers = transformToModifiers(
31
31
  style,
32
32
  { onPress: disabled ? undefined : onPress, disabled, hidden, testID },
33
- extraModifiers
33
+ extraModifiers,
34
+ { componentName: 'Text' }
34
35
  );
35
36
 
36
37
  // Build Compose Text style object
@@ -96,7 +96,8 @@ export function Text({
96
96
  const universalModifiers = transformToModifiers(
97
97
  style,
98
98
  { onPress, onAppear, onDisappear, disabled, hidden, testID },
99
- extraModifiers
99
+ extraModifiers,
100
+ { componentName: 'Text' }
100
101
  );
101
102
 
102
103
  // A user-supplied modifier replaces any text-derived modifier of the same type.
@@ -4,8 +4,8 @@ import { useUniversalLifecycle } from '../hooks';
4
4
  import type { TextProps } from './types';
5
5
 
6
6
  const styles = StyleSheet.create({
7
- light: { color: '#000000' },
8
- dark: { color: '#FFFFFF' },
7
+ light: { color: 'var(--expo-ui-foreground, #000000)' },
8
+ dark: { color: 'var(--expo-ui-foreground, #FFFFFF)' },
9
9
  hidden: { display: 'none' },
10
10
  disabled: { opacity: 0.5 },
11
11
  });
@@ -26,6 +26,17 @@ function mapReturnKeyType(value: ReturnKeyTypeOptions): TextFieldImeAction {
26
26
  return value as TextFieldImeAction;
27
27
  }
28
28
 
29
+ function mapSecureKeyboardType(value: KeyboardTypeOptions | undefined): TextFieldKeyboardType {
30
+ switch (value) {
31
+ case 'numeric':
32
+ case 'number-pad':
33
+ case 'decimal-pad':
34
+ return 'numberPassword';
35
+ default:
36
+ return 'password';
37
+ }
38
+ }
39
+
29
40
  function mapKeyboardType(value: KeyboardTypeOptions): TextFieldKeyboardType {
30
41
  switch (value) {
31
42
  case 'default':
@@ -133,12 +144,23 @@ export function TextInput({
133
144
  else onBlur?.();
134
145
  };
135
146
 
147
+ // `visualTransformation` only masks the text. The keyboard reads the keyboard type,
148
+ // so a secure field also needs a password type.
149
+ const resolvedKeyboardType = secureTextEntry
150
+ ? mapSecureKeyboardType(keyboardType)
151
+ : keyboardType
152
+ ? mapKeyboardType(keyboardType)
153
+ : undefined;
154
+ const resolvedAutoCorrect = secureTextEntry ? false : autoCorrect;
155
+
136
156
  const keyboardOptions =
137
- keyboardType || autoCapitalize || autoCorrect !== undefined || returnKeyType
157
+ resolvedKeyboardType || autoCapitalize || resolvedAutoCorrect !== undefined || returnKeyType
138
158
  ? {
139
- ...(keyboardType ? { keyboardType: mapKeyboardType(keyboardType) } : null),
159
+ ...(resolvedKeyboardType ? { keyboardType: resolvedKeyboardType } : null),
140
160
  ...(autoCapitalize ? { capitalization: autoCapitalize } : null),
141
- ...(autoCorrect !== undefined ? { autoCorrectEnabled: autoCorrect } : null),
161
+ ...(resolvedAutoCorrect !== undefined
162
+ ? { autoCorrectEnabled: resolvedAutoCorrect }
163
+ : null),
142
164
  ...(returnKeyType ? { imeAction: mapReturnKeyType(returnKeyType) } : null),
143
165
  }
144
166
  : undefined;
@@ -158,8 +180,7 @@ export function TextInput({
158
180
  <BasicTextField
159
181
  ref={innerRef}
160
182
  modifiers={[
161
- ...(userModifiers ?? []),
162
- ...transformToModifiers(style, {}),
183
+ ...transformToModifiers(style, {}, userModifiers, { componentName: 'TextInput' }),
163
184
  ...(testID ? [testIDModifier(testID)] : []),
164
185
  ...(autoComplete ? [semantics({ contentType: autoComplete })] : []),
165
186
  ...(onContentSizeChange ? [onSizeChanged(onContentSizeChange)] : []),
@@ -149,7 +149,7 @@ export function TextInput({
149
149
 
150
150
  const modifiers: ModifierConfig[] = [
151
151
  ...(userModifiers ?? []),
152
- ...transformToModifiers(style, {}, undefined, { textStyle }),
152
+ ...transformToModifiers(style, {}, undefined, { componentName: 'TextInput', textStyle }),
153
153
  ];
154
154
  if (editable === false) modifiers.push(disabledMod(true));
155
155
  if (keyboardType) modifiers.push(keyboardTypeMod(mapKeyboardType(keyboardType)));
@@ -19,4 +19,9 @@ export * from './Spacer';
19
19
  export * from './State';
20
20
  export { TextInput, type TextInputProps, type TextInputRef } from './TextInput';
21
21
 
22
- export type { UniversalStyle, UniversalAlignment, UniversalBaseProps } from './types';
22
+ export type {
23
+ UniversalStyle,
24
+ UniversalAlignment,
25
+ UniversalBaseProps,
26
+ UniversalDimension,
27
+ } from './types';