@expo/ui 55.0.2 → 55.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
- package/android/src/main/java/expo/modules/ui/BottomSheetView.kt +91 -13
- package/android/src/main/java/expo/modules/ui/CardView.kt +138 -34
- package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
- package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +258 -70
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +209 -61
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +44 -1
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
- package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
- package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
- package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
- package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +53 -161
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +39 -15
- package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
- package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
- package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -86
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
- package/build/datetime-picker/DateTimePicker.android.d.ts +3 -0
- package/build/datetime-picker/DateTimePicker.android.d.ts.map +1 -0
- package/build/datetime-picker/DateTimePicker.d.ts +3 -0
- package/build/datetime-picker/DateTimePicker.d.ts.map +1 -0
- package/build/datetime-picker/DateTimePicker.web.d.ts +3 -0
- package/build/datetime-picker/DateTimePicker.web.d.ts.map +1 -0
- package/build/datetime-picker/index.d.ts +5 -0
- package/build/datetime-picker/index.d.ts.map +1 -0
- package/build/datetime-picker/types.d.ts +128 -0
- package/build/datetime-picker/types.d.ts.map +1 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
- package/build/jetpack-compose/Button/index.d.ts +65 -51
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts +72 -14
- package/build/jetpack-compose/Card/index.d.ts.map +1 -1
- package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
- package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
- package/build/jetpack-compose/Chip/index.d.ts +247 -27
- package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +38 -3
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
- package/build/jetpack-compose/IconButton/index.d.ts +45 -29
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts +65 -13
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts.map +1 -1
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Progress/index.d.ts +78 -35
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
- package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
- package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Slider/index.d.ts +34 -10
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +10 -50
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextInput/index.d.ts +9 -0
- package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
- package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
- package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +5 -4
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +18 -1
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/Link/index.d.ts +36 -0
- package/build/swift-ui/Link/index.d.ts.map +1 -0
- package/build/swift-ui/ProgressView/index.d.ts +1 -5
- package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
- package/build/swift-ui/Stepper/index.d.ts +3 -3
- package/build/swift-ui/Stepper/index.d.ts.map +1 -1
- package/build/swift-ui/Text/index.d.ts +33 -1
- package/build/swift-ui/Text/index.d.ts.map +1 -1
- package/build/swift-ui/index.d.ts +1 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/environment.d.ts +16 -1
- package/build/swift-ui/modifiers/environment.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +24 -7
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
- package/build/swift-ui/modifiers/widgets.d.ts +14 -0
- package/build/swift-ui/modifiers/widgets.d.ts.map +1 -0
- package/build/swift-ui/types.d.ts +7 -0
- package/build/swift-ui/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +1 -6
- package/ios/ClosedRangeDateRecord.swift +10 -0
- package/ios/ColorPickerView.swift +9 -8
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +4 -6
- package/ios/DatePickerView.swift +7 -5
- package/ios/DisclosureGroupView.swift +5 -7
- package/ios/ExpoUIModule.swift +1 -0
- package/ios/LinkView.swift +29 -0
- package/ios/ListView.swift +6 -14
- package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
- package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
- package/ios/Modifiers/EnvironmentModifier.swift +14 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +12 -0
- package/ios/Modifiers/WidgetModifiers.swift +12 -0
- package/ios/Picker/PickerView.swift +6 -10
- package/ios/Popover/PopoverView.swift +3 -5
- package/ios/ProgressView.swift +0 -5
- package/ios/SectionView.swift +3 -5
- package/ios/SliderView.swift +8 -6
- package/ios/StepperView.swift +12 -16
- package/ios/TextView.swift +37 -1
- package/ios/Toggle/ToggleView.swift +5 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.module → 55.0.4/expo.modules.ui-55.0.4.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.pom → 55.0.4/expo.modules.ui-55.0.4.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +9 -2
- package/src/datetime-picker/DateTimePicker.android.tsx +126 -0
- package/src/datetime-picker/DateTimePicker.tsx +94 -0
- package/src/datetime-picker/DateTimePicker.web.tsx +5 -0
- package/src/datetime-picker/index.tsx +11 -0
- package/src/datetime-picker/types.tsx +147 -0
- package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
- package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
- package/src/jetpack-compose/Button/index.tsx +69 -92
- package/src/jetpack-compose/Card/index.tsx +105 -29
- package/src/jetpack-compose/Checkbox/index.tsx +126 -0
- package/src/jetpack-compose/Chip/index.tsx +391 -51
- package/src/jetpack-compose/DatePicker/index.tsx +112 -7
- package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
- package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
- package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
- package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
- package/src/jetpack-compose/IconButton/index.tsx +49 -56
- package/src/jetpack-compose/ModalBottomSheet/index.tsx +85 -15
- package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Progress/index.tsx +120 -62
- package/src/jetpack-compose/RadioButton/index.tsx +8 -9
- package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
- package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Slider/index.tsx +76 -29
- package/src/jetpack-compose/Switch/index.tsx +17 -87
- package/src/jetpack-compose/TextInput/index.tsx +10 -0
- package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
- package/src/jetpack-compose/index.ts +5 -4
- package/src/jetpack-compose/modifiers/index.ts +26 -2
- package/src/swift-ui/Link/index.tsx +52 -0
- package/src/swift-ui/ProgressView/index.tsx +1 -3
- package/src/swift-ui/Stepper/index.tsx +7 -7
- package/src/swift-ui/Text/index.tsx +66 -2
- package/src/swift-ui/index.tsx +1 -0
- package/src/swift-ui/modifiers/environment.ts +17 -4
- package/src/swift-ui/modifiers/index.ts +44 -10
- package/src/swift-ui/modifiers/widgets.ts +18 -0
- package/src/swift-ui/types.ts +5 -0
- package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
- package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
- package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
- package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
- package/build/jetpack-compose/Button/types.d.ts +0 -5
- package/build/jetpack-compose/Button/types.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
- package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
- package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
- package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
- package/build/jetpack-compose/Picker/index.d.ts +0 -62
- package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
- package/build/jetpack-compose/TextButton/index.d.ts +0 -29
- package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha512 +0 -1
- package/src/jetpack-compose/Button/types.ts +0 -57
- package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
- package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
- package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
- package/src/jetpack-compose/FilterChip/index.tsx +0 -89
- package/src/jetpack-compose/Picker/index.tsx +0 -90
- 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
|
|
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(
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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
|
-
*
|
|
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
|
|
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
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
onPress?: () => void;
|
|
21
|
-
/**
|
|
22
|
-
* The button variant.
|
|
20
|
+
* Callback that is called when the icon button is clicked.
|
|
23
21
|
*/
|
|
24
|
-
|
|
22
|
+
onClick?: () => void;
|
|
25
23
|
/**
|
|
26
|
-
*
|
|
24
|
+
* Whether the icon button is enabled for user interaction.
|
|
25
|
+
* @default true
|
|
27
26
|
*/
|
|
28
|
-
|
|
27
|
+
enabled?: boolean;
|
|
29
28
|
/**
|
|
30
|
-
* Colors for button
|
|
29
|
+
* Colors for icon button elements.
|
|
31
30
|
* @platform android
|
|
32
31
|
*/
|
|
33
|
-
|
|
32
|
+
colors?: IconButtonColors;
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
34
|
+
* The shape of the icon button.
|
|
36
35
|
*/
|
|
37
|
-
color?: ColorValue;
|
|
38
36
|
shape?: ShapeJSXElement;
|
|
39
37
|
/**
|
|
40
|
-
*
|
|
38
|
+
* Modifiers for the component.
|
|
41
39
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
modifiers?: ModifierConfig[];
|
|
44
41
|
/**
|
|
45
|
-
*
|
|
42
|
+
* Content to display inside the icon button.
|
|
46
43
|
*/
|
|
47
|
-
|
|
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
|
-
|
|
58
|
-
const
|
|
59
|
-
'ExpoUI',
|
|
60
|
-
'IconButton'
|
|
61
|
-
);
|
|
52
|
+
function createIconButtonComponent(name: string) {
|
|
53
|
+
const NativeView: React.ComponentType<NativeIconButtonProps> = requireNativeView('ExpoUI', name);
|
|
62
54
|
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
*
|
|
64
|
+
* A standard icon button with no background.
|
|
85
65
|
*/
|
|
86
|
-
export
|
|
87
|
-
|
|
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');
|