@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,13 +1,103 @@
1
1
  import { requireNativeView } from 'expo';
2
2
  import { type ColorValue } from 'react-native';
3
3
 
4
- import { ExpoModifier, ViewEvent } from '../../types';
4
+ import type { ModifierConfig, ViewEvent } from '../../types';
5
5
  import { createViewModifierEventListener } from '../modifiers/utils';
6
6
 
7
7
  export type AndroidVariant = 'picker' | 'input';
8
8
 
9
9
  export type DisplayedComponents = 'date' | 'hourAndMinute' | 'dateAndTime';
10
10
 
11
+ /**
12
+ * Color overrides for the Material 3 DatePicker component.
13
+ * All properties are optional — unset values use Material 3 theme defaults.
14
+ */
15
+ export type DatePickerElementColors = {
16
+ /** The background color of the date picker. */
17
+ containerColor?: ColorValue;
18
+ /** The color used for the date picker's title. */
19
+ titleContentColor?: ColorValue;
20
+ /** The color used for the date picker's headline. */
21
+ headlineContentColor?: ColorValue;
22
+ /** The color used for the weekday letters (Mon, Tue, etc.). */
23
+ weekdayContentColor?: ColorValue;
24
+ /** The color used for the month and year subhead labels. */
25
+ subheadContentColor?: ColorValue;
26
+ /** The color used for navigation arrows and year selection menu button. */
27
+ navigationContentColor?: ColorValue;
28
+ /** The color used for year item content. */
29
+ yearContentColor?: ColorValue;
30
+ /** The color used for disabled year item content. */
31
+ disabledYearContentColor?: ColorValue;
32
+ /** The color used for the current year content. */
33
+ currentYearContentColor?: ColorValue;
34
+ /** The color used for the selected year content. */
35
+ selectedYearContentColor?: ColorValue;
36
+ /** The color used for a disabled selected year content. */
37
+ disabledSelectedYearContentColor?: ColorValue;
38
+ /** The color used for the selected year container/background. */
39
+ selectedYearContainerColor?: ColorValue;
40
+ /** The color used for a disabled selected year container. */
41
+ disabledSelectedYearContainerColor?: ColorValue;
42
+ /** The color used for day content (number text). */
43
+ dayContentColor?: ColorValue;
44
+ /** The color used for disabled day content. */
45
+ disabledDayContentColor?: ColorValue;
46
+ /** The color used for selected day content. */
47
+ selectedDayContentColor?: ColorValue;
48
+ /** The color used for a disabled selected day content. */
49
+ disabledSelectedDayContentColor?: ColorValue;
50
+ /** The color used for the selected day container/background circle. */
51
+ selectedDayContainerColor?: ColorValue;
52
+ /** The color used for a disabled selected day container. */
53
+ disabledSelectedDayContainerColor?: ColorValue;
54
+ /** The color used for today's date text. */
55
+ todayContentColor?: ColorValue;
56
+ /** The color used for today's date border. */
57
+ todayDateBorderColor?: ColorValue;
58
+ /** The content color for days within a date range selection. */
59
+ dayInSelectionRangeContentColor?: ColorValue;
60
+ /** The container color for days within a date range selection. */
61
+ dayInSelectionRangeContainerColor?: ColorValue;
62
+ /** The color used for divider lines. */
63
+ dividerColor?: ColorValue;
64
+ };
65
+
66
+ /**
67
+ * Color overrides for the Material 3 TimePicker component.
68
+ * All properties are optional — unset values use Material 3 theme defaults.
69
+ */
70
+ export type TimePickerElementColors = {
71
+ /** The container/background color of the time picker. */
72
+ containerColor?: ColorValue;
73
+ /** The background color of the clock dial. */
74
+ clockDialColor?: ColorValue;
75
+ /** The color of clock dial numbers when selected or overlapping the selector. */
76
+ clockDialSelectedContentColor?: ColorValue;
77
+ /** The color of clock dial numbers when unselected. */
78
+ clockDialUnselectedContentColor?: ColorValue;
79
+ /** The color of the clock dial selector (hand). */
80
+ selectorColor?: ColorValue;
81
+ /** The border color of the AM/PM period selector. */
82
+ periodSelectorBorderColor?: ColorValue;
83
+ /** The background color of the selected AM/PM period. */
84
+ periodSelectorSelectedContainerColor?: ColorValue;
85
+ /** The background color of the unselected AM/PM period. */
86
+ periodSelectorUnselectedContainerColor?: ColorValue;
87
+ /** The text color of the selected AM/PM period. */
88
+ periodSelectorSelectedContentColor?: ColorValue;
89
+ /** The text color of the unselected AM/PM period. */
90
+ periodSelectorUnselectedContentColor?: ColorValue;
91
+ /** The background color of the selected hour/minute segment. */
92
+ timeSelectorSelectedContainerColor?: ColorValue;
93
+ /** The background color of the unselected hour/minute segment. */
94
+ timeSelectorUnselectedContainerColor?: ColorValue;
95
+ /** The text color of the selected hour/minute segment. */
96
+ timeSelectorSelectedContentColor?: ColorValue;
97
+ /** The text color of the unselected hour/minute segment. */
98
+ timeSelectorUnselectedContentColor?: ColorValue;
99
+ };
100
+
11
101
  export type DateTimePickerProps = {
12
102
  /**
13
103
  * The initial date to display on the picker.
@@ -37,29 +127,58 @@ export type DateTimePickerProps = {
37
127
  displayedComponents?: DisplayedComponents;
38
128
  /**
39
129
  * The tint color to use on the picker elements.
130
+ * When `elementColors` is not provided, this color is applied to a subset of
131
+ * picker elements (selected day, title, headline, today border for date picker;
132
+ * selector, selected time segment, clock dial for time picker).
40
133
  */
41
134
  color?: ColorValue;
135
+ /**
136
+ * Fine-grained color overrides for individual picker elements.
137
+ * When provided, these take precedence over the `color` prop.
138
+ * Date picker color keys are used when `displayedComponents` is 'date' or 'dateAndTime'.
139
+ * Time picker color keys are used when `displayedComponents` is 'hourAndMinute'.
140
+ * Unset values fall back to Material 3 theme defaults.
141
+ */
142
+ elementColors?: DatePickerElementColors & TimePickerElementColors;
42
143
  /**
43
144
  * Determines what format the clock should be displayed in on Android.
44
145
  * @default true
45
146
  */
46
147
  is24Hour?: boolean;
148
+ /**
149
+ * Constrains which dates can be selected. Mirrors the native Compose `selectableDates` parameter.
150
+ * `start` is the earliest selectable date, `end` is the latest.
151
+ */
152
+ selectableDates?: { start?: Date; end?: Date };
47
153
  /**
48
154
  * Modifiers for the component.
49
155
  */
50
- modifiers?: ExpoModifier[];
156
+ modifiers?: ModifierConfig[];
51
157
  };
52
158
 
53
159
  type NativeDatePickerProps = Omit<
54
160
  DateTimePickerProps,
55
- 'variant' | 'onDateSelected' | 'initialDate'
161
+ 'variant' | 'onDateSelected' | 'initialDate' | 'elementColors' | 'selectableDates'
56
162
  > & {
57
163
  variant?: AndroidVariant;
58
164
  initialDate?: number | null;
165
+ selectableDates?: { start?: number | null; end?: number | null } | null;
166
+ elementColors?: DatePickerElementColors & TimePickerElementColors;
59
167
  } & ViewEvent<'onDateSelected', { date: Date }>;
60
168
 
169
+ function convertSelectableDates(selectableDates?: {
170
+ start?: Date;
171
+ end?: Date;
172
+ }): { start?: number | null; end?: number | null } | null {
173
+ if (!selectableDates) return null;
174
+ return {
175
+ start: selectableDates.start ? selectableDates.start.getTime() : null,
176
+ end: selectableDates.end ? selectableDates.end.getTime() : null,
177
+ };
178
+ }
179
+
61
180
  function transformDateTimePickerProps(props: DateTimePickerProps): NativeDatePickerProps {
62
- const { modifiers, variant, initialDate, ...rest } = props;
181
+ const { modifiers, variant, initialDate, selectableDates, elementColors, color, ...rest } = props;
63
182
 
64
183
  // Convert ISO string to timestamp for Android
65
184
  const initialDateTimestamp = initialDate ? new Date(initialDate).getTime() : null;
@@ -68,11 +187,14 @@ function transformDateTimePickerProps(props: DateTimePickerProps): NativeDatePic
68
187
  modifiers,
69
188
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
70
189
  ...rest,
190
+ color,
71
191
  initialDate: initialDateTimestamp,
192
+ selectableDates: convertSelectableDates(selectableDates),
72
193
  onDateSelected: ({ nativeEvent: { date } }) => {
73
- props?.onDateSelected?.(new Date(date));
194
+ props.onDateSelected?.(new Date(date));
74
195
  },
75
196
  variant,
197
+ ...(elementColors != null ? { elementColors } : undefined),
76
198
  };
77
199
  }
78
200
 
@@ -82,8 +204,95 @@ const DatePickerNativeView: React.ComponentType<NativeDatePickerProps> = require
82
204
  );
83
205
 
84
206
  /**
85
- * Renders a `DateTimePicker` component.
207
+ * Renders an inline `DateTimePicker` component.
86
208
  */
87
209
  export function DateTimePicker(props: DateTimePickerProps) {
88
210
  return <DatePickerNativeView {...transformDateTimePickerProps(props)} />;
89
211
  }
212
+
213
+ // -- Dialog views (used internally by the compat layer) ---------------------
214
+
215
+ export type DatePickerDialogProps = {
216
+ initialDate?: string | null;
217
+ variant?: AndroidVariant;
218
+ showVariantToggle?: boolean;
219
+ confirmButtonLabel?: string;
220
+ dismissButtonLabel?: string;
221
+ color?: ColorValue;
222
+ elementColors?: DatePickerElementColors & TimePickerElementColors;
223
+ selectableDates?: { start?: Date; end?: Date };
224
+ onDateSelected?: (date: Date) => void;
225
+ onDismissRequest: () => void;
226
+ };
227
+
228
+ type NativeDatePickerDialogProps = Omit<
229
+ DatePickerDialogProps,
230
+ | 'variant'
231
+ | 'onDateSelected'
232
+ | 'onDismissRequest'
233
+ | 'initialDate'
234
+ | 'elementColors'
235
+ | 'selectableDates'
236
+ > & {
237
+ variant?: AndroidVariant;
238
+ initialDate?: number | null;
239
+ selectableDates?: { start?: number | null; end?: number | null } | null;
240
+ elementColors?: DatePickerElementColors & TimePickerElementColors;
241
+ } & ViewEvent<'onDateSelected', { date: Date }> &
242
+ ViewEvent<'onDismissRequest', void>;
243
+
244
+ const DatePickerDialogNativeView: React.ComponentType<NativeDatePickerDialogProps> =
245
+ requireNativeView('ExpoUI', 'DatePickerDialogView');
246
+
247
+ export function DatePickerDialog(props: DatePickerDialogProps) {
248
+ const { variant, initialDate, selectableDates, elementColors, onDismissRequest, ...rest } = props;
249
+ const nativeProps: NativeDatePickerDialogProps = {
250
+ ...rest,
251
+ variant,
252
+ initialDate: initialDate ? new Date(initialDate).getTime() : null,
253
+ selectableDates: convertSelectableDates(selectableDates),
254
+ onDateSelected: ({ nativeEvent: { date } }) => {
255
+ props.onDateSelected?.(new Date(date));
256
+ },
257
+ onDismissRequest,
258
+ ...(elementColors != null ? { elementColors } : undefined),
259
+ };
260
+ return <DatePickerDialogNativeView {...nativeProps} />;
261
+ }
262
+
263
+ export type TimePickerDialogProps = {
264
+ initialDate?: string | null;
265
+ is24Hour?: boolean;
266
+ confirmButtonLabel?: string;
267
+ dismissButtonLabel?: string;
268
+ color?: ColorValue;
269
+ elementColors?: DatePickerElementColors & TimePickerElementColors;
270
+ onDateSelected?: (date: Date) => void;
271
+ onDismissRequest: () => void;
272
+ };
273
+
274
+ type NativeTimePickerDialogProps = Omit<
275
+ TimePickerDialogProps,
276
+ 'onDateSelected' | 'onDismissRequest' | 'initialDate' | 'elementColors'
277
+ > & {
278
+ initialDate?: number | null;
279
+ elementColors?: DatePickerElementColors & TimePickerElementColors;
280
+ } & ViewEvent<'onDateSelected', { date: Date }> &
281
+ ViewEvent<'onDismissRequest', void>;
282
+
283
+ const TimePickerDialogNativeView: React.ComponentType<NativeTimePickerDialogProps> =
284
+ requireNativeView('ExpoUI', 'TimePickerDialogView');
285
+
286
+ export function TimePickerDialog(props: TimePickerDialogProps) {
287
+ const { initialDate, elementColors, onDismissRequest, ...rest } = props;
288
+ const nativeProps: NativeTimePickerDialogProps = {
289
+ ...rest,
290
+ initialDate: initialDate ? new Date(initialDate).getTime() : null,
291
+ onDateSelected: ({ nativeEvent: { date } }) => {
292
+ props.onDateSelected?.(new Date(date));
293
+ },
294
+ onDismissRequest,
295
+ ...(elementColors != null ? { elementColors } : undefined),
296
+ };
297
+ return <TimePickerDialogNativeView {...nativeProps} />;
298
+ }
@@ -0,0 +1,126 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { ColorValue } from 'react-native';
3
+
4
+ import { ModifierConfig, ViewEvent } from '../../types';
5
+ import { createViewModifierEventListener } from '../modifiers/utils';
6
+
7
+ type SlotNativeViewProps = {
8
+ slotName: string;
9
+ children: React.ReactNode;
10
+ };
11
+
12
+ const SlotNativeView: React.ComponentType<SlotNativeViewProps> = requireNativeView(
13
+ 'ExpoUI',
14
+ 'SlotView'
15
+ );
16
+
17
+ /**
18
+ * Color overrides for the `DropdownMenuItem` component.
19
+ */
20
+ export type DropdownMenuItemElementColors = {
21
+ /** Color of the menu item text. */
22
+ textColor?: ColorValue;
23
+ /** Color of the text when the menu item is disabled. */
24
+ disabledTextColor?: ColorValue;
25
+ // TODO: At the moment IconView's tint color defaults to Color.Unspecified instead of LocalContentColor.current.
26
+ // Thus the color override will not work for icons. At the moment icon color can only be set directly in IconView.
27
+ // leadingIconColor?: ColorValue;
28
+ // trailingIconColor?: ColorValue;
29
+ // disabledLeadingIconColor?: ColorValue;
30
+ // disabledTrailingIconColor?: ColorValue;
31
+ };
32
+
33
+ /**
34
+ * Props of the `DropdownMenuItem` component.
35
+ */
36
+ export type DropdownMenuItemProps = {
37
+ /**
38
+ * Whether the menu item is enabled.
39
+ * @default true
40
+ */
41
+ enabled?: boolean;
42
+ /**
43
+ * Color overrides for the menu item.
44
+ */
45
+ elementColors?: DropdownMenuItemElementColors;
46
+ /**
47
+ * Modifiers for the component.
48
+ */
49
+ modifiers?: ModifierConfig[];
50
+ /**
51
+ * Callback that is called when the menu item is clicked.
52
+ */
53
+ onClick?: () => void;
54
+ /**
55
+ * Slot children for text, leading/trailing icons.
56
+ */
57
+ children?: React.ReactNode;
58
+ };
59
+
60
+ type NativeDropdownMenuItemProps = Omit<DropdownMenuItemProps, 'onClick' | 'children'> &
61
+ ViewEvent<'onItemPressed', void> & { children?: React.ReactNode };
62
+
63
+ const DropdownMenuItemNativeView: React.ComponentType<NativeDropdownMenuItemProps> =
64
+ requireNativeView('ExpoUI', 'DropdownMenuItemView');
65
+
66
+ /**
67
+ * A leading icon slot for `DropdownMenuItem`.
68
+ * Wrap an `Icon` or other content to display before the menu item text.
69
+ *
70
+ * @platform android
71
+ */
72
+ function LeadingIcon(props: { children: React.ReactNode }) {
73
+ return <SlotNativeView slotName="leadingIcon">{props.children}</SlotNativeView>;
74
+ }
75
+
76
+ /**
77
+ * A trailing icon slot for `DropdownMenuItem`.
78
+ * Wrap an `Icon` or other content to display after the menu item text.
79
+ *
80
+ * @platform android
81
+ */
82
+ function TrailingIcon(props: { children: React.ReactNode }) {
83
+ return <SlotNativeView slotName="trailingIcon">{props.children}</SlotNativeView>;
84
+ }
85
+
86
+ /**
87
+ * A dropdown menu item component that wraps Compose's `DropdownMenuItem`.
88
+ * Should be used inside `DropdownMenu.Items`.
89
+ *
90
+ * @platform android
91
+ */
92
+ /**
93
+ * A text slot for `DropdownMenuItem`.
94
+ * Wrap text content to display as the menu item label.
95
+ *
96
+ * @platform android
97
+ */
98
+ function TextSlot(props: { children: React.ReactNode }) {
99
+ return <SlotNativeView slotName="text">{props.children}</SlotNativeView>;
100
+ }
101
+
102
+ /**
103
+ * A dropdown menu item component that wraps Compose's `DropdownMenuItem`.
104
+ * Should be used inside `ContextMenu.Items`.
105
+ *
106
+ * @platform android
107
+ */
108
+ function DropdownMenuItemComponent(props: DropdownMenuItemProps) {
109
+ const { onClick, modifiers, children, ...restProps } = props;
110
+ return (
111
+ <DropdownMenuItemNativeView
112
+ {...restProps}
113
+ modifiers={modifiers}
114
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
115
+ enabled={props.enabled ?? true}
116
+ onItemPressed={onClick ? () => onClick() : undefined}>
117
+ {children}
118
+ </DropdownMenuItemNativeView>
119
+ );
120
+ }
121
+
122
+ DropdownMenuItemComponent.Text = TextSlot;
123
+ DropdownMenuItemComponent.LeadingIcon = LeadingIcon;
124
+ DropdownMenuItemComponent.TrailingIcon = TrailingIcon;
125
+
126
+ export { DropdownMenuItemComponent as DropdownMenuItem };
@@ -0,0 +1,107 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { ReactNode } from 'react';
3
+ import { StyleProp, ViewStyle, type ColorValue } from 'react-native';
4
+
5
+ import { ModifierConfig } from '../../types';
6
+ import { createViewModifierEventListener } from '../modifiers/utils';
7
+
8
+ const MenuNativeView: React.ComponentType<NativeMenuProps> = requireNativeView(
9
+ 'ExpoUI',
10
+ 'DropdownMenuView'
11
+ );
12
+
13
+ // TODO: Extract into separate SlotView similar to swift-ui
14
+ const SlotNativeView: React.ComponentType<{
15
+ slotName: string;
16
+ children: React.ReactNode;
17
+ }> = requireNativeView('ExpoUI', 'SlotView');
18
+
19
+ /**
20
+ * Props of the `DropdownMenu` component.
21
+ */
22
+ export type DropdownMenuProps = {
23
+ /**
24
+ * The contents of the submenu are used as an anchor for the dropdown menu.
25
+ * The children will be wrapped in a pressable element, which triggers opening of the dropdown menu.
26
+ */
27
+ children: ReactNode;
28
+
29
+ /**
30
+ * Whether the dropdown menu is expanded (visible).
31
+ */
32
+ expanded?: boolean;
33
+
34
+ /**
35
+ * Callback fired when the menu requests to be dismissed (e.g. tapping outside).
36
+ * Must be provided when `expanded` is `true` to allow the menu to close.
37
+ */
38
+ onDismissRequest?: () => void;
39
+
40
+ /**
41
+ * The color of the container holding the dropdown menu items.
42
+ */
43
+ color?: ColorValue;
44
+
45
+ /**
46
+ * Optional styles to apply to the `DropdownMenu`.
47
+ */
48
+ style?: StyleProp<ViewStyle>;
49
+
50
+ /**
51
+ * Modifiers for the component.
52
+ */
53
+ modifiers?: ModifierConfig[];
54
+ };
55
+
56
+ type NativeMenuProps = {
57
+ expanded?: boolean;
58
+ onDismissRequest?: () => void;
59
+ color?: ColorValue;
60
+ style?: StyleProp<ViewStyle>;
61
+ modifiers?: ModifierConfig[];
62
+ children?: ReactNode;
63
+ };
64
+
65
+ /**
66
+ * Container for items displayed in the dropdown menu.
67
+ * Children should be `DropdownMenuItem` components or other native views.
68
+ */
69
+ export function Items(props: { children: ReactNode }) {
70
+ return <SlotNativeView slotName="items">{props.children}</SlotNativeView>;
71
+ }
72
+ Items.tag = 'Items';
73
+
74
+ /**
75
+ * Container for the trigger element that opens the dropdown menu.
76
+ */
77
+ export function Trigger(props: { children: ReactNode }) {
78
+ return <>{props.children}</>;
79
+ }
80
+ Trigger.tag = 'Trigger';
81
+
82
+ /**
83
+ * Preview content shown during long press (iOS only).
84
+ */
85
+ export function Preview(props: { children: ReactNode }) {
86
+ return <></>;
87
+ }
88
+
89
+ function DropdownMenu(props: DropdownMenuProps) {
90
+ const { modifiers, ...restProps } = props;
91
+ return (
92
+ <MenuNativeView
93
+ style={props.style}
94
+ modifiers={modifiers}
95
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
96
+ {...restProps}>
97
+ {props.children}
98
+ </MenuNativeView>
99
+ );
100
+ }
101
+
102
+ DropdownMenu.Trigger = Trigger;
103
+ DropdownMenu.Preview = Preview;
104
+ DropdownMenu.Items = Items;
105
+
106
+ export { DropdownMenu };
107
+ export { DropdownMenuItem } from './DropdownMenuItem';