@expo/ui 55.0.2 → 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 (193) hide show
  1. package/CHANGELOG.md +31 -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/CardView.kt +138 -34
  5. package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
  6. package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
  7. package/android/src/main/java/expo/modules/ui/DatePickerView.kt +258 -70
  8. package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
  9. package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +44 -1
  10. package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
  11. package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
  12. package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
  13. package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
  14. package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
  15. package/android/src/main/java/expo/modules/ui/SwitchView.kt +53 -161
  16. package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
  17. package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
  18. package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
  19. package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -86
  20. package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
  21. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
  22. package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
  23. package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
  24. package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
  25. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
  26. package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
  27. package/build/jetpack-compose/Button/index.d.ts +65 -51
  28. package/build/jetpack-compose/Button/index.d.ts.map +1 -1
  29. package/build/jetpack-compose/Card/index.d.ts +72 -14
  30. package/build/jetpack-compose/Card/index.d.ts.map +1 -1
  31. package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
  32. package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
  33. package/build/jetpack-compose/Chip/index.d.ts +247 -27
  34. package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
  35. package/build/jetpack-compose/DatePicker/index.d.ts +38 -3
  36. package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
  37. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
  38. package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
  39. package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
  40. package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
  41. package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
  42. package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
  43. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
  44. package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
  45. package/build/jetpack-compose/IconButton/index.d.ts +45 -29
  46. package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
  47. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
  48. package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  49. package/build/jetpack-compose/Progress/index.d.ts +78 -35
  50. package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
  51. package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
  52. package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
  53. package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
  54. package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
  55. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
  56. package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
  57. package/build/jetpack-compose/Slider/index.d.ts +34 -10
  58. package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
  59. package/build/jetpack-compose/Switch/index.d.ts +10 -50
  60. package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
  61. package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
  62. package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
  63. package/build/jetpack-compose/index.d.ts +5 -4
  64. package/build/jetpack-compose/index.d.ts.map +1 -1
  65. package/build/jetpack-compose/modifiers/index.d.ts +18 -1
  66. package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
  67. package/build/swift-ui/ProgressView/index.d.ts +1 -5
  68. package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
  69. package/build/swift-ui/Stepper/index.d.ts +3 -3
  70. package/build/swift-ui/Stepper/index.d.ts.map +1 -1
  71. package/build/swift-ui/Text/index.d.ts +33 -1
  72. package/build/swift-ui/Text/index.d.ts.map +1 -1
  73. package/build/swift-ui/modifiers/index.d.ts +22 -1
  74. package/build/swift-ui/modifiers/index.d.ts.map +1 -1
  75. package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
  76. package/build/swift-ui/types.d.ts +7 -0
  77. package/build/swift-ui/types.d.ts.map +1 -1
  78. package/expo-module.config.json +1 -1
  79. package/ios/BottomSheetView.swift +1 -6
  80. package/ios/ClosedRangeDateRecord.swift +10 -0
  81. package/ios/ColorPickerView.swift +9 -8
  82. package/ios/ConfirmationDialog/ConfirmationDialog.swift +4 -6
  83. package/ios/DatePickerView.swift +7 -5
  84. package/ios/DisclosureGroupView.swift +5 -7
  85. package/ios/ListView.swift +6 -14
  86. package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
  87. package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
  88. package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
  89. package/ios/Picker/PickerView.swift +6 -10
  90. package/ios/Popover/PopoverView.swift +3 -5
  91. package/ios/ProgressView.swift +0 -5
  92. package/ios/SectionView.swift +3 -5
  93. package/ios/SliderView.swift +8 -6
  94. package/ios/StepperView.swift +12 -16
  95. package/ios/TextView.swift +37 -1
  96. package/ios/Toggle/ToggleView.swift +5 -7
  97. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar +0 -0
  98. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +1 -0
  99. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +1 -0
  100. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +1 -0
  101. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +1 -0
  102. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar +0 -0
  103. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5 +1 -0
  104. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +1 -0
  105. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +1 -0
  106. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +1 -0
  107. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.module → 55.0.3/expo.modules.ui-55.0.3.module} +22 -22
  108. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +1 -0
  109. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +1 -0
  110. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +1 -0
  111. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +1 -0
  112. package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.pom → 55.0.3/expo.modules.ui-55.0.3.pom} +1 -1
  113. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +1 -0
  114. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +1 -0
  115. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +1 -0
  116. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512 +1 -0
  117. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
  118. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
  119. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
  120. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
  121. package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
  122. package/package.json +5 -2
  123. package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
  124. package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
  125. package/src/jetpack-compose/Button/index.tsx +69 -92
  126. package/src/jetpack-compose/Card/index.tsx +105 -29
  127. package/src/jetpack-compose/Checkbox/index.tsx +126 -0
  128. package/src/jetpack-compose/Chip/index.tsx +391 -51
  129. package/src/jetpack-compose/DatePicker/index.tsx +112 -7
  130. package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
  131. package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
  132. package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
  133. package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
  134. package/src/jetpack-compose/IconButton/index.tsx +49 -56
  135. package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
  136. package/src/jetpack-compose/Progress/index.tsx +120 -62
  137. package/src/jetpack-compose/RadioButton/index.tsx +8 -9
  138. package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
  139. package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
  140. package/src/jetpack-compose/Slider/index.tsx +76 -29
  141. package/src/jetpack-compose/Switch/index.tsx +17 -87
  142. package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
  143. package/src/jetpack-compose/index.ts +5 -4
  144. package/src/jetpack-compose/modifiers/index.ts +26 -2
  145. package/src/swift-ui/ProgressView/index.tsx +1 -3
  146. package/src/swift-ui/Stepper/index.tsx +7 -7
  147. package/src/swift-ui/Text/index.tsx +66 -2
  148. package/src/swift-ui/modifiers/index.ts +40 -0
  149. package/src/swift-ui/types.ts +5 -0
  150. package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
  151. package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
  152. package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
  153. package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
  154. package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
  155. package/build/jetpack-compose/Button/types.d.ts +0 -5
  156. package/build/jetpack-compose/Button/types.d.ts.map +0 -1
  157. package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
  158. package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
  159. package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
  160. package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
  161. package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
  162. package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
  163. package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
  164. package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
  165. package/build/jetpack-compose/Picker/index.d.ts +0 -62
  166. package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
  167. package/build/jetpack-compose/TextButton/index.d.ts +0 -29
  168. package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
  169. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar +0 -0
  170. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.md5 +0 -1
  171. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +0 -1
  172. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +0 -1
  173. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +0 -1
  174. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar +0 -0
  175. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.md5 +0 -1
  176. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +0 -1
  177. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +0 -1
  178. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +0 -1
  179. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +0 -1
  180. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +0 -1
  181. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +0 -1
  182. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +0 -1
  183. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +0 -1
  184. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +0 -1
  185. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +0 -1
  186. package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha512 +0 -1
  187. package/src/jetpack-compose/Button/types.ts +0 -57
  188. package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
  189. package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
  190. package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
  191. package/src/jetpack-compose/FilterChip/index.tsx +0 -89
  192. package/src/jetpack-compose/Picker/index.tsx +0 -90
  193. package/src/jetpack-compose/TextButton/index.tsx +0 -55
@@ -1,15 +1,14 @@
1
1
  import { requireNativeView } from 'expo';
2
2
  import { NativeSyntheticEvent, type ColorValue } from 'react-native';
3
3
 
4
- import { ExpoModifier } from '../../types';
4
+ import { type ModifierConfig } from '../../types';
5
5
  import { ExpoUIModule } from '../ExpoUIModule';
6
6
  import { createViewModifierEventListener } from '../modifiers/utils';
7
7
 
8
- // @docsMissing
9
8
  /**
10
- * Only for switch.
9
+ * Colors for switch core elements.
11
10
  */
12
- type SwitchElementColors = {
11
+ export type SwitchColors = {
13
12
  checkedThumbColor?: ColorValue;
14
13
  checkedTrackColor?: ColorValue;
15
14
  checkedBorderColor?: ColorValue;
@@ -28,89 +27,38 @@ type SwitchElementColors = {
28
27
  disabledUncheckedIconColor?: ColorValue;
29
28
  };
30
29
 
31
- // @docsMissing
32
- /**
33
- * Only for checkbox.
34
- */
35
- type CheckboxElementColors = {
36
- checkedColor?: ColorValue;
37
- disabledCheckedColor?: ColorValue;
38
- uncheckedColor?: ColorValue;
39
- disabledUncheckedColor?: ColorValue;
40
- checkmarkColor?: ColorValue;
41
- disabledIndeterminateColor?: ColorValue;
42
- };
43
-
44
30
  export type SwitchProps = {
45
31
  /**
46
32
  * Indicates whether the switch is checked.
47
33
  */
48
34
  value: boolean;
49
- /**
50
- * Label for the switch.
51
- *
52
- * > On Android, the label has an effect only when the `Switch` is used inside a `ContextMenu`.
53
- */
54
- label?: string;
55
-
56
- /**
57
- * Type of the switch component. Can be `'checkbox'`, `'switch'`, or `'button'`.
58
- * @default 'switch'
59
- */
60
- variant?: 'checkbox' | 'switch' | 'button';
61
35
  /**
62
36
  * Whether the switch is enabled.
63
37
  * @default true
64
- * @platform android
65
38
  */
66
39
  enabled?: boolean;
67
40
  /**
68
41
  * Callback function that is called when the checked state changes.
69
42
  */
70
- onValueChange?: (value: boolean) => void;
71
-
43
+ onCheckedChange?: (value: boolean) => void;
72
44
  /**
73
- * Picker color.
45
+ * Colors for switch core elements.
74
46
  */
75
- color?: ColorValue;
76
-
47
+ colors?: SwitchColors;
77
48
  /**
78
49
  * Modifiers for the component.
79
50
  */
80
- modifiers?: ExpoModifier[];
81
-
51
+ modifiers?: ModifierConfig[];
82
52
  /**
83
53
  * Children containing ThumbContent slot.
84
54
  * @platform android
85
55
  */
86
56
  children?: React.ReactNode;
87
- } & (SwitchSwitchVariantProps | SwitchCheckboxVariantProps | SwitchButtonVariantProps);
88
-
89
- export type SwitchSwitchVariantProps = {
90
- variant?: 'switch';
91
- /**
92
- * Colors for switch's core elements.
93
- * @platform android
94
- */
95
- elementColors?: SwitchElementColors;
96
- };
97
-
98
- export type SwitchCheckboxVariantProps = {
99
- variant: 'checkbox';
100
- /**
101
- * Colors for checkbox core elements.
102
- * @platform android
103
- */
104
- elementColors?: CheckboxElementColors;
105
57
  };
106
58
 
107
- export type SwitchButtonVariantProps = {
108
- variant: 'button';
109
- elementColors?: undefined;
110
- };
111
-
112
- type NativeSwitchProps = Omit<SwitchProps, 'onValueChange'> & {
113
- onValueChange: (event: NativeSyntheticEvent<{ value: boolean }>) => void;
59
+ type NativeSwitchProps = Omit<SwitchProps, 'onCheckedChange' | 'children'> & {
60
+ children?: React.ReactNode;
61
+ onCheckedChange: (event: NativeSyntheticEvent<{ value: boolean }>) => void;
114
62
  };
115
63
 
116
64
  type NativeSlotViewProps = {
@@ -140,39 +88,21 @@ export function SwitchThumbContent(props: ThumbContentProps) {
140
88
  return <SlotNativeView slotName="thumbContent">{props.children}</SlotNativeView>;
141
89
  }
142
90
 
143
- function getElementColors(props: SwitchProps) {
144
- if (props.variant === 'button') {
145
- return undefined;
146
- }
147
- if (!props.elementColors) {
148
- if (props.variant === 'switch') {
149
- return {
150
- checkedTrackColor: props.color,
151
- };
152
- } else {
153
- return {
154
- checkedColor: props.color,
155
- };
156
- }
157
- }
158
- return props.elementColors;
159
- }
160
-
161
91
  function transformSwitchProps(props: SwitchProps): Omit<NativeSwitchProps, 'children'> {
162
- const { modifiers, children, ...restProps } = props;
92
+ const { modifiers, children, onCheckedChange, ...restProps } = props;
163
93
  return {
164
94
  modifiers,
165
95
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
166
96
  ...restProps,
167
- variant: props.variant ?? 'switch',
168
- elementColors: getElementColors(props),
169
- color: props.color,
170
- onValueChange: ({ nativeEvent: { value } }) => {
171
- props?.onValueChange?.(value);
97
+ onCheckedChange: ({ nativeEvent: { value } }) => {
98
+ onCheckedChange?.(value);
172
99
  },
173
- } as Omit<NativeSwitchProps, 'children'>;
100
+ };
174
101
  }
175
102
 
103
+ /**
104
+ * A switch component.
105
+ */
176
106
  function SwitchComponent(props: SwitchProps) {
177
107
  return <SwitchNativeView {...transformSwitchProps(props)}>{props.children}</SwitchNativeView>;
178
108
  }
@@ -1,83 +1,107 @@
1
1
  import { requireNativeView } from 'expo';
2
2
  import { type ColorValue } from 'react-native';
3
3
 
4
- import { type ExpoModifier, type ViewEvent } from '../../types';
4
+ import type { ModifierConfig, ViewEvent } from '../../types';
5
5
  import { ExpoUIModule } from '../ExpoUIModule';
6
6
  import { createViewModifierEventListener } from '../modifiers/utils';
7
7
 
8
+ /**
9
+ * Colors for toggle button elements.
10
+ */
11
+ export type ToggleButtonColors = {
12
+ containerColor?: ColorValue;
13
+ contentColor?: ColorValue;
14
+ checkedContainerColor?: ColorValue;
15
+ checkedContentColor?: ColorValue;
16
+ disabledContainerColor?: ColorValue;
17
+ disabledContentColor?: ColorValue;
18
+ };
19
+
8
20
  export type ToggleButtonProps = {
9
21
  /**
10
22
  * Whether the toggle button is checked.
11
23
  */
12
24
  checked: boolean;
13
25
  /**
14
- * Text to display in the button.
15
- */
16
- text?: string;
17
- /**
18
- * The variant of the toggle button.
19
- * - `'default'` - Material 3 ToggleButton
20
- * - `'icon'` - Icon toggle button
21
- * - `'filledIcon'` - Filled icon toggle button
22
- * - `'outlinedIcon'` - Outlined icon toggle button
23
- * @default 'default'
24
- */
25
- variant?: 'default' | 'icon' | 'filledIcon' | 'outlinedIcon';
26
- /**
27
- * The color of the toggle button when checked.
26
+ * Callback that is called when the checked state changes.
28
27
  */
29
- color?: ColorValue;
28
+ onCheckedChange?: (checked: boolean) => void;
30
29
  /**
31
- * Whether the button is disabled.
30
+ * Whether the button is enabled for user interaction.
31
+ * @default true
32
32
  */
33
- disabled?: boolean;
33
+ enabled?: boolean;
34
34
  /**
35
- * Callback that is called when the checked state changes.
35
+ * Colors for toggle button elements.
36
36
  */
37
- onCheckedChange?: (checked: boolean) => void;
37
+ colors?: ToggleButtonColors;
38
38
  /**
39
39
  * Modifiers for the component.
40
40
  */
41
- modifiers?: ExpoModifier[];
42
-
41
+ modifiers?: ModifierConfig[];
43
42
  /**
44
- * The content to display inside the toggle button.
43
+ * Content to display inside the toggle button.
45
44
  */
46
- children?: React.ReactNode;
45
+ children: React.ReactNode;
47
46
  };
48
47
 
49
- type NativeToggleButtonProps = Omit<ToggleButtonProps, 'onCheckedChange'> &
50
- ViewEvent<'onCheckedChange', { checked: boolean }>;
51
-
52
- const ToggleButtonNativeView: React.ComponentType<NativeToggleButtonProps> = requireNativeView(
53
- 'ExpoUI',
54
- 'ToggleButtonView'
55
- );
48
+ type NativeToggleButtonProps = Omit<ToggleButtonProps, 'onCheckedChange' | 'children'> & {
49
+ children?: React.ReactNode;
50
+ } & ViewEvent<'onCheckedChange', { checked: boolean }>;
56
51
 
57
- function transformProps(props: ToggleButtonProps): Omit<NativeToggleButtonProps, 'children'> {
58
- const { modifiers, onCheckedChange, children, ...restProps } = props;
52
+ /**
53
+ * @hidden
54
+ */
55
+ export function transformToggleButtonProps(
56
+ props: Omit<ToggleButtonProps, 'children'>
57
+ ): NativeToggleButtonProps {
58
+ const { onCheckedChange, modifiers, ...restProps } = props;
59
59
  return {
60
60
  modifiers,
61
61
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
62
62
  ...restProps,
63
+ enabled: props.enabled ?? true,
63
64
  onCheckedChange: onCheckedChange
64
65
  ? ({ nativeEvent: { checked } }) => onCheckedChange(checked)
65
66
  : undefined,
66
67
  };
67
68
  }
69
+
70
+ function createToggleButtonComponent(name: string) {
71
+ const NativeView: React.ComponentType<NativeToggleButtonProps> = requireNativeView(
72
+ 'ExpoUI',
73
+ name
74
+ );
75
+
76
+ function Component(props: ToggleButtonProps) {
77
+ const { children, ...restProps } = props;
78
+ return <NativeView {...transformToggleButtonProps(restProps)}>{children}</NativeView>;
79
+ }
80
+ Component.displayName = name;
81
+ return Component;
82
+ }
83
+
68
84
  /**
69
85
  * A toggle button component that can be toggled on and off.
70
- *
71
- * When `text` prop is provided, it displays the text.
72
- * Otherwise, custom children can be passed to render custom content.
73
86
  */
74
- function ToggleButton(props: ToggleButtonProps) {
75
- const { children } = props;
87
+ const ToggleButton = Object.assign(createToggleButtonComponent('ToggleButton'), {
88
+ DefaultIconSpacing: ExpoUIModule.ToggleButtonIconSpacing as number,
89
+ DefaultIconSize: ExpoUIModule.ToggleButtonIconSize as number,
90
+ });
76
91
 
77
- return <ToggleButtonNativeView {...transformProps(props)}>{children}</ToggleButtonNativeView>;
78
- }
92
+ /**
93
+ * An icon toggle button with no background.
94
+ */
95
+ const IconToggleButton = createToggleButtonComponent('IconToggleButton');
79
96
 
80
- ToggleButton.DefaultIconSpacing = ExpoUIModule.ToggleButtonIconSpacing;
81
- ToggleButton.DefaultIconSize = ExpoUIModule.ToggleButtonIconSize;
97
+ /**
98
+ * A filled icon toggle button with a solid background.
99
+ */
100
+ const FilledIconToggleButton = createToggleButtonComponent('FilledIconToggleButton');
101
+
102
+ /**
103
+ * An outlined icon toggle button with a border and no fill.
104
+ */
105
+ const OutlinedIconToggleButton = createToggleButtonComponent('OutlinedIconToggleButton');
82
106
 
83
- export { ToggleButton };
107
+ export { ToggleButton, IconToggleButton, FilledIconToggleButton, OutlinedIconToggleButton };
@@ -3,24 +3,23 @@ import './MaterialSymbolsAssetsTransformer.fx';
3
3
  export * from './AlertDialog';
4
4
  export * from './BasicAlertDialog';
5
5
  export * from './Card';
6
+ export * from './Checkbox';
6
7
  export * from './Chip';
7
- export * from './FilterChip';
8
8
  export * from './Button';
9
9
  export * from './Icon';
10
10
  export * from './IconButton';
11
- export * from './ContextMenu';
11
+ export * from './DropdownMenu';
12
12
  export * from './Divider';
13
13
  export * from './Host';
14
14
  export * from './LazyColumn';
15
15
  export * from './ListItem';
16
16
  export * from './RNHostView';
17
17
  export * from './DatePicker';
18
- export * from './Picker';
18
+ export * from './SegmentedButton';
19
19
  export * from './Progress';
20
20
  export * from './Slider';
21
21
  export * from './Spacer';
22
22
  export * from './Switch';
23
- export * from './TextButton';
24
23
  export * from './TextInput';
25
24
  export * from './ToggleButton';
26
25
  export * from './Shape';
@@ -29,11 +28,13 @@ export * from './Carousel';
29
28
  export * from './SearchBar';
30
29
  export * from './DockedSearchBar';
31
30
  export * from './HorizontalFloatingToolbar';
31
+ export * from './FloatingActionButton';
32
32
  export * from './PullToRefreshBox';
33
33
  export * from './RadioButton';
34
34
  export * from './Surface';
35
35
  export * from './Text';
36
36
 
37
+ export * from './AnimatedVisibility';
37
38
  export * from './Box';
38
39
  export * from './Row';
39
40
  export * from './Column';
@@ -262,9 +262,33 @@ export const clickable = (handler: () => void, options?: { indication?: boolean
262
262
  * Makes the view selectable, like a radio button row.
263
263
  * @param selected - Whether the item is currently selected.
264
264
  * @param handler - Function to call when the item is clicked.
265
+ * @param role - Optional semantic role for accessibility: 'radioButton', 'checkbox', 'switch', or 'tab'.
265
266
  */
266
- export const selectable = (selected: boolean, handler: () => void) =>
267
- createModifierWithEventListener('selectable', handler, { selected });
267
+ export const selectable = (
268
+ selected: boolean,
269
+ handler: () => void,
270
+ role?: 'radioButton' | 'checkbox' | 'switch' | 'tab'
271
+ ) => createModifierWithEventListener('selectable', handler, { selected, role });
272
+
273
+ /**
274
+ * Marks a column/row as a selectable group for accessibility.
275
+ * Screen readers will treat the children as a group of selectable items.
276
+ */
277
+ export const selectableGroup = () => createModifier('selectableGroup');
278
+
279
+ /**
280
+ * Makes the view toggleable with accessibility semantics.
281
+ * Use this to make a row containing a checkbox or switch tappable as a whole.
282
+ * @param value - The current toggle state.
283
+ * @param handler - Function to call when toggled.
284
+ * @param options - Optional configuration.
285
+ * @param options.role - The semantic role for accessibility: `'checkbox'`, `'radioButton'`, `'switch'`, or `'tab'`.
286
+ */
287
+ export const toggleable = (
288
+ value: boolean,
289
+ handler: () => void,
290
+ options?: { role?: 'checkbox' | 'radioButton' | 'switch' | 'tab' }
291
+ ) => createModifierWithEventListener('toggleable', handler, { value, role: options?.role });
268
292
 
269
293
  // =============================================================================
270
294
  // Utility Modifiers
@@ -1,9 +1,7 @@
1
1
  import { requireNativeView } from 'expo';
2
2
 
3
3
  import { createViewModifierEventListener } from '../modifiers/utils';
4
- import { type CommonViewModifierProps } from '../types';
5
-
6
- export type ClosedRangeDate = { lower: Date; upper: Date };
4
+ import { type ClosedRangeDate, type CommonViewModifierProps } from '../types';
7
5
 
8
6
  export type ProgressViewProps = {
9
7
  /**
@@ -10,9 +10,9 @@ export type StepperProps = {
10
10
  */
11
11
  label: string;
12
12
  /**
13
- * The initial/default value of the stepper.
13
+ * The current value of the stepper.
14
14
  */
15
- defaultValue?: number;
15
+ value?: number;
16
16
  /**
17
17
  * The step value for increment/decrement operations.
18
18
  */
@@ -28,11 +28,11 @@ export type StepperProps = {
28
28
  /**
29
29
  * Called when the stepper value changes.
30
30
  */
31
- onValueChanged: (value: number) => void;
31
+ onValueChange: (value: number) => void;
32
32
  } & CommonViewModifierProps;
33
33
 
34
- type NativeStepperProps = Omit<StepperProps, 'onValueChanged'> &
35
- ViewEvent<'onValueChanged', { value: number }>;
34
+ type NativeStepperProps = Omit<StepperProps, 'onValueChange'> &
35
+ ViewEvent<'onValueChange', { value: number }>;
36
36
 
37
37
  const StepperNativeView: React.ComponentType<NativeStepperProps> = requireNativeView(
38
38
  'ExpoUI',
@@ -45,8 +45,8 @@ function transformStepperProps(props: StepperProps): NativeStepperProps {
45
45
  modifiers,
46
46
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
47
47
  ...restProps,
48
- onValueChanged: ({ nativeEvent: { value } }) => {
49
- props.onValueChanged(value);
48
+ onValueChange: ({ nativeEvent: { value } }) => {
49
+ props.onValueChange(value);
50
50
  },
51
51
  };
52
52
  }
@@ -2,7 +2,12 @@ import { requireNativeView } from 'expo';
2
2
  import * as React from 'react';
3
3
 
4
4
  import { createViewModifierEventListener } from '../modifiers/utils';
5
- import { type CommonViewModifierProps } from '../types';
5
+ import { type ClosedRangeDate, type CommonViewModifierProps } from '../types';
6
+
7
+ /**
8
+ * The style used to format a date in a SwiftUI `Text` view.
9
+ */
10
+ export type TextDateStyle = 'timer' | 'relative' | 'offset' | 'date' | 'time';
6
11
 
7
12
  export interface TextProps extends CommonViewModifierProps {
8
13
  /**
@@ -14,12 +19,50 @@ export interface TextProps extends CommonViewModifierProps {
14
19
  * Enables Markdown formatting for the text content using SwiftUI LocalizedStringKey.
15
20
  */
16
21
  markdownEnabled?: boolean;
22
+
23
+ /**
24
+ * A date to display using the specified `dateStyle`. The text auto-updates as time passes.
25
+ */
26
+ date?: Date;
27
+
28
+ /**
29
+ * The style used to format the `date` prop.
30
+ * @default 'date'
31
+ */
32
+ dateStyle?: TextDateStyle;
33
+
34
+ /**
35
+ * A time interval to display as a live-updating timer.
36
+ * @platform ios 16.0+
37
+ * @platform tvos 16.0+
38
+ */
39
+ timerInterval?: ClosedRangeDate;
40
+
41
+ /**
42
+ * Whether the timer counts down (`true`) or up (`false`).
43
+ * @default true
44
+ * @platform ios 16.0+
45
+ * @platform tvos 16.0+
46
+ */
47
+ countsDown?: boolean;
48
+
49
+ /**
50
+ * A date at which the timer should appear paused.
51
+ * @platform ios 16.0+
52
+ * @platform tvos 16.0+
53
+ */
54
+ pauseTime?: Date;
17
55
  }
18
56
 
19
57
  type NativeTextProps = CommonViewModifierProps & {
20
58
  text?: string;
21
59
  children?: React.ReactNode;
22
60
  markdownEnabled?: boolean;
61
+ date?: number;
62
+ dateStyle?: TextDateStyle;
63
+ timerInterval?: { lower: number; upper: number };
64
+ countsDown?: boolean;
65
+ pauseTime?: number;
23
66
  };
24
67
 
25
68
  const TextNativeView: React.ComponentType<NativeTextProps> = requireNativeView(
@@ -28,7 +71,28 @@ const TextNativeView: React.ComponentType<NativeTextProps> = requireNativeView(
28
71
  );
29
72
 
30
73
  export function Text(props: TextProps) {
31
- const { children, modifiers, ...restProps } = props;
74
+ const { children, modifiers, date, timerInterval, pauseTime, ...restProps } = props;
75
+
76
+ // Date/timer mode: pass converted timestamps to native, ignore children
77
+ if (date != null || timerInterval != null) {
78
+ return (
79
+ <TextNativeView
80
+ modifiers={modifiers}
81
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
82
+ {...restProps}
83
+ date={date ? date.getTime() : undefined}
84
+ timerInterval={
85
+ timerInterval
86
+ ? {
87
+ lower: timerInterval.lower.getTime(),
88
+ upper: timerInterval.upper.getTime(),
89
+ }
90
+ : undefined
91
+ }
92
+ pauseTime={pauseTime ? pauseTime.getTime() : undefined}
93
+ />
94
+ );
95
+ }
32
96
 
33
97
  if (children === undefined || children === null) {
34
98
  return null;
@@ -567,6 +567,44 @@ export const scrollDismissesKeyboard = (
567
567
  export const scrollDisabled = (disabled: boolean = true) =>
568
568
  createModifier('scrollDisabled', { disabled });
569
569
 
570
+ type UnitPointValue =
571
+ | 'zero'
572
+ | 'topLeading'
573
+ | 'top'
574
+ | 'topTrailing'
575
+ | 'leading'
576
+ | 'center'
577
+ | 'trailing'
578
+ | 'bottomLeading'
579
+ | 'bottom'
580
+ | 'bottomTrailing';
581
+
582
+ /**
583
+ * Sets the default anchor point for a scroll view's content.
584
+ * @param anchor - The anchor point for initial scroll position and content size changes, or `null` to reset.
585
+ * @platform ios 17.0+
586
+ * @platform tvos 17.0+
587
+ * @platform macos 14.0+
588
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/defaultscrollanchor(_:)).
589
+ */
590
+ export const defaultScrollAnchor = (anchor: UnitPointValue | null) =>
591
+ createModifier('defaultScrollAnchor', { anchor });
592
+
593
+ /**
594
+ * Sets the default anchor point for a scroll view for a specific role.
595
+ * Pass `null` to opt out of a specific role while keeping anchors for other roles.
596
+ * @param anchor - The anchor point, or `null` to opt out of this role.
597
+ * @param role - The scroll anchor role: `'initialOffset'`, `'sizeChanges'`, or `'alignment'`.
598
+ * @platform ios 18.0+
599
+ * @platform tvos 18.0+
600
+ * @platform macos 15.0+
601
+ * @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/defaultscrollanchor(_:for:)).
602
+ */
603
+ export const defaultScrollAnchorForRole = (
604
+ anchor: UnitPointValue | null,
605
+ role: 'initialOffset' | 'sizeChanges' | 'alignment'
606
+ ) => createModifier('defaultScrollAnchorForRole', { anchor, role });
607
+
570
608
  /**
571
609
  * Disables the move action for a view in a list.
572
610
  * Apply to items within a `ForEach` to prevent them from being moved.
@@ -1097,6 +1135,8 @@ export type BuiltInModifier =
1097
1135
  | ReturnType<typeof containerRelativeFrame>
1098
1136
  | ReturnType<typeof scrollContentBackground>
1099
1137
  | ReturnType<typeof scrollDisabled>
1138
+ | ReturnType<typeof defaultScrollAnchor>
1139
+ | ReturnType<typeof defaultScrollAnchorForRole>
1100
1140
  | ReturnType<typeof moveDisabled>
1101
1141
  | ReturnType<typeof deleteDisabled>
1102
1142
  | ReturnType<typeof environment>
@@ -73,6 +73,11 @@ export interface PaddingProps {
73
73
  trailing?: number;
74
74
  }
75
75
 
76
+ /**
77
+ * A closed date range with lower and upper bounds.
78
+ */
79
+ export type ClosedRangeDate = { lower: Date; upper: Date };
80
+
76
81
  /**
77
82
  * Common props that can be applied to any view.
78
83
  */
@@ -1,59 +0,0 @@
1
- package expo.modules.ui
2
-
3
- import androidx.compose.material3.FilterChip
4
- import androidx.compose.material3.FilterChipDefaults
5
- import androidx.compose.material3.Text
6
- import androidx.compose.runtime.Composable
7
- import expo.modules.kotlin.records.Record
8
- import expo.modules.kotlin.views.ComposableScope
9
- import expo.modules.kotlin.views.ComposeProps
10
- import expo.modules.kotlin.views.FunctionalComposableScope
11
- import java.io.Serializable
12
-
13
- open class FilterChipPressedEvent : Record, Serializable
14
-
15
- data class FilterChipProps(
16
- val selected: Boolean = false,
17
- val label: String = "",
18
- val enabled: Boolean = true,
19
- val modifiers: ModifierList = emptyList()
20
- ) : ComposeProps
21
-
22
- @Composable
23
- fun FunctionalComposableScope.FilterChipContent(
24
- props: FilterChipProps,
25
- onPress: (FilterChipPressedEvent) -> Unit
26
- ) {
27
- val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
28
-
29
- val leadingIconSlotView = findChildSlotView(view, "leadingIcon")
30
- val trailingIconSlotView = findChildSlotView(view, "trailingIcon")
31
-
32
- FilterChip(
33
- selected = props.selected,
34
- onClick = { onPress(FilterChipPressedEvent()) },
35
- label = { Text(props.label) },
36
- enabled = props.enabled,
37
- leadingIcon = leadingIconSlotView?.let {
38
- {
39
- with(ComposableScope()) {
40
- with(it) {
41
- Content()
42
- }
43
- }
44
- }
45
- },
46
- trailingIcon = trailingIconSlotView?.let {
47
- {
48
- with(ComposableScope()) {
49
- with(it) {
50
- Content()
51
- }
52
- }
53
- }
54
- },
55
- colors = FilterChipDefaults.filterChipColors(),
56
- border = FilterChipDefaults.filterChipBorder(enabled = props.enabled, selected = props.selected),
57
- modifier = modifier
58
- )
59
- }