@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
@@ -0,0 +1 @@
1
+ f145e3373b2e35638d4cb0073f7383c0a6d92b95196658871f714491d5e8c4ae
@@ -0,0 +1 @@
1
+ 0623256bf93c3c81aa8b0a3cc4dbd49f1c7e30fadb966367cf7731ccf29a2e51922f75c7adf16555b2d364fa4fbc04bfb9564bebceb4fb0a212de7c11bf5e0b6
@@ -0,0 +1 @@
1
+ 0dcea7ff840c77f459c393528d9f163eafc5beb4
@@ -0,0 +1 @@
1
+ 0fabcbaf4112be9662f5a77b9c3c4eccfa49651b7f3a81b852e316a798ba20bb
@@ -0,0 +1 @@
1
+ d738e4775e8d79128bbba80d2fccf657ea523f04ab14df1f1f3453d4a1c21f4d1727f05275e874864ca716b995977bc06e17cc2a851c7b2c940cd5b443a02820
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "expo.modules.ui",
5
5
  "module": "expo.modules.ui",
6
- "version": "58.0.8",
6
+ "version": "58.0.10",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.ui-58.0.8.aar",
28
- "url": "expo.modules.ui-58.0.8.aar",
29
- "size": 1836349,
30
- "sha512": "e5ced1751f3e2e90a7320abf88d98bea0a578fbcabcf73c0aca0e9997efe4d0313375d810c789fe2d96f6f6d5cdb9f36c21c2b82f67db8626149105938f29523",
31
- "sha256": "315787d05711205c64b7245b046f29efe369b50f4e86866afef62b2b2474e537",
32
- "sha1": "94aec72d27a48e827dbb31b9d734150334b08662",
33
- "md5": "31be76a409dceed307ca47e9e66c8348"
27
+ "name": "expo.modules.ui-58.0.10.aar",
28
+ "url": "expo.modules.ui-58.0.10.aar",
29
+ "size": 1844321,
30
+ "sha512": "d738e4775e8d79128bbba80d2fccf657ea523f04ab14df1f1f3453d4a1c21f4d1727f05275e874864ca716b995977bc06e17cc2a851c7b2c940cd5b443a02820",
31
+ "sha256": "0fabcbaf4112be9662f5a77b9c3c4eccfa49651b7f3a81b852e316a798ba20bb",
32
+ "sha1": "0dcea7ff840c77f459c393528d9f163eafc5beb4",
33
+ "md5": "d79aa0c5f5eae19a395adaf3133d4bb1"
34
34
  }
35
35
  ]
36
36
  },
@@ -141,13 +141,13 @@
141
141
  ],
142
142
  "files": [
143
143
  {
144
- "name": "expo.modules.ui-58.0.8.aar",
145
- "url": "expo.modules.ui-58.0.8.aar",
146
- "size": 1836349,
147
- "sha512": "e5ced1751f3e2e90a7320abf88d98bea0a578fbcabcf73c0aca0e9997efe4d0313375d810c789fe2d96f6f6d5cdb9f36c21c2b82f67db8626149105938f29523",
148
- "sha256": "315787d05711205c64b7245b046f29efe369b50f4e86866afef62b2b2474e537",
149
- "sha1": "94aec72d27a48e827dbb31b9d734150334b08662",
150
- "md5": "31be76a409dceed307ca47e9e66c8348"
144
+ "name": "expo.modules.ui-58.0.10.aar",
145
+ "url": "expo.modules.ui-58.0.10.aar",
146
+ "size": 1844321,
147
+ "sha512": "d738e4775e8d79128bbba80d2fccf657ea523f04ab14df1f1f3453d4a1c21f4d1727f05275e874864ca716b995977bc06e17cc2a851c7b2c940cd5b443a02820",
148
+ "sha256": "0fabcbaf4112be9662f5a77b9c3c4eccfa49651b7f3a81b852e316a798ba20bb",
149
+ "sha1": "0dcea7ff840c77f459c393528d9f163eafc5beb4",
150
+ "md5": "d79aa0c5f5eae19a395adaf3133d4bb1"
151
151
  }
152
152
  ]
153
153
  },
@@ -161,13 +161,13 @@
161
161
  },
162
162
  "files": [
163
163
  {
164
- "name": "expo.modules.ui-58.0.8-sources.jar",
165
- "url": "expo.modules.ui-58.0.8-sources.jar",
166
- "size": 109792,
167
- "sha512": "fe7df10c6d11c1f95ca7de35f60911401b64bd4b258c6c7956611f973bd062a367c0aea2693298e3d703e58a89b70cfd2c47851400299d035ea28499e595fb8e",
168
- "sha256": "02ee570f6a4a03679186bf43c56875eebf84f15abb7e79bb7040eddad7da908d",
169
- "sha1": "c96c6c3f5dc0911a893274646c0cf2096a610423",
170
- "md5": "9fb8758d9f0ad26c9154ad6536600e2c"
164
+ "name": "expo.modules.ui-58.0.10-sources.jar",
165
+ "url": "expo.modules.ui-58.0.10-sources.jar",
166
+ "size": 110439,
167
+ "sha512": "0623256bf93c3c81aa8b0a3cc4dbd49f1c7e30fadb966367cf7731ccf29a2e51922f75c7adf16555b2d364fa4fbc04bfb9564bebceb4fb0a212de7c11bf5e0b6",
168
+ "sha256": "f145e3373b2e35638d4cb0073f7383c0a6d92b95196658871f714491d5e8c4ae",
169
+ "sha1": "e37768569504f9fa90267fc6c3beba9d9cc35372",
170
+ "md5": "368760562360e5fb3fa8ba0bded3c520"
171
171
  }
172
172
  ]
173
173
  }
@@ -0,0 +1 @@
1
+ 1cc869e3ee310f7480fac356b53346ff115e054d
@@ -0,0 +1 @@
1
+ 01b113e83cceddd1aefec3f0e0c87cb914239ee66f5e2ae04aa92b96f20b135c
@@ -0,0 +1 @@
1
+ 27bee629427b9983020b802f9c7b6d391948f15dad48cddaacd36df01f1ecb20facb24537fab5500184bba45865f71676da3ff5ddc431ed4cf1fbce258a8f98b
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>expo.modules.ui</groupId>
11
11
  <artifactId>expo.modules.ui</artifactId>
12
- <version>58.0.8</version>
12
+ <version>58.0.10</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.ui</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ 1b5bde4495bd228e0cd676da0377d9d16aff8c58
@@ -0,0 +1 @@
1
+ ba1f7cd196676bb09597182345849c73fb333126658134051f40e2959a212a9a
@@ -0,0 +1 @@
1
+ 738650c58d03e4215b915694328bdecc2fa131b3e95a0f7936f1f0fd870ccc7d6daa58573b50317698ba272dd6216e74d028b49745970d86bc5113ac1ba3991b
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/ui",
3
- "version": "58.0.8",
3
+ "version": "58.0.10",
4
4
  "description": "A collection of UI components",
5
5
  "keywords": [
6
6
  "Jetpack Compose",
@@ -148,7 +148,7 @@
148
148
  "@types/jest": "^29.2.1",
149
149
  "@types/node": "^22.14.0",
150
150
  "@types/react": "~19.3.0",
151
- "expo-module-scripts": "56.0.3",
151
+ "expo-module-scripts": "56.0.4",
152
152
  "react-native-reanimated": "4.7.0",
153
153
  "react-native-worklets": "0.13.0"
154
154
  },
@@ -171,9 +171,9 @@
171
171
  "optional": true
172
172
  }
173
173
  },
174
- "gitHead": "74f6d2b90bc50bd8df7b160d6e6b2204b37a8ce7",
175
174
  "scripts": {
176
175
  "precompile-ios": "et prebuild-package-for-publish",
176
+ "precompile-android": "et prebuild-android-package-for-publish",
177
177
  "build": "pnpm run build:lib && pnpm run build:plugin",
178
178
  "build:lib": "expo-build src",
179
179
  "build:plugin": "expo-build --base plugin cjs:src",
@@ -36,6 +36,11 @@ export function Picker<T extends PickerItemValue>(props: PickerProps<T>) {
36
36
  const selectedLabel = selectedItem?.label ?? '';
37
37
  const labelState = useNativeState(selectedLabel);
38
38
 
39
+ // `useNativeState` only captures its initial value, so push later changes to the field.
40
+ React.useEffect(() => {
41
+ labelState.set(selectedLabel);
42
+ }, [labelState, selectedLabel]);
43
+
39
44
  return (
40
45
  <Host style={style} matchContents={{ vertical: true }}>
41
46
  <ExposedDropdownMenuBox
@@ -4,6 +4,8 @@ import type { ExpoModifier } from '../../types';
4
4
  import { LazyItems } from '../LazyItems';
5
5
  import { createViewModifierEventListener } from '../modifiers/utils';
6
6
 
7
+ export { LazyItems, type LazyItemsProps } from '../LazyItems';
8
+
7
9
  /**
8
10
  * Content padding values for LazyColumn.
9
11
  */
@@ -5,38 +5,36 @@ import {
5
5
  useItemKeys,
6
6
  useRecycledRows,
7
7
  type RecycledSlotProps,
8
- type RenderItem,
9
8
  type WindowChangeEvent,
10
9
  } from '../../recycling/useRecycledRows';
11
10
  import { type ViewEvent } from '../../types';
12
11
 
13
- export interface LazyItemsProps<ItemT> {
12
+ export interface LazyItemsProps<T> {
14
13
  /** Items to display. Replace the array when updating data. */
15
- data: readonly ItemT[];
14
+ data: readonly T[];
16
15
  /** Returns a stable, unique string key, also used as the lazy list item key. */
17
- keyExtractor: (item: ItemT, index: number) => string;
16
+ keyExtractor: (item: T, index: number) => string;
18
17
  /**
19
- * Renders a row. Wrap it in `useCallback`, or every row re-renders on each parent render.
20
- * Recycled rows are reused for other items, so their local state (`useState`) carries over.
21
- * Reset it when the item changes, or keep the state outside the row.
18
+ * Renders an item. Wrap it in `useCallback`, or every item re-renders on each parent render.
19
+ * Recycled views 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 view.
22
21
  */
23
- children: RenderItem<ItemT>;
22
+ children: (info: { item: T; index: number }) => ReactElement;
24
23
  /**
25
- * Renders only the rows near the visible range and reuses them while scrolling. Set to `false` to
26
- * render every row at once. Set it once; changing it remounts the rows.
24
+ * Renders only the items near the visible range and reuses them while scrolling. Set to `false`
25
+ * to render every item at once. Set it once; changing it remounts the items.
27
26
  * @default true
28
27
  */
29
28
  recycling?: boolean;
30
29
  /**
31
- * Extra rows to prepare on each side of the visible rows. Must be a non-negative integer.
30
+ * Extra items to prepare on each side of the visible items. Must be a non-negative integer.
32
31
  * Ignored when `recycling` is `false`.
33
32
  * @default 10
34
33
  */
35
34
  overscanCount?: number;
36
35
  /**
37
- * Placeholder size in dp along the scroll axis, until a row is measured. Must be positive.
38
- * Measurements reset when the data changes. In `LazyColumn.Items` they also reset when the list
39
- * width changes. Ignored when `recycling` is `false`.
36
+ * Placeholder size in dp along the scroll axis, until an item is measured. Must be positive.
37
+ * Ignored when `recycling` is `false`.
40
38
  * @default 64
41
39
  */
42
40
  estimatedItemSize?: number;
@@ -62,8 +60,7 @@ const LazyItemsPoolNativeView: React.ComponentType<{ children: ReactElement[] }>
62
60
  * so large data sets stay cheap. Rows that are not ready yet show a placeholder of
63
61
  * `estimatedItemSize`, or of the size last measured for that item.
64
62
  *
65
- * Mount it as a direct child of `LazyColumn` or `LazyRow`. Plain children of the same list stay
66
- * single items, so static and recycled content can be mixed in order.
63
+ * Mount it as a direct child of `LazyColumn` or `LazyRow`.
67
64
  * @platform android
68
65
  */
69
66
  export const LazyItems = createLazyItems('LazyColumn.Items');
@@ -73,29 +70,29 @@ export const LazyItems = createLazyItems('LazyColumn.Items');
73
70
  * Creates the `Items` component of one lazy list, so its errors name that list.
74
71
  */
75
72
  export function createLazyItems(componentName: string) {
76
- function Items<ItemT>({ recycling = true, ...props }: LazyItemsProps<ItemT>) {
73
+ function Items<T>({ recycling = true, ...props }: LazyItemsProps<T>) {
77
74
  return recycling ? <RecycledItems {...props} /> : <StaticItems {...props} />;
78
75
  }
79
76
 
80
77
  // Each row is a plain child of the lazy list, so it becomes one lazy item.
81
- function StaticItems<ItemT>({
78
+ function StaticItems<T>({
82
79
  data,
83
80
  keyExtractor,
84
81
  children: renderItem,
85
- }: Omit<LazyItemsProps<ItemT>, 'recycling'>) {
82
+ }: Omit<LazyItemsProps<T>, 'recycling'>) {
86
83
  const itemKeys = useItemKeys(componentName, data, keyExtractor);
87
84
  return data.map((item, index) => (
88
85
  <Fragment key={itemKeys[index]}>{renderItem({ item, index })}</Fragment>
89
86
  ));
90
87
  }
91
88
 
92
- function RecycledItems<ItemT>({
89
+ function RecycledItems<T>({
93
90
  data,
94
91
  keyExtractor,
95
92
  children: renderItem,
96
93
  overscanCount,
97
94
  estimatedItemSize = 64,
98
- }: Omit<LazyItemsProps<ItemT>, 'recycling'>) {
95
+ }: Omit<LazyItemsProps<T>, 'recycling'>) {
99
96
  const { itemKeys, revision, rows, onWindowChange } = useRecycledRows({
100
97
  componentName,
101
98
  Slot: LazyItemsSlotNativeView,
@@ -5,6 +5,8 @@ import { type ContentPadding } from '../LazyColumn';
5
5
  import { createLazyItems } from '../LazyItems';
6
6
  import { createViewModifierEventListener } from '../modifiers/utils';
7
7
 
8
+ export { LazyItems, type LazyItemsProps } from '../LazyItems';
9
+
8
10
  export interface LazyRowProps {
9
11
  /**
10
12
  * The content to display inside the lazy row.
@@ -4,6 +4,7 @@ import type { LayoutChangeEvent } from 'react-native';
4
4
 
5
5
  import { PresentedContentContext, useIsPresentedInOwnWindow } from '../../PresentedContentContext';
6
6
  import type { ModifierConfig } from '../../types';
7
+ import { resolveMatchContents } from '../../utils/matchContents';
7
8
  import type { PrimitiveBaseProps } from '../layout';
8
9
  import { createViewModifierEventListener } from '../modifiers/utils';
9
10
 
@@ -11,10 +12,12 @@ export interface RNHostProps extends PrimitiveBaseProps {
11
12
  /**
12
13
  * When `true`, the RNHost will update its size in the Jetpack Compose view tree to match the children's size.
13
14
  * When `false`, the RNHost will use the size of the parent Jetpack Compose View.
15
+ * Pass an object to choose per axis. For example, `{ vertical: true }` takes the width from the
16
+ * parent and the height from the children, so text wraps and grows vertically.
14
17
  * Can be only set once on mount.
15
18
  * @default false
16
19
  */
17
- matchContents?: boolean;
20
+ matchContents?: boolean | { vertical?: boolean; horizontal?: boolean };
18
21
  /**
19
22
  * Called on mount and whenever this view's layout in the React Native view tree changes.
20
23
  * With `matchContents`, the reported size is the one measured from the hosted view.
@@ -30,8 +33,10 @@ export interface RNHostProps extends PrimitiveBaseProps {
30
33
  modifiers?: ModifierConfig[];
31
34
  }
32
35
 
33
- type NativeRNHostProps = RNHostProps & {
36
+ type NativeRNHostProps = Omit<RNHostProps, 'matchContents'> & {
34
37
  layoutRoot: boolean;
38
+ matchContentsHorizontal: boolean;
39
+ matchContentsVertical: boolean;
35
40
  /**
36
41
  * Internal. Drives the shadow node's content measurement, see
37
42
  * `ExpoViewShadowNode::sizesToContent`.
@@ -44,13 +49,17 @@ const NativeRNHostView: ComponentType<NativeRNHostProps> = requireNativeView(
44
49
  );
45
50
 
46
51
  function transformProps(props: RNHostProps, layoutRoot: boolean): NativeRNHostProps {
47
- const { modifiers, ...restProps } = props;
52
+ const { modifiers, matchContents, ...restProps } = props;
53
+ const { horizontal: matchContentsHorizontal, vertical: matchContentsVertical } =
54
+ resolveMatchContents(matchContents);
48
55
  return {
49
56
  modifiers,
50
57
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
51
58
  ...restProps,
52
59
  layoutRoot,
53
- expoInternalSizeFromChildren: props.matchContents,
60
+ matchContentsHorizontal,
61
+ matchContentsVertical,
62
+ expoInternalSizeFromChildren: matchContentsHorizontal || matchContentsVertical,
54
63
  };
55
64
  }
56
65
 
@@ -61,12 +70,14 @@ export function RNHostView(props: RNHostProps) {
61
70
  // is what makes a `Pressable` drop its press on the first finger movement.
62
71
  const layoutRoot = useIsPresentedInOwnWindow();
63
72
 
73
+ const nativeProps = transformProps(props, layoutRoot);
74
+
64
75
  return (
65
76
  <NativeRNHostView
66
- {...transformProps(props, layoutRoot)}
77
+ {...nativeProps}
67
78
  // `matchContents` can only be used once on mount
68
79
  // So we force unmount when it changes to prevent unexpected layout
69
- key={props.matchContents ? 'matchContents' : 'noMatchContents'}>
80
+ key={`${nativeProps.matchContentsHorizontal}-${nativeProps.matchContentsVertical}`}>
70
81
  {/* Reset context here so only nearest RNHostView becomes the layout root for its children, and not any other RNHostView above it in the tree. */}
71
82
  <PresentedContentContext.Provider value={false}>
72
83
  {props.children}
@@ -17,7 +17,6 @@ export * from './ExposedDropdownMenuBox';
17
17
  export * from './Divider';
18
18
  export * from './Host';
19
19
  export * from './LazyColumn';
20
- export { type LazyItemsProps } from './LazyItems';
21
20
  export * from './LazyRow';
22
21
  export * from './ListItem';
23
22
  export * from './RNHostView';
@@ -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;