@expo/ui 55.0.1 → 55.0.3

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 (269) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/CONTRIBUTING.md +30 -0
  3. package/android/build.gradle +2 -2
  4. package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
  5. package/android/src/main/java/expo/modules/ui/CardView.kt +138 -34
  6. package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
  7. package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
  8. package/android/src/main/java/expo/modules/ui/DatePickerView.kt +302 -31
  9. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
  10. package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +21 -8
  11. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +149 -40
  12. package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
  13. package/android/src/main/java/expo/modules/ui/RNHostView.kt +204 -50
  14. package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
  15. package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
  16. package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
  17. package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
  18. package/android/src/main/java/expo/modules/ui/SwitchView.kt +62 -104
  19. package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
  20. package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
  21. package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
  22. package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -80
  23. package/android/src/main/java/expo/modules/ui/convertibles/AnimatableFloat.kt +26 -0
  24. package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +93 -0
  25. package/android/src/main/java/expo/modules/ui/convertibles/GraphicsLayerParams.kt +24 -0
  26. package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
  27. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
  28. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
  29. package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
  30. package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
  31. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
  32. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
  33. package/build/jetpack-compose/Button/index.d.ts +65 -51
  34. package/build/jetpack-compose/Button/index.d.ts.map +1 -1
  35. package/build/jetpack-compose/Card/index.d.ts +72 -14
  36. package/build/jetpack-compose/Card/index.d.ts.map +1 -1
  37. package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
  38. package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
  39. package/build/jetpack-compose/Chip/index.d.ts +247 -27
  40. package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
  41. package/build/jetpack-compose/DatePicker/index.d.ts +137 -3
  42. package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
  43. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
  44. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
  45. package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
  46. package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
  47. package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
  48. package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
  49. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
  50. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
  51. package/build/jetpack-compose/IconButton/index.d.ts +45 -29
  52. package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
  53. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
  54. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  55. package/build/jetpack-compose/Progress/index.d.ts +78 -35
  56. package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
  57. package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
  58. package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
  59. package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
  60. package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
  61. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
  62. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  63. package/build/jetpack-compose/Slider/index.d.ts +34 -10
  64. package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
  65. package/build/jetpack-compose/Spacer/index.d.ts +2 -2
  66. package/build/jetpack-compose/Switch/index.d.ts +25 -47
  67. package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
  68. package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
  69. package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
  70. package/build/jetpack-compose/index.d.ts +5 -4
  71. package/build/jetpack-compose/index.d.ts.map +1 -1
  72. package/build/jetpack-compose/modifiers/animation.d.ts +44 -0
  73. package/build/jetpack-compose/modifiers/animation.d.ts.map +1 -0
  74. package/build/jetpack-compose/modifiers/index.d.ts +68 -4
  75. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  76. package/build/swift-ui/AccessoryWidgetBackground/index.d.ts +4 -0
  77. package/build/swift-ui/AccessoryWidgetBackground/index.d.ts.map +1 -0
  78. package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
  79. package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
  80. package/build/swift-ui/ControlGroup/index.d.ts +29 -0
  81. package/build/swift-ui/ControlGroup/index.d.ts.map +1 -0
  82. package/build/swift-ui/Gauge/index.d.ts.map +1 -1
  83. package/build/swift-ui/Image/index.d.ts +7 -1
  84. package/build/swift-ui/Image/index.d.ts.map +1 -1
  85. package/build/swift-ui/Label/index.d.ts.map +1 -1
  86. package/build/swift-ui/LabeledContent/index.d.ts.map +1 -1
  87. package/build/swift-ui/Menu/index.d.ts.map +1 -1
  88. package/build/swift-ui/Picker/index.d.ts.map +1 -1
  89. package/build/swift-ui/Popover/index.d.ts.map +1 -1
  90. package/build/swift-ui/ProgressView/index.d.ts +1 -5
  91. package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
  92. package/build/swift-ui/Section/index.d.ts.map +1 -1
  93. package/build/swift-ui/Slider/index.d.ts.map +1 -1
  94. package/build/swift-ui/SlotView.d.ts +5 -0
  95. package/build/swift-ui/SlotView.d.ts.map +1 -0
  96. package/build/swift-ui/Stepper/index.d.ts +3 -3
  97. package/build/swift-ui/Stepper/index.d.ts.map +1 -1
  98. package/build/swift-ui/Text/index.d.ts +33 -1
  99. package/build/swift-ui/Text/index.d.ts.map +1 -1
  100. package/build/swift-ui/index.d.ts +2 -0
  101. package/build/swift-ui/index.d.ts.map +1 -1
  102. package/build/swift-ui/modifiers/index.d.ts +54 -1
  103. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  104. package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
  105. package/build/swift-ui/types.d.ts +7 -0
  106. package/build/swift-ui/types.d.ts.map +1 -1
  107. package/expo-module.config.json +1 -1
  108. package/ios/AccessoryWidgetBackgroundView.swift +27 -0
  109. package/ios/BottomSheetView.swift +1 -6
  110. package/ios/ClosedRangeDateRecord.swift +10 -0
  111. package/ios/ColorPickerView.swift +9 -8
  112. package/ios/ConfirmationDialog/ConfirmationDialog.swift +7 -15
  113. package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +0 -5
  114. package/ios/ContextMenu/ContextMenu.swift +27 -22
  115. package/ios/ContextMenu/ContextMenuRecords.swift +0 -6
  116. package/ios/ControlGroupView.swift +33 -0
  117. package/ios/DatePickerView.swift +7 -5
  118. package/ios/DisclosureGroupView.swift +5 -7
  119. package/ios/ExpoUIModule.swift +10 -32
  120. package/ios/GaugeView.swift +4 -26
  121. package/ios/HostView.swift +1 -2
  122. package/ios/ImageView.swift +22 -11
  123. package/ios/Label.swift +2 -17
  124. package/ios/LabeledContentView.swift +3 -27
  125. package/ios/ListView.swift +6 -14
  126. package/ios/Menu/MenuRecords.swift +0 -2
  127. package/ios/Menu/MenuView.swift +2 -5
  128. package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
  129. package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
  130. package/ios/Modifiers/ResizableModifier.swift +24 -0
  131. package/ios/Modifiers/Rotation3DEffectModifier.swift +20 -0
  132. package/ios/Modifiers/View+ModifierArray.swift +29 -0
  133. package/ios/Modifiers/ViewModifierRegistry.swift +37 -3
  134. package/ios/Modifiers/WidgetModifiers.swift +46 -0
  135. package/ios/Picker/PickerView.swift +8 -16
  136. package/ios/Popover/PopoverProps.swift +0 -4
  137. package/ios/Popover/PopoverView.swift +5 -11
  138. package/ios/ProgressView.swift +0 -5
  139. package/ios/RNHostView.swift +91 -10
  140. package/ios/SectionView.swift +9 -17
  141. package/ios/SecureFieldView.swift +0 -1
  142. package/ios/ShareLink/ShareLinkView.swift +1 -1
  143. package/ios/SliderView.swift +16 -31
  144. package/ios/SlotView.swift +38 -0
  145. package/ios/StepperView.swift +12 -16
  146. package/ios/TextFieldView.swift +0 -1
  147. package/ios/TextView.swift +37 -1
  148. package/ios/Toggle/ToggleView.swift +5 -7
  149. package/ios/UIBaseView.swift +34 -3
  150. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar +0 -0
  151. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +1 -0
  152. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +1 -0
  153. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +1 -0
  154. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +1 -0
  155. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar +0 -0
  156. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5 +1 -0
  157. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +1 -0
  158. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +1 -0
  159. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +1 -0
  160. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.module → 55.0.3/expo.modules.ui-55.0.3.module} +22 -22
  161. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +1 -0
  162. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +1 -0
  163. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +1 -0
  164. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +1 -0
  165. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.pom → 55.0.3/expo.modules.ui-55.0.3.pom} +1 -1
  166. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +1 -0
  167. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +1 -0
  168. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +1 -0
  169. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512 +1 -0
  170. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  171. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  172. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  173. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  174. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  175. package/package.json +5 -2
  176. package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
  177. package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
  178. package/src/jetpack-compose/Button/index.tsx +69 -92
  179. package/src/jetpack-compose/Card/index.tsx +105 -29
  180. package/src/jetpack-compose/Checkbox/index.tsx +126 -0
  181. package/src/jetpack-compose/Chip/index.tsx +391 -51
  182. package/src/jetpack-compose/DatePicker/index.tsx +215 -6
  183. package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
  184. package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
  185. package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
  186. package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
  187. package/src/jetpack-compose/IconButton/index.tsx +49 -56
  188. package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
  189. package/src/jetpack-compose/Progress/index.tsx +120 -62
  190. package/src/jetpack-compose/RadioButton/index.tsx +8 -9
  191. package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
  192. package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
  193. package/src/jetpack-compose/Slider/index.tsx +76 -29
  194. package/src/jetpack-compose/Spacer/index.tsx +2 -2
  195. package/src/jetpack-compose/Switch/index.tsx +32 -84
  196. package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
  197. package/src/jetpack-compose/index.ts +5 -4
  198. package/src/jetpack-compose/modifiers/animation.ts +37 -0
  199. package/src/jetpack-compose/modifiers/index.ts +86 -6
  200. package/src/swift-ui/AccessoryWidgetBackground/index.tsx +12 -0
  201. package/src/swift-ui/ConfirmationDialog/index.tsx +4 -12
  202. package/src/swift-ui/ContextMenu/index.tsx +6 -20
  203. package/src/swift-ui/ControlGroup/index.tsx +59 -0
  204. package/src/swift-ui/Gauge/index.tsx +5 -20
  205. package/src/swift-ui/Image/index.tsx +7 -1
  206. package/src/swift-ui/Label/index.tsx +2 -5
  207. package/src/swift-ui/LabeledContent/index.tsx +3 -12
  208. package/src/swift-ui/Menu/index.tsx +2 -6
  209. package/src/swift-ui/Picker/index.tsx +4 -11
  210. package/src/swift-ui/Popover/index.tsx +3 -12
  211. package/src/swift-ui/ProgressView/index.tsx +1 -3
  212. package/src/swift-ui/Section/index.tsx +4 -9
  213. package/src/swift-ui/Slider/index.tsx +4 -12
  214. package/src/swift-ui/SlotView.tsx +8 -0
  215. package/src/swift-ui/Stepper/index.tsx +7 -7
  216. package/src/swift-ui/Text/index.tsx +66 -2
  217. package/src/swift-ui/index.tsx +2 -0
  218. package/src/swift-ui/modifiers/index.ts +87 -1
  219. package/src/swift-ui/types.ts +5 -0
  220. package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
  221. package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
  222. package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
  223. package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
  224. package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
  225. package/build/jetpack-compose/Button/types.d.ts +0 -5
  226. package/build/jetpack-compose/Button/types.d.ts.map +0 -1
  227. package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
  228. package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
  229. package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
  230. package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
  231. package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
  232. package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
  233. package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
  234. package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
  235. package/build/jetpack-compose/Picker/index.d.ts +0 -62
  236. package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
  237. package/build/jetpack-compose/TextButton/index.d.ts +0 -29
  238. package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
  239. package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +0 -26
  240. package/ios/ContextMenu/ContextMenuComponents.swift +0 -37
  241. package/ios/Menu/MenuComponents.swift +0 -12
  242. package/ios/Picker/PickerComponents.swift +0 -24
  243. package/ios/Popover/PopoverComponents.swift +0 -18
  244. package/ios/SectionComponents.swift +0 -34
  245. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar +0 -0
  246. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.md5 +0 -1
  247. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha1 +0 -1
  248. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha256 +0 -1
  249. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha512 +0 -1
  250. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar +0 -0
  251. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.md5 +0 -1
  252. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha1 +0 -1
  253. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha256 +0 -1
  254. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha512 +0 -1
  255. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.md5 +0 -1
  256. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha1 +0 -1
  257. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha256 +0 -1
  258. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha512 +0 -1
  259. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.md5 +0 -1
  260. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha1 +0 -1
  261. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha256 +0 -1
  262. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha512 +0 -1
  263. package/src/jetpack-compose/Button/types.ts +0 -57
  264. package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
  265. package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
  266. package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
  267. package/src/jetpack-compose/FilterChip/index.tsx +0 -89
  268. package/src/jetpack-compose/Picker/index.tsx +0 -90
  269. package/src/jetpack-compose/TextButton/index.tsx +0 -55
@@ -1,24 +1,16 @@
1
1
  package expo.modules.ui.button
2
2
 
3
3
  import android.graphics.Color
4
- import androidx.compose.foundation.layout.Row
5
- import androidx.compose.foundation.layout.RowScope
6
- import androidx.compose.foundation.layout.padding
4
+ import androidx.compose.foundation.layout.PaddingValues
7
5
  import androidx.compose.material3.ButtonDefaults
8
6
  import androidx.compose.material3.ElevatedButton
9
7
  import androidx.compose.material3.FilledTonalButton
10
- import androidx.compose.material3.Icon
11
8
  import androidx.compose.material3.OutlinedButton
12
- import androidx.compose.material3.Text
13
9
  import androidx.compose.material3.TextButton
14
10
  import androidx.compose.runtime.Composable
15
- import androidx.compose.ui.Alignment
16
- import androidx.compose.ui.Modifier
17
- import androidx.compose.ui.graphics.Shape
18
11
  import androidx.compose.ui.unit.dp
19
12
  import expo.modules.kotlin.records.Field
20
13
  import expo.modules.kotlin.records.Record
21
- import expo.modules.kotlin.types.Enumerable
22
14
  import expo.modules.kotlin.views.ComposableScope
23
15
  import expo.modules.kotlin.views.ComposeProps
24
16
  import expo.modules.kotlin.views.FunctionalComposableScope
@@ -26,180 +18,147 @@ import expo.modules.ui.ModifierList
26
18
  import expo.modules.ui.ModifierRegistry
27
19
  import expo.modules.ui.ShapeRecord
28
20
  import expo.modules.ui.compose
29
- import expo.modules.ui.getImageVector
30
- import expo.modules.ui.menu.LocalContextMenuExpanded
31
21
  import expo.modules.ui.shapeFromShapeRecord
32
22
  import java.io.Serializable
33
23
 
34
24
  open class ButtonPressedEvent() : Record, Serializable
35
25
 
36
- enum class ButtonVariant(val value: String) : Enumerable {
37
- DEFAULT("default"),
38
- BORDERED("bordered"),
39
- BORDERLESS("borderless"),
40
- OUTLINED("outlined"),
41
- ELEVATED("elevated")
42
- }
43
-
44
26
  class ButtonColors : Record {
45
- @Field
46
- val containerColor: Color? = null
47
-
48
- @Field
49
- val contentColor: Color? = null
50
-
51
- @Field
52
- val disabledContainerColor: Color? = null
27
+ @Field val containerColor: Color? = null
28
+ @Field val contentColor: Color? = null
29
+ @Field val disabledContainerColor: Color? = null
30
+ @Field val disabledContentColor: Color? = null
31
+ }
53
32
 
54
- @Field
55
- val disabledContentColor: Color? = null
33
+ class ContentPaddingRecord : Record {
34
+ @Field val start: Double? = null
35
+ @Field val top: Double? = null
36
+ @Field val end: Double? = null
37
+ @Field val bottom: Double? = null
56
38
  }
57
39
 
40
+ fun ContentPaddingRecord.toPaddingValues(): PaddingValues =
41
+ PaddingValues(
42
+ start = start?.dp ?: ButtonDefaults.ContentPadding.calculateLeftPadding(androidx.compose.ui.unit.LayoutDirection.Ltr),
43
+ top = top?.dp ?: ButtonDefaults.ContentPadding.calculateTopPadding(),
44
+ end = end?.dp ?: ButtonDefaults.ContentPadding.calculateRightPadding(androidx.compose.ui.unit.LayoutDirection.Ltr),
45
+ bottom = bottom?.dp ?: ButtonDefaults.ContentPadding.calculateBottomPadding()
46
+ )
47
+
58
48
  data class ButtonProps(
59
- val text: String = "",
60
- val variant: ButtonVariant? = ButtonVariant.DEFAULT,
61
- val elementColors: ButtonColors = ButtonColors(),
62
- val leadingIcon: String? = null,
63
- val trailingIcon: String? = null,
64
- val disabled: Boolean? = false,
49
+ val colors: ButtonColors = ButtonColors(),
50
+ val enabled: Boolean = true,
51
+ val contentPadding: ContentPaddingRecord? = null,
65
52
  val shape: ShapeRecord? = null,
66
53
  val modifiers: ModifierList = emptyList()
67
54
  ) : ComposeProps
68
55
 
69
56
  @Composable
70
- fun StyledButton(
71
- variant: ButtonVariant,
72
- colors: ButtonColors,
73
- disabled: Boolean,
74
- onPress: () -> Unit,
75
- modifier: Modifier = Modifier,
76
- shape: Shape?,
77
- content: @Composable (RowScope.() -> Unit)
57
+ fun FunctionalComposableScope.ButtonContent(
58
+ props: ButtonProps,
59
+ onClick: (ButtonPressedEvent) -> Unit
78
60
  ) {
79
- when (variant) {
80
- ButtonVariant.BORDERED -> FilledTonalButton(
81
- onPress,
82
- enabled = !disabled,
83
- content = content,
84
- colors = ButtonDefaults.filledTonalButtonColors(
85
- containerColor = colors.containerColor.compose,
86
- contentColor = colors.contentColor.compose,
87
- disabledContainerColor = colors.disabledContainerColor.compose,
88
- disabledContentColor = colors.disabledContentColor.compose
89
- ),
90
- shape = shape ?: ButtonDefaults.filledTonalShape,
91
- modifier = modifier
92
- )
93
-
94
- ButtonVariant.BORDERLESS -> TextButton(
95
- onPress,
96
- enabled = !disabled,
97
- content = content,
98
- colors = ButtonDefaults.textButtonColors(
99
- containerColor = colors.containerColor.compose,
100
- contentColor = colors.contentColor.compose,
101
- disabledContainerColor = colors.disabledContainerColor.compose,
102
- disabledContentColor = colors.disabledContentColor.compose
103
- ),
104
- shape = shape ?: ButtonDefaults.textShape,
105
- modifier = modifier
106
- )
107
-
108
- ButtonVariant.OUTLINED -> OutlinedButton(
109
- onPress,
110
- enabled = !disabled,
111
- content = content,
112
- colors = ButtonDefaults.outlinedButtonColors(
113
- containerColor = colors.containerColor.compose,
114
- contentColor = colors.contentColor.compose,
115
- disabledContainerColor = colors.disabledContainerColor.compose,
116
- disabledContentColor = colors.disabledContentColor.compose
117
- ),
118
- shape = shape ?: ButtonDefaults.outlinedShape,
119
- modifier = modifier
120
- )
121
-
122
- ButtonVariant.ELEVATED -> ElevatedButton(
123
- onPress,
124
- enabled = !disabled,
125
- content = content,
126
- colors = ButtonDefaults.elevatedButtonColors(
127
- containerColor = colors.containerColor.compose,
128
- contentColor = colors.contentColor.compose,
129
- disabledContainerColor = colors.disabledContainerColor.compose,
130
- disabledContentColor = colors.disabledContentColor.compose
131
- ),
132
- shape = shape ?: ButtonDefaults.elevatedShape,
133
- modifier = modifier
134
- )
135
-
136
- else -> androidx.compose.material3.Button(
137
- onPress,
138
- enabled = !disabled,
139
- content = content,
140
- colors = ButtonDefaults.buttonColors(
141
- containerColor = colors.containerColor.compose,
142
- contentColor = colors.contentColor.compose,
143
- disabledContainerColor = colors.disabledContainerColor.compose,
144
- disabledContentColor = colors.disabledContentColor.compose
145
- ),
146
- shape = shape ?: ButtonDefaults.shape,
147
- modifier = modifier
148
- )
61
+ androidx.compose.material3.Button(
62
+ onClick = { onClick(ButtonPressedEvent()) },
63
+ enabled = props.enabled,
64
+ contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
65
+ colors = ButtonDefaults.buttonColors(
66
+ containerColor = props.colors.containerColor.compose,
67
+ contentColor = props.colors.contentColor.compose,
68
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
69
+ disabledContentColor = props.colors.disabledContentColor.compose
70
+ ),
71
+ shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.shape,
72
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
73
+ ) {
74
+ Children(ComposableScope(rowScope = this))
149
75
  }
150
76
  }
151
77
 
152
78
  @Composable
153
- fun FunctionalComposableScope.ButtonContent(
79
+ fun FunctionalComposableScope.FilledTonalButtonContent(
154
80
  props: ButtonProps,
155
- onButtonPressed: (ButtonPressedEvent) -> Unit
81
+ onClick: (ButtonPressedEvent) -> Unit
156
82
  ) {
157
- val variant = props.variant
158
- val text = props.text
159
- val colors = props.elementColors
160
- val leadingIcon = props.leadingIcon
161
- val trailingIcon = props.trailingIcon
162
- val disabled = props.disabled
163
-
164
- // Check if this Button is inside a ContextMenu
165
- val contextMenuExpanded = LocalContextMenuExpanded.current
83
+ FilledTonalButton(
84
+ onClick = { onClick(ButtonPressedEvent()) },
85
+ enabled = props.enabled,
86
+ contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
87
+ colors = ButtonDefaults.filledTonalButtonColors(
88
+ containerColor = props.colors.containerColor.compose,
89
+ contentColor = props.colors.contentColor.compose,
90
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
91
+ disabledContentColor = props.colors.disabledContentColor.compose
92
+ ),
93
+ shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.filledTonalShape,
94
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
95
+ ) {
96
+ Children(ComposableScope(rowScope = this))
97
+ }
98
+ }
166
99
 
167
- StyledButton(
168
- variant ?: ButtonVariant.DEFAULT,
169
- colors,
170
- disabled ?: false,
171
- onPress = {
172
- // If inside ContextMenu, expand the menu
173
- contextMenuExpanded?.let { it.value = true }
174
- // Also fire the button pressed event
175
- onButtonPressed(ButtonPressedEvent())
176
- },
177
- modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
178
- shape = shapeFromShapeRecord(props.shape)
100
+ @Composable
101
+ fun FunctionalComposableScope.OutlinedButtonContent(
102
+ props: ButtonProps,
103
+ onClick: (ButtonPressedEvent) -> Unit
104
+ ) {
105
+ OutlinedButton(
106
+ onClick = { onClick(ButtonPressedEvent()) },
107
+ enabled = props.enabled,
108
+ contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
109
+ colors = ButtonDefaults.outlinedButtonColors(
110
+ containerColor = props.colors.containerColor.compose,
111
+ contentColor = props.colors.contentColor.compose,
112
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
113
+ disabledContentColor = props.colors.disabledContentColor.compose
114
+ ),
115
+ shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.outlinedShape,
116
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
179
117
  ) {
180
- Row(verticalAlignment = Alignment.CenterVertically) {
181
- Children(ComposableScope(rowScope = this))
182
- leadingIcon?.let { iconName ->
183
- getImageVector(iconName)?.let {
184
- Icon(
185
- it,
186
- contentDescription = iconName,
187
- modifier = Modifier.padding(end = 8.dp)
188
- )
189
- }
190
- }
118
+ Children(ComposableScope(rowScope = this))
119
+ }
120
+ }
191
121
 
192
- Text(text)
122
+ @Composable
123
+ fun FunctionalComposableScope.ElevatedButtonContent(
124
+ props: ButtonProps,
125
+ onClick: (ButtonPressedEvent) -> Unit
126
+ ) {
127
+ ElevatedButton(
128
+ onClick = { onClick(ButtonPressedEvent()) },
129
+ enabled = props.enabled,
130
+ contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
131
+ colors = ButtonDefaults.elevatedButtonColors(
132
+ containerColor = props.colors.containerColor.compose,
133
+ contentColor = props.colors.contentColor.compose,
134
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
135
+ disabledContentColor = props.colors.disabledContentColor.compose
136
+ ),
137
+ shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.elevatedShape,
138
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
139
+ ) {
140
+ Children(ComposableScope(rowScope = this))
141
+ }
142
+ }
193
143
 
194
- trailingIcon?.let { iconName ->
195
- getImageVector(iconName)?.let {
196
- Icon(
197
- it,
198
- contentDescription = iconName,
199
- modifier = Modifier.padding(start = 8.dp)
200
- )
201
- }
202
- }
203
- }
144
+ @Composable
145
+ fun FunctionalComposableScope.TextButtonContent(
146
+ props: ButtonProps,
147
+ onClick: (ButtonPressedEvent) -> Unit
148
+ ) {
149
+ TextButton(
150
+ onClick = { onClick(ButtonPressedEvent()) },
151
+ enabled = props.enabled,
152
+ contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.TextButtonContentPadding,
153
+ colors = ButtonDefaults.textButtonColors(
154
+ containerColor = props.colors.containerColor.compose,
155
+ contentColor = props.colors.contentColor.compose,
156
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
157
+ disabledContentColor = props.colors.disabledContentColor.compose
158
+ ),
159
+ shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.textShape,
160
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
161
+ ) {
162
+ Children(ComposableScope(rowScope = this))
204
163
  }
205
164
  }
@@ -0,0 +1,92 @@
1
+ package expo.modules.ui.button
2
+
3
+ import android.graphics.Color
4
+ import androidx.compose.material3.ExtendedFloatingActionButton
5
+ import androidx.compose.material3.FloatingActionButton
6
+ import androidx.compose.material3.FloatingActionButtonDefaults
7
+ import androidx.compose.material3.LargeFloatingActionButton
8
+ import androidx.compose.material3.SmallFloatingActionButton
9
+ import androidx.compose.runtime.Composable
10
+ import expo.modules.kotlin.types.Enumerable
11
+ import expo.modules.kotlin.views.ComposableScope
12
+ import expo.modules.kotlin.views.ComposeProps
13
+ import expo.modules.kotlin.views.FunctionalComposableScope
14
+ import expo.modules.ui.ModifierList
15
+ import expo.modules.ui.ModifierRegistry
16
+ import expo.modules.ui.compose
17
+ import expo.modules.ui.findChildSlotView
18
+
19
+ enum class FloatingActionButtonVariant(val value: String) : Enumerable {
20
+ SMALL("small"),
21
+ MEDIUM("medium"),
22
+ LARGE("large"),
23
+ EXTENDED("extended")
24
+ }
25
+
26
+ data class FloatingActionButtonProps(
27
+ val variant: FloatingActionButtonVariant = FloatingActionButtonVariant.MEDIUM,
28
+ val expanded: Boolean = true,
29
+ val containerColor: Color? = null,
30
+ val modifiers: ModifierList = emptyList()
31
+ ) : ComposeProps
32
+
33
+ @Composable
34
+ fun FunctionalComposableScope.FloatingActionButtonContent(
35
+ props: FloatingActionButtonProps,
36
+ onClick: () -> Unit
37
+ ) {
38
+ val containerColor = props.containerColor?.compose ?: FloatingActionButtonDefaults.containerColor
39
+ val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
40
+
41
+ val iconSlotView = findChildSlotView(view, "icon")
42
+ val iconContent: (@Composable () -> Unit) = iconSlotView?.let {
43
+ {
44
+ with(ComposableScope()) {
45
+ with(it) {
46
+ Content()
47
+ }
48
+ }
49
+ }
50
+ } ?: {}
51
+
52
+ when (props.variant) {
53
+ FloatingActionButtonVariant.SMALL -> SmallFloatingActionButton(
54
+ onClick = onClick,
55
+ containerColor = containerColor,
56
+ modifier = modifier,
57
+ content = iconContent
58
+ )
59
+ FloatingActionButtonVariant.LARGE -> LargeFloatingActionButton(
60
+ onClick = onClick,
61
+ containerColor = containerColor,
62
+ modifier = modifier,
63
+ content = iconContent
64
+ )
65
+ FloatingActionButtonVariant.EXTENDED -> {
66
+ val textSlotView = findChildSlotView(view, "text")
67
+ val textContent: (@Composable () -> Unit) = textSlotView?.let {
68
+ {
69
+ with(ComposableScope()) {
70
+ with(it) {
71
+ Content()
72
+ }
73
+ }
74
+ }
75
+ } ?: {}
76
+ ExtendedFloatingActionButton(
77
+ onClick = onClick,
78
+ expanded = props.expanded,
79
+ icon = iconContent,
80
+ text = textContent,
81
+ containerColor = containerColor,
82
+ modifier = modifier
83
+ )
84
+ }
85
+ FloatingActionButtonVariant.MEDIUM -> FloatingActionButton(
86
+ onClick = onClick,
87
+ containerColor = containerColor,
88
+ modifier = modifier,
89
+ content = iconContent
90
+ )
91
+ }
92
+ }
@@ -1,107 +1,100 @@
1
1
  package expo.modules.ui.button
2
2
 
3
- import androidx.compose.material3.ButtonDefaults
3
+ import androidx.compose.material3.FilledIconButton
4
4
  import androidx.compose.material3.FilledTonalIconButton
5
5
  import androidx.compose.material3.IconButton
6
6
  import androidx.compose.material3.IconButtonDefaults
7
7
  import androidx.compose.material3.OutlinedIconButton
8
8
  import androidx.compose.runtime.Composable
9
- import androidx.compose.ui.Modifier
10
- import androidx.compose.ui.graphics.Shape
11
- import expo.modules.kotlin.types.Enumerable
12
9
  import expo.modules.kotlin.views.ComposableScope
13
- import expo.modules.kotlin.views.ComposeProps
14
10
  import expo.modules.kotlin.views.FunctionalComposableScope
15
- import expo.modules.ui.ModifierList
16
11
  import expo.modules.ui.ModifierRegistry
17
- import expo.modules.ui.ShapeRecord
18
12
  import expo.modules.ui.compose
19
13
  import expo.modules.ui.shapeFromShapeRecord
20
14
 
21
- enum class IconButtonVariant(val value: String) : Enumerable {
22
- DEFAULT("default"),
23
- BORDERED("bordered"),
24
- OUTLINED("outlined")
15
+ @Composable
16
+ fun FunctionalComposableScope.IconButtonContent(
17
+ props: ButtonProps,
18
+ onButtonPressed: (ButtonPressedEvent) -> Unit
19
+ ) {
20
+ val shape = shapeFromShapeRecord(props.shape)
21
+ IconButton(
22
+ onClick = { onButtonPressed(ButtonPressedEvent()) },
23
+ enabled = props.enabled,
24
+ colors = IconButtonDefaults.iconButtonColors(
25
+ containerColor = props.colors.containerColor.compose,
26
+ contentColor = props.colors.contentColor.compose,
27
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
28
+ disabledContentColor = props.colors.disabledContentColor.compose
29
+ ),
30
+ shape = shape ?: IconButtonDefaults.standardShape,
31
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
32
+ ) {
33
+ Children(ComposableScope())
34
+ }
25
35
  }
26
36
 
27
- data class IconButtonProps(
28
- val variant: IconButtonVariant? = IconButtonVariant.DEFAULT,
29
- val elementColors: ButtonColors = ButtonColors(),
30
- val disabled: Boolean? = false,
31
- val shape: ShapeRecord? = null,
32
- val modifiers: ModifierList = emptyList()
33
- ) : ComposeProps
34
-
35
37
  @Composable
36
- fun StyledIconButton(
37
- variant: IconButtonVariant,
38
- colors: ButtonColors,
39
- disabled: Boolean,
40
- onPress: () -> Unit,
41
- modifier: Modifier = Modifier,
42
- shape: Shape?,
43
- content: @Composable (() -> Unit)
38
+ fun FunctionalComposableScope.FilledIconButtonContent(
39
+ props: ButtonProps,
40
+ onButtonPressed: (ButtonPressedEvent) -> Unit
44
41
  ) {
45
- when (variant) {
46
- IconButtonVariant.BORDERED -> FilledTonalIconButton(
47
- onPress,
48
- enabled = !disabled,
49
- content = content,
50
- colors = IconButtonDefaults.filledTonalIconButtonColors(
51
- containerColor = colors.containerColor.compose,
52
- contentColor = colors.contentColor.compose,
53
- disabledContainerColor = colors.disabledContainerColor.compose,
54
- disabledContentColor = colors.disabledContentColor.compose
55
- ),
56
- shape = shape ?: ButtonDefaults.filledTonalShape,
57
- modifier = modifier
58
- )
59
-
60
- IconButtonVariant.OUTLINED -> OutlinedIconButton(
61
- onPress,
62
- enabled = !disabled,
63
- content = content,
64
- colors = IconButtonDefaults.outlinedIconButtonColors(
65
- containerColor = colors.containerColor.compose,
66
- contentColor = colors.contentColor.compose,
67
- disabledContainerColor = colors.disabledContainerColor.compose,
68
- disabledContentColor = colors.disabledContentColor.compose
69
- ),
70
- shape = shape ?: ButtonDefaults.outlinedShape,
71
- modifier = modifier
72
- )
73
-
74
- else -> IconButton(
75
- onPress,
76
- enabled = !disabled,
77
- content = content,
78
- colors = IconButtonDefaults.iconButtonColors(
79
- containerColor = colors.containerColor.compose,
80
- contentColor = colors.contentColor.compose,
81
- disabledContainerColor = colors.disabledContainerColor.compose,
82
- disabledContentColor = colors.disabledContentColor.compose
83
- ),
84
- modifier = modifier
85
- )
42
+ val shape = shapeFromShapeRecord(props.shape)
43
+ FilledIconButton(
44
+ onClick = { onButtonPressed(ButtonPressedEvent()) },
45
+ enabled = props.enabled,
46
+ colors = IconButtonDefaults.filledIconButtonColors(
47
+ containerColor = props.colors.containerColor.compose,
48
+ contentColor = props.colors.contentColor.compose,
49
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
50
+ disabledContentColor = props.colors.disabledContentColor.compose
51
+ ),
52
+ shape = shape ?: IconButtonDefaults.filledShape,
53
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
54
+ ) {
55
+ Children(ComposableScope())
86
56
  }
87
57
  }
88
58
 
89
59
  @Composable
90
- fun FunctionalComposableScope.IconButtonContent(
91
- props: IconButtonProps,
60
+ fun FunctionalComposableScope.FilledTonalIconButtonContent(
61
+ props: ButtonProps,
92
62
  onButtonPressed: (ButtonPressedEvent) -> Unit
93
63
  ) {
94
- val variant = props.variant
95
- val colors = props.elementColors
96
- val disabled = props.disabled
64
+ val shape = shapeFromShapeRecord(props.shape)
65
+ FilledTonalIconButton(
66
+ onClick = { onButtonPressed(ButtonPressedEvent()) },
67
+ enabled = props.enabled,
68
+ colors = IconButtonDefaults.filledTonalIconButtonColors(
69
+ containerColor = props.colors.containerColor.compose,
70
+ contentColor = props.colors.contentColor.compose,
71
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
72
+ disabledContentColor = props.colors.disabledContentColor.compose
73
+ ),
74
+ shape = shape ?: IconButtonDefaults.filledShape,
75
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
76
+ ) {
77
+ Children(ComposableScope())
78
+ }
79
+ }
97
80
 
98
- StyledIconButton(
99
- variant ?: IconButtonVariant.DEFAULT,
100
- colors,
101
- disabled ?: false,
102
- onPress = { onButtonPressed(ButtonPressedEvent()) },
103
- modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
104
- shape = shapeFromShapeRecord(props.shape)
81
+ @Composable
82
+ fun FunctionalComposableScope.OutlinedIconButtonContent(
83
+ props: ButtonProps,
84
+ onButtonPressed: (ButtonPressedEvent) -> Unit
85
+ ) {
86
+ val shape = shapeFromShapeRecord(props.shape)
87
+ OutlinedIconButton(
88
+ onClick = { onButtonPressed(ButtonPressedEvent()) },
89
+ enabled = props.enabled,
90
+ colors = IconButtonDefaults.outlinedIconButtonColors(
91
+ containerColor = props.colors.containerColor.compose,
92
+ contentColor = props.colors.contentColor.compose,
93
+ disabledContainerColor = props.colors.disabledContainerColor.compose,
94
+ disabledContentColor = props.colors.disabledContentColor.compose
95
+ ),
96
+ shape = shape ?: IconButtonDefaults.outlinedShape,
97
+ modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
105
98
  ) {
106
99
  Children(ComposableScope())
107
100
  }
@@ -0,0 +1,26 @@
1
+ package expo.modules.ui.convertibles
2
+
3
+ import androidx.compose.animation.core.AnimationSpec
4
+ import androidx.compose.animation.core.animateFloatAsState
5
+ import androidx.compose.animation.core.snap
6
+ import androidx.compose.animation.core.spring
7
+ import androidx.compose.runtime.Composable
8
+ import androidx.compose.runtime.getValue
9
+
10
+ @Composable
11
+ fun resolveAnimatable(map: Map<String, Any?>, key: String, default: Float): Float {
12
+ val raw = map[key]
13
+ val targetValue = when {
14
+ raw is Number -> raw.toFloat()
15
+ raw is Map<*, *> && raw["\$animated"] == true ->
16
+ (raw["targetValue"] as Number).toFloat()
17
+ else -> default
18
+ }
19
+ val spec: AnimationSpec<Float> = when {
20
+ raw is Map<*, *> && raw["\$animated"] == true ->
21
+ parseAnimationSpec(raw["animationSpec"]) ?: spring()
22
+ else -> snap()
23
+ }
24
+ val animated by animateFloatAsState(targetValue, spec, label = key)
25
+ return animated
26
+ }