@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,102 +1,160 @@
1
1
  import { requireNativeView } from 'expo';
2
- import { ColorValue } from 'react-native';
2
+ import { type ColorValue } from 'react-native';
3
3
 
4
- import { ExpoModifier } from '../../types';
4
+ import { type ModifierConfig } from '../../types';
5
5
  import { createViewModifierEventListener } from '../modifiers/utils';
6
6
 
7
- export type ProgressElementColors = {
8
- /**
9
- * Track color.
10
- *
11
- * @platform android
12
- */
13
- trackColor?: ColorValue;
14
- };
7
+ /**
8
+ * Stroke cap style for progress indicators.
9
+ */
10
+ export type StrokeCap = 'round' | 'butt' | 'square';
15
11
 
16
- export type CircularProgressProps = {
12
+ /**
13
+ * Common props shared by all progress indicator variants.
14
+ */
15
+ type BaseProgressProps = {
17
16
  /**
18
- * The current progress value of the slider. This is a number between `0` and `1`.
17
+ * The current progress value between `0` and `1`. Omit for indeterminate.
19
18
  */
20
19
  progress?: number | null;
21
20
  /**
22
- * Progress color.
21
+ * Progress indicator color.
23
22
  */
24
23
  color?: ColorValue;
25
24
  /**
26
- * Colors for switch's core elements.
27
- * @platform android
25
+ * Track (background) color.
28
26
  */
29
- elementColors?: ProgressElementColors;
27
+ trackColor?: ColorValue;
30
28
  /**
31
29
  * Modifiers for the component.
32
30
  */
33
- modifiers?: ExpoModifier[];
31
+ modifiers?: ModifierConfig[];
34
32
  };
35
33
 
36
- export type LinearProgressProps = {
37
- /**
38
- * The current progress value of the slider. This is a number between `0` and `1`.
39
- */
40
- progress?: number | null;
34
+ function transformProps<T extends BaseProgressProps>(props: T): T {
35
+ const { modifiers, ...restProps } = props;
36
+ return {
37
+ modifiers,
38
+ ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
39
+ ...restProps,
40
+ } as T;
41
+ }
42
+
43
+ function createProgressComponent<P extends BaseProgressProps>(
44
+ viewName: string
45
+ ): React.ComponentType<P> {
46
+ const NativeView: React.ComponentType<P> = requireNativeView('ExpoUI', viewName);
47
+ return function ProgressComponent(props: P) {
48
+ return <NativeView {...transformProps(props)} />;
49
+ };
50
+ }
51
+
52
+ // region LinearProgressIndicator
53
+
54
+ /**
55
+ * Configuration for the stop indicator dot at the end of the determinate linear progress track.
56
+ * When provided, draws a stop indicator with the given options. Omit to use the Compose default.
57
+ */
58
+ export type DrawStopIndicatorConfig = {
41
59
  /**
42
- * Progress color.
60
+ * Color of the stop indicator. Defaults to the indicator's color.
43
61
  */
44
62
  color?: ColorValue;
45
63
  /**
46
- * Colors for switch's core elements.
47
- * @platform android
64
+ * Stroke cap style for the stop indicator. Defaults to the indicator's strokeCap.
48
65
  */
49
- elementColors?: ProgressElementColors;
66
+ strokeCap?: StrokeCap;
50
67
  /**
51
- * Modifiers for the component.
68
+ * Size of the stop indicator in dp. Defaults to the Material 3 default.
52
69
  */
53
- modifiers?: ExpoModifier[];
70
+ stopSize?: number;
54
71
  };
55
72
 
56
- type NativeProgressProps =
57
- | CircularProgressProps
58
- | (LinearProgressProps & {
59
- variant: 'linear' | 'circular' | 'linearWavy' | 'circularWavy';
60
- });
73
+ export type LinearProgressIndicatorProps = BaseProgressProps & {
74
+ /**
75
+ * Stroke cap style for the indicator ends.
76
+ * @default 'round'
77
+ */
78
+ strokeCap?: StrokeCap;
79
+ /**
80
+ * Gap size between the indicator and track in dp.
81
+ */
82
+ gapSize?: number;
83
+ /**
84
+ * Configuration for the stop indicator dot at the end of the determinate progress track.
85
+ */
86
+ drawStopIndicator?: DrawStopIndicatorConfig;
87
+ };
61
88
 
62
- const NativeProgressView: React.ComponentType<NativeProgressProps> = requireNativeView(
63
- 'ExpoUI',
64
- 'ProgressView'
89
+ /**
90
+ * A linear progress indicator that displays progress in a horizontal bar.
91
+ *
92
+ * Matches the Jetpack Compose `LinearProgressIndicator`.
93
+ */
94
+ export const LinearProgressIndicator = createProgressComponent<LinearProgressIndicatorProps>(
95
+ 'LinearProgressIndicatorView'
65
96
  );
66
97
 
67
- function transformProps(props: CircularProgressProps | LinearProgressProps): NativeProgressProps {
68
- const { modifiers, ...restProps } = props;
69
- return {
70
- modifiers,
71
- ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
72
- ...restProps,
73
- };
74
- }
98
+ // endregion
75
99
 
76
- /**
77
- * Renders a `CircularProgress` component.
78
- */
79
- export function CircularProgress(props: CircularProgressProps) {
80
- return <NativeProgressView {...transformProps(props)} variant="circular" />;
81
- }
100
+ // region CircularProgressIndicator
101
+
102
+ export type CircularProgressIndicatorProps = BaseProgressProps & {
103
+ /**
104
+ * Width of the circular stroke in dp.
105
+ */
106
+ strokeWidth?: number;
107
+ /**
108
+ * Stroke cap style for the indicator ends.
109
+ * @default 'round'
110
+ */
111
+ strokeCap?: StrokeCap;
112
+ /**
113
+ * Gap size between the indicator and track in dp.
114
+ */
115
+ gapSize?: number;
116
+ };
82
117
 
83
118
  /**
84
- * Renders a `LinearProgress` component.
119
+ * A circular progress indicator that displays progress in a circular format.
120
+ *
121
+ * Matches the Jetpack Compose `CircularProgressIndicator`.
85
122
  */
86
- export function LinearProgress(props: LinearProgressProps) {
87
- return <NativeProgressView {...transformProps(props)} variant="linear" />;
88
- }
123
+ export const CircularProgressIndicator = createProgressComponent<CircularProgressIndicatorProps>(
124
+ 'CircularProgressIndicatorView'
125
+ );
126
+
127
+ // endregion
128
+
129
+ // region LinearWavyProgressIndicator
130
+
131
+ export type LinearWavyProgressIndicatorProps = BaseProgressProps & {
132
+ /**
133
+ * Size of the stop indicator in dp at the end of the determinate progress track.
134
+ */
135
+ stopSize?: number;
136
+ };
89
137
 
90
138
  /**
91
- * Renders a `CircularWavyProgress` component with wavy animation.
139
+ * A linear progress indicator with wavy animation style.
140
+ *
141
+ * Matches the Jetpack Compose `LinearWavyProgressIndicator`.
92
142
  */
93
- export function CircularWavyProgress(props: CircularProgressProps) {
94
- return <NativeProgressView {...transformProps(props)} variant="circularWavy" />;
95
- }
143
+ export const LinearWavyProgressIndicator =
144
+ createProgressComponent<LinearWavyProgressIndicatorProps>('LinearWavyProgressIndicatorView');
145
+
146
+ // endregion
147
+
148
+ // region CircularWavyProgressIndicator
149
+
150
+ export type CircularWavyProgressIndicatorProps = BaseProgressProps;
96
151
 
97
152
  /**
98
- * Renders a `LinearWavyProgress` component with wavy animation.
153
+ * A circular progress indicator with wavy animation style.
154
+ *
155
+ * Matches the Jetpack Compose `CircularWavyProgressIndicator`.
99
156
  */
100
- export function LinearWavyProgress(props: LinearProgressProps) {
101
- return <NativeProgressView {...transformProps(props)} variant="linearWavy" />;
102
- }
157
+ export const CircularWavyProgressIndicator =
158
+ createProgressComponent<CircularWavyProgressIndicatorProps>('CircularWavyProgressIndicatorView');
159
+
160
+ // endregion
@@ -1,6 +1,6 @@
1
1
  import { requireNativeView } from 'expo';
2
2
 
3
- import { type ExpoModifier, type ViewEvent } from '../../types';
3
+ import { type ModifierConfig, type ViewEvent } from '../../types';
4
4
  import { createViewModifierEventListener } from '../modifiers/utils';
5
5
 
6
6
  export type RadioButtonProps = {
@@ -15,12 +15,13 @@ export type RadioButtonProps = {
15
15
  /**
16
16
  * Modifiers for the component.
17
17
  */
18
- modifiers?: ExpoModifier[];
18
+ modifiers?: ModifierConfig[];
19
19
  };
20
20
 
21
- type NativeRadioButtonProps = Omit<RadioButtonProps, 'onClick'> & {
22
- nativeClickable: boolean;
23
- } & ViewEvent<'onNativeClick', void>;
21
+ type NativeRadioButtonProps = Omit<RadioButtonProps, 'onClick'> &
22
+ ViewEvent<'onButtonPressed', void> & {
23
+ clickable: boolean;
24
+ };
24
25
 
25
26
  const RadioButtonNativeView: React.ComponentType<NativeRadioButtonProps> = requireNativeView(
26
27
  'ExpoUI',
@@ -33,10 +34,8 @@ function transformProps(props: RadioButtonProps): NativeRadioButtonProps {
33
34
  modifiers,
34
35
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
35
36
  ...restProps,
36
- nativeClickable: onClick != null,
37
- onNativeClick: () => {
38
- onClick?.();
39
- },
37
+ clickable: onClick != null,
38
+ onButtonPressed: () => onClick?.(),
40
39
  };
41
40
  }
42
41
 
@@ -0,0 +1,109 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { type ColorValue } from 'react-native';
3
+
4
+ import { type ModifierConfig, type ViewEvent } from '../../types';
5
+ import { createViewModifierEventListener } from '../modifiers/utils';
6
+
7
+ /**
8
+ * Colors for the segmented button in different states.
9
+ */
10
+ export type SegmentedButtonColors = {
11
+ activeBorderColor?: ColorValue;
12
+ activeContentColor?: ColorValue;
13
+ inactiveBorderColor?: ColorValue;
14
+ inactiveContentColor?: ColorValue;
15
+ disabledActiveBorderColor?: ColorValue;
16
+ disabledActiveContentColor?: ColorValue;
17
+ disabledInactiveBorderColor?: ColorValue;
18
+ disabledInactiveContentColor?: ColorValue;
19
+ activeContainerColor?: ColorValue;
20
+ inactiveContainerColor?: ColorValue;
21
+ disabledActiveContainerColor?: ColorValue;
22
+ disabledInactiveContainerColor?: ColorValue;
23
+ };
24
+
25
+ export type SegmentedButtonProps = {
26
+ /**
27
+ * Whether the button is currently selected (used inside `SingleChoiceSegmentedButtonRow`).
28
+ */
29
+ selected?: boolean;
30
+ /**
31
+ * Callback that is called when the button is clicked (used inside `SingleChoiceSegmentedButtonRow`).
32
+ */
33
+ onClick?: () => void;
34
+ /**
35
+ * Whether the button is currently checked (used inside `MultiChoiceSegmentedButtonRow`).
36
+ */
37
+ checked?: boolean;
38
+ /**
39
+ * Callback that is called when the checked state changes (used inside `MultiChoiceSegmentedButtonRow`).
40
+ */
41
+ onCheckedChange?: (checked: boolean) => void;
42
+ /**
43
+ * Whether the button is enabled.
44
+ * @default true
45
+ */
46
+ enabled?: boolean;
47
+ /**
48
+ * Colors for the button in different states.
49
+ */
50
+ colors?: SegmentedButtonColors;
51
+ /**
52
+ * Modifiers for the component.
53
+ */
54
+ modifiers?: ModifierConfig[];
55
+ /**
56
+ * Children containing a `Label` slot.
57
+ */
58
+ children?: React.ReactNode;
59
+ };
60
+
61
+ type NativeSlotViewProps = {
62
+ slotName: string;
63
+ children: React.ReactNode;
64
+ };
65
+
66
+ type NativeSegmentedButtonProps = Omit<SegmentedButtonProps, 'onClick' | 'onCheckedChange'> &
67
+ ViewEvent<'onButtonPressed', void> &
68
+ ViewEvent<'onCheckedChange', { value: boolean }>;
69
+
70
+ const SegmentedButtonNativeView: React.ComponentType<NativeSegmentedButtonProps> =
71
+ requireNativeView('ExpoUI', 'SegmentedButtonView');
72
+
73
+ const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
74
+ 'ExpoUI',
75
+ 'SlotView'
76
+ );
77
+
78
+ /**
79
+ * Label slot for `SegmentedButton`.
80
+ */
81
+ function SegmentedButtonLabel(props: { children: React.ReactNode }) {
82
+ return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
83
+ }
84
+
85
+ /**
86
+ * A Material 3 segmented button. Must be used inside a `SingleChoiceSegmentedButtonRow`
87
+ * or `MultiChoiceSegmentedButtonRow`.
88
+ */
89
+ function SegmentedButtonComponent(props: SegmentedButtonProps) {
90
+ const { children, modifiers, onClick, onCheckedChange, ...restProps } = props;
91
+ return (
92
+ <SegmentedButtonNativeView
93
+ modifiers={modifiers}
94
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
95
+ {...restProps}
96
+ onButtonPressed={() => onClick?.()}
97
+ onCheckedChange={(e) => onCheckedChange?.(e.nativeEvent.value)}>
98
+ {children}
99
+ </SegmentedButtonNativeView>
100
+ );
101
+ }
102
+
103
+ SegmentedButtonComponent.Label = SegmentedButtonLabel;
104
+
105
+ export { SegmentedButtonComponent as SegmentedButton };
106
+ export { SingleChoiceSegmentedButtonRow } from '../SingleChoiceSegmentedButtonRow';
107
+ export type { SingleChoiceSegmentedButtonRowProps } from '../SingleChoiceSegmentedButtonRow';
108
+ export { MultiChoiceSegmentedButtonRow } from '../MultiChoiceSegmentedButtonRow';
109
+ export type { MultiChoiceSegmentedButtonRowProps } from '../MultiChoiceSegmentedButtonRow';
@@ -0,0 +1,34 @@
1
+ import { requireNativeView } from 'expo';
2
+
3
+ import { type ModifierConfig } from '../../types';
4
+ import { createViewModifierEventListener } from '../modifiers/utils';
5
+
6
+ export type SingleChoiceSegmentedButtonRowProps = {
7
+ /**
8
+ * SegmentedButton children.
9
+ */
10
+ children: React.ReactNode;
11
+ /**
12
+ * Modifiers for the component.
13
+ */
14
+ modifiers?: ModifierConfig[];
15
+ };
16
+
17
+ const SingleChoiceSegmentedButtonRowNativeView: React.ComponentType<SingleChoiceSegmentedButtonRowProps> =
18
+ requireNativeView('ExpoUI', 'SingleChoiceSegmentedButtonRowView');
19
+
20
+ /**
21
+ * A row container for single-choice `SegmentedButton` children.
22
+ * Maps to Material 3 `SingleChoiceSegmentedButtonRow`.
23
+ */
24
+ export function SingleChoiceSegmentedButtonRow(props: SingleChoiceSegmentedButtonRowProps) {
25
+ const { children, modifiers, ...restProps } = props;
26
+ return (
27
+ <SingleChoiceSegmentedButtonRowNativeView
28
+ modifiers={modifiers}
29
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
30
+ {...restProps}>
31
+ {children}
32
+ </SingleChoiceSegmentedButtonRowNativeView>
33
+ );
34
+ }
@@ -1,14 +1,24 @@
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
+ type SlotNativeViewProps = {
8
+ slotName: string;
9
+ children: React.ReactNode;
10
+ };
11
+
12
+ const SlotNativeView: React.ComponentType<SlotNativeViewProps> = requireNativeView(
13
+ 'ExpoUI',
14
+ 'SlotView'
15
+ );
16
+
7
17
  /**
8
- * Colors for slider's core elements.
18
+ * Colors for slider elements. Maps directly to Material3's `SliderDefaults.colors()`.
9
19
  * @platform android
10
20
  */
11
- export type SliderElementColors = {
21
+ export type SliderColors = {
12
22
  thumbColor?: ColorValue;
13
23
  activeTrackColor?: ColorValue;
14
24
  inactiveTrackColor?: ColorValue;
@@ -38,35 +48,47 @@ export type SliderProps = {
38
48
  */
39
49
  max?: number;
40
50
  /**
41
- * Colors for slider's core elements.
42
- * @platform android
51
+ * Whether the slider is enabled for user interaction.
52
+ * @default true
43
53
  */
44
- elementColors?: SliderElementColors;
54
+ enabled?: boolean;
45
55
  /**
46
- * Slider color.
56
+ * Colors for slider elements. Maps to Material3's `SliderDefaults.colors()`.
57
+ * @platform android
47
58
  */
48
- color?: ColorValue;
59
+ colors?: SliderColors;
49
60
  /**
50
61
  * Callback triggered on dragging along the slider.
51
62
  */
52
63
  onValueChange?: (value: number) => void;
53
-
64
+ /**
65
+ * Callback triggered when the user finishes changing the value (for example, lifts a finger).
66
+ * Maps to Material3's `onValueChangeFinished`.
67
+ */
68
+ onValueChangeFinished?: () => void;
54
69
  /**
55
70
  * Modifiers for the component.
56
71
  */
57
- modifiers?: ExpoModifier[];
72
+ modifiers?: ModifierConfig[];
73
+ /**
74
+ * Slot children for custom thumb and track.
75
+ */
76
+ children?: React.ReactNode;
58
77
  };
59
78
 
60
- type NativeSliderProps = Omit<SliderProps, 'onValueChange'> &
61
- ViewEvent<'onValueChanged', { value: number }>;
79
+ type NativeSliderProps = Omit<SliderProps, 'onValueChange' | 'onValueChangeFinished' | 'children'> &
80
+ ViewEvent<'onValueChange', { value: number }> &
81
+ ViewEvent<'onValueChangeFinished', void> & { children?: React.ReactNode };
62
82
 
63
83
  const SliderNativeView: React.ComponentType<NativeSliderProps> = requireNativeView(
64
84
  'ExpoUI',
65
85
  'SliderView'
66
86
  );
67
87
 
68
- function transformSliderProps(props: SliderProps): NativeSliderProps {
69
- const { modifiers, ...restProps } = props;
88
+ function transformSliderProps(
89
+ props: Omit<SliderProps, 'children'>
90
+ ): Omit<NativeSliderProps, 'children'> {
91
+ const { modifiers, onValueChange, onValueChangeFinished, ...restProps } = props;
70
92
  return {
71
93
  modifiers,
72
94
  ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
@@ -75,22 +97,47 @@ function transformSliderProps(props: SliderProps): NativeSliderProps {
75
97
  max: props.max ?? 1,
76
98
  steps: props.steps ?? 0,
77
99
  value: props.value ?? 0,
78
- onValueChanged: ({ nativeEvent: { value } }) => {
79
- props?.onValueChange?.(value);
80
- },
81
- elementColors: props.elementColors
82
- ? props.elementColors
83
- : props.color
84
- ? {
85
- thumbColor: props.color,
86
- activeTrackColor: props.color,
87
- activeTickColor: props.color,
88
- }
89
- : undefined,
90
- color: props.color,
100
+ enabled: props.enabled ?? true,
101
+ onValueChange: onValueChange
102
+ ? ({ nativeEvent: { value } }) => {
103
+ onValueChange(value);
104
+ }
105
+ : undefined,
106
+ onValueChangeFinished: onValueChangeFinished ? () => onValueChangeFinished() : undefined,
91
107
  };
92
108
  }
93
109
 
94
- export function Slider(props: SliderProps) {
95
- return <SliderNativeView {...transformSliderProps(props)} />;
110
+ /**
111
+ * A custom thumb slot for `Slider`.
112
+ * Wrap any content to use as the slider's thumb indicator.
113
+ *
114
+ * @platform android
115
+ */
116
+ function Thumb(props: { children: React.ReactNode }) {
117
+ return <SlotNativeView slotName="thumb">{props.children}</SlotNativeView>;
96
118
  }
119
+
120
+ /**
121
+ * A custom track slot for `Slider`.
122
+ * Wrap any content to use as the slider's track.
123
+ *
124
+ * @platform android
125
+ */
126
+ function Track(props: { children: React.ReactNode }) {
127
+ return <SlotNativeView slotName="track">{props.children}</SlotNativeView>;
128
+ }
129
+
130
+ /**
131
+ * A slider component that wraps Material3's `Slider`.
132
+ *
133
+ * @platform android
134
+ */
135
+ function SliderComponent(props: SliderProps) {
136
+ const { children, ...restProps } = props;
137
+ return <SliderNativeView {...transformSliderProps(restProps)}>{children}</SliderNativeView>;
138
+ }
139
+
140
+ SliderComponent.Thumb = Thumb;
141
+ SliderComponent.Track = Track;
142
+
143
+ export { SliderComponent as Slider };