@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
@@ -0,0 +1,610 @@
1
+ package expo.modules.ui
2
+
3
+ import androidx.compose.foundation.layout.Arrangement
4
+ import androidx.compose.runtime.Composable
5
+ import androidx.compose.runtime.CompositionLocalProvider
6
+ import androidx.compose.runtime.compositionLocalOf
7
+ import androidx.compose.runtime.remember
8
+ import androidx.compose.ui.Alignment
9
+ import androidx.compose.ui.Modifier
10
+ import androidx.compose.ui.layout.IntrinsicMeasurable
11
+ import androidx.compose.ui.layout.IntrinsicMeasureScope
12
+ import androidx.compose.ui.layout.Layout
13
+ import androidx.compose.ui.layout.Measurable
14
+ import androidx.compose.ui.layout.MeasurePolicy
15
+ import androidx.compose.ui.layout.MeasureResult
16
+ import androidx.compose.ui.layout.MeasureScope
17
+ import androidx.compose.ui.layout.Placeable
18
+ import androidx.compose.ui.node.ModifierNodeElement
19
+ import androidx.compose.ui.node.ParentDataModifierNode
20
+ import androidx.compose.ui.platform.InspectorInfo
21
+ import androidx.compose.ui.unit.Constraints
22
+ import androidx.compose.ui.unit.Density
23
+ import androidx.compose.ui.unit.constrainHeight
24
+ import androidx.compose.ui.unit.constrainWidth
25
+ import expo.modules.kotlin.records.Field
26
+ import expo.modules.kotlin.records.Record
27
+ import expo.modules.kotlin.types.OptimizedRecord
28
+ import kotlin.math.max
29
+ import kotlin.math.min
30
+ import kotlin.math.roundToInt
31
+
32
+ /**
33
+ * Row and Column in Compose size children from incoming constraints.
34
+ * They cannot resolve a percentage of the parent's content box, so universal
35
+ * `width` and `height` are measured by these layouts instead.
36
+ */
37
+ internal enum class UniversalStackAxis {
38
+ Horizontal,
39
+ Vertical
40
+ }
41
+
42
+ internal val LocalUniversalStackAxis = compositionLocalOf<UniversalStackAxis?> { null }
43
+
44
+ internal data class UniversalLayoutParentData(
45
+ val dimensions: UniversalLayoutDimensions = UniversalLayoutDimensions(),
46
+ val weight: Float = 0f,
47
+ val horizontalAlignment: Alignment.Horizontal? = null,
48
+ val verticalAlignment: Alignment.Vertical? = null
49
+ )
50
+
51
+ internal fun Any?.asUniversalLayoutParentData(): UniversalLayoutParentData =
52
+ this as? UniversalLayoutParentData ?: UniversalLayoutParentData()
53
+
54
+ @OptimizedRecord
55
+ internal data class UniversalLayoutParams(
56
+ @Field val widthPoints: Double? = null,
57
+ @Field val widthFraction: Double? = null,
58
+ @Field val heightPoints: Double? = null,
59
+ @Field val heightFraction: Double? = null
60
+ ) : Record
61
+
62
+ internal data class UniversalLayoutDimensions(
63
+ val widthPoints: Float? = null,
64
+ val widthFraction: Float? = null,
65
+ val heightPoints: Float? = null,
66
+ val heightFraction: Float? = null
67
+ )
68
+
69
+ internal fun UniversalLayoutParams.toDimensions(): UniversalLayoutDimensions =
70
+ UniversalLayoutDimensions(
71
+ widthPoints = widthPoints.validatedUniversalDimension(),
72
+ widthFraction = widthFraction.validatedUniversalDimension(),
73
+ heightPoints = heightPoints.validatedUniversalDimension(),
74
+ heightFraction = heightFraction.validatedUniversalDimension()
75
+ )
76
+
77
+ private fun Double?.validatedUniversalDimension(): Float? =
78
+ this?.toFloat()?.takeIf { it.isFinite() && it >= 0f }
79
+
80
+ internal data class UniversalLayoutElement(
81
+ val dimensions: UniversalLayoutDimensions
82
+ ) : ModifierNodeElement<UniversalLayoutNode>() {
83
+ override fun create() = UniversalLayoutNode(dimensions)
84
+
85
+ override fun update(node: UniversalLayoutNode) {
86
+ node.dimensions = dimensions
87
+ }
88
+
89
+ override fun InspectorInfo.inspectableProperties() {
90
+ name = "universalLayout"
91
+ properties["dimensions"] = dimensions
92
+ }
93
+ }
94
+
95
+ internal class UniversalLayoutNode(
96
+ var dimensions: UniversalLayoutDimensions
97
+ ) : Modifier.Node(), ParentDataModifierNode {
98
+ override fun Density.modifyParentData(parentData: Any?): Any {
99
+ // This node is outer, and Compose walks parent data from inner to outer.
100
+ // A platform Row, Column, FlowRow, or Box already stored weight or align.
101
+ // Those parents do not read this data, so keep theirs.
102
+ if (parentData != null && parentData !is UniversalLayoutParentData) {
103
+ return parentData
104
+ }
105
+ return parentData.asUniversalLayoutParentData().copy(dimensions = dimensions)
106
+ }
107
+ }
108
+
109
+ internal data class UniversalWeightElement(val weight: Float) : ModifierNodeElement<UniversalWeightNode>() {
110
+ override fun create() = UniversalWeightNode(weight)
111
+
112
+ override fun update(node: UniversalWeightNode) {
113
+ node.weight = weight
114
+ }
115
+
116
+ override fun InspectorInfo.inspectableProperties() {
117
+ name = "universalWeight"
118
+ properties["weight"] = weight
119
+ }
120
+ }
121
+
122
+ internal class UniversalWeightNode(var weight: Float) : Modifier.Node(), ParentDataModifierNode {
123
+ override fun Density.modifyParentData(parentData: Any?): Any =
124
+ parentData.asUniversalLayoutParentData().copy(weight = weight)
125
+ }
126
+
127
+ internal data class UniversalAlignElement(
128
+ val horizontal: Alignment.Horizontal? = null,
129
+ val vertical: Alignment.Vertical? = null
130
+ ) : ModifierNodeElement<UniversalAlignNode>() {
131
+ override fun create() = UniversalAlignNode(horizontal, vertical)
132
+
133
+ override fun update(node: UniversalAlignNode) {
134
+ node.horizontal = horizontal
135
+ node.vertical = vertical
136
+ }
137
+
138
+ override fun InspectorInfo.inspectableProperties() {
139
+ name = "universalAlign"
140
+ }
141
+ }
142
+
143
+ internal class UniversalAlignNode(
144
+ var horizontal: Alignment.Horizontal?,
145
+ var vertical: Alignment.Vertical?
146
+ ) : Modifier.Node(), ParentDataModifierNode {
147
+ override fun Density.modifyParentData(parentData: Any?): Any =
148
+ parentData.asUniversalLayoutParentData().copy(
149
+ horizontalAlignment = horizontal,
150
+ verticalAlignment = vertical
151
+ )
152
+ }
153
+
154
+ private fun Float.toSafeFractionPixels(parentSize: Int): Int =
155
+ (this * parentSize).roundToInt().coerceIn(0, Constraints.Infinity)
156
+
157
+ private fun Float.toSafePixels(density: Float): Int =
158
+ (this * density).roundToInt().coerceIn(0, Constraints.Infinity)
159
+
160
+ private fun UniversalLayoutDimensions.resolveWidthFraction(parentWidth: Int?): Int? =
161
+ parentWidth?.let { widthFraction?.toSafeFractionPixels(it) }
162
+
163
+ private fun UniversalLayoutDimensions.resolveHeightFraction(parentHeight: Int?): Int? =
164
+ parentHeight?.let { heightFraction?.toSafeFractionPixels(it) }
165
+
166
+ /**
167
+ * An explicit size becomes a tight constraint, clamped so `min` never exceeds `max`.
168
+ * An unspecified axis keeps [maxWidth] or [maxHeight] as a loose upper bound.
169
+ */
170
+ private fun fixedOrBoundedConstraints(
171
+ width: Int?,
172
+ height: Int?,
173
+ maxWidth: Int,
174
+ maxHeight: Int
175
+ ): Constraints {
176
+ val resolvedWidth = width?.coerceIn(0, maxWidth.coerceAtLeast(0))
177
+ val resolvedHeight = height?.coerceIn(0, maxHeight.coerceAtLeast(0))
178
+ return Constraints(
179
+ minWidth = resolvedWidth ?: 0,
180
+ maxWidth = resolvedWidth ?: maxWidth,
181
+ minHeight = resolvedHeight ?: 0,
182
+ maxHeight = resolvedHeight ?: maxHeight
183
+ )
184
+ }
185
+
186
+ /**
187
+ * Measures a host child.
188
+ * Axes without a universal size keep the incoming constraints, so a tight host
189
+ * still stretches unsized children.
190
+ */
191
+ internal fun MeasureScope.measureUniversalChild(
192
+ measurable: Measurable,
193
+ constraints: Constraints,
194
+ parentWidth: Int?,
195
+ parentHeight: Int?
196
+ ): Placeable {
197
+ val dimensions = measurable.parentData.asUniversalLayoutParentData().dimensions
198
+ // A host gives its children exact constraints, which would override a `width()` or `height()` modifier.
199
+ val width = dimensions.widthPoints?.toSafePixels(density) ?: dimensions.resolveWidthFraction(parentWidth)
200
+ val height = dimensions.heightPoints?.toSafePixels(density) ?: dimensions.resolveHeightFraction(parentHeight)
201
+ if (width == null && height == null) {
202
+ return measurable.measure(constraints)
203
+ }
204
+
205
+ val resolved = fixedOrBoundedConstraints(width, height, constraints.maxWidth, constraints.maxHeight)
206
+ return measurable.measure(
207
+ Constraints(
208
+ minWidth = if (width != null) {
209
+ resolved.minWidth
210
+ } else {
211
+ constraints.minWidth
212
+ },
213
+ maxWidth = if (width != null) {
214
+ resolved.maxWidth
215
+ } else {
216
+ constraints.maxWidth
217
+ },
218
+ minHeight = if (height != null) {
219
+ resolved.minHeight
220
+ } else {
221
+ constraints.minHeight
222
+ },
223
+ maxHeight = if (height != null) {
224
+ resolved.maxHeight
225
+ } else {
226
+ constraints.maxHeight
227
+ }
228
+ )
229
+ )
230
+ }
231
+
232
+ @Composable
233
+ internal fun UniversalRow(
234
+ modifier: Modifier,
235
+ horizontalArrangement: Arrangement.Horizontal,
236
+ verticalAlignment: Alignment.Vertical,
237
+ content: @Composable () -> Unit
238
+ ) {
239
+ val measurePolicy = remember(horizontalArrangement, verticalAlignment) {
240
+ UniversalStackMeasurePolicy(
241
+ UniversalStackAxis.Horizontal,
242
+ horizontalArrangement,
243
+ Arrangement.Top,
244
+ Alignment.Start,
245
+ verticalAlignment
246
+ )
247
+ }
248
+ CompositionLocalProvider(LocalUniversalStackAxis provides UniversalStackAxis.Horizontal) {
249
+ Layout(content = content, modifier = modifier, measurePolicy = measurePolicy)
250
+ }
251
+ }
252
+
253
+ @Composable
254
+ internal fun UniversalColumn(
255
+ modifier: Modifier,
256
+ verticalArrangement: Arrangement.Vertical,
257
+ horizontalAlignment: Alignment.Horizontal,
258
+ content: @Composable () -> Unit
259
+ ) {
260
+ val measurePolicy = remember(verticalArrangement, horizontalAlignment) {
261
+ UniversalStackMeasurePolicy(
262
+ UniversalStackAxis.Vertical,
263
+ Arrangement.Start,
264
+ verticalArrangement,
265
+ horizontalAlignment,
266
+ Alignment.Top
267
+ )
268
+ }
269
+ CompositionLocalProvider(LocalUniversalStackAxis provides UniversalStackAxis.Vertical) {
270
+ Layout(content = content, modifier = modifier, measurePolicy = measurePolicy)
271
+ }
272
+ }
273
+
274
+ private class UniversalStackMeasurePolicy(
275
+ private val axis: UniversalStackAxis,
276
+ private val horizontalArrangement: Arrangement.Horizontal,
277
+ private val verticalArrangement: Arrangement.Vertical,
278
+ private val horizontalAlignment: Alignment.Horizontal,
279
+ private val verticalAlignment: Alignment.Vertical
280
+ ) : MeasurePolicy {
281
+ private val horizontal = axis == UniversalStackAxis.Horizontal
282
+
283
+ override fun MeasureScope.measure(measurables: List<Measurable>, constraints: Constraints): MeasureResult =
284
+ measureUniversalStack(
285
+ measurables,
286
+ constraints,
287
+ axis,
288
+ horizontalArrangement,
289
+ verticalArrangement,
290
+ horizontalAlignment,
291
+ verticalAlignment
292
+ )
293
+
294
+ // The intrinsics follow Compose `Row` and `Column`, which size weighted children by their weight.
295
+ override fun IntrinsicMeasureScope.minIntrinsicWidth(measurables: List<IntrinsicMeasurable>, height: Int): Int =
296
+ if (horizontal) {
297
+ intrinsicMainSize(measurables, height, spacingPx()) { minIntrinsicWidth(it) }
298
+ } else {
299
+ intrinsicCrossSize(measurables, height, spacingPx(), { minIntrinsicHeight(it) }, { minIntrinsicWidth(it) })
300
+ }
301
+
302
+ override fun IntrinsicMeasureScope.maxIntrinsicWidth(measurables: List<IntrinsicMeasurable>, height: Int): Int =
303
+ if (horizontal) {
304
+ intrinsicMainSize(measurables, height, spacingPx()) { maxIntrinsicWidth(it) }
305
+ } else {
306
+ intrinsicCrossSize(measurables, height, spacingPx(), { maxIntrinsicHeight(it) }, { maxIntrinsicWidth(it) })
307
+ }
308
+
309
+ override fun IntrinsicMeasureScope.minIntrinsicHeight(measurables: List<IntrinsicMeasurable>, width: Int): Int =
310
+ if (horizontal) {
311
+ intrinsicCrossSize(measurables, width, spacingPx(), { minIntrinsicWidth(it) }, { minIntrinsicHeight(it) })
312
+ } else {
313
+ intrinsicMainSize(measurables, width, spacingPx()) { minIntrinsicHeight(it) }
314
+ }
315
+
316
+ override fun IntrinsicMeasureScope.maxIntrinsicHeight(measurables: List<IntrinsicMeasurable>, width: Int): Int =
317
+ if (horizontal) {
318
+ intrinsicCrossSize(measurables, width, spacingPx(), { maxIntrinsicWidth(it) }, { maxIntrinsicHeight(it) })
319
+ } else {
320
+ intrinsicMainSize(measurables, width, spacingPx()) { maxIntrinsicHeight(it) }
321
+ }
322
+
323
+ private fun Density.spacingPx(): Int =
324
+ (
325
+ if (horizontal) {
326
+ horizontalArrangement.spacing
327
+ } else {
328
+ verticalArrangement.spacing
329
+ }
330
+ ).roundToPx().coerceAtLeast(0)
331
+ }
332
+
333
+ private inline fun intrinsicMainSize(
334
+ children: List<IntrinsicMeasurable>,
335
+ crossAvailable: Int,
336
+ spacing: Int,
337
+ mainSize: IntrinsicMeasurable.(Int) -> Int
338
+ ): Int {
339
+ if (children.isEmpty()) {
340
+ return 0
341
+ }
342
+ var fixedSpace = 0
343
+ var weightUnitSpace = 0
344
+ var totalWeight = 0f
345
+ children.forEach { child ->
346
+ val weight = child.parentData.asUniversalLayoutParentData().weight
347
+ val size = child.mainSize(crossAvailable)
348
+ if (weight > 0f) {
349
+ totalWeight += weight
350
+ weightUnitSpace = max(weightUnitSpace, (size / weight).roundToInt())
351
+ } else {
352
+ fixedSpace += size
353
+ }
354
+ }
355
+ return (weightUnitSpace * totalWeight).roundToInt() + fixedSpace + spacing * (children.size - 1)
356
+ }
357
+
358
+ private inline fun intrinsicCrossSize(
359
+ children: List<IntrinsicMeasurable>,
360
+ mainAvailable: Int,
361
+ spacing: Int,
362
+ mainSize: IntrinsicMeasurable.(Int) -> Int,
363
+ crossSize: IntrinsicMeasurable.(Int) -> Int
364
+ ): Int {
365
+ if (children.isEmpty()) {
366
+ return 0
367
+ }
368
+ var fixedSpace = min(spacing * (children.size - 1), mainAvailable)
369
+ var crossMax = 0
370
+ var totalWeight = 0f
371
+ children.forEach { child ->
372
+ val weight = child.parentData.asUniversalLayoutParentData().weight
373
+ if (weight > 0f) {
374
+ totalWeight += weight
375
+ return@forEach
376
+ }
377
+ val preferredMain = child.mainSize(Constraints.Infinity)
378
+ val main = if (mainAvailable == Constraints.Infinity) {
379
+ preferredMain
380
+ } else {
381
+ min(preferredMain, (mainAvailable - fixedSpace).coerceAtLeast(0))
382
+ }
383
+ fixedSpace += main
384
+ crossMax = max(crossMax, child.crossSize(main))
385
+ }
386
+ val weightUnitSpace = when {
387
+ totalWeight == 0f -> 0
388
+ mainAvailable == Constraints.Infinity -> Constraints.Infinity
389
+ else -> ((mainAvailable - fixedSpace).coerceAtLeast(0) / totalWeight).roundToInt()
390
+ }
391
+ children.forEach { child ->
392
+ val weight = child.parentData.asUniversalLayoutParentData().weight
393
+ if (weight > 0f) {
394
+ val main = if (weightUnitSpace == Constraints.Infinity) {
395
+ Constraints.Infinity
396
+ } else {
397
+ (weightUnitSpace * weight).roundToInt()
398
+ }
399
+ crossMax = max(crossMax, child.crossSize(main))
400
+ }
401
+ }
402
+ return crossMax
403
+ }
404
+
405
+ private fun MeasureScope.measureUniversalStack(
406
+ measurables: List<Measurable>,
407
+ constraints: Constraints,
408
+ axis: UniversalStackAxis,
409
+ horizontalArrangement: Arrangement.Horizontal,
410
+ verticalArrangement: Arrangement.Vertical,
411
+ horizontalAlignment: Alignment.Horizontal,
412
+ verticalAlignment: Alignment.Vertical
413
+ ): MeasureResult {
414
+ val horizontal = axis == UniversalStackAxis.Horizontal
415
+ // A size is definite only when the parent gave this stack an exact constraint.
416
+ // A loose max is an upper bound, not a content box to take a percentage of.
417
+ val definiteWidth = constraints.maxWidth.takeIf {
418
+ it != Constraints.Infinity && constraints.minWidth == it
419
+ }
420
+ val definiteHeight = constraints.maxHeight.takeIf {
421
+ it != Constraints.Infinity && constraints.minHeight == it
422
+ }
423
+ val maxMain = if (horizontal) {
424
+ constraints.maxWidth
425
+ } else {
426
+ constraints.maxHeight
427
+ }
428
+ val maxCross = if (horizontal) {
429
+ constraints.maxHeight
430
+ } else {
431
+ constraints.maxWidth
432
+ }
433
+ val spacing = (
434
+ if (horizontal) {
435
+ horizontalArrangement.spacing.roundToPx()
436
+ } else {
437
+ verticalArrangement.spacing.roundToPx()
438
+ }
439
+ ).coerceAtLeast(0)
440
+ val placeables = arrayOfNulls<Placeable>(measurables.size)
441
+ // Like Compose `Row` and `Column`, count only the spacing used so far, plus the gap after each child.
442
+ var occupiedMain = 0
443
+ var spaceAfterLastFixed = 0
444
+
445
+ measurables.forEachIndexed { index, measurable ->
446
+ val parentData = measurable.parentData.asUniversalLayoutParentData()
447
+ if (parentData.weight > 0f) {
448
+ return@forEachIndexed
449
+ }
450
+
451
+ // A fixed size comes from the child's `width()` or `height()`, so it can shrink to the space left, as in Compose `Row`.
452
+ val width = parentData.dimensions.resolveWidthFraction(definiteWidth)
453
+ val height = parentData.dimensions.resolveHeightFraction(definiteHeight)
454
+ val resolvedMain = if (horizontal) {
455
+ width
456
+ } else {
457
+ height
458
+ }
459
+ val remainingMain = if (maxMain == Constraints.Infinity) {
460
+ Constraints.Infinity
461
+ } else {
462
+ (maxMain - occupiedMain).coerceAtLeast(0)
463
+ }
464
+ // The percentage uses the whole stack.
465
+ // The tight constraint is then limited to the incoming max, so 150% cannot paint past the parent.
466
+ val mainLimit = if (resolvedMain == null || maxMain == Constraints.Infinity) {
467
+ resolvedMain ?: remainingMain
468
+ } else {
469
+ resolvedMain.coerceAtMost(maxMain.coerceAtLeast(0))
470
+ }
471
+ val childConstraints = if (horizontal) {
472
+ fixedOrBoundedConstraints(width, height, mainLimit, maxCross)
473
+ } else {
474
+ fixedOrBoundedConstraints(width, height, maxCross, mainLimit)
475
+ }
476
+ val placeable = measurable.measure(childConstraints)
477
+ placeables[index] = placeable
478
+ val childMain = if (horizontal) {
479
+ placeable.width
480
+ } else {
481
+ placeable.height
482
+ }
483
+ spaceAfterLastFixed = if (remainingMain == Constraints.Infinity) {
484
+ spacing
485
+ } else {
486
+ min(spacing, (remainingMain - childMain).coerceAtLeast(0))
487
+ }
488
+ occupiedMain += childMain + spaceAfterLastFixed
489
+ }
490
+
491
+ var totalWeight = 0f
492
+ var weightedCount = 0
493
+ measurables.forEach { measurable ->
494
+ val weight = measurable.parentData.asUniversalLayoutParentData().weight
495
+ if (weight > 0f) {
496
+ totalWeight += weight
497
+ weightedCount++
498
+ }
499
+ }
500
+ val weightedSpacing = spacing * (weightedCount - 1).coerceAtLeast(0)
501
+ if (totalWeight == 0f) {
502
+ occupiedMain -= spaceAfterLastFixed
503
+ } else {
504
+ val targetMain = when {
505
+ maxMain != Constraints.Infinity -> maxMain
506
+ horizontal -> constraints.minWidth
507
+ else -> constraints.minHeight
508
+ }
509
+ var remaining = (targetMain - occupiedMain - weightedSpacing).coerceAtLeast(0)
510
+ var remainingWeight = totalWeight
511
+ measurables.forEachIndexed { index, measurable ->
512
+ val parentData = measurable.parentData.asUniversalLayoutParentData()
513
+ if (parentData.weight <= 0f) {
514
+ return@forEachIndexed
515
+ }
516
+
517
+ val laterWeight = measurables.drop(index + 1).any {
518
+ it.parentData.asUniversalLayoutParentData().weight > 0f
519
+ }
520
+ val share = if (!laterWeight) {
521
+ remaining
522
+ } else {
523
+ (remaining * (parentData.weight / remainingWeight)).roundToInt()
524
+ }
525
+ remaining -= share
526
+ remainingWeight -= parentData.weight
527
+ val width = if (horizontal) {
528
+ share
529
+ } else {
530
+ parentData.dimensions.resolveWidthFraction(definiteWidth)
531
+ }
532
+ val height = if (horizontal) {
533
+ parentData.dimensions.resolveHeightFraction(definiteHeight)
534
+ } else {
535
+ share
536
+ }
537
+ placeables[index] = measurable.measure(
538
+ fixedOrBoundedConstraints(width, height, constraints.maxWidth, constraints.maxHeight)
539
+ )
540
+ }
541
+ }
542
+
543
+ val childMainSizes = IntArray(placeables.size) { index ->
544
+ placeables[index]?.let {
545
+ if (horizontal) {
546
+ it.width
547
+ } else {
548
+ it.height
549
+ }
550
+ } ?: 0
551
+ }
552
+ var weightedMain = 0
553
+ measurables.forEachIndexed { index, measurable ->
554
+ if (measurable.parentData.asUniversalLayoutParentData().weight > 0f) {
555
+ weightedMain += childMainSizes[index]
556
+ }
557
+ }
558
+ val contentMain = occupiedMain + if (weightedCount > 0) {
559
+ weightedMain + weightedSpacing
560
+ } else {
561
+ 0
562
+ }
563
+ val contentCross = placeables.maxOfOrNull {
564
+ it?.let { placeable ->
565
+ if (horizontal) {
566
+ placeable.height
567
+ } else {
568
+ placeable.width
569
+ }
570
+ } ?: 0
571
+ } ?: 0
572
+ val width = constraints.constrainWidth(
573
+ if (horizontal) {
574
+ contentMain
575
+ } else {
576
+ contentCross
577
+ }
578
+ )
579
+ val height = constraints.constrainHeight(
580
+ if (horizontal) {
581
+ contentCross
582
+ } else {
583
+ contentMain
584
+ }
585
+ )
586
+ val positions = IntArray(placeables.size)
587
+ if (horizontal) {
588
+ with(horizontalArrangement) {
589
+ arrange(width, childMainSizes, layoutDirection, positions)
590
+ }
591
+ } else {
592
+ with(verticalArrangement) {
593
+ arrange(height, childMainSizes, positions)
594
+ }
595
+ }
596
+
597
+ return layout(width, height) {
598
+ placeables.forEachIndexed { index, placeable ->
599
+ placeable ?: return@forEachIndexed
600
+ val parentData = measurables[index].parentData.asUniversalLayoutParentData()
601
+ if (horizontal) {
602
+ val alignment = parentData.verticalAlignment ?: verticalAlignment
603
+ placeable.place(positions[index], alignment.align(placeable.height, height))
604
+ } else {
605
+ val alignment = parentData.horizontalAlignment ?: horizontalAlignment
606
+ placeable.place(alignment.align(placeable.width, width, layoutDirection), positions[index])
607
+ }
608
+ }
609
+ }
610
+ }
@@ -12,7 +12,6 @@ import androidx.compose.runtime.getValue
12
12
  import androidx.compose.runtime.mutableFloatStateOf
13
13
  import androidx.compose.runtime.remember
14
14
  import androidx.compose.runtime.setValue
15
- import expo.modules.kotlin.viewevent.getValue
16
15
  import expo.modules.kotlin.views.ComposeProps
17
16
  import expo.modules.kotlin.views.FunctionalComposableScope
18
17
  import expo.modules.kotlin.views.OptimizedComposeProps
@@ -33,9 +32,11 @@ data class VerticalSliderProps(
33
32
 
34
33
  @OptIn(ExperimentalMaterial3Api::class, ExperimentalMaterial3ExpressiveApi::class)
35
34
  @Composable
36
- fun FunctionalComposableScope.VerticalSliderContent(props: VerticalSliderProps) {
37
- val onValueChange by remember { this@VerticalSliderContent.EventDispatcher<SliderValueChangedEvent>() }
38
- val onValueChangeFinished by remember { this@VerticalSliderContent.EventDispatcher<Unit>() }
35
+ fun FunctionalComposableScope.VerticalSliderContent(
36
+ props: VerticalSliderProps,
37
+ onValueChange: (SliderValueChangedEvent) -> Unit,
38
+ onValueChangeFinished: (Unit) -> Unit
39
+ ) {
39
40
  val interactionSource = remember { MutableInteractionSource() }
40
41
 
41
42
  val effectiveLower = maxOf(props.min, props.lowerLimit ?: Float.NEGATIVE_INFINITY)
@@ -10,6 +10,8 @@ import expo.modules.kotlin.sharedobjects.SharedObject
10
10
  * recomposes automatically when the value changes.
11
11
  */
12
12
  class ObservableState(initialValue: Any? = null) : SharedObject() {
13
+ override val releasesAfterPendingViewUpdates = true
14
+
13
15
  private val _state: MutableState<Any?> = mutableStateOf(initialValue)
14
16
  internal var onChange: WorkletCallback? = null
15
17
  private var isNotifying = false
@@ -10,6 +10,8 @@ import expo.modules.kotlin.sharedobjects.SharedObject
10
10
  * The view resolves it and executes the worklet on the UI runtime.
11
11
  */
12
12
  class WorkletCallback : SharedObject() {
13
+ override val releasesAfterPendingViewUpdates = true
14
+
13
15
  var worklet: Worklet? = null
14
16
 
15
17
  fun invoke(vararg arguments: Any?) {
@@ -168,6 +168,8 @@ function findNearestSnapPointIndex(snapPoints, position) {
168
168
  children: /*#__PURE__*/ _jsx(Host, {
169
169
  style: {
170
170
  position: 'absolute',
171
+ top: 0,
172
+ bottom: 0,
171
173
  width
172
174
  },
173
175
  pointerEvents: "none",
@@ -1 +1 @@
1
- {"version":3,"sources":["community/bottom-sheet/BottomSheet.android.tsx"],"sourcesContent":[null],"names":["useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","StyleSheet","useWindowDimensions","View","Host","ModalBottomSheet","RNHostView","BottomSheetContext","BottomSheetInternalContext","SheetScrollContextReset","parseSnapPoint","useBottomSheet","extractBackgroundColor","backgroundStyle","undefined","flatten","backgroundColor","findNearestSnapPointIndex","snapPoints","position","length","parsedTarget","nearestIndex","nearestDistance","Infinity","forEach","snapPoint","index","parsedSnapPoint","type","distance","Math","abs","value","BottomSheet","props","ref","snapPointsProp","indexProp","onChange","onClose","onDismiss","enablePanDownToClose","enableDynamicSizing","handleComponent","children","width","hasMultipleSnapPoints","fitToContents","skipPartially","maxIndex","containerColor","internalContextValue","clampIndex","min","max","isOpen","setIsOpen","isOpenRef","current","pendingIndexRef","sheetRef","closedRef","onChangeRef","onCloseRef","onDismissRef","fireCloseCallbacks","handleDismiss","methods","snapToIndex","hide","then","clampedIndex","expand","partialExpand","close","snapToPosition","collapse","forceClose","present","dismiss","Provider","style","pointerEvents","onDismissRequest","skipPartiallyExpanded","initialFullyExpanded","showDragHandle","sheetGesturesEnabled","properties","shouldDismissOnBackPress","shouldDismissOnClickOutside","matchContents","flexGrow","height"],"mappings":";AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/F,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,eAAe;AAErE,SAASC,IAAI,QAAQ,6BAA6B;AAClD,SAASC,gBAAgB,QAAkC,yCAAyC;AACpG,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,kBAAkB,EAAEC,0BAA0B,QAAQ,YAAY;AAC3E,SAASC,uBAAuB,QAAQ,uBAAuB;AAE/D,SAASC,cAAc,QAAQ,UAAU;AAEzC,SAASC,cAAc,QAAQ,YAAY;AAE3C,SAASC,uBACPC,eAAoD;IAEpD,IAAI,CAACA,iBAAiB,OAAOC;IAC7B,OAAQb,WAAWc,OAAO,CAACF,kBAA0BG;AACvD;AAEA,SAASC,0BACPC,UAA0C,EAC1CC,QAAyB;IAEzB,IAAI,CAACD,cAAcA,WAAWE,MAAM,KAAK,GAAG,OAAO;IAEnD,MAAMC,eAAeX,eAAeS;IACpC,IAAIG,eAAe;IACnB,IAAIC,kBAAkBC;IAEtBN,WAAWO,OAAO,CAAC,CAACC,WAAWC;QAC7B,MAAMC,kBAAkBlB,eAAegB;QACvC,IAAIE,gBAAgBC,IAAI,KAAKR,aAAaQ,IAAI,EAAE;QAEhD,MAAMC,WAAWC,KAAKC,GAAG,CAACJ,gBAAgBK,KAAK,GAAGZ,aAAaY,KAAK;QACpE,IAAIH,WAAWP,iBAAiB;YAC9BA,kBAAkBO;YAClBR,eAAeK;QACjB;IACF;IAEA,IAAIJ,oBAAoBC,UAAU;QAChC,OAAOF;IACT;IAEA,OAAO,OAAOH,aAAa,W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ottom-sheet/BottomSheet.android.tsx"],"sourcesContent":[null],"names":["useCallback","useEffect","useImperativeHandle","useMemo","useRef","useState","StyleSheet","useWindowDimensions","View","Host","ModalBottomSheet","RNHostView","BottomSheetContext","BottomSheetInternalContext","SheetScrollContextReset","parseSnapPoint","useBottomSheet","extractBackgroundColor","backgroundStyle","undefined","flatten","backgroundColor","findNearestSnapPointIndex","snapPoints","position","length","parsedTarget","nearestIndex","nearestDistance","Infinity","forEach","snapPoint","index","parsedSnapPoint","type","distance","Math","abs","value","BottomSheet","props","ref","snapPointsProp","indexProp","onChange","onClose","onDismiss","enablePanDownToClose","enableDynamicSizing","handleComponent","children","width","hasMultipleSnapPoints","fitToContents","skipPartially","maxIndex","containerColor","internalContextValue","clampIndex","min","max","isOpen","setIsOpen","isOpenRef","current","pendingIndexRef","sheetRef","closedRef","onChangeRef","onCloseRef","onDismissRef","fireCloseCallbacks","handleDismiss","methods","snapToIndex","hide","then","clampedIndex","expand","partialExpand","close","snapToPosition","collapse","forceClose","present","dismiss","Provider","style","top","bottom","pointerEvents","onDismissRequest","skipPartiallyExpanded","initialFullyExpanded","showDragHandle","sheetGesturesEnabled","properties","shouldDismissOnBackPress","shouldDismissOnClickOutside","matchContents","flexGrow","height"],"mappings":";AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC/F,SAASC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,eAAe;AAErE,SAASC,IAAI,QAAQ,6BAA6B;AAClD,SAASC,gBAAgB,QAAkC,yCAAyC;AACpG,SAASC,UAAU,QAAQ,mCAAmC;AAC9D,SAASC,kBAAkB,EAAEC,0BAA0B,QAAQ,YAAY;AAC3E,SAASC,uBAAuB,QAAQ,uBAAuB;AAE/D,SAASC,cAAc,QAAQ,UAAU;AAEzC,SAASC,cAAc,QAAQ,YAAY;AAE3C,SAASC,uBACPC,eAAoD;IAEpD,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