@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
@@ -0,0 +1,126 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { ColorValue } from 'react-native';
3
+
4
+ import { ModifierConfig, ViewEvent } from '../../types';
5
+ import { createViewModifierEventListener } from '../modifiers/utils';
6
+
7
+ type SlotNativeViewProps = {
8
+ slotName: string;
9
+ children: React.ReactNode;
10
+ };
11
+
12
+ const SlotNativeView: React.ComponentType<SlotNativeViewProps> = requireNativeView(
13
+ 'ExpoUI',
14
+ 'SlotView'
15
+ );
16
+
17
+ /**
18
+ * Color overrides for the `DropdownMenuItem` component.
19
+ */
20
+ export type DropdownMenuItemElementColors = {
21
+ /** Color of the menu item text. */
22
+ textColor?: ColorValue;
23
+ /** Color of the text when the menu item is disabled. */
24
+ disabledTextColor?: ColorValue;
25
+ // TODO: At the moment IconView's tint color defaults to Color.Unspecified instead of LocalContentColor.current.
26
+ // Thus the color override will not work for icons. At the moment icon color can only be set directly in IconView.
27
+ // leadingIconColor?: ColorValue;
28
+ // trailingIconColor?: ColorValue;
29
+ // disabledLeadingIconColor?: ColorValue;
30
+ // disabledTrailingIconColor?: ColorValue;
31
+ };
32
+
33
+ /**
34
+ * Props of the `DropdownMenuItem` component.
35
+ */
36
+ export type DropdownMenuItemProps = {
37
+ /**
38
+ * Whether the menu item is enabled.
39
+ * @default true
40
+ */
41
+ enabled?: boolean;
42
+ /**
43
+ * Color overrides for the menu item.
44
+ */
45
+ elementColors?: DropdownMenuItemElementColors;
46
+ /**
47
+ * Modifiers for the component.
48
+ */
49
+ modifiers?: ModifierConfig[];
50
+ /**
51
+ * Callback that is called when the menu item is clicked.
52
+ */
53
+ onClick?: () => void;
54
+ /**
55
+ * Slot children for text, leading/trailing icons.
56
+ */
57
+ children?: React.ReactNode;
58
+ };
59
+
60
+ type NativeDropdownMenuItemProps = Omit<DropdownMenuItemProps, 'onClick' | 'children'> &
61
+ ViewEvent<'onItemPressed', void> & { children?: React.ReactNode };
62
+
63
+ const DropdownMenuItemNativeView: React.ComponentType<NativeDropdownMenuItemProps> =
64
+ requireNativeView('ExpoUI', 'DropdownMenuItemView');
65
+
66
+ /**
67
+ * A leading icon slot for `DropdownMenuItem`.
68
+ * Wrap an `Icon` or other content to display before the menu item text.
69
+ *
70
+ * @platform android
71
+ */
72
+ function LeadingIcon(props: { children: React.ReactNode }) {
73
+ return <SlotNativeView slotName="leadingIcon">{props.children}</SlotNativeView>;
74
+ }
75
+
76
+ /**
77
+ * A trailing icon slot for `DropdownMenuItem`.
78
+ * Wrap an `Icon` or other content to display after the menu item text.
79
+ *
80
+ * @platform android
81
+ */
82
+ function TrailingIcon(props: { children: React.ReactNode }) {
83
+ return <SlotNativeView slotName="trailingIcon">{props.children}</SlotNativeView>;
84
+ }
85
+
86
+ /**
87
+ * A dropdown menu item component that wraps Compose's `DropdownMenuItem`.
88
+ * Should be used inside `DropdownMenu.Items`.
89
+ *
90
+ * @platform android
91
+ */
92
+ /**
93
+ * A text slot for `DropdownMenuItem`.
94
+ * Wrap text content to display as the menu item label.
95
+ *
96
+ * @platform android
97
+ */
98
+ function TextSlot(props: { children: React.ReactNode }) {
99
+ return <SlotNativeView slotName="text">{props.children}</SlotNativeView>;
100
+ }
101
+
102
+ /**
103
+ * A dropdown menu item component that wraps Compose's `DropdownMenuItem`.
104
+ * Should be used inside `ContextMenu.Items`.
105
+ *
106
+ * @platform android
107
+ */
108
+ function DropdownMenuItemComponent(props: DropdownMenuItemProps) {
109
+ const { onClick, modifiers, children, ...restProps } = props;
110
+ return (
111
+ <DropdownMenuItemNativeView
112
+ {...restProps}
113
+ modifiers={modifiers}
114
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
115
+ enabled={props.enabled ?? true}
116
+ onItemPressed={onClick ? () => onClick() : undefined}>
117
+ {children}
118
+ </DropdownMenuItemNativeView>
119
+ );
120
+ }
121
+
122
+ DropdownMenuItemComponent.Text = TextSlot;
123
+ DropdownMenuItemComponent.LeadingIcon = LeadingIcon;
124
+ DropdownMenuItemComponent.TrailingIcon = TrailingIcon;
125
+
126
+ export { DropdownMenuItemComponent as DropdownMenuItem };
@@ -0,0 +1,107 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { ReactNode } from 'react';
3
+ import { StyleProp, ViewStyle, type ColorValue } from 'react-native';
4
+
5
+ import { ModifierConfig } from '../../types';
6
+ import { createViewModifierEventListener } from '../modifiers/utils';
7
+
8
+ const MenuNativeView: React.ComponentType<NativeMenuProps> = requireNativeView(
9
+ 'ExpoUI',
10
+ 'DropdownMenuView'
11
+ );
12
+
13
+ // TODO: Extract into separate SlotView similar to swift-ui
14
+ const SlotNativeView: React.ComponentType<{
15
+ slotName: string;
16
+ children: React.ReactNode;
17
+ }> = requireNativeView('ExpoUI', 'SlotView');
18
+
19
+ /**
20
+ * Props of the `DropdownMenu` component.
21
+ */
22
+ export type DropdownMenuProps = {
23
+ /**
24
+ * The contents of the submenu are used as an anchor for the dropdown menu.
25
+ * The children will be wrapped in a pressable element, which triggers opening of the dropdown menu.
26
+ */
27
+ children: ReactNode;
28
+
29
+ /**
30
+ * Whether the dropdown menu is expanded (visible).
31
+ */
32
+ expanded?: boolean;
33
+
34
+ /**
35
+ * Callback fired when the menu requests to be dismissed (e.g. tapping outside).
36
+ * Must be provided when `expanded` is `true` to allow the menu to close.
37
+ */
38
+ onDismissRequest?: () => void;
39
+
40
+ /**
41
+ * The color of the container holding the dropdown menu items.
42
+ */
43
+ color?: ColorValue;
44
+
45
+ /**
46
+ * Optional styles to apply to the `DropdownMenu`.
47
+ */
48
+ style?: StyleProp<ViewStyle>;
49
+
50
+ /**
51
+ * Modifiers for the component.
52
+ */
53
+ modifiers?: ModifierConfig[];
54
+ };
55
+
56
+ type NativeMenuProps = {
57
+ expanded?: boolean;
58
+ onDismissRequest?: () => void;
59
+ color?: ColorValue;
60
+ style?: StyleProp<ViewStyle>;
61
+ modifiers?: ModifierConfig[];
62
+ children?: ReactNode;
63
+ };
64
+
65
+ /**
66
+ * Container for items displayed in the dropdown menu.
67
+ * Children should be `DropdownMenuItem` components or other native views.
68
+ */
69
+ export function Items(props: { children: ReactNode }) {
70
+ return <SlotNativeView slotName="items">{props.children}</SlotNativeView>;
71
+ }
72
+ Items.tag = 'Items';
73
+
74
+ /**
75
+ * Container for the trigger element that opens the dropdown menu.
76
+ */
77
+ export function Trigger(props: { children: ReactNode }) {
78
+ return <>{props.children}</>;
79
+ }
80
+ Trigger.tag = 'Trigger';
81
+
82
+ /**
83
+ * Preview content shown during long press (iOS only).
84
+ */
85
+ export function Preview(props: { children: ReactNode }) {
86
+ return <></>;
87
+ }
88
+
89
+ function DropdownMenu(props: DropdownMenuProps) {
90
+ const { modifiers, ...restProps } = props;
91
+ return (
92
+ <MenuNativeView
93
+ style={props.style}
94
+ modifiers={modifiers}
95
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
96
+ {...restProps}>
97
+ {props.children}
98
+ </MenuNativeView>
99
+ );
100
+ }
101
+
102
+ DropdownMenu.Trigger = Trigger;
103
+ DropdownMenu.Preview = Preview;
104
+ DropdownMenu.Items = Items;
105
+
106
+ export { DropdownMenu };
107
+ export { DropdownMenuItem } from './DropdownMenuItem';
@@ -0,0 +1,207 @@
1
+ import { requireNativeView } from 'expo';
2
+ import { type ColorValue } from 'react-native';
3
+
4
+ import { ModifierConfig, ViewEvent } from '../../types';
5
+ import { createViewModifierEventListener } from '../modifiers/utils';
6
+
7
+ type SlotChildProps = {
8
+ children: React.ReactNode;
9
+ };
10
+
11
+ type NativeSlotViewProps = {
12
+ slotName: string;
13
+ children: React.ReactNode;
14
+ };
15
+
16
+ /**
17
+ * Props shared by all `FloatingActionButton` variants.
18
+ */
19
+ export type FloatingActionButtonProps = {
20
+ /**
21
+ * Slot-based children (use `.Icon` sub-component).
22
+ */
23
+ children: React.ReactNode;
24
+
25
+ /**
26
+ * The background color of the button container.
27
+ * Defaults to `FloatingActionButtonDefaults.containerColor` (primary container).
28
+ */
29
+ containerColor?: ColorValue;
30
+
31
+ /**
32
+ * Callback invoked when the button is clicked.
33
+ */
34
+ onClick?: () => void;
35
+
36
+ /**
37
+ * Modifiers for the component.
38
+ */
39
+ modifiers?: ModifierConfig[];
40
+ };
41
+
42
+ /**
43
+ * Props for the `SmallFloatingActionButton` component.
44
+ * Same as {@link FloatingActionButtonProps}.
45
+ */
46
+ export type SmallFloatingActionButtonProps = FloatingActionButtonProps;
47
+
48
+ /**
49
+ * Props for the `LargeFloatingActionButton` component.
50
+ * Same as {@link FloatingActionButtonProps}.
51
+ */
52
+ export type LargeFloatingActionButtonProps = FloatingActionButtonProps;
53
+
54
+ /**
55
+ * Props for the `ExtendedFloatingActionButton` component.
56
+ */
57
+ export type ExtendedFloatingActionButtonProps = FloatingActionButtonProps & {
58
+ /**
59
+ * Slot-based children (use `.Icon` and `.Text` sub-components).
60
+ */
61
+ children: React.ReactNode;
62
+
63
+ /**
64
+ * Controls whether the label is shown (expanded) or hidden (collapsed).
65
+ * @default true
66
+ */
67
+ expanded?: boolean;
68
+ };
69
+
70
+ /**
71
+ * @hidden
72
+ */
73
+ type NativeFloatingActionButtonProps = Omit<FloatingActionButtonProps, 'onClick'> &
74
+ ViewEvent<'onButtonPressed', void> & {
75
+ variant: string;
76
+ expanded?: boolean;
77
+ };
78
+
79
+ const FloatingActionButtonNativeView: React.ComponentType<NativeFloatingActionButtonProps> =
80
+ requireNativeView('ExpoUI', 'FloatingActionButtonView');
81
+
82
+ const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeView(
83
+ 'ExpoUI',
84
+ 'SlotView'
85
+ );
86
+
87
+ function FABIcon(props: SlotChildProps) {
88
+ return <SlotNativeView slotName="icon">{props.children}</SlotNativeView>;
89
+ }
90
+
91
+ function FABText(props: SlotChildProps) {
92
+ return <SlotNativeView slotName="text">{props.children}</SlotNativeView>;
93
+ }
94
+
95
+ function transformProps(
96
+ props: FloatingActionButtonProps & { variant: string; expanded?: boolean }
97
+ ): NativeFloatingActionButtonProps {
98
+ const { children, onClick, modifiers, ...restProps } = props;
99
+
100
+ return {
101
+ modifiers,
102
+ ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
103
+ ...restProps,
104
+ children,
105
+ onButtonPressed: onClick,
106
+ };
107
+ }
108
+
109
+ /**
110
+ * Renders a Material Design 3 small `FloatingActionButton`.
111
+ *
112
+ * Wraps [`SmallFloatingActionButton`](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#SmallFloatingActionButton(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.material3.FloatingActionButtonElevation,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)).
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * import { SmallFloatingActionButton, Host, Icon } from '@expo/ui/jetpack-compose';
117
+ *
118
+ * <Host matchContents>
119
+ * <SmallFloatingActionButton onClick={() => console.log('pressed')}>
120
+ * <SmallFloatingActionButton.Icon>
121
+ * <Icon source={require('./assets/add.xml')} />
122
+ * </SmallFloatingActionButton.Icon>
123
+ * </SmallFloatingActionButton>
124
+ * </Host>
125
+ * ```
126
+ */
127
+ function SmallFloatingActionButtonComponent(props: SmallFloatingActionButtonProps) {
128
+ return <FloatingActionButtonNativeView {...transformProps({ ...props, variant: 'small' })} />;
129
+ }
130
+ SmallFloatingActionButtonComponent.Icon = FABIcon;
131
+ export { SmallFloatingActionButtonComponent as SmallFloatingActionButton };
132
+
133
+ /**
134
+ * Renders a Material Design 3 standard `FloatingActionButton`.
135
+ *
136
+ * Wraps [`FloatingActionButton`](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#FloatingActionButton(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.material3.FloatingActionButtonElevation,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)).
137
+ *
138
+ * @example
139
+ * ```tsx
140
+ * import { FloatingActionButton, Host, Icon } from '@expo/ui/jetpack-compose';
141
+ *
142
+ * <Host matchContents>
143
+ * <FloatingActionButton onClick={() => console.log('pressed')}>
144
+ * <FloatingActionButton.Icon>
145
+ * <Icon source={require('./assets/add.xml')} />
146
+ * </FloatingActionButton.Icon>
147
+ * </FloatingActionButton>
148
+ * </Host>
149
+ * ```
150
+ */
151
+ function FloatingActionButtonComponent(props: FloatingActionButtonProps) {
152
+ return <FloatingActionButtonNativeView {...transformProps({ ...props, variant: 'medium' })} />;
153
+ }
154
+ FloatingActionButtonComponent.Icon = FABIcon;
155
+ export { FloatingActionButtonComponent as FloatingActionButton };
156
+
157
+ /**
158
+ * Renders a Material Design 3 large `FloatingActionButton`.
159
+ *
160
+ * Wraps [`LargeFloatingActionButton`](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#LargeFloatingActionButton(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.material3.FloatingActionButtonElevation,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function0)).
161
+ *
162
+ * @example
163
+ * ```tsx
164
+ * import { LargeFloatingActionButton, Host, Icon } from '@expo/ui/jetpack-compose';
165
+ *
166
+ * <Host matchContents>
167
+ * <LargeFloatingActionButton onClick={() => console.log('pressed')}>
168
+ * <LargeFloatingActionButton.Icon>
169
+ * <Icon source={require('./assets/add.xml')} />
170
+ * </LargeFloatingActionButton.Icon>
171
+ * </LargeFloatingActionButton>
172
+ * </Host>
173
+ * ```
174
+ */
175
+ function LargeFloatingActionButtonComponent(props: LargeFloatingActionButtonProps) {
176
+ return <FloatingActionButtonNativeView {...transformProps({ ...props, variant: 'large' })} />;
177
+ }
178
+ LargeFloatingActionButtonComponent.Icon = FABIcon;
179
+ export { LargeFloatingActionButtonComponent as LargeFloatingActionButton };
180
+
181
+ /**
182
+ * Renders a Material Design 3 `ExtendedFloatingActionButton` with animated label expansion.
183
+ *
184
+ * Wraps [`ExtendedFloatingActionButton`](https://developer.android.com/reference/kotlin/androidx/compose/material3/package-summary#ExtendedFloatingActionButton(kotlin.Function0,androidx.compose.ui.Modifier,androidx.compose.ui.graphics.Shape,androidx.compose.ui.graphics.Color,androidx.compose.ui.graphics.Color,androidx.compose.material3.FloatingActionButtonElevation,androidx.compose.foundation.interaction.MutableInteractionSource,kotlin.Function1)).
185
+ *
186
+ * @example
187
+ * ```tsx
188
+ * import { ExtendedFloatingActionButton, Host, Icon, Text } from '@expo/ui/jetpack-compose';
189
+ *
190
+ * <Host matchContents>
191
+ * <ExtendedFloatingActionButton expanded={true} onClick={() => console.log('pressed')}>
192
+ * <ExtendedFloatingActionButton.Icon>
193
+ * <Icon source={require('./assets/edit.xml')} />
194
+ * </ExtendedFloatingActionButton.Icon>
195
+ * <ExtendedFloatingActionButton.Text>
196
+ * <Text>Edit</Text>
197
+ * </ExtendedFloatingActionButton.Text>
198
+ * </ExtendedFloatingActionButton>
199
+ * </Host>
200
+ * ```
201
+ */
202
+ function ExtendedFloatingActionButtonComponent(props: ExtendedFloatingActionButtonProps) {
203
+ return <FloatingActionButtonNativeView {...transformProps({ ...props, variant: 'extended' })} />;
204
+ }
205
+ ExtendedFloatingActionButtonComponent.Icon = FABIcon;
206
+ ExtendedFloatingActionButtonComponent.Text = FABText;
207
+ export { ExtendedFloatingActionButtonComponent as ExtendedFloatingActionButton };
@@ -21,7 +21,7 @@ export type HorizontalFloatingToolbarProps = {
21
21
  modifiers?: ExpoModifier[];
22
22
  };
23
23
 
24
- export type FloatingActionButtonProps = {
24
+ export type HorizontalFloatingToolbarFloatingActionButtonProps = {
25
25
  /**
26
26
  * A callback that is called when the button is pressed.
27
27
  */
@@ -54,7 +54,9 @@ const SlotNativeView: React.ComponentType<NativeSlotViewProps> = requireNativeVi
54
54
  * FloatingActionButton component for HorizontalFloatingToolbar.
55
55
  * This component marks its children to be rendered in the FAB slot.
56
56
  */
57
- export function HorizontalFloatingToolbarFloatingActionButton(props: FloatingActionButtonProps) {
57
+ export function HorizontalFloatingToolbarFloatingActionButton(
58
+ props: HorizontalFloatingToolbarFloatingActionButtonProps
59
+ ) {
58
60
  return (
59
61
  <SlotNativeView slotName="floatingActionButton" onSlotEvent={props.onPress}>
60
62
  {props.children}
@@ -1,88 +1,81 @@
1
1
  import { requireNativeView } from 'expo';
2
2
  import { type ColorValue } from 'react-native';
3
3
 
4
- import { ExpoModifier, ViewEvent } from '../../types';
5
- import { ButtonElementColors } from '../Button';
6
- import { parseJSXShape, ShapeJSXElement, ShapeRecordProps } from '../Shape';
7
- import { createViewModifierEventListener } from '../modifiers/utils';
4
+ import type { ModifierConfig, ViewEvent } from '../../types';
5
+ import { transformButtonProps } from '../Button';
6
+ import { type ShapeJSXElement, type ShapeRecordProps } from '../Shape';
8
7
 
9
8
  /**
10
- * The built-in button styles available on Android.
11
- * - `outlined` - A button with an outline.
12
- * - `elevated` - A filled button with a shadow.
9
+ * Colors for icon button elements.
13
10
  */
14
- export type IconButtonVariant = 'default' | 'bordered' | 'outlined';
11
+ export type IconButtonColors = {
12
+ containerColor?: ColorValue;
13
+ contentColor?: ColorValue;
14
+ disabledContainerColor?: ColorValue;
15
+ disabledContentColor?: ColorValue;
16
+ };
15
17
 
16
18
  export type IconButtonProps = {
17
19
  /**
18
- * A callback that is called when the button is pressed.
19
- */
20
- onPress?: () => void;
21
- /**
22
- * The button variant.
20
+ * Callback that is called when the icon button is clicked.
23
21
  */
24
- variant?: IconButtonVariant;
22
+ onClick?: () => void;
25
23
  /**
26
- * The text to display inside the button.
24
+ * Whether the icon button is enabled for user interaction.
25
+ * @default true
27
26
  */
28
- children?: React.JSX.Element;
27
+ enabled?: boolean;
29
28
  /**
30
- * Colors for button's core elements.
29
+ * Colors for icon button elements.
31
30
  * @platform android
32
31
  */
33
- elementColors?: ButtonElementColors;
32
+ colors?: IconButtonColors;
34
33
  /**
35
- * Button color.
34
+ * The shape of the icon button.
36
35
  */
37
- color?: ColorValue;
38
36
  shape?: ShapeJSXElement;
39
37
  /**
40
- * Disabled state of the button.
38
+ * Modifiers for the component.
41
39
  */
42
- disabled?: boolean;
43
-
40
+ modifiers?: ModifierConfig[];
44
41
  /**
45
- * Modifiers for the component.
42
+ * Content to display inside the icon button.
46
43
  */
47
- modifiers?: ExpoModifier[];
44
+ children: React.ReactNode;
48
45
  };
49
46
 
50
- /**
51
- * @hidden
52
- */
53
- export type NativeIconButtonProps = Omit<IconButtonProps, 'role' | 'onPress' | 'shape'> & {
47
+ type NativeIconButtonProps = Omit<IconButtonProps, 'onClick' | 'shape' | 'children'> & {
54
48
  shape?: ShapeRecordProps;
49
+ children?: React.ReactNode;
55
50
  } & ViewEvent<'onButtonPressed', void>;
56
51
 
57
- // We have to work around the `role` and `onPress` props being reserved by React Native.
58
- const IconButtonNativeView: React.ComponentType<NativeIconButtonProps> = requireNativeView(
59
- 'ExpoUI',
60
- 'IconButton'
61
- );
52
+ function createIconButtonComponent(name: string) {
53
+ const NativeView: React.ComponentType<NativeIconButtonProps> = requireNativeView('ExpoUI', name);
62
54
 
63
- function transformIconButtonProps(props: IconButtonProps): NativeIconButtonProps {
64
- const { children, onPress, shape, modifiers, ...restProps } = props;
65
-
66
- return {
67
- modifiers,
68
- ...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
69
- ...restProps,
70
- children,
71
- shape: parseJSXShape(shape),
72
- onButtonPressed: onPress,
73
- elementColors: props.elementColors
74
- ? props.elementColors
75
- : props.color
76
- ? {
77
- containerColor: props.color,
78
- }
79
- : undefined,
80
- };
55
+ function Component(props: IconButtonProps) {
56
+ const { children, ...restProps } = props;
57
+ return <NativeView {...transformButtonProps(restProps)}>{children}</NativeView>;
58
+ }
59
+ Component.displayName = name;
60
+ return Component;
81
61
  }
82
62
 
83
63
  /**
84
- * Displays a native button component.
64
+ * A standard icon button with no background.
85
65
  */
86
- export function IconButton(props: IconButtonProps) {
87
- return <IconButtonNativeView {...transformIconButtonProps(props)} />;
88
- }
66
+ export const IconButton = createIconButtonComponent('IconButton');
67
+
68
+ /**
69
+ * A filled icon button with a solid background.
70
+ */
71
+ export const FilledIconButton = createIconButtonComponent('FilledIconButton');
72
+
73
+ /**
74
+ * A filled tonal icon button with a muted background.
75
+ */
76
+ export const FilledTonalIconButton = createIconButtonComponent('FilledTonalIconButton');
77
+
78
+ /**
79
+ * An outlined icon button with a border and no fill.
80
+ */
81
+ export const OutlinedIconButton = createIconButtonComponent('OutlinedIconButton');
@@ -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 MultiChoiceSegmentedButtonRowProps = {
7
+ /**
8
+ * SegmentedButton children.
9
+ */
10
+ children: React.ReactNode;
11
+ /**
12
+ * Modifiers for the component.
13
+ */
14
+ modifiers?: ModifierConfig[];
15
+ };
16
+
17
+ const MultiChoiceSegmentedButtonRowNativeView: React.ComponentType<MultiChoiceSegmentedButtonRowProps> =
18
+ requireNativeView('ExpoUI', 'MultiChoiceSegmentedButtonRowView');
19
+
20
+ /**
21
+ * A row container for multi-choice `SegmentedButton` children.
22
+ * Maps to Material 3 `MultiChoiceSegmentedButtonRow`.
23
+ */
24
+ export function MultiChoiceSegmentedButtonRow(props: MultiChoiceSegmentedButtonRowProps) {
25
+ const { children, modifiers, ...restProps } = props;
26
+ return (
27
+ <MultiChoiceSegmentedButtonRowNativeView
28
+ modifiers={modifiers}
29
+ {...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
30
+ {...restProps}>
31
+ {children}
32
+ </MultiChoiceSegmentedButtonRowNativeView>
33
+ );
34
+ }