@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
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/TextInput/index.ios.tsx"],"sourcesContent":[null],"names":["SecureField","Text","TextField","useNativeState","autocorrectionDisabled","disabled","disabledMod","foregroundStyle","keyboardType","keyboardTypeMod","lineLimit","multilineTextAlignment","onGeometryChange","onSubmit","submitLabel","textContentType","textInputAutocapitalization","tint","useImperativeHandle","useRef","transformToModifiers","autoCompleteToTextContentType","enterKeyHintToReturnKeyType","inputModeToKeyboardType","resolveEditable","mapReturnKeyType","value","mapKeyboardType","TextInput","ref","onChangeText","placeholder","autoFocus","editable","editableProp","multiline","keyboardTypeProp","autoCapitalize","autoCorrect","returnKeyType","returnKeyTypeProp","onSubmitEditing","onFocus","onBlur","cursorColor","textAlign","readOnly","inputMode","enterKeyHint","defaultValue","numberOfLines","numberOfLinesProp","rows","testID","placeholderTextColor","style","textStyle","secureTextEntry","autoComplete","onContentSizeChange","maxLength","caretHidden","selectionColor","selection","onSelectionChange","selectTextOnFocus","modifiers","userModifiers","initialFallbackRef","fallback","current","state","textFieldRef","secureFieldRef","isFocusedRef","focus","blur","clear","isFocused","setSelection","start","end","__DEV__","console","warn","Promise","resolve","handleFocusChange","focused","length","undefined","push","reservesSpace","mappedContentType","text","onTextChange","onFocusChange","Placeholder","axis"],"mappings":";AAAA,SACEA,WAAW,EAEXC,IAAI,EACJC,SAAS,EAETC,cAAc,QACT,oBAAoB;AAC3B,SACEC,sBAAsB,EACtBC,YAAYC,WAAW,EACvBC,eAAe,EACfC,gBAAgBC,eAAe,EAC/BC,SAAS,EACTC,sBAAsB,EACtBC,gBAAgB,EAChBC,QAAQ,EACRC,WAAW,EACXC,eAAe,EACfC,2BAA2B,EAC3BC,IAAI,QAEC,8BAA8B;AACrC,SAASC,mBAAmB,EAAEC,MAAM,QAAQ,QAAQ;AAGpD,SAASC,oBAAoB,QAAQ,oBAAoB;AAEzD,SACEC,6BAA6B,EAC7BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,eAAe,QACV,UAAU;AAKjB,SAASC,iBAAiBC,KAA2B;IACnD,IAAIA,UAAU,YAAYA,UAAU,SAAS,OAAO;IACpD,IACEA,UAAU,aACVA,UAAU,UACVA,UAAU,cACVA,UAAU,kBACV;QACA,OAAO;IACT;IACA,OAAOA;AACT;AAEA,SAASC,gBAAgBD,KAA0B;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B+C;iBAAsB;0BAAGvB;;aAE3D;;AAGV;AAEA,cAAc,UAAU"}
1
+ {"version":3,"sources":["universal/TextInput/index.ios.tsx"],"sourcesContent":[null],"names":["SecureField","Text","TextField","useNativeState","autocorrectionDisabled","disabled","disabledMod","foregroundStyle","keyboardType","keyboardTypeMod","lineLimit","multilineTextAlignment","onGeometryChange","onSubmit","submitLabel","textContentType","textInputAutocapitalization","tint","useImperativeHandle","useRef","transformToModifiers","autoCompleteToTextContentType","enterKeyHintToReturnKeyType","inputModeToKeyboardType","resolveEditable","mapReturnKeyType","value","mapKeyboardType","TextInput","ref","onChangeText","placeholder","autoFocus","editable","editableProp","multiline","keyboardTypeProp","autoCapitalize","autoCorrect","returnKeyType","returnKeyTypeProp","onSubmitEditing","onFocus","onBlur","cursorColor","textAlign","readOnly","inputMode","enterKeyHint","defaultValue","numberOfLines","numberOfLinesProp","rows","testID","placeholderTextColor","style","textStyle","secureTextEntry","autoComplete","onContentSizeChange","maxLength","caretHidden","selectionColor","selection","onSelectionChange","selectTextOnFocus","modifiers","userModifiers","initialFallbackRef","fallback","current","state","textFieldRef","secureFieldRef","isFocusedRef","focus","blur","clear","isFocused","setSelection","start","end","__DEV__","console","warn","Promise","resolve","handleFocusChange","focused","length","undefined","componentName","push","reservesSpace","mappedContentType","text","onTextChange","onFocusChange","Placeholder","axis"],"mappings":";AAAA,SACEA,WAAW,EAEXC,IAAI,EACJC,SAAS,EAETC,cAAc,QACT,oBAAoB;AAC3B,SACEC,sBAAsB,EACtBC,YAAYC,WAAW,EACvBC,eAAe,EACfC,gBAAgBC,eAAe,EAC/BC,SAAS,EACTC,sBAAsB,EACtBC,gBAAgB,EAChBC,QAAQ,EACRC,WAAW,EACXC,eAAe,EACfC,2BAA2B,EAC3BC,IAAI,QAEC,8BAA8B;AACrC,SAASC,mBAAmB,EAAEC,MAAM,QAAQ,QAAQ;AAGpD,SAASC,oBAAoB,QAAQ,oBAAoB;AAEzD,SACEC,6BAA6B,EAC7BC,2B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,aAAa;QAC/B6D,cAAclE;QACdmE,eAAeV;QACfxB,WAAWA;QACXC,mBAAmBA;QACnBJ,WAAWA;QACXM,WAAWA,UAAUuB,MAAM,GAAG,IAAIvB,YAAYwB;QAC9CrC,QAAQA;kBACPC,wBAAwBvB,4BACvB,KAAC7B,UAAUgG,WAAW;sBACpB,cAAA,KAACjG;gBAAKiE,WAAW;oBAAC3D,gBAAgB+C;iBAAsB;0BAAGvB;;aAE3D;;AAGV;AAEA,cAAc,UAAU"}
@@ -18,4 +18,4 @@ export * from './RNHostView';
18
18
  export * from './Spacer';
19
19
  export * from './State';
20
20
  export { TextInput, type TextInputProps, type TextInputRef } from './TextInput';
21
- export type { UniversalStyle, UniversalAlignment, UniversalBaseProps } from './types';
21
+ export type { UniversalStyle, UniversalAlignment, UniversalBaseProps, UniversalDimension, } from './types';
@@ -12,4 +12,37 @@ import type { ModifierConfig } from '../types';
12
12
  */
13
13
  export declare function omitUserOverridden<T extends {
14
14
  $type: string;
15
- }>(derived: T[], userModifiers?: readonly ModifierConfig[]): T[];
15
+ }>(derived: T[], userModifiers?: readonly ModifierConfig[], preservedTypes?: ReadonlySet<string>): T[];
16
+ /**
17
+ * A fixed size in density-independent pixels, or a percentage of the parent.
18
+ * `'50%'` is half of the parent's content size on that axis.
19
+ * @docsInline
20
+ */
21
+ export type UniversalDimension = number | `${number}%` | null;
22
+ export type SerializedUniversalDimensions = {
23
+ widthPoints?: number;
24
+ widthFraction?: number;
25
+ heightPoints?: number;
26
+ heightFraction?: number;
27
+ };
28
+ export type UniversalLayoutPlatform = 'android' | 'ios';
29
+ type UniversalDimensionStyle = {
30
+ width?: unknown;
31
+ height?: unknown;
32
+ };
33
+ export declare function serializeUniversalDimensions(style: UniversalDimensionStyle | undefined, componentName?: string): SerializedUniversalDimensions;
34
+ /**
35
+ * Which axes a user modifier already owns.
36
+ * `weight` applies to the parent's main axis, so the cross axis still comes from `style`.
37
+ * `defaultMinSize` only applies when the incoming constraint is 0, so it does not replace a size.
38
+ * A `frame` owns an axis only when it sets `width` or `height`.
39
+ * A minimum or maximum limits that size.
40
+ */
41
+ export declare function getUserSizingOverrides(userModifiers: readonly ModifierConfig[] | undefined, platform: UniversalLayoutPlatform): {
42
+ width: boolean;
43
+ height: boolean;
44
+ };
45
+ export declare function omitUserOverriddenDimensions(dimensions: SerializedUniversalDimensions, userModifiers: readonly ModifierConfig[] | undefined, platform: UniversalLayoutPlatform): SerializedUniversalDimensions;
46
+ export declare function createUniversalLayoutModifier(dimensions: SerializedUniversalDimensions): ModifierConfig | undefined;
47
+ export declare function resetUniversalDimensionWarningsForTests(): void;
48
+ export {};
@@ -8,12 +8,108 @@
8
8
  * functional props (for example `onPress`, `onAppear`, `disabled`) must not
9
9
  * go through this filter, or a user modifier of the same type would silently
10
10
  * disable the prop.
11
- */ export function omitUserOverridden(derived, userModifiers) {
11
+ */ export function omitUserOverridden(derived, userModifiers, preservedTypes) {
12
12
  if (!userModifiers?.length) {
13
13
  return derived;
14
14
  }
15
15
  const userTypes = new Set(userModifiers.map((modifier)=>modifier.$type));
16
- return derived.filter((modifier)=>!userTypes.has(modifier.$type));
16
+ return derived.filter((modifier)=>preservedTypes?.has(modifier.$type) || !userTypes.has(modifier.$type));
17
+ }
18
+ const PERCENTAGE_PATTERN = /^(?:\d+(?:\.\d+)?|\.\d+)%$/;
19
+ const warnedInvalidDimensions = new Set();
20
+ function warnInvalidDimension(componentName, axis, value) {
21
+ if (!__DEV__) return;
22
+ const warningKey = `${componentName}:${axis}`;
23
+ if (warnedInvalidDimensions.has(warningKey)) return;
24
+ warnedInvalidDimensions.add(warningKey);
25
+ console.warn(`[Expo UI] Ignoring invalid ${axis} on ${componentName}: ${String(value)}. ` + 'Expected a finite, non-negative number or percentage.');
26
+ }
27
+ function serializeDimension(value, componentName, axis) {
28
+ if (value == null) return {};
29
+ if (typeof value === 'number') {
30
+ if (Number.isFinite(value) && value >= 0) return {
31
+ points: value
32
+ };
33
+ warnInvalidDimension(componentName, axis, value);
34
+ return {};
35
+ }
36
+ if (typeof value === 'string' && PERCENTAGE_PATTERN.test(value)) {
37
+ const percentage = Number(value.slice(0, -1));
38
+ if (Number.isFinite(percentage) && percentage >= 0) {
39
+ return {
40
+ fraction: percentage / 100
41
+ };
42
+ }
43
+ }
44
+ warnInvalidDimension(componentName, axis, value);
45
+ return {};
46
+ }
47
+ export function serializeUniversalDimensions(style, componentName = 'universal component') {
48
+ const width = serializeDimension(style?.width, componentName, 'width');
49
+ const height = serializeDimension(style?.height, componentName, 'height');
50
+ return {
51
+ widthPoints: width.points,
52
+ widthFraction: width.fraction,
53
+ heightPoints: height.points,
54
+ heightFraction: height.fraction
55
+ };
56
+ }
57
+ /**
58
+ * Which axes a user modifier already owns.
59
+ * `weight` applies to the parent's main axis, so the cross axis still comes from `style`.
60
+ * `defaultMinSize` only applies when the incoming constraint is 0, so it does not replace a size.
61
+ * A `frame` owns an axis only when it sets `width` or `height`.
62
+ * A minimum or maximum limits that size.
63
+ */ export function getUserSizingOverrides(userModifiers, platform) {
64
+ let width = false;
65
+ let height = false;
66
+ for (const modifier of userModifiers ?? []){
67
+ if (platform === 'android') {
68
+ if (modifier.$type === 'size' || modifier.$type === 'fillMaxSize') {
69
+ width = true;
70
+ height = true;
71
+ } else if (modifier.$type === 'width' || modifier.$type === 'fillMaxWidth' || modifier.$type === 'wrapContentWidth') {
72
+ width = true;
73
+ } else if (modifier.$type === 'height' || modifier.$type === 'fillMaxHeight' || modifier.$type === 'wrapContentHeight') {
74
+ height = true;
75
+ }
76
+ continue;
77
+ }
78
+ if (modifier.$type === 'frame') {
79
+ width ||= modifier.width != null;
80
+ height ||= modifier.height != null;
81
+ } else if (modifier.$type === 'containerRelativeFrame') {
82
+ width ||= modifier.axes === 'horizontal' || modifier.axes === 'both';
83
+ height ||= modifier.axes === 'vertical' || modifier.axes === 'both';
84
+ } else if (modifier.$type === 'fixedSize') {
85
+ const hasExplicitAxis = modifier.horizontal != null || modifier.vertical != null;
86
+ width ||= hasExplicitAxis ? modifier.horizontal === true : true;
87
+ height ||= hasExplicitAxis ? modifier.vertical === true : true;
88
+ }
89
+ }
90
+ return {
91
+ width,
92
+ height
93
+ };
94
+ }
95
+ export function omitUserOverriddenDimensions(dimensions, userModifiers, platform) {
96
+ const overrides = getUserSizingOverrides(userModifiers, platform);
97
+ return {
98
+ widthPoints: overrides.width ? undefined : dimensions.widthPoints,
99
+ widthFraction: overrides.width ? undefined : dimensions.widthFraction,
100
+ heightPoints: overrides.height ? undefined : dimensions.heightPoints,
101
+ heightFraction: overrides.height ? undefined : dimensions.heightFraction
102
+ };
103
+ }
104
+ export function createUniversalLayoutModifier(dimensions) {
105
+ const hasDimension = Object.values(dimensions).some((value)=>value != null);
106
+ return hasDimension ? {
107
+ $type: 'universalLayout',
108
+ ...dimensions
109
+ } : undefined;
110
+ }
111
+ export function resetUniversalDimensionWarningsForTests() {
112
+ warnedInvalidDimensions.clear();
17
113
  }
18
114
 
19
115
  //# sourceMappingURL=modifierUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/modifierUtils.ts"],"sourcesContent":[null],"names":["omitUserOverridden","derived","userModifiers","length","userTypes","Set","map","modifier","$type","filter","has"],"mappings":"AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASA,mBACdC,OAAY,EACZC,aAAyC;IAEzC,IAAI,CAACA,eAAeC,QAAQ;QAC1B,OAAOF;IACT;IACA,MAAMG,YAAY,IAAIC,IAAIH,cAAcI,GAAG,CAAC,CAACC,WAAaA,SAASC,KAAK;IACxE,OAAOP,QAAQQ,MAAM,CAAC,CAACF,WAAa,CAACH,UAAUM,GAAG,CAACH,SAASC,KAAK;AACnE"}
1
+ {"version":3,"sources":["universal/modifierUtils.ts"],"sourcesContent":[null],"names":["omitUserOverridden","derived","userModifiers","preservedTypes","length","userTypes","Set","map","modifier","$type","filter","has","PERCENTAGE_PATTERN","warnedInvalidDimensions","warnInvalidDimension","componentName","axis","value","__DEV__","warningKey","add","console","warn","String","serializeDimension","Number","isFinite","points","test","percentage","slice","fraction","serializeUniversalDimensions","style","width","height","widthPoints","widthFraction","heightPoints","heightFraction","getUserSizingOverrides","platform","axes","hasExplicitAxis","horizontal","vertical","omitUserOverriddenDimensions","dimensions","overrides","undefined","createUniversalLayoutModifier","hasDimension","Object","values","some","resetUniversalDimensionWarningsForTests","clear"],"mappings":"AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASA,mBACdC,OAAY,EACZC,aAAyC,EACzCC,cAAoC;IAEpC,IAAI,CAACD,eAAeE,QAAQ;QAC1B,OAAOH;IACT;IACA,MAAMI,YAAY,IAAIC,IAAIJ,cAAcK,GAAG,CAAC,CAACC,WAAaA,SAASC,KAAK;IACxE,OAAOR,QAAQS,MAAM,CACnB,CAACF,WAAaL,gBAAgBQ,IAAIH,SAASC,KAAK,KAAK,CAACJ,UAAUM,GAAG,CAACH,SAASC,KAAK;AAEtF;AAyBA,MAAMG,qBAAqB;AAC3B,MAAMC,0BAA0B,IAAIP;AAEpC,SAASQ,qBAAqBC,aAAqB,EAAEC,IAAmB,EAAEC,KAAc;IACtF,IAAI,CAACC,SAAS;IAEd,MAAMC,aAAa,GAAGJ,cAAc,CAAC,EAAEC,MAAM;IAC7C,IAAIH,wBAAwBF,GAAG,CAACQ,aAAa;IAC7CN,wBAAwBO,GAAG,CAACD;IAE5BE,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAEN,KAAK,IAAI,EAAED,cAAc,EAAE,EAAEQ,OAAON,OAAO,EAAE,CAAC,GAC1E;AAEN;AAEA,SAASO,mBACPP,KAAc,EACdF,aAAqB,EACrBC,IAAmB;IAEnB,IAAIC,SAAS,MAAM,OAAO,CAAC;IAE3B,IAAI,OAAOA,UAAU,UAAU;QAC7B,IAAIQ,OAAOC,QAAQ,CAACT,UAAUA,SAAS,GAAG,OAAO;YAAEU,QAAQV;QAAM;QACjEH,qBAAqBC,eAAeC,MAAMC;QAC1C,OAAO,CAAC;IACV;IAEA,IAAI,OAAOA,UAAU,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,0BAA0B;YACtDyB,UAAU1B,SAASkC,IAAI,KAAK,gBAAgBlC,SAASkC,IAAI,KAAK;YAC9DP,WAAW3B,SAASkC,IAAI,KAAK,cAAclC,SAASkC,IAAI,KAAK;QAC/D,OAAO,IAAIlC,SAASC,KAAK,KAAK,aAAa;YACzC,MAAMkC,kBAAkBnC,SAASoC,UAAU,IAAI,QAAQpC,SAASqC,QAAQ,IAAI;YAC5EX,UAAUS,kBAAkBnC,SAASoC,UAAU,KAAK,OAAO;YAC3DT,WAAWQ,kBAAkBnC,SAASqC,QAAQ,KAAK,OAAO;QAC5D;IACF;IAEA,OAAO;QAAEX;QAAOC;IAAO;AACzB;AAEA,OAAO,SAASW,6BACdC,UAAyC,EACzC7C,aAAoD,EACpDuC,QAAiC;IAEjC,MAAMO,YAAYR,uBAAuBtC,eAAeuC;IACxD,OAAO;QACLL,aAAaY,UAAUd,KAAK,GAAGe,YAAYF,WAAWX,WAAW;QACjEC,eAAeW,UAAUd,KAAK,GAAGe,YAAYF,WAAWV,aAAa;QACrEC,cAAcU,UAAUb,MAAM,GAAGc,YAAYF,WAAWT,YAAY;QACpEC,gBAAgBS,UAAUb,MAAM,GAAGc,YAAYF,WAAWR,cAAc;IAC1E;AACF;AAEA,OAAO,SAASW,8BACdH,UAAyC;IAEzC,MAAMI,eAAeC,OAAOC,MAAM,CAACN,YAAYO,IAAI,CAAC,CAACrC,QAAUA,SAAS;IACxE,OAAOkC,eAAe;QAAE1C,OAAO;QAAmB,GAAGsC,UAAU;IAAC,IAAIE;AACtE;AAEA,OAAO,SAASM;IACd1C,wBAAwB2C,KAAK;AAC/B"}
@@ -0,0 +1,9 @@
1
+ import type { UniversalStyle } from './types';
2
+ export type StackAxis = 'horizontal' | 'vertical';
3
+ /**
4
+ * Main axis of the nearest universal `Row` or `Column` on web.
5
+ * A plain view lays its children out vertically, so that is the default.
6
+ */
7
+ export declare const StackAxisContext: import("react").Context<StackAxis>;
8
+ /** The size `style` sets on the parent's cross axis, if any. */
9
+ export declare function useCrossAxisSize(style: UniversalStyle | undefined): import("./modifierUtils").UniversalDimension | undefined;
@@ -0,0 +1,11 @@
1
+ import { createContext, useContext } from 'react';
2
+ /**
3
+ * Main axis of the nearest universal `Row` or `Column` on web.
4
+ * A plain view lays its children out vertically, so that is the default.
5
+ */ export const StackAxisContext = createContext('vertical');
6
+ /** The size `style` sets on the parent's cross axis, if any. */ export function useCrossAxisSize(style) {
7
+ const parentAxis = useContext(StackAxisContext);
8
+ return parentAxis === 'horizontal' ? style?.height : style?.width;
9
+ }
10
+
11
+ //# sourceMappingURL=stackAxis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["universal/stackAxis.ts"],"sourcesContent":[null],"names":["createContext","useContext","StackAxisContext","useCrossAxisSize","style","parentAxis","height","width"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAMlD;;;CAGC,GACD,OAAO,MAAMC,mBAAmBF,cAAyB,YAAY;AAErE,8DAA8D,GAC9D,OAAO,SAASG,iBAAiBC,KAAiC;IAChE,MAAMC,aAAaJ,WAAWC;IAC9B,OAAOG,eAAe,eAAeD,OAAOE,SAASF,OAAOG;AAC9D"}
@@ -6,10 +6,14 @@ import type { UniversalBaseProps, UniversalStyle } from './types';
6
6
  *
7
7
  * Compose modifiers apply outside-in (left to right). To match React Native's
8
8
  * box model where background includes the padding area and border is outermost:
9
- * sizing → border → clip → background → padding → opacity
9
+ * universal layout → fixed size → border → clip → background → padding → opacity
10
10
  * → events → behavior → user escape-hatch
11
11
  *
12
+ * Fixed sizes become `size`, `width`, or `height`.
13
+ * Percentages stay on `universalLayout` so the parent stack can resolve them.
12
14
  * Style-derived modifiers yield to user-supplied modifiers of the same
13
15
  * `$type`, so the escape hatch can override anything derived from props.
14
16
  */
15
- export declare function transformToModifiers(style: UniversalStyle | undefined, props: Pick<UniversalBaseProps, 'onPress' | 'disabled' | 'hidden' | 'testID'>, extraModifiers?: ModifierConfig[]): ModifierConfig[];
17
+ export declare function transformToModifiers(style: UniversalStyle | undefined, props: Pick<UniversalBaseProps, 'onPress' | 'disabled' | 'hidden' | 'testID'>, extraModifiers?: ModifierConfig[], options?: {
18
+ componentName?: string;
19
+ }): ModifierConfig[];
@@ -1,27 +1,34 @@
1
1
  import { alpha, background, border, clickable, clip, height, padding, paddingAll, Shapes, size, testID as testIDModifier, width } from '@expo/ui/jetpack-compose/modifiers';
2
- import { omitUserOverridden } from './modifierUtils';
2
+ import { createUniversalLayoutModifier, omitUserOverridden, omitUserOverriddenDimensions, serializeUniversalDimensions } from './modifierUtils';
3
3
  /**
4
4
  * Converts universal style/event/lifecycle/behavior props into a Jetpack
5
5
  * Compose modifier array.
6
6
  *
7
7
  * Compose modifiers apply outside-in (left to right). To match React Native's
8
8
  * box model where background includes the padding area and border is outermost:
9
- * sizing → border → clip → background → padding → opacity
9
+ * universal layout → fixed size → border → clip → background → padding → opacity
10
10
  * → events → behavior → user escape-hatch
11
11
  *
12
+ * Fixed sizes become `size`, `width`, or `height`.
13
+ * Percentages stay on `universalLayout` so the parent stack can resolve them.
12
14
  * Style-derived modifiers yield to user-supplied modifiers of the same
13
15
  * `$type`, so the escape hatch can override anything derived from props.
14
- */ export function transformToModifiers(style, props, extraModifiers) {
16
+ */ export function transformToModifiers(style, props, extraModifiers, options) {
15
17
  let mods = [];
18
+ const dimensions = omitUserOverriddenDimensions(serializeUniversalDimensions(style, options?.componentName), extraModifiers, 'android');
19
+ const fixedWidth = dimensions.widthPoints;
20
+ const fixedHeight = dimensions.heightPoints;
21
+ const universalLayoutModifier = createUniversalLayoutModifier(dimensions);
22
+ if (universalLayoutModifier) mods.push(universalLayoutModifier);
23
+ // Fixed sizing is applied directly. Percentages remain as parent data for
24
+ // the owning universal layout to resolve against its content box.
25
+ if (fixedWidth != null && fixedHeight != null) {
26
+ mods.push(size(fixedWidth, fixedHeight));
27
+ } else {
28
+ if (fixedWidth != null) mods.push(width(fixedWidth));
29
+ if (fixedHeight != null) mods.push(height(fixedHeight));
30
+ }
16
31
  if (style) {
17
- // Sizing (outermost)
18
- if (style.width != null && style.height != null) {
19
- mods.push(size(style.width, style.height));
20
- } else if (style.width != null) {
21
- mods.push(width(style.width));
22
- } else if (style.height != null) {
23
- mods.push(height(style.height));
24
- }
25
32
  // Border + background + borderRadius handling.
26
33
  // Compose's border() doesn't accept a shape, so when borderRadius is set
27
34
  // alongside border, we simulate a rounded border using layered backgrounds:
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/transformStyle.android.ts"],"sourcesContent":[null],"names":["alpha","background","border","clickable","clip","height","padding","paddingAll","Shapes","size","testID","testIDModifier","width","omitUserOverridden","transformToModifiers","style","props","extraModifiers","mods","push","hasBorder","borderWidth","borderColor","hasRadius","borderRadius","radius","bw","RoundedCorner","String","Math","max","backgroundColor","all","top","paddingTop","paddingVertical","bottom","paddingBottom","start","paddingLeft","paddingHorizontal","end","paddingRight","opacity","onPress","hidden"],"mappings":"AAAA,SACEA,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,UAAU,EACVC,MAAM,EACNC,IAAI,EACJC,UAAUC,cAAc,EACxBC,KAAK,QAEA,qCAAqC;AAE5C,SAASC,kBAAkB,QAAQ,kBAAkB;AAGrD;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,qBACdC,KAAiC,EACjCC,KAA6E,EAC7EC,cAAiC;IAEjC,IAAIC,OAAyB,EAAE;IAE/B,IAAIH,OAAO;QACT,qBAAqB;QACrB,IAAIA,MAAMH,KAAK,IAAI,QAAQG,MAAMV,MAAM,IAAI,MAAM;YAC/Ca,KAAKC,IAAI,CAACV,KAAKM,MAAMH,KAAK,EAAYG,MAAMV,MAAM;QACpD,OAAO,IAAIU,MAAMH,KAAK,IAAI,MAAM;YAC9BM,KAAKC,IAAI,CAACP,MAAMG,MAAMH,KAAK;QAC7B,OAAO,IAAIG,MAAMV,MAAM,IAAI,MAAM;YAC/Ba,KAAKC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B,MAAMyB,iBAAiB,IAAeR;YACtF,MAAMS,MAAM,AAAC1B,MAAM2B,YAAY,IAAgB3B,MAAMyB,iBAAiB,IAAeR;YACrF,IAAIC,OAAOG,UAAUE,SAASG,KAAK;gBACjC,IAAIR,QAAQG,UAAUA,WAAWE,SAASA,UAAUG,KAAK;oBACvDvB,KAAKC,IAAI,CAACZ,WAAW0B;gBACvB,OAAO;oBACLf,KAAKC,IAAI,CAACb,QAAQgC,OAAOL,KAAKQ,KAAKL;gBACrC;YACF;QACF;QAEA,UAAU;QACV,IAAIrB,MAAM4B,OAAO,IAAI,MAAM;YACzBzB,KAAKC,IAAI,CAACnB,MAAMe,MAAM4B,OAAO;QAC/B;IACF;IAEA,2EAA2E;IAC3E,kEAAkE;IAClEzB,OAAOL,mBAAmBK,MAAMD;IAEhC,2CAA2C;IAC3C,IAAID,MAAM4B,OAAO,EAAE1B,KAAKC,IAAI,CAAChB,UAAUa,MAAM4B,OAAO;IAEpD,WAAW;IACX,IAAI5B,MAAM6B,MAAM,EAAE3B,KAAKC,IAAI,CAACnB,MAAM;IAClC,IAAIgB,MAAMN,MAAM,EAAEQ,KAAKC,IAAI,CAACR,eAAeK,MAAMN,MAAM;IACvD,wFAAwF;IAExF,mDAAmD;IACnD,IAAIO,gBAAgBC,KAAKC,IAAI,IAAIF;IAEjC,OAAOC;AACT"}
1
+ {"version":3,"sources":["universal/transformStyle.android.ts"],"sourcesContent":[null],"names":["alpha","background","border","clickable","clip","height","padding","paddingAll","Shapes","size","testID","testIDModifier","width","createUniversalLayoutModifier","omitUserOverridden","omitUserOverriddenDimensions","serializeUniversalDimensions","transformToModifiers","style","props","extraModifiers","options","mods","dimensions","componentName","fixedWidth","widthPoints","fixedHeight","heightPoints","universalLayoutModifier","push","hasBorder","borderWidth","borderColor","hasRadius","borderRadius","radius","bw","RoundedCorner","String","Math","max","backgroundColor","all","top","paddingTop","paddingVertical","bottom","paddingBottom","start","paddingLeft","paddingHorizontal","end","paddingRight","opacity","onP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ACV,IAAI7B,MAAMoC,OAAO,IAAI,MAAM;YACzBhC,KAAKQ,IAAI,CAAC9B,MAAMkB,MAAMoC,OAAO;QAC/B;IACF;IAEA,2EAA2E;IAC3E,kEAAkE;IAClEhC,OAAOR,mBAAmBQ,MAAMF;IAEhC,2CAA2C;IAC3C,IAAID,MAAMoC,OAAO,EAAEjC,KAAKQ,IAAI,CAAC3B,UAAUgB,MAAMoC,OAAO;IAEpD,WAAW;IACX,IAAIpC,MAAMqC,MAAM,EAAElC,KAAKQ,IAAI,CAAC9B,MAAM;IAClC,IAAImB,MAAMT,MAAM,EAAEY,KAAKQ,IAAI,CAACnB,eAAeQ,MAAMT,MAAM;IACvD,wFAAwF;IAExF,mDAAmD;IACnD,IAAIU,gBAAgBE,KAAKQ,IAAI,IAAIV;IAEjC,OAAOE;AACT"}
@@ -7,13 +7,17 @@ import type { UniversalBaseProps, UniversalStyle } from './types';
7
7
  *
8
8
  * SwiftUI modifiers apply inside-out (each modifier wraps the previous).
9
9
  * To match React Native's box model (background fills the full box):
10
- * padding → sizing → background → clip → border → opacity
10
+ * padding → fixed frame → universal layout → background → border → clip → opacity
11
11
  * → events → lifecycle → behavior → user escape-hatch
12
12
  *
13
+ * Fixed sizes become a `frame`.
14
+ * Percentages stay on `universalLayout` so the parent stack can resolve them.
13
15
  * Style-derived modifiers yield to user-supplied modifiers of the same
14
16
  * `$type`, so the escape hatch can override anything derived from props.
15
17
  */
16
18
  export declare function transformToModifiers(style: UniversalStyle | undefined, props: Pick<UniversalBaseProps, 'onPress' | 'onAppear' | 'onDisappear' | 'disabled' | 'hidden' | 'testID'>, extraModifiers?: ModifierConfig[], options?: {
19
+ /** Component name included in invalid-dimension development warnings. */
20
+ componentName?: string;
17
21
  /** Alignment for the frame modifier (used by Column/Row). */
18
22
  frameAlignment?: Parameters<typeof frame>[0]['alignment'];
19
23
  /** Text-styling props for text-rendering components. */
@@ -1,5 +1,11 @@
1
1
  import { background, border, clipShape, contentShape, disabled as disabledMod, font, foregroundStyle, frame, hidden as hiddenMod, kerning, lineSpacing, multilineTextAlignment, onAppear, onDisappear, onTapGesture, opacity, padding, shapes } from '@expo/ui/swift-ui/modifiers';
2
- import { omitUserOverridden } from './modifierUtils';
2
+ import { createUniversalLayoutModifier, omitUserOverridden, omitUserOverriddenDimensions, serializeUniversalDimensions } from './modifierUtils';
3
+ // A user frame owns only the axes it sets. Keep a derived frame that still
4
+ // owns the other axis, and keep the layout value the parent stack reads.
5
+ const preservedSizingTypes = new Set([
6
+ 'frame',
7
+ 'universalLayout'
8
+ ]);
3
9
  const FONT_WEIGHT_MAP = {
4
10
  '100': 'ultraLight',
5
11
  '200': 'thin',
@@ -19,13 +25,18 @@ const FONT_WEIGHT_MAP = {
19
25
  *
20
26
  * SwiftUI modifiers apply inside-out (each modifier wraps the previous).
21
27
  * To match React Native's box model (background fills the full box):
22
- * padding → sizing → background → clip → border → opacity
28
+ * padding → fixed frame → universal layout → background → border → clip → opacity
23
29
  * → events → lifecycle → behavior → user escape-hatch
24
30
  *
31
+ * Fixed sizes become a `frame`.
32
+ * Percentages stay on `universalLayout` so the parent stack can resolve them.
25
33
  * Style-derived modifiers yield to user-supplied modifiers of the same
26
34
  * `$type`, so the escape hatch can override anything derived from props.
27
35
  */ export function transformToModifiers(style, props, extraModifiers, options) {
28
36
  let mods = [];
37
+ const dimensions = omitUserOverriddenDimensions(serializeUniversalDimensions(style, options?.componentName), extraModifiers, 'ios');
38
+ const fixedWidth = dimensions.widthPoints;
39
+ const fixedHeight = dimensions.heightPoints;
29
40
  // Text styling (innermost — applies to text content before container modifiers)
30
41
  const textStyle = options?.textStyle;
31
42
  if (textStyle) {
@@ -62,14 +73,19 @@ const FONT_WEIGHT_MAP = {
62
73
  trailing: style.paddingRight
63
74
  }));
64
75
  }
65
- // Sizing (before background so background fills the frame)
66
- if (style.width != null || style.height != null) {
67
- mods.push(frame({
68
- width: style.width,
69
- height: style.height,
70
- alignment: options?.frameAlignment
71
- }));
72
- }
76
+ }
77
+ // Fixed sizing is applied directly. Percentages remain as layout values for
78
+ // the owning universal layout to resolve against its content box.
79
+ if (fixedWidth != null || fixedHeight != null) {
80
+ mods.push(frame({
81
+ width: fixedWidth,
82
+ height: fixedHeight,
83
+ alignment: options?.frameAlignment
84
+ }));
85
+ }
86
+ const universalLayoutModifier = createUniversalLayoutModifier(dimensions);
87
+ if (universalLayoutModifier) mods.push(universalLayoutModifier);
88
+ if (style) {
73
89
  // Background (fills the frame area including padding)
74
90
  if (style.backgroundColor) {
75
91
  mods.push(background(style.backgroundColor));
@@ -92,7 +108,9 @@ const FONT_WEIGHT_MAP = {
92
108
  }
93
109
  // A user-supplied modifier replaces any style-derived modifier of the same
94
110
  // type. The event, lifecycle, and behavior modifiers below are never dropped.
95
- mods = omitUserOverridden(mods, extraModifiers);
111
+ // Axis-aware sizing precedence has already removed only the dimensions set
112
+ // by a user frame. Preserve any derived frame that still owns the other axis.
113
+ mods = omitUserOverridden(mods, extraModifiers, preservedSizingTypes);
96
114
  // Events. SwiftUI only hit-tests drawn content, so the `contentShape` lets
97
115
  // taps on empty space (for example a `Spacer` in a `Row`) reach `onPress`.
98
116
  if (props.onPress) mods.push(contentShape(shapes.rectangle()), onTapGesture(props.onPress));
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/transformStyle.ios.ts"],"sourcesContent":[null],"names":["background","border","clipShape","contentShape","disabled","disabledMod","font","foregroundStyle","frame","hidden","hiddenMod","kerning","lineSpacing","multilineTextAlignment","onAppear","onDisappear","onTapGesture","opacity","padding","shapes","omitUserOverridden","FONT_WEIGHT_MAP","normal","bold","transformToModifiers","style","props","extraModifiers","options","mods","textStyle","fontFamily","fontSize","fontWeight","push","family","size","weight","undefined","color","letterSpacing","lineHeight","baseFontSize","Math","max","textAlign","hasPadding","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","all","horizontal","vertical","top","bottom","leading","trailing","width","height","alignment","frameAlignment","backgroundColor","borderWidth","borderColor","content","borderRadius","on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AAM;YAC1DrC,KAAKK,IAAI,CAACjC,OAAO;gBAAEkE,SAAS1C,MAAMyC,WAAW;gBAAEN,OAAOnC,MAAMwC,WAAW;YAAC;QAC1E;QAEA,2DAA2D;QAC3D,IAAIxC,MAAM2C,YAAY,IAAI,MAAM;YAC9BvC,KAAKK,IAAI,CAAChC,UAAU,oBAAoBuB,MAAM2C,YAAY;QAC5D;QAEA,UAAU;QACV,IAAI3C,MAAMR,OAAO,IAAI,MAAM;YACzBY,KAAKK,IAAI,CAACjB,QAAQQ,MAAMR,OAAO;QACjC;IACF;IAEA,2EAA2E;IAC3E,8EAA8E;IAC9EY,OAAOT,mBAAmBS,MAAMF;IAEhC,2EAA2E;IAC3E,2EAA2E;IAC3E,IAAID,MAAM2C,OAAO,EAAExC,KAAKK,IAAI,CAAC/B,aAAagB,OAAOmD,SAAS,KAAKtD,aAAaU,MAAM2C,OAAO;IAEzF,YAAY;IACZ,IAAI3C,MAAMZ,QAAQ,EAAEe,KAAKK,IAAI,CAACpB,SAASY,MAAMZ,QAAQ;IACrD,IAAIY,MAAMX,WAAW,EAAEc,KAAKK,IAAI,CAACnB,YAAYW,MAAMX,WAAW;IAE9D,WAAW;IACX,IAAIW,MAAMtB,QAAQ,EAAEyB,KAAKK,IAAI,CAAC7B,YAAY;IAC1C,IAAIqB,MAAMjB,MAAM,EAAEoB,KAAKK,IAAI,CAACxB,UAAU;IAEtC,mDAAmD;IACnD,IAAIiB,gBAAgBE,KAAKK,IAAI,IAAIP;IAEjC,OAAOE;AACT"}
1
+ {"version":3,"sources":["universal/transformStyle.ios.ts"],"sourcesContent":[null],"names":["background","border","clipShape","contentShape","disabled","disabledMod","font","foregroundStyle","frame","hidden","hiddenMod","kerning","lineSpacing","multilineTextAlignment","onAppear","onDisappear","onTapGesture","opacity","padding","shapes","createUniversalLayoutModifier","omitUserOverridden","omitUserOverriddenDimensions","serializeUniversalDimensions","preservedSizingTypes","Set","FONT_WEIGHT_MAP","normal","bold","transformToModifiers","style","props","extraModifiers","options","mods","dimensions","componentName","fixedWidth","widthPoints","fixedHeight","heightPoints","textStyle","fontFamily","fontSize","fontWeight","push","family","size","weight","undefined","color","letterSpacing","lineHeight","baseFontSize","Math","max","textAlign","hasPadding","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","all","horizontal","vertical","top","bottom","leading","trailing","width","height","alignment","frameAlignment","universalLayoutModifier","backgroundColor","borderWidth","borderColor","content","borderRadius","onPress","rectangle"],"mappings":"AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,YAAYC,WAAW,EACvBC,IAAI,EACJC,eAAe,EACfC,KAAK,EACLC,UAAUC,SAAS,EACnBC,OAAO,EACPC,WAAW,EACXC,sBAAsB,EACtBC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,OAAO,EACPC,MAAM,QAED,8BAA8B;AAGrC,SACEC,6BAA6B,EAC7BC,kBAAkB,EAClBC,4BAA4B,EAC5BC,4BAA4B,QACvB,kBAAkB;AAGzB,2EAA2E;AAC3E,yEAAyE;AACzE,MAAMC,uBAAuB,IAAIC,IAAI;IAAC;IAAS;CAAkB;AAEjE,MAAMC,kBAAwE;IAC5E,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACPC,QAAQ;IACRC,MAAM;AACR;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,qBACdC,KAAiC,EACjCC,KAGC,EACDC,cAAiC,EACjCC,OAOC;IAED,IAAIC,OAAyB,EAAE;IAC/B,MAAMC,aAAab,6BACjBC,6BAA6BO,OAAOG,SAASG,gBAC7CJ,gBACA;IAEF,MAAMK,aAAaF,WAAWG,WAAW;IACzC,MAAMC,cAAcJ,WAAWK,YAAY;IAE3C,gFAAgF;IAChF,MAAMC,YAAYR,SAASQ;IAC3B,IAAIA,WAAW;QACb,IACEA,UAAUC,UAA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AEzF,YAAY;IACZ,IAAIlD,MAAMjB,QAAQ,EAAEoB,KAAKW,IAAI,CAAC/B,SAASiB,MAAMjB,QAAQ;IACrD,IAAIiB,MAAMhB,WAAW,EAAEmB,KAAKW,IAAI,CAAC9B,YAAYgB,MAAMhB,WAAW;IAE9D,WAAW;IACX,IAAIgB,MAAM3B,QAAQ,EAAE8B,KAAKW,IAAI,CAACxC,YAAY;IAC1C,IAAI0B,MAAMtB,MAAM,EAAEyB,KAAKW,IAAI,CAACnC,UAAU;IAEtC,mDAAmD;IACnD,IAAIsB,gBAAgBE,KAAKW,IAAI,IAAIb;IAEjC,OAAOE;AACT"}
@@ -1,11 +1,36 @@
1
1
  import type { ViewStyle } from 'react-native';
2
2
  import type { ModifierConfig } from '../types';
3
+ import type { UniversalDimension } from './modifierUtils';
4
+ export type { UniversalDimension } from './modifierUtils';
3
5
  /**
4
6
  * Subset of React Native `ViewStyle` that maps cleanly to both SwiftUI modifiers
5
7
  * and Jetpack Compose modifiers. On web, passes through to React Native StyleSheet.
8
+ *
9
+ * `width` and `height` also accept a percentage of the parent, such as `'50%'`.
10
+ * On Android and iOS, a percentage resolves when the parent is a universal `Row`, `Column`,
11
+ * or `Host` with a size on that axis.
12
+ * A universal `ScrollView` resolves the cross axis only.
13
+ * The scroll axis stays unbounded.
14
+ * On web, the value is passed through to the view style.
15
+ * A Jetpack Compose `Row` or `Column`, or a SwiftUI stack, does not resolve it.
6
16
  * @docsInline
7
17
  */
8
- export type UniversalStyle = Pick<ViewStyle, 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'opacity' | 'width' | 'height'>;
18
+ export type UniversalStyle = Pick<ViewStyle, 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'opacity'> & {
19
+ /**
20
+ * Fixed size in density-independent pixels, or a percentage of the parent's content width.
21
+ * On Android and iOS, percentages resolve when the parent is a universal `Row`, `Column`,
22
+ * `ScrollView`, or `Host` with a defined width.
23
+ * A horizontal `ScrollView` leaves width unbounded.
24
+ */
25
+ width?: UniversalDimension;
26
+ /**
27
+ * Fixed size in density-independent pixels, or a percentage of the parent's content height.
28
+ * On Android and iOS, percentages resolve when the parent is a universal `Row`, `Column`,
29
+ * `ScrollView`, or `Host` with a defined height.
30
+ * A vertical `ScrollView` leaves height unbounded.
31
+ */
32
+ height?: UniversalDimension;
33
+ };
9
34
  /**
10
35
  * Base props inherited by all universal components.
11
36
  * @docsInline
@@ -1 +1 @@
1
- {"version":3,"sources":["universal/types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAkHA;;;;;;;;;CASC,GACD,WAeE"}
1
+ {"version":3,"sources":["universal/types.ts"],"sourcesContent":[null],"names":[],"mappings":"AA0IA;;;;;;;;;CASC,GACD,WAeE"}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Like `React.Children.toArray`, but also flattens `React.Fragment` children so
4
+ * their contents are treated as direct children. Keys of nested elements are
5
+ * prefixed with the fragment's key to stay unique.
6
+ */
7
+ export declare function flattenFragments(children: React.ReactNode): React.ReactNode[];
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Like `React.Children.toArray`, but also flattens `React.Fragment` children so
4
+ * their contents are treated as direct children. Keys of nested elements are
5
+ * prefixed with the fragment's key to stay unique.
6
+ */ export function flattenFragments(children) {
7
+ return React.Children.toArray(children).flatMap((child)=>{
8
+ if (React.isValidElement(child) && child.type === React.Fragment) {
9
+ return flattenFragments(child.props.children).map((nested)=>React.isValidElement(nested) ? React.cloneElement(nested, {
10
+ key: `${child.key}${nested.key}`
11
+ }) : nested);
12
+ }
13
+ return child;
14
+ });
15
+ }
16
+
17
+ //# sourceMappingURL=flattenFragments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["utils/flattenFragments.ts"],"sourcesContent":[null],"names":["React","flattenFragments","children","Children","toArray","flatMap","child","isValidElement","type","Fragment","props","map","nested","cloneElement","key"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B;;;;CAIC,GACD,OAAO,SAASC,iBAAiBC,QAAyB;IACxD,OAAOF,MAAMG,QAAQ,CAACC,OAAO,CAACF,UAAUG,OAAO,CAAC,CAACC;QAC/C,IACEN,MAAMO,cAAc,CAAiCD,UACrDA,MAAME,IAAI,KAAKR,MAAMS,QAAQ,EAC7B;YACA,OAAOR,iBAAiBK,MAAMI,KAAK,CAACR,QAAQ,EAAES,GAAG,CAAC,CAACC,SACjDZ,MAAMO,cAAc,CAACK,UACjBZ,MAAMa,YAAY,CAACD,QAAQ;oBAAEE,KAAK,GAAGR,MAAMQ,GAAG,GAAGF,OAAOE,GAAG,EAAE;gBAAC,KAC9DF;QAER;QACA,OAAON;IACT;AACF"}
@@ -18,7 +18,15 @@ public struct ContentUnavailableView: ExpoSwiftUI.View {
18
18
 
19
19
  public var body: some View {
20
20
  if #available(iOS 17.0, tvOS 17.0, *) {
21
- SwiftUI.ContentUnavailableView(props.title, systemImage: props.systemImage, description: Text(props.description))
21
+ SwiftUI.ContentUnavailableView {
22
+ Label(props.title, systemImage: props.systemImage)
23
+ } description: {
24
+ Text(props.description)
25
+ } actions: {
26
+ if let actions = props.children?.slot("actions") {
27
+ actions
28
+ }
29
+ }
22
30
  }
23
31
  }
24
32
  }
@@ -7,6 +7,7 @@ public final class GroupViewProps: UIBaseViewProps {}
7
7
 
8
8
  public struct GroupView: ExpoSwiftUI.View {
9
9
  @ObservedObject public var props: GroupViewProps
10
+ @Environment(\.resolvesOwnPercentage) private var resolvesOwnPercentage
10
11
 
11
12
  public init(props: GroupViewProps) {
12
13
  self.props = props
@@ -16,5 +17,7 @@ public struct GroupView: ExpoSwiftUI.View {
16
17
  Group {
17
18
  Children()
18
19
  }
20
+ // Group does not size its children, so they keep this view's parent.
21
+ .environment(\.universalPercentageParent, resolvesOwnPercentage)
19
22
  }
20
23
  }
@@ -29,20 +29,44 @@ internal enum VerticalAlignmentOptions: String, Enumerable {
29
29
  public final class HStackViewProps: UIBaseViewProps {
30
30
  @Field var spacing: Double?
31
31
  @Field var alignment: VerticalAlignmentOptions?
32
+ // Universal `Row` sets this so a child percentage is a fraction of this stack.
33
+ // A SwiftUI `HStack` leaves it off and keeps the platform layout.
34
+ @Field var resolvesChildPercentages: Bool = false
32
35
  }
33
36
 
34
37
  public struct HStackView: ExpoSwiftUI.View {
35
38
  @ObservedObject public var props: HStackViewProps
39
+ // A fraction on this stack is a real size only when the parent opted in.
40
+ @Environment(\.resolvesOwnPercentage) private var resolvesOwnPercentage
36
41
 
37
42
  public init(props: HStackViewProps) {
38
43
  self.props = props
39
44
  }
40
45
 
41
46
  public var body: some View {
47
+ if props.resolvesChildPercentages {
48
+ ParentAwareHStackLayout(
49
+ alignment: props.alignment ?? .center,
50
+ spacing: props.spacing.map { CGFloat($0) },
51
+ ownDimensions: universalLayoutDimensions(from: props.modifiers),
52
+ resolvesOwnPercentage: resolvesOwnPercentage
53
+ ) {
54
+ Children()
55
+ }
56
+ .environment(\.universalPercentageParent, true)
57
+ } else {
58
+ platformStack
59
+ }
60
+ }
61
+
62
+ private var platformStack: some View {
42
63
  HStack(
43
64
  alignment: props.alignment?.toVerticalAlignment() ?? .center,
44
- spacing: props.spacing.map { CGFloat($0) }) {
45
- Children()
65
+ spacing: props.spacing.map { CGFloat($0) }
66
+ ) {
67
+ Children()
46
68
  }
69
+ // Overrides a Host, so a percentage inside a SwiftUI stack keeps the child's own size.
70
+ .environment(\.universalPercentageParent, false)
47
71
  }
48
72
  }