@expo/ui 58.0.22 → 58.0.24

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 (234) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/ComposeViews.kt +53 -29
  4. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +6 -4
  5. package/android/src/main/java/expo/modules/ui/HostView.kt +85 -15
  6. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +40 -12
  7. package/android/src/main/java/expo/modules/ui/RNHostView.kt +138 -2
  8. package/android/src/main/java/expo/modules/ui/SliderView.kt +5 -4
  9. package/android/src/main/java/expo/modules/ui/UniversalLayout.kt +610 -0
  10. package/android/src/main/java/expo/modules/ui/VerticalSliderView.kt +5 -4
  11. package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +2 -0
  12. package/android/src/main/java/expo/modules/ui/state/WorkletCallback.kt +2 -0
  13. package/build/community/bottom-sheet/BottomSheet.android.js +2 -0
  14. package/build/community/bottom-sheet/BottomSheet.android.js.map +1 -1
  15. package/build/community/menu/MenuView.ios.js +2 -1
  16. package/build/community/menu/MenuView.ios.js.map +1 -1
  17. package/build/jetpack-compose/Column/index.d.ts +5 -0
  18. package/build/jetpack-compose/Column/index.js.map +1 -1
  19. package/build/jetpack-compose/Row/index.d.ts +5 -0
  20. package/build/jetpack-compose/Row/index.js.map +1 -1
  21. package/build/jetpack-compose/Text/index.js +5 -4
  22. package/build/jetpack-compose/Text/index.js.map +1 -1
  23. package/build/recycling/useRecycledRows.d.ts +2 -0
  24. package/build/recycling/useRecycledRows.js +1 -0
  25. package/build/recycling/useRecycledRows.js.map +1 -1
  26. package/build/swift-ui/ContentUnavailableView/index.d.ts +5 -0
  27. package/build/swift-ui/ContentUnavailableView/index.js +7 -2
  28. package/build/swift-ui/ContentUnavailableView/index.js.map +1 -1
  29. package/build/swift-ui/HStack/index.d.ts +6 -0
  30. package/build/swift-ui/HStack/index.js.map +1 -1
  31. package/build/swift-ui/RNHostView.d.ts +7 -1
  32. package/build/swift-ui/RNHostView.js +2 -1
  33. package/build/swift-ui/RNHostView.js.map +1 -1
  34. package/build/swift-ui/Text/index.js +2 -1
  35. package/build/swift-ui/Text/index.js.map +1 -1
  36. package/build/swift-ui/VStack/index.d.ts +6 -0
  37. package/build/swift-ui/VStack/index.js.map +1 -1
  38. package/build/swift-ui/modifiers/index.d.ts +18 -0
  39. package/build/swift-ui/modifiers/index.js +9 -0
  40. package/build/swift-ui/modifiers/index.js.map +1 -1
  41. package/build/universal/BottomSheet/index.android.js +5 -5
  42. package/build/universal/BottomSheet/index.android.js.map +1 -1
  43. package/build/universal/Button/index.android.js +3 -1
  44. package/build/universal/Button/index.android.js.map +1 -1
  45. package/build/universal/Button/index.ios.js +3 -1
  46. package/build/universal/Button/index.ios.js.map +1 -1
  47. package/build/universal/Collapsible/index.ios.js +1 -0
  48. package/build/universal/Collapsible/index.ios.js.map +1 -1
  49. package/build/universal/Column/index.android.js +4 -1
  50. package/build/universal/Column/index.android.js.map +1 -1
  51. package/build/universal/Column/index.ios.js +2 -0
  52. package/build/universal/Column/index.ios.js.map +1 -1
  53. package/build/universal/Column/index.js +13 -4
  54. package/build/universal/Column/index.js.map +1 -1
  55. package/build/universal/FieldGroup/FieldGroup.android.js +3 -1
  56. package/build/universal/FieldGroup/FieldGroup.android.js.map +1 -1
  57. package/build/universal/FieldGroup/FieldGroup.ios.js +3 -1
  58. package/build/universal/FieldGroup/FieldGroup.ios.js.map +1 -1
  59. package/build/universal/FieldGroup/FieldSection.android.js +13 -4
  60. package/build/universal/FieldGroup/FieldSection.android.js.map +1 -1
  61. package/build/universal/FieldGroup/FieldSection.ios.js +3 -1
  62. package/build/universal/FieldGroup/FieldSection.ios.js.map +1 -1
  63. package/build/universal/Icon/index.android.js +3 -1
  64. package/build/universal/Icon/index.android.js.map +1 -1
  65. package/build/universal/Icon/index.ios.js +3 -1
  66. package/build/universal/Icon/index.ios.js.map +1 -1
  67. package/build/universal/List/ListForEach.android.d.ts +7 -0
  68. package/build/universal/List/ListForEach.android.js +6 -0
  69. package/build/universal/List/ListForEach.android.js.map +1 -0
  70. package/build/universal/List/ListForEach.d.ts +5 -0
  71. package/build/universal/List/ListForEach.ios.d.ts +5 -0
  72. package/build/universal/List/ListForEach.ios.js +11 -0
  73. package/build/universal/List/ListForEach.ios.js.map +1 -0
  74. package/build/universal/List/ListForEach.js +263 -0
  75. package/build/universal/List/ListForEach.js.map +1 -0
  76. package/build/universal/List/ListScrollContext.d.ts +5 -0
  77. package/build/universal/List/ListScrollContext.js +6 -0
  78. package/build/universal/List/ListScrollContext.js.map +1 -0
  79. package/build/universal/List/index.android.d.ts +5 -0
  80. package/build/universal/List/index.android.js +3 -0
  81. package/build/universal/List/index.android.js.map +1 -1
  82. package/build/universal/List/index.d.ts +5 -0
  83. package/build/universal/List/index.ios.d.ts +5 -0
  84. package/build/universal/List/index.ios.js +3 -0
  85. package/build/universal/List/index.ios.js.map +1 -1
  86. package/build/universal/List/index.js +12 -1
  87. package/build/universal/List/index.js.map +1 -1
  88. package/build/universal/List/types.d.ts +42 -1
  89. package/build/universal/List/types.js +1 -3
  90. package/build/universal/List/types.js.map +1 -1
  91. package/build/universal/RNHostView/index.android.js +3 -1
  92. package/build/universal/RNHostView/index.android.js.map +1 -1
  93. package/build/universal/Row/index.android.js +4 -1
  94. package/build/universal/Row/index.android.js.map +1 -1
  95. package/build/universal/Row/index.ios.js +2 -0
  96. package/build/universal/Row/index.ios.js.map +1 -1
  97. package/build/universal/Row/index.js +13 -7
  98. package/build/universal/Row/index.js.map +1 -1
  99. package/build/universal/ScrollView/index.android.js +8 -1
  100. package/build/universal/ScrollView/index.android.js.map +1 -1
  101. package/build/universal/ScrollView/index.ios.js +3 -1
  102. package/build/universal/ScrollView/index.ios.js.map +1 -1
  103. package/build/universal/Spacer/index.android.js +3 -1
  104. package/build/universal/Spacer/index.android.js.map +1 -1
  105. package/build/universal/Spacer/index.ios.js +3 -1
  106. package/build/universal/Spacer/index.ios.js.map +1 -1
  107. package/build/universal/Text/index.android.js +3 -1
  108. package/build/universal/Text/index.android.js.map +1 -1
  109. package/build/universal/Text/index.ios.js +3 -1
  110. package/build/universal/Text/index.ios.js.map +1 -1
  111. package/build/universal/TextInput/index.android.js +22 -7
  112. package/build/universal/TextInput/index.android.js.map +1 -1
  113. package/build/universal/TextInput/index.ios.js +1 -0
  114. package/build/universal/TextInput/index.ios.js.map +1 -1
  115. package/build/universal/index.d.ts +1 -1
  116. package/build/universal/modifierUtils.d.ts +34 -1
  117. package/build/universal/modifierUtils.js +98 -2
  118. package/build/universal/modifierUtils.js.map +1 -1
  119. package/build/universal/stackAxis.d.ts +9 -0
  120. package/build/universal/stackAxis.js +11 -0
  121. package/build/universal/stackAxis.js.map +1 -0
  122. package/build/universal/transformStyle.android.d.ts +6 -2
  123. package/build/universal/transformStyle.android.js +18 -11
  124. package/build/universal/transformStyle.android.js.map +1 -1
  125. package/build/universal/transformStyle.ios.d.ts +5 -1
  126. package/build/universal/transformStyle.ios.js +29 -11
  127. package/build/universal/transformStyle.ios.js.map +1 -1
  128. package/build/universal/types.d.ts +26 -1
  129. package/build/universal/types.js.map +1 -1
  130. package/build/utils/flattenFragments.d.ts +7 -0
  131. package/build/utils/flattenFragments.js +17 -0
  132. package/build/utils/flattenFragments.js.map +1 -0
  133. package/ios/ContentUnavailableView.swift +9 -1
  134. package/ios/GroupView.swift +3 -0
  135. package/ios/HStackView.swift +26 -2
  136. package/ios/HostView.swift +21 -12
  137. package/ios/Modifiers/FontModifier.swift +27 -0
  138. package/ios/Modifiers/SectionIndexLabelModifier.swift +21 -0
  139. package/ios/Modifiers/ViewModifierRegistry.swift +26 -0
  140. package/ios/RNHostView.swift +4 -0
  141. package/ios/ScrollViewComponent.swift +20 -0
  142. package/ios/UIBaseView.swift +4 -1
  143. package/ios/UniversalLayout.swift +691 -0
  144. package/ios/VStackView.swift +26 -2
  145. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.22/expo.modules.ui-58.0.22-sources.jar → 58.0.24/expo.modules.ui-58.0.24-sources.jar} +0 -0
  146. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.md5 +1 -0
  147. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha1 +1 -0
  148. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha256 +1 -0
  149. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24-sources.jar.sha512 +1 -0
  150. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar +0 -0
  151. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.md5 +1 -0
  152. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha1 +1 -0
  153. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha256 +1 -0
  154. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.aar.sha512 +1 -0
  155. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.22/expo.modules.ui-58.0.22.module → 58.0.24/expo.modules.ui-58.0.24.module} +22 -22
  156. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.md5 +1 -0
  157. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha1 +1 -0
  158. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha256 +1 -0
  159. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.module.sha512 +1 -0
  160. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.22/expo.modules.ui-58.0.22.pom → 58.0.24/expo.modules.ui-58.0.24.pom} +1 -1
  161. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.md5 +1 -0
  162. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha1 +1 -0
  163. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha256 +1 -0
  164. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.24/expo.modules.ui-58.0.24.pom.sha512 +1 -0
  165. package/package.json +1 -1
  166. package/src/community/bottom-sheet/BottomSheet.android.tsx +2 -1
  167. package/src/community/menu/MenuView.ios.tsx +3 -2
  168. package/src/jetpack-compose/Column/index.tsx +5 -0
  169. package/src/jetpack-compose/Row/index.tsx +5 -0
  170. package/src/jetpack-compose/Text/index.tsx +5 -4
  171. package/src/recycling/useRecycledRows.tsx +3 -0
  172. package/src/swift-ui/ContentUnavailableView/index.tsx +19 -4
  173. package/src/swift-ui/HStack/index.tsx +6 -0
  174. package/src/swift-ui/RNHostView.tsx +8 -1
  175. package/src/swift-ui/Text/index.tsx +2 -1
  176. package/src/swift-ui/VStack/index.tsx +6 -0
  177. package/src/swift-ui/modifiers/index.ts +19 -0
  178. package/src/universal/BottomSheet/index.android.tsx +3 -1
  179. package/src/universal/Button/index.android.tsx +3 -1
  180. package/src/universal/Button/index.ios.tsx +2 -1
  181. package/src/universal/Collapsible/index.ios.tsx +4 -1
  182. package/src/universal/Column/index.android.tsx +3 -1
  183. package/src/universal/Column/index.ios.tsx +2 -1
  184. package/src/universal/Column/index.tsx +9 -4
  185. package/src/universal/FieldGroup/FieldGroup.android.tsx +8 -1
  186. package/src/universal/FieldGroup/FieldGroup.ios.tsx +2 -1
  187. package/src/universal/FieldGroup/FieldSection.android.tsx +17 -4
  188. package/src/universal/FieldGroup/FieldSection.ios.tsx +2 -1
  189. package/src/universal/Icon/index.android.tsx +2 -1
  190. package/src/universal/Icon/index.ios.tsx +2 -1
  191. package/src/universal/List/ListForEach.android.tsx +6 -0
  192. package/src/universal/List/ListForEach.ios.tsx +9 -0
  193. package/src/universal/List/ListForEach.tsx +246 -0
  194. package/src/universal/List/ListScrollContext.ts +6 -0
  195. package/src/universal/List/index.android.tsx +5 -0
  196. package/src/universal/List/index.ios.tsx +5 -0
  197. package/src/universal/List/index.tsx +11 -2
  198. package/src/universal/List/types.ts +45 -1
  199. package/src/universal/RNHostView/index.android.tsx +2 -1
  200. package/src/universal/Row/index.android.tsx +3 -1
  201. package/src/universal/Row/index.ios.tsx +2 -1
  202. package/src/universal/Row/index.tsx +9 -10
  203. package/src/universal/ScrollView/index.android.tsx +15 -3
  204. package/src/universal/ScrollView/index.ios.tsx +2 -1
  205. package/src/universal/Spacer/index.android.tsx +6 -4
  206. package/src/universal/Spacer/index.ios.tsx +2 -1
  207. package/src/universal/Text/index.android.tsx +2 -1
  208. package/src/universal/Text/index.ios.tsx +2 -1
  209. package/src/universal/TextInput/index.android.tsx +26 -5
  210. package/src/universal/TextInput/index.ios.tsx +1 -1
  211. package/src/universal/index.ts +6 -1
  212. package/src/universal/modifierUtils.ts +159 -2
  213. package/src/universal/stackAxis.ts +17 -0
  214. package/src/universal/transformStyle.android.ts +30 -12
  215. package/src/universal/transformStyle.ios.ts +41 -13
  216. package/src/universal/types.ts +27 -3
  217. package/src/utils/flattenFragments.ts +22 -0
  218. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.md5 +0 -1
  219. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha1 +0 -1
  220. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha256 +0 -1
  221. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22-sources.jar.sha512 +0 -1
  222. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar +0 -0
  223. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.md5 +0 -1
  224. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha1 +0 -1
  225. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha256 +0 -1
  226. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.aar.sha512 +0 -1
  227. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.md5 +0 -1
  228. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha1 +0 -1
  229. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha256 +0 -1
  230. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.module.sha512 +0 -1
  231. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.md5 +0 -1
  232. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha1 +0 -1
  233. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha256 +0 -1
  234. package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.22/expo.modules.ui-58.0.22.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## 58.0.24
4
+
5
+ ### Patch Changes
6
+
7
+ - [Android] Fix a crash when dragging `Slider` or `VerticalSlider` in release builds. Their `onValueChange` and `onValueChangeFinished` events are now declared with `Event<T>()` in the view definition, as `ToggleButton` and `TextField` already do. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
8
+ - [Android] Fix the Jetpack Compose `Text` dropping nested `Text` spans and strings that are inside a React fragment. Move the fragment flattening helper to a shared util used by both the SwiftUI and Jetpack Compose `Text`. ([#52227](https://github.com/expo/expo/pull/52227) by [@expo-tuft](https://github.com/apps/expo-tuft))
9
+ - [iOS] Add an `actions` prop to `ContentUnavailableView`, which shows controls below the description. ([#52190](https://github.com/expo/expo/pull/52190) by [@drewvolz](https://github.com/drewvolz))
10
+ - [iOS] Add `smallCaps` and `leading` options to the `font` modifier, which apply SwiftUI's `Font.smallCaps()` and `Font.leading(_:)`. ([#52189](https://github.com/expo/expo/pull/52189) by [@drewvolz](https://github.com/drewvolz))
11
+ - [Android] Fix an `@expo/ui` control inside a `Pressable` losing taps to the `Pressable`. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
12
+ - [iOS] Apply the `underline` and `strikethrough` modifiers to a nested `Text`. Before, a nested `Text` dropped them, and a debug build showed a "not supported for nested Text" warning. ([#52112](https://github.com/expo/expo/pull/52112) by [@drewvolz](https://github.com/drewvolz))
13
+ - [iOS] Fix the SwiftUI `Text` dropping nested `Text` spans and strings that are inside a React fragment. `Text` now flattens fragment children before it concatenates them. ([#52225](https://github.com/expo/expo/pull/52225) by [@expo-bot](https://github.com/expo-bot))
14
+ - [iOS] Fix `MenuView` triggers that fill their parent, so text in them wraps and they resize on rotation. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
15
+ - [Android] Fix a tap on plain React Native content in `RNHostView` not reaching a parent Compose `clickable`. ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
16
+ - [iOS] Add the `sectionIndexLabel` modifier, which sets the label a list's section index shows for a `Section` on iOS 26 and later. ([#52186](https://github.com/expo/expo/pull/52186) by [@drewvolz](https://github.com/drewvolz))
17
+ - [Android] Fix the universal `BottomSheet` and the community `BottomSheet` / `BottomSheetModal` not opening inside a `FlatList` (or another view with `removeClippedSubviews`). ([#52278](https://github.com/expo/expo/pull/52278) by [@github-actions](https://github.com/apps/github-actions))
18
+
19
+ ## 58.0.23
20
+
21
+ ### Patch Changes
22
+
23
+ - [Android] Fix "Cannot use shared object that was already released" errors when a view with a shared object prop, such as the `@expo/ui` `TextInput`, is remounted right after its first render. ([#51934](https://github.com/expo/expo/pull/51934) by [@expo-tuft](https://github.com/apps/expo-tuft))
24
+ - Universal `Row` and `Column` on Android resolve a child `width` or `height` percentage, such as `'50%'`, against their own size. ([#51118](https://github.com/expo/expo/pull/51118) by [@Kudo](https://github.com/Kudo))
25
+ - Universal `Row` and `Column` on iOS resolve a child `width` or `height` percentage, such as `'50%'`, against their own size. The default `spacing` of a universal `Row` or `Column` on iOS is now `0`, as on Android and web. ([#51119](https://github.com/expo/expo/pull/51119) by [@Kudo](https://github.com/Kudo))
26
+ - Add `List.ForEach` to the universal `List`. It renders rows from `data` and recycles them on Android, iOS, and web. The web `List` now fills its parent, so it scrolls. ([#52047](https://github.com/expo/expo/pull/52047) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
27
+ - Universal `style.width` and `style.height` accept a percentage of the parent, such as `'50%'`. ([#51117](https://github.com/expo/expo/pull/51117) by [@Kudo](https://github.com/Kudo))
28
+ - On web, a universal `Row` or `Column` with a size on its parent's cross axis no longer stretches, so the parent's alignment can place it. ([#51120](https://github.com/expo/expo/pull/51120) by [@Kudo](https://github.com/Kudo))
29
+ - [Android] Fixed `TextInput` with `secureTextEntry` showing the typed password in the keyboard's suggestion strip. A secure field now asks the keyboard for a password layout and turns off autocorrect. ([#52010](https://github.com/expo/expo/pull/52010) by [@enzomanuelmangano](https://github.com/enzomanuelmangano))
30
+
3
31
  ## 58.0.22
4
32
 
5
33
  ### Patch Changes
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
12
12
  apply plugin: 'org.jetbrains.kotlin.plugin.compose'
13
13
 
14
14
  group = 'expo.modules.ui'
15
- version = '58.0.22'
15
+ version = '58.0.24'
16
16
 
17
17
  android {
18
18
  namespace "expo.modules.ui"
19
19
  defaultConfig {
20
20
  versionCode 1
21
- versionName "58.0.22"
21
+ versionName "58.0.24"
22
22
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23
23
  }
24
24
  buildFeatures {
@@ -50,7 +50,9 @@ data class LayoutProps(
50
50
  val verticalAlignment: VerticalAlignment? = null,
51
51
  val contentAlignment: ContentAlignment? = null,
52
52
  val floatingToolbarExitAlwaysScrollBehavior: FloatingToolbarExitAlwaysScrollBehavior? = null,
53
- val modifiers: ModifierList = emptyList()
53
+ val modifiers: ModifierList = emptyList(),
54
+ // Universal `Row` and `Column` set this. Compose `Row` and `Column` leave it false.
55
+ val resolvesChildPercentages: Boolean = false
54
56
  ) : ComposeProps
55
57
 
56
58
  @Composable
@@ -60,20 +62,31 @@ internal fun FunctionalComposableScope.RowContent(props: LayoutProps) {
60
62
  ?.let {
61
63
  FloatingToolbarDefaults.exitAlwaysScrollBehavior(exitDirection = it)
62
64
  }
63
- Row(
64
- horizontalArrangement = props.horizontalArrangement?.toComposeArrangement() ?: Arrangement.Start,
65
- verticalAlignment = props.verticalAlignment?.toComposeAlignment() ?: Alignment.Top,
66
- modifier = ModifierRegistry
67
- .applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
68
- .then(
69
- if (scrollBehavior != null) {
70
- Modifier.nestedScroll(scrollBehavior)
71
- } else {
72
- Modifier
73
- }
74
- )
75
- ) {
76
- Children(UIComposableScope(rowScope = this@Row, nestedScrollConnection = scrollBehavior))
65
+ val modifier = ModifierRegistry
66
+ .applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
67
+ .then(
68
+ if (scrollBehavior != null) {
69
+ Modifier.nestedScroll(scrollBehavior)
70
+ } else {
71
+ Modifier
72
+ }
73
+ )
74
+ if (props.resolvesChildPercentages) {
75
+ UniversalRow(
76
+ horizontalArrangement = props.horizontalArrangement?.toComposeArrangement() ?: Arrangement.Start,
77
+ verticalAlignment = props.verticalAlignment?.toComposeAlignment() ?: Alignment.Top,
78
+ modifier = modifier
79
+ ) {
80
+ Children(UIComposableScope(nestedScrollConnection = scrollBehavior))
81
+ }
82
+ } else {
83
+ Row(
84
+ horizontalArrangement = props.horizontalArrangement?.toComposeArrangement() ?: Arrangement.Start,
85
+ verticalAlignment = props.verticalAlignment?.toComposeAlignment() ?: Alignment.Top,
86
+ modifier = modifier
87
+ ) {
88
+ Children(UIComposableScope(rowScope = this@Row, nestedScrollConnection = scrollBehavior))
89
+ }
77
90
  }
78
91
  }
79
92
 
@@ -96,20 +109,31 @@ internal fun FunctionalComposableScope.ColumnContent(props: LayoutProps) {
96
109
  ?.let {
97
110
  FloatingToolbarDefaults.exitAlwaysScrollBehavior(exitDirection = it)
98
111
  }
99
- Column(
100
- verticalArrangement = props.verticalArrangement?.toComposeArrangement() ?: Arrangement.Top,
101
- horizontalAlignment = props.horizontalAlignment?.toComposeAlignment() ?: Alignment.Start,
102
- modifier = ModifierRegistry
103
- .applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
104
- .then(
105
- if (scrollBehavior != null) {
106
- Modifier.nestedScroll(scrollBehavior)
107
- } else {
108
- Modifier
109
- }
110
- )
111
- ) {
112
- Children(UIComposableScope(columnScope = this@Column, nestedScrollConnection = scrollBehavior))
112
+ val modifier = ModifierRegistry
113
+ .applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
114
+ .then(
115
+ if (scrollBehavior != null) {
116
+ Modifier.nestedScroll(scrollBehavior)
117
+ } else {
118
+ Modifier
119
+ }
120
+ )
121
+ if (props.resolvesChildPercentages) {
122
+ UniversalColumn(
123
+ verticalArrangement = props.verticalArrangement?.toComposeArrangement() ?: Arrangement.Top,
124
+ horizontalAlignment = props.horizontalAlignment?.toComposeAlignment() ?: Alignment.Start,
125
+ modifier = modifier
126
+ ) {
127
+ Children(UIComposableScope(nestedScrollConnection = scrollBehavior))
128
+ }
129
+ } else {
130
+ Column(
131
+ verticalArrangement = props.verticalArrangement?.toComposeArrangement() ?: Arrangement.Top,
132
+ horizontalAlignment = props.horizontalAlignment?.toComposeAlignment() ?: Alignment.Start,
133
+ modifier = modifier
134
+ ) {
135
+ Children(UIComposableScope(columnScope = this@Column, nestedScrollConnection = scrollBehavior))
136
+ }
113
137
  }
114
138
  }
115
139
 
@@ -359,18 +359,20 @@ class ExpoUIModule : Module() {
359
359
  }
360
360
 
361
361
  ExpoUIView<SliderProps>("SliderView") {
362
- Events("onValueChange", "onValueChangeFinished")
362
+ val onValueChange by Event<SliderValueChangedEvent>()
363
+ val onValueChangeFinished by Event<Unit>()
363
364
 
364
365
  Content { props ->
365
- SliderContent(props)
366
+ SliderContent(props, { onValueChange(it) }, { onValueChangeFinished(it) })
366
367
  }
367
368
  }
368
369
 
369
370
  ExpoUIView<VerticalSliderProps>("VerticalSliderView") {
370
- Events("onValueChange", "onValueChangeFinished")
371
+ val onValueChange by Event<SliderValueChangedEvent>()
372
+ val onValueChangeFinished by Event<Unit>()
371
373
 
372
374
  Content { props ->
373
- VerticalSliderContent(props)
375
+ VerticalSliderContent(props, { onValueChange(it) }, { onValueChangeFinished(it) })
374
376
  }
375
377
  }
376
378
 
@@ -40,6 +40,7 @@ import androidx.compose.ui.unit.Density
40
40
  import androidx.compose.ui.unit.IntSize
41
41
  import androidx.compose.ui.unit.LayoutDirection
42
42
  import androidx.compose.ui.unit.dp
43
+ import com.facebook.react.uimanager.events.NativeGestureUtil
43
44
  import expo.modules.kotlin.AppContext
44
45
  import expo.modules.kotlin.records.Field
45
46
  import expo.modules.kotlin.records.Record
@@ -123,6 +124,11 @@ internal class HostView(context: Context, appContext: AppContext) :
123
124
  private val onLayoutContent by EventDispatcher<LayoutContentEvent>()
124
125
  private var lastDispatchedContentSize: IntSize? = null
125
126
 
127
+ // The size a child fraction was resolved against, in dp.
128
+ // matchContents would otherwise publish the percentage result and the next pass divides it again.
129
+ private var percentageBaseWidthDp: Double? = null
130
+ private var percentageBaseHeightDp: Double? = null
131
+
126
132
  /**
127
133
  * True while this view passes down an `ACTION_CANCEL` that came from its React Native parent,
128
134
  * not from a Compose gesture detector. React Native already owns that gesture: the usual cause is
@@ -131,16 +137,41 @@ internal class HostView(context: Context, appContext: AppContext) :
131
137
  internal var isDispatchingCancelFromParent = false
132
138
  private set
133
139
 
140
+ // Set by a hosted `RNHostView` under the down. That content handles its touches in JS.
141
+ internal var reactNativeContentHit = false
142
+ private var ownsNativeGesture = false
143
+
134
144
  override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
135
- if (ev.actionMasked != MotionEvent.ACTION_CANCEL) {
136
- return super.dispatchTouchEvent(ev)
145
+ if (ev.actionMasked == MotionEvent.ACTION_DOWN) {
146
+ reactNativeContentHit = false
147
+ ownsNativeGesture = false
137
148
  }
138
- isDispatchingCancelFromParent = true
139
- try {
140
- return super.dispatchTouchEvent(ev)
141
- } finally {
142
- isDispatchingCancelFromParent = false
149
+
150
+ val handled = if (ev.actionMasked != MotionEvent.ACTION_CANCEL) {
151
+ super.dispatchTouchEvent(ev)
152
+ } else {
153
+ isDispatchingCancelFromParent = true
154
+ try {
155
+ super.dispatchTouchEvent(ev)
156
+ } finally {
157
+ isDispatchingCancelFromParent = false
158
+ }
143
159
  }
160
+
161
+ when (ev.actionMasked) {
162
+ // Compose only handles a down that a touch handler is under, like a native view.
163
+ // Then cancel the JS touch, so a JS responder around this view can't take the gesture.
164
+ MotionEvent.ACTION_DOWN -> if (handled && !reactNativeContentHit) {
165
+ ownsNativeGesture = true
166
+ NativeGestureUtil.notifyNativeGestureStarted(this, ev)
167
+ }
168
+ // On a cancel, a native parent like a scroll view took over and ends the gesture itself.
169
+ MotionEvent.ACTION_UP -> if (ownsNativeGesture) {
170
+ ownsNativeGesture = false
171
+ NativeGestureUtil.notifyNativeGestureEnded(this, ev)
172
+ }
173
+ }
174
+ return handled
144
175
  }
145
176
 
146
177
  @Composable
@@ -240,15 +271,54 @@ internal class HostView(context: Context, appContext: AppContext) :
240
271
  constraints.maxHeight
241
272
  }
242
273
  )
243
- val placeables = measurables.map { it.measure(boundedConstraints) }
274
+ // `measure` does not read a child percentage, so apply it here when this host
275
+ // has a size on that axis. A child with no percentage keeps these constraints.
276
+ // Compose Row and Column do not read that percentage.
277
+ val definiteWidth = boundedConstraints.maxWidth.takeIf {
278
+ it != Constraints.Infinity && (boundedConstraints.minWidth == it || useViewportSizeMeasurement)
279
+ }
280
+ val definiteHeight = boundedConstraints.maxHeight.takeIf {
281
+ it != Constraints.Infinity && (boundedConstraints.minHeight == it || useViewportSizeMeasurement)
282
+ }
283
+ val placeables = measurables.map {
284
+ measureUniversalChild(it, boundedConstraints, definiteWidth, definiteHeight)
285
+ }
244
286
 
245
287
  val contentWidthPx = placeables.maxOfOrNull { it.width } ?: 0
246
288
  val contentHeightPx = placeables.maxOfOrNull { it.height } ?: 0
289
+ // A child percentage is a fraction of the safe area proposed above.
290
+ // Publishing that result as the view size makes the next pass resolve it again.
291
+ val widthFromPercentage = definiteWidth != null && measurables.any {
292
+ it.parentData.asUniversalLayoutParentData().dimensions.widthFraction != null
293
+ }
294
+ val heightFromPercentage = definiteHeight != null && measurables.any {
295
+ it.parentData.asUniversalLayoutParentData().dimensions.heightFraction != null
296
+ }
297
+ // setStyleSize replaces the pending setViewSize flush.
298
+ // Publish this base for a viewport fraction so both updates describe the same size.
299
+ percentageBaseWidthDp = if (useViewportSizeMeasurement && widthFromPercentage && definiteWidth != null) {
300
+ with(density) { definiteWidth.toDp().value.toDouble() }
301
+ } else {
302
+ null
303
+ }
304
+ percentageBaseHeightDp = if (useViewportSizeMeasurement && heightFromPercentage && definiteHeight != null) {
305
+ with(density) { definiteHeight.toDp().value.toDouble() }
306
+ } else {
307
+ null
308
+ }
247
309
 
248
310
  if (useViewportSizeMeasurement && (constraints.maxWidth == 0 || constraints.maxHeight == 0)) {
249
311
  with(density) {
250
- val widthDp = contentWidthPx.toDp().value.toDouble()
251
- val heightDp = contentHeightPx.toDp().value.toDouble()
312
+ val widthDp = if (widthFromPercentage) {
313
+ safeWidthPx.toDp().value.toDouble()
314
+ } else {
315
+ contentWidthPx.toDp().value.toDouble()
316
+ }
317
+ val heightDp = if (heightFromPercentage) {
318
+ safeHeightPx.toDp().value.toDouble()
319
+ } else {
320
+ contentHeightPx.toDp().value.toDouble()
321
+ }
252
322
 
253
323
  shadowNodeProxy.setViewSize(
254
324
  if (constraints.maxWidth == 0) {
@@ -287,17 +357,17 @@ internal class HostView(context: Context, appContext: AppContext) :
287
357
  val height = size.height.toDp().value
288
358
 
289
359
  if (matchContentsHorizontal == true || matchContentsVertical == true) {
290
- val styleWidth = if (matchContentsHorizontal == true && width > 0) {
291
- width
360
+ val styleWidth = if (matchContentsHorizontal == true) {
361
+ percentageBaseWidthDp ?: width.takeIf { it > 0 }?.toDouble()
292
362
  } else {
293
363
  null
294
364
  }
295
- val styleHeight = if (matchContentsVertical == true && height > 0) {
296
- height
365
+ val styleHeight = if (matchContentsVertical == true) {
366
+ percentageBaseHeightDp ?: height.takeIf { it > 0 }?.toDouble()
297
367
  } else {
298
368
  null
299
369
  }
300
- shadowNodeProxy.setStyleSize(styleWidth?.toDouble(), styleHeight?.toDouble())
370
+ shadowNodeProxy.setStyleSize(styleWidth, styleHeight)
301
371
  }
302
372
 
303
373
  // `onSizeChanged` runs inside the Compose measure pass. Emitting the event here reaches
@@ -506,6 +506,11 @@ object ModifierRegistry {
506
506
  Modifier.height(params.height.dp)
507
507
  }
508
508
 
509
+ register("universalLayout") { map, _, appContext, _ ->
510
+ val params = recordFromMap<UniversalLayoutParams>(map, appContext)
511
+ UniversalLayoutElement(params.toDimensions())
512
+ }
513
+
509
514
  register("defaultMinSize") { map, _, appContext, _ ->
510
515
  val params = recordFromMap<DefaultMinSizeParams>(map, appContext)
511
516
  Modifier.defaultMinSize(
@@ -674,22 +679,45 @@ object ModifierRegistry {
674
679
  // Scope-dependent modifiers
675
680
  register("weight") { map, scope, appContext, _ ->
676
681
  val params = recordFromMap<WeightParams>(map, appContext)
677
- scope?.rowScope?.run {
678
- Modifier.weight(params.weight)
679
- } ?: scope?.columnScope?.run {
680
- Modifier.weight(params.weight)
681
- } ?: Modifier
682
+ val weight = params.weight.takeIf { it.isFinite() && it > 0f }
683
+ // Prefer row, column, or box scope.
684
+ // Those parents ignore universal parent data, and Box has no weight.
685
+ when {
686
+ scope?.rowScope != null || scope?.columnScope != null ->
687
+ scope?.rowScope?.run {
688
+ weight?.let { Modifier.weight(it) }
689
+ } ?: scope?.columnScope?.run {
690
+ weight?.let { Modifier.weight(it) }
691
+ } ?: Modifier
692
+ scope?.boxScope != null -> Modifier
693
+ LocalUniversalStackAxis.current == UniversalStackAxis.Horizontal ||
694
+ LocalUniversalStackAxis.current == UniversalStackAxis.Vertical ->
695
+ weight?.let { UniversalWeightElement(it) } ?: Modifier
696
+ else -> Modifier
697
+ }
682
698
  }
683
699
 
684
700
  register("align") { map, scope, appContext, _ ->
685
701
  val params = recordFromMap<AlignParams>(map, appContext)
686
- scope?.boxScope?.run {
687
- params.alignment?.toAlignment()?.let { alignment -> Modifier.align(alignment) }
688
- } ?: scope?.rowScope?.run {
689
- params.alignment?.toVerticalAlignment()?.let { alignment -> Modifier.align(alignment) }
690
- } ?: scope?.columnScope?.run {
691
- params.alignment?.toHorizontalAlignment()?.let { alignment -> Modifier.align(alignment) }
692
- } ?: Modifier
702
+ when {
703
+ scope?.boxScope != null ->
704
+ scope?.boxScope?.run {
705
+ params.alignment?.toAlignment()?.let { alignment -> Modifier.align(alignment) }
706
+ } ?: Modifier
707
+ scope?.rowScope != null ->
708
+ scope?.rowScope?.run {
709
+ params.alignment?.toVerticalAlignment()?.let { alignment -> Modifier.align(alignment) }
710
+ } ?: Modifier
711
+ scope?.columnScope != null ->
712
+ scope?.columnScope?.run {
713
+ params.alignment?.toHorizontalAlignment()?.let { alignment -> Modifier.align(alignment) }
714
+ } ?: Modifier
715
+ LocalUniversalStackAxis.current == UniversalStackAxis.Horizontal ->
716
+ UniversalAlignElement(vertical = params.alignment?.toVerticalAlignment())
717
+ LocalUniversalStackAxis.current == UniversalStackAxis.Vertical ->
718
+ UniversalAlignElement(horizontal = params.alignment?.toHorizontalAlignment())
719
+ else -> Modifier
720
+ }
693
721
  }
694
722
 
695
723
  register("matchParentSize") { _, scope, _, _ ->
@@ -2,6 +2,8 @@ package expo.modules.ui
2
2
 
3
3
  import android.annotation.SuppressLint
4
4
  import android.content.Context
5
+ import android.text.Spanned
6
+ import android.text.style.ClickableSpan
5
7
  import android.util.Log
6
8
  import android.view.MotionEvent
7
9
  import android.view.View
@@ -24,6 +26,8 @@ import androidx.compose.runtime.key
24
26
  import androidx.compose.runtime.mutableStateOf
25
27
  import androidx.compose.ui.Alignment
26
28
  import androidx.compose.ui.Modifier
29
+ import androidx.compose.ui.input.pointer.PointerEventPass
30
+ import androidx.compose.ui.input.pointer.pointerInput
27
31
  import androidx.compose.ui.layout.onGloballyPositioned
28
32
  import androidx.compose.ui.layout.onSizeChanged
29
33
  import androidx.compose.ui.layout.positionInRoot
@@ -31,6 +35,7 @@ import androidx.compose.ui.platform.AbstractComposeView
31
35
  import androidx.compose.ui.platform.LocalDensity
32
36
  import androidx.compose.ui.unit.IntSize
33
37
  import androidx.compose.ui.viewinterop.AndroidView
38
+ import androidx.core.view.NestedScrollingChild
34
39
  import androidx.core.view.NestedScrollingChild3
35
40
  import androidx.core.view.NestedScrollingChildHelper
36
41
  import androidx.core.view.ViewCompat
@@ -39,10 +44,16 @@ import com.facebook.react.common.annotations.UnstableReactNativeAPI
39
44
  import com.facebook.react.config.ReactFeatureFlags
40
45
  import com.facebook.react.uimanager.JSPointerDispatcher
41
46
  import com.facebook.react.uimanager.JSTouchDispatcher
47
+ import com.facebook.react.uimanager.ReactCompoundView
48
+ import com.facebook.react.uimanager.ReactCompoundViewGroup
42
49
  import com.facebook.react.uimanager.RootView
43
50
  import com.facebook.react.uimanager.ThemedReactContext
51
+ import com.facebook.react.uimanager.TouchTargetHelper
44
52
  import com.facebook.react.uimanager.UIManagerHelper
45
53
  import com.facebook.react.uimanager.events.EventDispatcher
54
+ import com.facebook.react.views.image.ReactImageView
55
+ import com.facebook.react.views.text.ReactTextView
56
+ import com.facebook.react.views.view.ReactViewGroup
46
57
  import expo.modules.kotlin.AppContext
47
58
  import expo.modules.kotlin.views.ComposableScope
48
59
  import expo.modules.kotlin.views.ComposeProps
@@ -204,6 +215,7 @@ internal class RNHostView(context: Context, appContext: AppContext) :
204
215
  val modifiers = ModifierRegistry.applyModifiers(props.modifiers.value, appContext, scope, globalEventDispatcher)
205
216
  .then(sizingModifier)
206
217
  .then(publishContentOriginModifier())
218
+ .then(reportComposeClaimModifier(wrapper))
207
219
 
208
220
  // `addView` creates a new wrapper for each mounted child, and `AndroidView` only calls `factory` once.
209
221
  key(wrapper) {
@@ -296,6 +308,23 @@ internal class RNHostView(context: Context, appContext: AppContext) :
296
308
  }
297
309
  }
298
310
 
311
+ // After every handler has run, a consumed change means Compose claimed the gesture.
312
+ private fun reportComposeClaimModifier(wrapper: TouchDispatchingRootViewGroup): Modifier =
313
+ Modifier.pointerInput(wrapper) {
314
+ awaitPointerEventScope {
315
+ while (true) {
316
+ val event = awaitPointerEvent(PointerEventPass.Final)
317
+ if (event.changes.any { it.isConsumed }) {
318
+ wrapper.onComposeClaimedGesture()
319
+ }
320
+ // Also covers gestures whose down never reached the wrapper.
321
+ if (event.changes.all { !it.pressed }) {
322
+ wrapper.clearGestureLeftToCompose()
323
+ }
324
+ }
325
+ }
326
+ }
327
+
299
328
  // Sets Yoga node size from Compose view size
300
329
  // Listens to Compose view size changes and updates the Yoga node size
301
330
  @Composable
@@ -440,6 +469,9 @@ private class TouchDispatchingRootViewGroup(
440
469
  */
441
470
  var dispatchesTouchesToJS: Boolean = false
442
471
 
472
+ // The down of a gesture this view left to Compose, until Compose claims it or the next gesture.
473
+ private var gestureLeftToCompose: MotionEvent? = null
474
+
443
475
  private val reactContext: ThemedReactContext
444
476
  get() = context as ThemedReactContext
445
477
 
@@ -478,7 +510,23 @@ private class TouchDispatchingRootViewGroup(
478
510
  composeOwnerView?.let { keepLastForTouchTargeting(it, hostedViewsContainer) }
479
511
  }
480
512
 
513
+ override fun onDetachedFromWindow() {
514
+ super.onDetachedFromWindow()
515
+ clearGestureLeftToCompose()
516
+ }
517
+
481
518
  override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
519
+ if (ev.actionMasked == MotionEvent.ACTION_DOWN) {
520
+ // This view handles the JS side of its gestures, so the `Host` must not cancel them.
521
+ findAncestorHostView()?.reactNativeContentHit = true
522
+ // Like a native view that doesn't handle touches, plain hosted content lets the Compose
523
+ // parent handle the gesture. Only a host that dispatches to JavaScript must own its gestures.
524
+ clearGestureLeftToCompose()
525
+ if (!dispatchesTouchesToJS && !hasNativeTouchTarget(ev.x, ev.y)) {
526
+ gestureLeftToCompose = MotionEvent.obtain(ev)
527
+ return false
528
+ }
529
+ }
482
530
  if (
483
531
  ev.actionMasked == MotionEvent.ACTION_CANCEL &&
484
532
  !dispatchesTouchesToJS &&
@@ -544,14 +592,102 @@ private class TouchDispatchingRootViewGroup(
544
592
  * reporting it as a native one would cancel the press it belongs to.
545
593
  */
546
594
  private fun isCancelFromReactNative(): Boolean {
595
+ return findAncestorHostView()?.isDispatchingCancelFromParent ?: false
596
+ }
597
+
598
+ /**
599
+ * Whether a view under the point handles touches natively, like a scroll view, a text input, a
600
+ * switch, or a nested `Host`. Plain views, text and images only reach JavaScript through the
601
+ * ancestor root, so they don't count.
602
+ */
603
+ private fun hasNativeTouchTarget(x: Float, y: Float): Boolean {
604
+ // React Native's own hit test, so `hitSlop`, transforms, `zIndex`, `pointerEvents` and children
605
+ // drawn outside their parent pick the same target that JavaScript gets.
606
+ // `targetPoint` ends up relative to the deepest view under the point.
607
+ val targetPoint = FloatArray(2)
608
+ val path = TouchTargetHelper.findTargetPathAndCoordinatesForTouch(x, y, this, targetPoint)
609
+ val targetView = path.firstNotNullOfOrNull { it.getView() }
610
+ return path.any { target ->
611
+ val view = target.getView()
612
+ val localPoint = targetPoint.takeIf { view === targetView }
613
+ view != null && view !== this && handlesTouchesNatively(view, localPoint)
614
+ }
615
+ }
616
+
617
+ private fun handlesTouchesNatively(view: View, localPoint: FloatArray?): Boolean {
618
+ return when {
619
+ // React Native makes a `Pressable` clickable. `accessible` alone only makes a view focusable.
620
+ view is ReactViewGroup || view is ReactImageView -> view.isClickable || view.isLongClickable
621
+ // A `Text` with `onPress` is focusable on Android, and a nested one is a link span.
622
+ view is ReactTextView ->
623
+ view.isClickable ||
624
+ view.isLongClickable ||
625
+ view.isFocusable ||
626
+ hasLinkSpanAt(view, localPoint)
627
+ // `PreparedLayoutTextView` is internal, so it's matched as React Native's other text view type.
628
+ view is ReactCompoundView && view !is ReactCompoundViewGroup ->
629
+ view.isClickable || view.isLongClickable || view.isFocusable
630
+ // A nested `Host` can hold Compose controls.
631
+ view is ExpoComposeView<*> -> true
632
+ // Other native views: controls, text inputs and scroll views handle touches. Views that only
633
+ // draw, like an image or a gradient, don't.
634
+ else ->
635
+ view.isClickable ||
636
+ view.isLongClickable ||
637
+ view.isFocusable ||
638
+ view.isScrollContainer ||
639
+ view is NestedScrollingChild ||
640
+ view.canScrollVertically(1) || view.canScrollVertically(-1) ||
641
+ view.canScrollHorizontally(1) || view.canScrollHorizontally(-1)
642
+ }
643
+ }
644
+
645
+ // Only a link under the point counts, so the rest of the text still lets the parent handle it.
646
+ private fun hasLinkSpanAt(view: ReactTextView, localPoint: FloatArray?): Boolean {
647
+ if (localPoint == null) {
648
+ return false
649
+ }
650
+ val text = view.text as? Spanned ?: return false
651
+ val layout = view.layout ?: return false
652
+ val lineX = localPoint[0] - view.totalPaddingLeft + view.scrollX
653
+ val lineY = (localPoint[1] - view.totalPaddingTop + view.scrollY).toInt()
654
+ if (lineY < 0 || lineY > layout.height) {
655
+ return false
656
+ }
657
+ val line = layout.getLineForVertical(lineY)
658
+ if (lineX < layout.getLineLeft(line) || lineX > layout.getLineRight(line)) {
659
+ return false
660
+ }
661
+ val offset = layout.getOffsetForHorizontal(line, lineX)
662
+ return text.getSpans(offset, offset, ClickableSpan::class.java).isNotEmpty()
663
+ }
664
+
665
+ /**
666
+ * A gesture this view left to Compose reaches JavaScript through the ancestor root. When Compose
667
+ * takes it, for example a `clickable` press or a `LazyColumn` scroll, tell the root, so JavaScript
668
+ * cancels its touch the same way it does for a native child that claims a gesture.
669
+ */
670
+ fun onComposeClaimedGesture() {
671
+ val down = gestureLeftToCompose ?: return
672
+ gestureLeftToCompose = null
673
+ notifyAncestorRootViews { it.onChildStartedNativeGesture(null, down) }
674
+ down.recycle()
675
+ }
676
+
677
+ fun clearGestureLeftToCompose() {
678
+ gestureLeftToCompose?.recycle()
679
+ gestureLeftToCompose = null
680
+ }
681
+
682
+ private fun findAncestorHostView(): HostView? {
547
683
  var current: ViewParent? = parent
548
684
  while (current != null) {
549
685
  if (current is HostView) {
550
- return current.isDispatchingCancelFromParent
686
+ return current
551
687
  }
552
688
  current = current.parent
553
689
  }
554
- return false
690
+ return null
555
691
  }
556
692
 
557
693
  private inline fun notifyAncestorRootViews(block: (RootView) -> Unit) {
@@ -14,7 +14,6 @@ import androidx.compose.runtime.remember
14
14
  import androidx.compose.runtime.setValue
15
15
  import expo.modules.kotlin.records.Field
16
16
  import expo.modules.kotlin.records.Record
17
- import expo.modules.kotlin.viewevent.getValue
18
17
  import expo.modules.kotlin.views.ComposeProps
19
18
  import expo.modules.kotlin.views.FunctionalComposableScope
20
19
  import expo.modules.kotlin.types.OptimizedRecord
@@ -58,9 +57,11 @@ data class SliderValueChangedEvent(
58
57
 
59
58
  @OptIn(ExperimentalMaterial3Api::class)
60
59
  @Composable
61
- fun FunctionalComposableScope.SliderContent(props: SliderProps) {
62
- val onValueChange by remember { this@SliderContent.EventDispatcher<SliderValueChangedEvent>() }
63
- val onValueChangeFinished by remember { this@SliderContent.EventDispatcher<Unit>() }
60
+ fun FunctionalComposableScope.SliderContent(
61
+ props: SliderProps,
62
+ onValueChange: (SliderValueChangedEvent) -> Unit,
63
+ onValueChangeFinished: (Unit) -> Unit
64
+ ) {
64
65
  val interactionSource = remember { MutableInteractionSource() }
65
66
 
66
67
  val effectiveLower = maxOf(props.min, props.lowerLimit ?: Float.NEGATIVE_INFINITY)