@expo/ui 55.0.2 → 55.0.4

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 (232) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
  4. package/android/src/main/java/expo/modules/ui/BottomSheetView.kt +91 -13
  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 +258 -70
  9. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +209 -61
  10. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +44 -1
  11. package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
  12. package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
  13. package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
  14. package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
  15. package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
  16. package/android/src/main/java/expo/modules/ui/SwitchView.kt +53 -161
  17. package/android/src/main/java/expo/modules/ui/TextInputView.kt +39 -15
  18. package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
  19. package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
  20. package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
  21. package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -86
  22. package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
  23. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
  24. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
  25. package/build/datetime-picker/DateTimePicker.android.d.ts +3 -0
  26. package/build/datetime-picker/DateTimePicker.android.d.ts.map +1 -0
  27. package/build/datetime-picker/DateTimePicker.d.ts +3 -0
  28. package/build/datetime-picker/DateTimePicker.d.ts.map +1 -0
  29. package/build/datetime-picker/DateTimePicker.web.d.ts +3 -0
  30. package/build/datetime-picker/DateTimePicker.web.d.ts.map +1 -0
  31. package/build/datetime-picker/index.d.ts +5 -0
  32. package/build/datetime-picker/index.d.ts.map +1 -0
  33. package/build/datetime-picker/types.d.ts +128 -0
  34. package/build/datetime-picker/types.d.ts.map +1 -0
  35. package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
  36. package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
  37. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
  38. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
  39. package/build/jetpack-compose/Button/index.d.ts +65 -51
  40. package/build/jetpack-compose/Button/index.d.ts.map +1 -1
  41. package/build/jetpack-compose/Card/index.d.ts +72 -14
  42. package/build/jetpack-compose/Card/index.d.ts.map +1 -1
  43. package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
  44. package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
  45. package/build/jetpack-compose/Chip/index.d.ts +247 -27
  46. package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
  47. package/build/jetpack-compose/DatePicker/index.d.ts +38 -3
  48. package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
  49. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
  50. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
  51. package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
  52. package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
  53. package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
  54. package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
  55. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
  56. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
  57. package/build/jetpack-compose/IconButton/index.d.ts +45 -29
  58. package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
  59. package/build/jetpack-compose/ModalBottomSheet/index.d.ts +65 -13
  60. package/build/jetpack-compose/ModalBottomSheet/index.d.ts.map +1 -1
  61. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
  62. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  63. package/build/jetpack-compose/Progress/index.d.ts +78 -35
  64. package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
  65. package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
  66. package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
  67. package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
  68. package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
  69. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
  70. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  71. package/build/jetpack-compose/Slider/index.d.ts +34 -10
  72. package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
  73. package/build/jetpack-compose/Switch/index.d.ts +10 -50
  74. package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
  75. package/build/jetpack-compose/TextInput/index.d.ts +9 -0
  76. package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
  77. package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
  78. package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
  79. package/build/jetpack-compose/index.d.ts +5 -4
  80. package/build/jetpack-compose/index.d.ts.map +1 -1
  81. package/build/jetpack-compose/modifiers/index.d.ts +18 -1
  82. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  83. package/build/swift-ui/Link/index.d.ts +36 -0
  84. package/build/swift-ui/Link/index.d.ts.map +1 -0
  85. package/build/swift-ui/ProgressView/index.d.ts +1 -5
  86. package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
  87. package/build/swift-ui/Stepper/index.d.ts +3 -3
  88. package/build/swift-ui/Stepper/index.d.ts.map +1 -1
  89. package/build/swift-ui/Text/index.d.ts +33 -1
  90. package/build/swift-ui/Text/index.d.ts.map +1 -1
  91. package/build/swift-ui/index.d.ts +1 -0
  92. package/build/swift-ui/index.d.ts.map +1 -1
  93. package/build/swift-ui/modifiers/environment.d.ts +16 -1
  94. package/build/swift-ui/modifiers/environment.d.ts.map +1 -1
  95. package/build/swift-ui/modifiers/index.d.ts +24 -7
  96. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  97. package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
  98. package/build/swift-ui/modifiers/widgets.d.ts +14 -0
  99. package/build/swift-ui/modifiers/widgets.d.ts.map +1 -0
  100. package/build/swift-ui/types.d.ts +7 -0
  101. package/build/swift-ui/types.d.ts.map +1 -1
  102. package/expo-module.config.json +1 -1
  103. package/ios/BottomSheetView.swift +1 -6
  104. package/ios/ClosedRangeDateRecord.swift +10 -0
  105. package/ios/ColorPickerView.swift +9 -8
  106. package/ios/ConfirmationDialog/ConfirmationDialog.swift +4 -6
  107. package/ios/DatePickerView.swift +7 -5
  108. package/ios/DisclosureGroupView.swift +5 -7
  109. package/ios/ExpoUIModule.swift +1 -0
  110. package/ios/LinkView.swift +29 -0
  111. package/ios/ListView.swift +6 -14
  112. package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
  113. package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
  114. package/ios/Modifiers/EnvironmentModifier.swift +14 -0
  115. package/ios/Modifiers/ViewModifierRegistry.swift +12 -0
  116. package/ios/Modifiers/WidgetModifiers.swift +12 -0
  117. package/ios/Picker/PickerView.swift +6 -10
  118. package/ios/Popover/PopoverView.swift +3 -5
  119. package/ios/ProgressView.swift +0 -5
  120. package/ios/SectionView.swift +3 -5
  121. package/ios/SliderView.swift +8 -6
  122. package/ios/StepperView.swift +12 -16
  123. package/ios/TextView.swift +37 -1
  124. package/ios/Toggle/ToggleView.swift +5 -7
  125. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar +0 -0
  126. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.md5 +1 -0
  127. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha1 +1 -0
  128. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha256 +1 -0
  129. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha512 +1 -0
  130. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar +0 -0
  131. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.md5 +1 -0
  132. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1 +1 -0
  133. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256 +1 -0
  134. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha512 +1 -0
  135. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.module → 55.0.4/expo.modules.ui-55.0.4.module} +22 -22
  136. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5 +1 -0
  137. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1 +1 -0
  138. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256 +1 -0
  139. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha512 +1 -0
  140. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.pom → 55.0.4/expo.modules.ui-55.0.4.pom} +1 -1
  141. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5 +1 -0
  142. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1 +1 -0
  143. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256 +1 -0
  144. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha512 +1 -0
  145. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  146. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  147. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  148. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  149. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  150. package/package.json +9 -2
  151. package/src/datetime-picker/DateTimePicker.android.tsx +126 -0
  152. package/src/datetime-picker/DateTimePicker.tsx +94 -0
  153. package/src/datetime-picker/DateTimePicker.web.tsx +5 -0
  154. package/src/datetime-picker/index.tsx +11 -0
  155. package/src/datetime-picker/types.tsx +147 -0
  156. package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
  157. package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
  158. package/src/jetpack-compose/Button/index.tsx +69 -92
  159. package/src/jetpack-compose/Card/index.tsx +105 -29
  160. package/src/jetpack-compose/Checkbox/index.tsx +126 -0
  161. package/src/jetpack-compose/Chip/index.tsx +391 -51
  162. package/src/jetpack-compose/DatePicker/index.tsx +112 -7
  163. package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
  164. package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
  165. package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
  166. package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
  167. package/src/jetpack-compose/IconButton/index.tsx +49 -56
  168. package/src/jetpack-compose/ModalBottomSheet/index.tsx +85 -15
  169. package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
  170. package/src/jetpack-compose/Progress/index.tsx +120 -62
  171. package/src/jetpack-compose/RadioButton/index.tsx +8 -9
  172. package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
  173. package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
  174. package/src/jetpack-compose/Slider/index.tsx +76 -29
  175. package/src/jetpack-compose/Switch/index.tsx +17 -87
  176. package/src/jetpack-compose/TextInput/index.tsx +10 -0
  177. package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
  178. package/src/jetpack-compose/index.ts +5 -4
  179. package/src/jetpack-compose/modifiers/index.ts +26 -2
  180. package/src/swift-ui/Link/index.tsx +52 -0
  181. package/src/swift-ui/ProgressView/index.tsx +1 -3
  182. package/src/swift-ui/Stepper/index.tsx +7 -7
  183. package/src/swift-ui/Text/index.tsx +66 -2
  184. package/src/swift-ui/index.tsx +1 -0
  185. package/src/swift-ui/modifiers/environment.ts +17 -4
  186. package/src/swift-ui/modifiers/index.ts +44 -10
  187. package/src/swift-ui/modifiers/widgets.ts +18 -0
  188. package/src/swift-ui/types.ts +5 -0
  189. package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
  190. package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
  191. package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
  192. package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
  193. package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
  194. package/build/jetpack-compose/Button/types.d.ts +0 -5
  195. package/build/jetpack-compose/Button/types.d.ts.map +0 -1
  196. package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
  197. package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
  198. package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
  199. package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
  200. package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
  201. package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
  202. package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
  203. package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
  204. package/build/jetpack-compose/Picker/index.d.ts +0 -62
  205. package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
  206. package/build/jetpack-compose/TextButton/index.d.ts +0 -29
  207. package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
  208. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar +0 -0
  209. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.md5 +0 -1
  210. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +0 -1
  211. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +0 -1
  212. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +0 -1
  213. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar +0 -0
  214. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.md5 +0 -1
  215. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +0 -1
  216. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +0 -1
  217. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +0 -1
  218. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +0 -1
  219. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +0 -1
  220. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +0 -1
  221. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +0 -1
  222. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +0 -1
  223. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +0 -1
  224. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +0 -1
  225. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha512 +0 -1
  226. package/src/jetpack-compose/Button/types.ts +0 -57
  227. package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
  228. package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
  229. package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
  230. package/src/jetpack-compose/FilterChip/index.tsx +0 -89
  231. package/src/jetpack-compose/Picker/index.tsx +0 -90
  232. package/src/jetpack-compose/TextButton/index.tsx +0 -55
@@ -0,0 +1,94 @@
1
+ import { buildEvent, buildChangeEvent, type DateTimePickerProps } from './types';
2
+ import { DatePicker, type DatePickerProps } from '../swift-ui/DatePicker';
3
+ import { Host } from '../swift-ui/Host';
4
+ import { disabled as disabledModifier, ModifierConfig, tint } from '../swift-ui/modifiers';
5
+ import { datePickerStyle } from '../swift-ui/modifiers/datePickerStyle';
6
+ import { environment } from '../swift-ui/modifiers/environment';
7
+
8
+ type DatePickerStyleType = 'automatic' | 'compact' | 'graphical' | 'wheel';
9
+
10
+ function modeToDisplayedComponents(
11
+ mode: DateTimePickerProps['mode']
12
+ ): DatePickerProps['displayedComponents'] {
13
+ switch (mode) {
14
+ case 'time':
15
+ return ['hourAndMinute'];
16
+ case 'datetime':
17
+ return ['date', 'hourAndMinute'];
18
+ case 'date':
19
+ default:
20
+ return ['date'];
21
+ }
22
+ }
23
+
24
+ function displayToDatePickerStyle(display: DateTimePickerProps['display']): DatePickerStyleType {
25
+ switch (display) {
26
+ case 'spinner':
27
+ return 'wheel';
28
+ case 'compact':
29
+ return 'compact';
30
+ case 'inline':
31
+ return 'graphical';
32
+ default:
33
+ return 'automatic';
34
+ }
35
+ }
36
+
37
+ export function DateTimePicker(props: DateTimePickerProps) {
38
+ const {
39
+ value,
40
+ onChange,
41
+ onValueChange,
42
+ mode = 'date',
43
+ minimumDate,
44
+ maximumDate,
45
+ display = 'default',
46
+ testID,
47
+ style,
48
+ accentColor,
49
+ disabled,
50
+ locale,
51
+ themeVariant,
52
+ timeZoneName,
53
+ } = props;
54
+
55
+ const pickerStyle = displayToDatePickerStyle(display);
56
+
57
+ const modifiers: ModifierConfig[] = [datePickerStyle(pickerStyle)];
58
+ if (accentColor) {
59
+ modifiers.push(tint(accentColor));
60
+ }
61
+ if (disabled != null) {
62
+ modifiers.push(disabledModifier(disabled));
63
+ }
64
+ if (locale) {
65
+ modifiers.push(environment('locale', locale));
66
+ }
67
+ if (themeVariant) {
68
+ modifiers.push(environment('colorScheme', themeVariant));
69
+ }
70
+ if (timeZoneName) {
71
+ modifiers.push(environment('timeZone', timeZoneName));
72
+ }
73
+
74
+ const iosProps: DatePickerProps = {
75
+ selection: value,
76
+ displayedComponents: modeToDisplayedComponents(mode),
77
+ range: minimumDate || maximumDate ? { start: minimumDate, end: maximumDate } : undefined,
78
+ onDateChange: (date: Date) => {
79
+ if (onValueChange) {
80
+ onValueChange(buildChangeEvent(date), date);
81
+ } else {
82
+ onChange?.(buildEvent(date), date);
83
+ }
84
+ },
85
+ modifiers,
86
+ testID,
87
+ };
88
+
89
+ return (
90
+ <Host matchContents={{ vertical: true }} style={style}>
91
+ <DatePicker {...iosProps} />
92
+ </Host>
93
+ );
94
+ }
@@ -0,0 +1,5 @@
1
+ import type { DateTimePickerProps } from './types';
2
+
3
+ export function DateTimePicker(_props: DateTimePickerProps) {
4
+ return null;
5
+ }
@@ -0,0 +1,11 @@
1
+ import { DateTimePicker } from './DateTimePicker';
2
+
3
+ export {
4
+ type DateTimePickerEvent,
5
+ type DateTimePickerChangeEvent,
6
+ type DateTimePickerProps,
7
+ } from './types';
8
+
9
+ export default DateTimePicker;
10
+ // named export needed for docs generator
11
+ export { DateTimePicker };
@@ -0,0 +1,147 @@
1
+ import type { ViewProps } from 'react-native';
2
+
3
+ // -- Public types matching @react-native-community/datetimepicker ----------
4
+
5
+ /**
6
+ * @deprecated used with the deprecated `onChange` prop
7
+ * */
8
+ export type DateTimePickerEvent = {
9
+ /**
10
+ * `'set'` when the user selects a date. `'dismissed'` when the user cancels
11
+ * an Android dialog picker. iOS never fires `'dismissed'`.
12
+ */
13
+ type: 'set' | 'dismissed';
14
+ nativeEvent: {
15
+ timestamp: number;
16
+ utcOffset: number;
17
+ };
18
+ };
19
+
20
+ export type DateTimePickerChangeEvent = {
21
+ nativeEvent: {
22
+ timestamp: number;
23
+ utcOffset: number;
24
+ };
25
+ };
26
+
27
+ export type DateTimePickerProps = {
28
+ /**
29
+ * The current date value (controlled).
30
+ */
31
+ value: Date;
32
+ /**
33
+ * @deprecated Use `onValueChange` and `onDismiss` instead.
34
+ *
35
+ * Called when the user changes the date/time or dismisses the picker.
36
+ * The event type is encoded in `event.type`.
37
+ * If the new specific listeners are provided, they take precedence.
38
+ */
39
+ onChange?: (event: DateTimePickerEvent, date?: Date) => void;
40
+ /**
41
+ * Called when the user selects a date or time.
42
+ */
43
+ onValueChange?: (event: DateTimePickerChangeEvent, date: Date) => void;
44
+ /**
45
+ * Called when the picker is dismissed without selecting a value.
46
+ * @platform android
47
+ */
48
+ onDismiss?: () => void;
49
+ /**
50
+ * The picker mode.
51
+ * @default 'date'
52
+ */
53
+ mode?: 'date' | 'time' | 'datetime';
54
+ /**
55
+ * The earliest selectable date.
56
+ */
57
+ minimumDate?: Date;
58
+ /**
59
+ * The latest selectable date.
60
+ */
61
+ maximumDate?: Date;
62
+ /**
63
+ * A test ID forwarded to the native view.
64
+ * Note: on Android dialog presentation, the test ID is not forwarded.
65
+ */
66
+ testID?: string;
67
+ /**
68
+ * Display style. Android supports `'default' | 'spinner'` — `'spinner'` shows a text input
69
+ * rather than a scroll wheel (Material 3 does not have a wheel-style picker).
70
+ * iOS supports `'default' | 'spinner' | 'compact' | 'inline'`.
71
+ * @default 'default'
72
+ */
73
+ display?: 'default' | 'spinner' | 'compact' | 'inline' | 'calendar' | 'clock';
74
+ /**
75
+ * Use 24-hour format.
76
+ * @platform android
77
+ */
78
+ is24Hour?: boolean;
79
+ /**
80
+ * Accent/tint color applied to the picker.
81
+ * Maps to `color` on Android and `tint` on iOS.
82
+ */
83
+ accentColor?: string;
84
+ /**
85
+ * Whether the picker is disabled.
86
+ * @platform ios
87
+ */
88
+ disabled?: boolean;
89
+ /**
90
+ * Locale identifier (e.g. 'en_US', 'fr_FR') for the picker display.
91
+ * @platform ios
92
+ */
93
+ locale?: string;
94
+ /**
95
+ * Force a specific color scheme on the picker.
96
+ * @platform ios
97
+ */
98
+ themeVariant?: 'dark' | 'light';
99
+ /**
100
+ * IANA time zone name (e.g. 'America/New_York') for the picker display.
101
+ * @platform ios
102
+ */
103
+ timeZoneName?: string;
104
+ /**
105
+ * How the picker is presented.
106
+ * - `'inline'` renders the picker directly in the view hierarchy.
107
+ * - `'dialog'` shows a modal dialog that opens on mount. Fires `onValueChange` on confirmation, `onDismiss` on cancel. The caller should
108
+ * unmount the component in response.
109
+ *
110
+ * On iOS this prop is accepted but ignored (always inline).
111
+ * On Android the default is `'dialog'`.
112
+ * @default 'dialog'
113
+ * @platform android
114
+ */
115
+ presentation?: 'inline' | 'dialog';
116
+ /**
117
+ * Set the positive (confirm) button label.
118
+ * @platform android
119
+ */
120
+ positiveButton?: { label?: string };
121
+ /**
122
+ * Set the negative (cancel) button label.
123
+ * @platform android
124
+ */
125
+ negativeButton?: { label?: string };
126
+ } & Pick<ViewProps, 'style'>;
127
+
128
+ // -- Helpers ---------------------------------------------------------------
129
+
130
+ export function buildEvent(date: Date): DateTimePickerEvent {
131
+ return {
132
+ type: 'set',
133
+ nativeEvent: {
134
+ timestamp: date.getTime(),
135
+ utcOffset: -date.getTimezoneOffset(),
136
+ },
137
+ };
138
+ }
139
+
140
+ export function buildChangeEvent(date: Date): DateTimePickerChangeEvent {
141
+ return {
142
+ nativeEvent: {
143
+ timestamp: date.getTime(),
144
+ utcOffset: -date.getTimezoneOffset(),
145
+ },
146
+ };
147
+ }
@@ -0,0 +1,206 @@
1
+ /**
2
+ * AnimatedVisibility — a React wrapper around Jetpack Compose's AnimatedVisibility.
3
+ *
4
+ * Architecture overview:
5
+ *
6
+ * 1. **Public API** — `EnterTransition` / `ExitTransition` factory objects produce
7
+ * chainable transition descriptors via `.plus()`, mirroring Compose's `+` operator.
8
+ *
9
+ * 2. **Internal records** — Each factory call creates an `EnterTransitionRecord` or
10
+ * `ExitTransitionRecord`, a plain JSON object with a `type` discriminator and optional
11
+ * parameters. These records are the format passed to the native Android view.
12
+ *
13
+ * 3. **Symbol-based encapsulation** — The record arrays are stored behind unique Symbols
14
+ * (`ENTER_TRANSITION_SYMBOL` / `EXIT_TRANSITION_SYMBOL`). This prevents consumers from
15
+ * accessing or constructing raw records directly, ensuring transitions are only built
16
+ * through the factory API.
17
+ *
18
+ * 4. **Chaining** — `.plus(other)` concatenates the current record array with `other`'s
19
+ * records into a new transition object. The result is a flat list, not a tree.
20
+ * e.g. `fadeIn().plus(expandIn())` → `[{ type: 'fadeIn' }, { type: 'expandIn' }]`
21
+ *
22
+ * 5. **Component** — `<AnimatedVisibility>` extracts the record arrays from the chainable
23
+ * types via their Symbols and passes them as plain JSON arrays to the native view.
24
+ */
25
+ import { requireNativeView } from 'expo';
26
+
27
+ import { PrimitiveBaseProps, transformProps } from '../layout-types';
28
+ import { ENTER_TRANSITION_SYMBOL, EXIT_TRANSITION_SYMBOL } from './symbols';
29
+
30
+ type EnterTransitionRecord = {
31
+ type:
32
+ | 'fadeIn'
33
+ | 'slideInHorizontally'
34
+ | 'slideInVertically'
35
+ | 'expandIn'
36
+ | 'expandHorizontally'
37
+ | 'expandVertically'
38
+ | 'scaleIn';
39
+ initialAlpha?: number;
40
+ /** Fraction of width: -1.0 = full width left, 1.0 = full width right */
41
+ initialOffsetX?: number;
42
+ /** Fraction of height: -1.0 = full height top, 1.0 = full height bottom */
43
+ initialOffsetY?: number;
44
+ initialScale?: number;
45
+ };
46
+
47
+ type ExitTransitionRecord = {
48
+ type:
49
+ | 'fadeOut'
50
+ | 'slideOutHorizontally'
51
+ | 'slideOutVertically'
52
+ | 'shrinkOut'
53
+ | 'shrinkHorizontally'
54
+ | 'shrinkVertically'
55
+ | 'scaleOut';
56
+ targetAlpha?: number;
57
+ /** Fraction of width: -1.0 = full width left, 1.0 = full width right */
58
+ targetOffsetX?: number;
59
+ /** Fraction of height: -1.0 = full height top, 1.0 = full height bottom */
60
+ targetOffsetY?: number;
61
+ targetScale?: number;
62
+ };
63
+
64
+ /**
65
+ * Represents an enter transition that can be combined with other enter transitions using `.plus()`.
66
+ */
67
+ export type EnterTransitionType = {
68
+ /** Combines this transition with another enter transition (mirrors Compose's `+` operator). */
69
+ plus: (other: EnterTransitionType) => EnterTransitionType;
70
+ [ENTER_TRANSITION_SYMBOL]: () => EnterTransitionRecord[];
71
+ };
72
+
73
+ /**
74
+ * Represents an exit transition that can be combined with other exit transitions using `.plus()`.
75
+ */
76
+ export type ExitTransitionType = {
77
+ /** Combines this transition with another exit transition (mirrors Compose's `+` operator). */
78
+ plus: (other: ExitTransitionType) => ExitTransitionType;
79
+ [EXIT_TRANSITION_SYMBOL]: () => ExitTransitionRecord[];
80
+ };
81
+
82
+ function createEnterTransition(records: EnterTransitionRecord[]): EnterTransitionType {
83
+ return {
84
+ plus: (other) => createEnterTransition([...records, ...other[ENTER_TRANSITION_SYMBOL]()]),
85
+ [ENTER_TRANSITION_SYMBOL]: () => records,
86
+ };
87
+ }
88
+
89
+ function createExitTransition(records: ExitTransitionRecord[]): ExitTransitionType {
90
+ return {
91
+ plus: (other) => createExitTransition([...records, ...other[EXIT_TRANSITION_SYMBOL]()]),
92
+ [EXIT_TRANSITION_SYMBOL]: () => records,
93
+ };
94
+ }
95
+
96
+ /**
97
+ * Factory for enter transitions used with `AnimatedVisibility`.
98
+ * Transitions can be combined using `.plus()`.
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * // Single transition
103
+ * EnterTransition.fadeIn()
104
+ *
105
+ * // Combined transitions
106
+ * EnterTransition.fadeIn({ initialAlpha: 0.3 })
107
+ * .plus(EnterTransition.slideInHorizontally({ initialOffsetX: 1.0 }))
108
+ * ```
109
+ */
110
+ export const EnterTransition = {
111
+ /** Fades the content in. */
112
+ fadeIn: (params?: { initialAlpha?: number }) =>
113
+ createEnterTransition([{ type: 'fadeIn', ...params }]),
114
+ /** Slides the content in horizontally. */
115
+ slideInHorizontally: (params?: { initialOffsetX?: number }) =>
116
+ createEnterTransition([{ type: 'slideInHorizontally', ...params }]),
117
+ /** Slides the content in vertically. */
118
+ slideInVertically: (params?: { initialOffsetY?: number }) =>
119
+ createEnterTransition([{ type: 'slideInVertically', ...params }]),
120
+ /** Expands the content from the center. */
121
+ expandIn: () => createEnterTransition([{ type: 'expandIn' }]),
122
+ /** Expands the content horizontally from the center. */
123
+ expandHorizontally: () => createEnterTransition([{ type: 'expandHorizontally' }]),
124
+ /** Expands the content vertically from the center. */
125
+ expandVertically: () => createEnterTransition([{ type: 'expandVertically' }]),
126
+ /** Scales the content in from a smaller size. */
127
+ scaleIn: (params?: { initialScale?: number }) =>
128
+ createEnterTransition([{ type: 'scaleIn', ...params }]),
129
+ };
130
+
131
+ /**
132
+ * Factory for exit transitions used with `AnimatedVisibility`.
133
+ * Transitions can be combined using `.plus()`.
134
+ *
135
+ * @example
136
+ * ```tsx
137
+ * // Single transition
138
+ * ExitTransition.fadeOut()
139
+ *
140
+ * // Combined transitions
141
+ * ExitTransition.fadeOut()
142
+ * .plus(ExitTransition.slideOutHorizontally({ targetOffsetX: 1.0 }))
143
+ * ```
144
+ */
145
+ export const ExitTransition = {
146
+ /** Fades the content out. */
147
+ fadeOut: (params?: { targetAlpha?: number }) =>
148
+ createExitTransition([{ type: 'fadeOut', ...params }]),
149
+ /** Slides the content out horizontally. */
150
+ slideOutHorizontally: (params?: { targetOffsetX?: number }) =>
151
+ createExitTransition([{ type: 'slideOutHorizontally', ...params }]),
152
+ /** Slides the content out vertically. */
153
+ slideOutVertically: (params?: { targetOffsetY?: number }) =>
154
+ createExitTransition([{ type: 'slideOutVertically', ...params }]),
155
+ /** Shrinks the content towards the center. */
156
+ shrinkOut: () => createExitTransition([{ type: 'shrinkOut' }]),
157
+ /** Shrinks the content horizontally towards the center. */
158
+ shrinkHorizontally: () => createExitTransition([{ type: 'shrinkHorizontally' }]),
159
+ /** Shrinks the content vertically towards the center. */
160
+ shrinkVertically: () => createExitTransition([{ type: 'shrinkVertically' }]),
161
+ /** Scales the content out to a smaller size. */
162
+ scaleOut: (params?: { targetScale?: number }) =>
163
+ createExitTransition([{ type: 'scaleOut', ...params }]),
164
+ };
165
+
166
+ export type AnimatedVisibilityProps = {
167
+ children?: React.ReactNode;
168
+ /**
169
+ * Whether the content is visible. When changed, the content will animate in or out.
170
+ */
171
+ visible: boolean;
172
+ /**
173
+ * The enter transition to use when `visible` changes to `true`.
174
+ * Use `EnterTransition` factory methods and combine with `.plus()`.
175
+ * Defaults to Compose's `fadeIn + expandIn` when not specified.
176
+ */
177
+ enterTransition?: EnterTransitionType;
178
+ /**
179
+ * The exit transition to use when `visible` changes to `false`.
180
+ * Use `ExitTransition` factory methods and combine with `.plus()`.
181
+ * Defaults to Compose's `fadeOut + shrinkOut` when not specified.
182
+ */
183
+ exitTransition?: ExitTransitionType;
184
+ } & PrimitiveBaseProps;
185
+
186
+ type AnimatedVisibilityNativeProps = Omit<
187
+ AnimatedVisibilityProps,
188
+ 'enterTransition' | 'exitTransition'
189
+ > & {
190
+ enterTransition?: EnterTransitionRecord[];
191
+ exitTransition?: ExitTransitionRecord[];
192
+ };
193
+
194
+ const AnimatedVisibilityNativeView: React.ComponentType<AnimatedVisibilityNativeProps> =
195
+ requireNativeView('ExpoUI', 'AnimatedVisibilityView');
196
+
197
+ export function AnimatedVisibility(props: AnimatedVisibilityProps) {
198
+ const { enterTransition, exitTransition, ...rest } = props;
199
+ return (
200
+ <AnimatedVisibilityNativeView
201
+ {...transformProps(rest)}
202
+ enterTransition={enterTransition?.[ENTER_TRANSITION_SYMBOL]()}
203
+ exitTransition={exitTransition?.[EXIT_TRANSITION_SYMBOL]()}
204
+ />
205
+ );
206
+ }
@@ -0,0 +1,8 @@
1
+ // Unique Symbols used as private keys on transition objects. They act as a sealed accessor:
2
+ // only this module and the component can read the underlying record arrays from an
3
+ // EnterTransitionType or ExitTransitionType, preventing consumers from bypassing the factory API.
4
+ //
5
+ // Exported from this file for internal use (component + tests), but NOT re-exported from
6
+ // the package's public index.
7
+ export const ENTER_TRANSITION_SYMBOL = Symbol('enterTransition');
8
+ export const EXIT_TRANSITION_SYMBOL = Symbol('exitTransition');
@@ -1,139 +1,116 @@
1
1
  import { requireNativeView } from 'expo';
2
2
  import { type ColorValue } from 'react-native';
3
3
 
4
- import { MaterialIcon } from './types';
5
- import { ExpoModifier, ViewEvent } from '../../types';
6
- import { getTextFromChildren } from '../../utils';
7
- import { parseJSXShape, ShapeJSXElement, ShapeRecordProps } from '../Shape';
4
+ import type { ModifierConfig, ViewEvent } from '../../types';
5
+ import { ShapeJSXElement, ShapeRecordProps, parseJSXShape } from '../Shape';
8
6
  import { createViewModifierEventListener } from '../modifiers/utils';
9
7
 
10
8
  /**
11
- * The built-in button styles available on Android.
12
- * - `outlined` - A button with an outline.
13
- * - `elevated` - A filled button with a shadow.
9
+ * Colors for button elements.
14
10
  */
15
- export type ButtonVariant = 'default' | 'bordered' | 'borderless' | 'outlined' | 'elevated';
16
-
17
- /**
18
- * Colors for button's core elements.
19
- */
20
- export type ButtonElementColors = {
11
+ export type ButtonColors = {
21
12
  containerColor?: ColorValue;
22
13
  contentColor?: ColorValue;
23
14
  disabledContainerColor?: ColorValue;
24
15
  disabledContentColor?: ColorValue;
25
16
  };
26
17
 
18
+ /**
19
+ * Content padding for the button's inner content.
20
+ * All values are in density-independent pixels (dp).
21
+ */
22
+ export type ButtonContentPadding = {
23
+ start?: number;
24
+ top?: number;
25
+ end?: number;
26
+ bottom?: number;
27
+ };
28
+
27
29
  export type ButtonProps = {
28
30
  /**
29
- * A callback that is called when the button is pressed.
30
- */
31
- onPress?: () => void;
32
- /**
33
- * A string describing the leading icon to display in the button.
34
- * Uses Material Icons on Android.
35
- */
36
- leadingIcon?: MaterialIcon;
37
- /**
38
- * A string describing the trailing icon to display in the button.
39
- * Uses Material Icons on Android.
40
- */
41
- trailingIcon?: MaterialIcon;
42
- /**
43
- * A string describing the system image to display in the button.
44
- * Uses Material Icons on Android.
45
- * @deprecated Use `leadingIcon` instead.
31
+ * Callback that is called when the button is clicked.
46
32
  */
47
- systemImage?: MaterialIcon;
33
+ onClick?: () => void;
48
34
  /**
49
- * The button variant.
35
+ * Whether the button is enabled for user interaction.
36
+ * @default true
50
37
  */
51
- variant?: ButtonVariant;
38
+ enabled?: boolean;
52
39
  /**
53
- * The text to display inside the button.
40
+ * Colors for button elements.
54
41
  */
55
- children?: string | string[] | React.JSX.Element;
42
+ colors?: ButtonColors;
56
43
  /**
57
- * Colors for button's core elements.
58
- * @platform android
44
+ * The padding between the button container and its content.
45
+ * Use this to adjust internal spacing, for example when adding a leading icon
59
46
  */
60
- elementColors?: ButtonElementColors;
47
+ contentPadding?: ButtonContentPadding;
61
48
  /**
62
- * Button color.
49
+ * The shape of the button.
63
50
  */
64
- color?: ColorValue;
65
51
  shape?: ShapeJSXElement;
66
52
  /**
67
- * Disabled state of the button.
53
+ * Modifiers for the component.
68
54
  */
69
- disabled?: boolean;
70
-
55
+ modifiers?: ModifierConfig[];
71
56
  /**
72
- * Modifiers for the component.
57
+ * Content to display inside the button.
73
58
  */
74
- modifiers?: ExpoModifier[];
59
+ children: React.ReactNode;
75
60
  };
76
61
 
77
- /**
78
- * @hidden
79
- */
80
- export type NativeButtonProps = Omit<
81
- ButtonProps,
82
- 'role' | 'onPress' | 'leadingIcon' | 'trailingIcon' | 'systemImage' | 'shape'
83
- > & {
84
- text: string;
85
- leadingIcon?: string;
86
- trailingIcon?: string;
62
+ type NativeButtonProps = Omit<ButtonProps, 'onClick' | 'shape' | 'children'> & {
87
63
  shape?: ShapeRecordProps;
64
+ children?: React.ReactNode;
88
65
  } & ViewEvent<'onButtonPressed', void>;
89
66
 
90
- // We have to work around the `role` and `onPress` props being reserved by React Native.
91
- const ButtonNativeView: React.ComponentType<NativeButtonProps> = requireNativeView(
92
- 'ExpoUI',
93
- 'Button'
94
- );
95
-
96
67
  /**
97
68
  * @hidden
98
69
  */
99
- export function transformButtonProps(props: ButtonProps): NativeButtonProps {
100
- const {
101
- children,
102
- onPress,
103
- leadingIcon,
104
- trailingIcon,
105
- systemImage,
106
- shape,
107
- modifiers,
108
- ...restProps
109
- } = props;
110
-
111
- // Handle backward compatibility: systemImage maps to leadingIcon
112
- const finalLeadingIcon = leadingIcon ?? systemImage;
113
-
70
+ export function transformButtonProps(props: Omit<ButtonProps, 'children'>): NativeButtonProps {
71
+ const { onClick, shape, modifiers, ...restProps } = props;
114
72
  return {
115
73
  modifiers,
116
74
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
117
75
  ...restProps,
118
- text: getTextFromChildren(children) ?? '',
119
- children: getTextFromChildren(children) !== undefined ? undefined : children,
120
- leadingIcon: finalLeadingIcon,
76
+ enabled: props.enabled ?? true,
121
77
  shape: parseJSXShape(shape),
122
- trailingIcon,
123
- onButtonPressed: onPress,
124
- elementColors: props.elementColors
125
- ? props.elementColors
126
- : props.color
127
- ? {
128
- containerColor: props.color,
129
- }
130
- : undefined,
78
+ onButtonPressed: onClick ? () => onClick() : undefined,
131
79
  };
132
80
  }
133
81
 
82
+ function createButtonComponent(name: string) {
83
+ const NativeView: React.ComponentType<NativeButtonProps> = requireNativeView('ExpoUI', name);
84
+
85
+ function Component(props: ButtonProps) {
86
+ const { children, ...restProps } = props;
87
+ return <NativeView {...transformButtonProps(restProps)}>{children}</NativeView>;
88
+ }
89
+ Component.displayName = name;
90
+ return Component;
91
+ }
92
+
134
93
  /**
135
- * Displays a native button component.
94
+ * A filled button component.
136
95
  */
137
- export function Button(props: ButtonProps) {
138
- return <ButtonNativeView {...transformButtonProps(props)} />;
139
- }
96
+ export const Button = createButtonComponent('Button');
97
+
98
+ /**
99
+ * A filled tonal button component.
100
+ */
101
+ export const FilledTonalButton = createButtonComponent('FilledTonalButton');
102
+
103
+ /**
104
+ * An outlined button component.
105
+ */
106
+ export const OutlinedButton = createButtonComponent('OutlinedButton');
107
+
108
+ /**
109
+ * An elevated button component.
110
+ */
111
+ export const ElevatedButton = createButtonComponent('ElevatedButton');
112
+
113
+ /**
114
+ * A text button component.
115
+ */
116
+ export const TextButton = createButtonComponent('TextButton');