@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
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
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
|
|
18
|
+
* Colors for slider elements. Maps directly to Material3's `SliderDefaults.colors()`.
|
|
9
19
|
* @platform android
|
|
10
20
|
*/
|
|
11
|
-
export type
|
|
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
|
-
*
|
|
42
|
-
* @
|
|
51
|
+
* Whether the slider is enabled for user interaction.
|
|
52
|
+
* @default true
|
|
43
53
|
*/
|
|
44
|
-
|
|
54
|
+
enabled?: boolean;
|
|
45
55
|
/**
|
|
46
|
-
*
|
|
56
|
+
* Colors for slider elements. Maps to Material3's `SliderDefaults.colors()`.
|
|
57
|
+
* @platform android
|
|
47
58
|
*/
|
|
48
|
-
|
|
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?:
|
|
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<'
|
|
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(
|
|
69
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
:
|
|
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
|
-
|
|
95
|
-
|
|
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 };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { NativeSyntheticEvent, type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { type ModifierConfig } from '../../types';
|
|
5
5
|
import { ExpoUIModule } from '../ExpoUIModule';
|
|
6
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
7
|
|
|
8
|
-
// @docsMissing
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* Colors for switch core elements.
|
|
11
10
|
*/
|
|
12
|
-
type
|
|
11
|
+
export type SwitchColors = {
|
|
13
12
|
checkedThumbColor?: ColorValue;
|
|
14
13
|
checkedTrackColor?: ColorValue;
|
|
15
14
|
checkedBorderColor?: ColorValue;
|
|
@@ -28,89 +27,38 @@ type SwitchElementColors = {
|
|
|
28
27
|
disabledUncheckedIconColor?: ColorValue;
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
// @docsMissing
|
|
32
|
-
/**
|
|
33
|
-
* Only for checkbox.
|
|
34
|
-
*/
|
|
35
|
-
type CheckboxElementColors = {
|
|
36
|
-
checkedColor?: ColorValue;
|
|
37
|
-
disabledCheckedColor?: ColorValue;
|
|
38
|
-
uncheckedColor?: ColorValue;
|
|
39
|
-
disabledUncheckedColor?: ColorValue;
|
|
40
|
-
checkmarkColor?: ColorValue;
|
|
41
|
-
disabledIndeterminateColor?: ColorValue;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
30
|
export type SwitchProps = {
|
|
45
31
|
/**
|
|
46
32
|
* Indicates whether the switch is checked.
|
|
47
33
|
*/
|
|
48
34
|
value: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Label for the switch.
|
|
51
|
-
*
|
|
52
|
-
* > On Android, the label has an effect only when the `Switch` is used inside a `ContextMenu`.
|
|
53
|
-
*/
|
|
54
|
-
label?: string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Type of the switch component. Can be `'checkbox'`, `'switch'`, or `'button'`.
|
|
58
|
-
* @default 'switch'
|
|
59
|
-
*/
|
|
60
|
-
variant?: 'checkbox' | 'switch' | 'button';
|
|
61
35
|
/**
|
|
62
36
|
* Whether the switch is enabled.
|
|
63
37
|
* @default true
|
|
64
|
-
* @platform android
|
|
65
38
|
*/
|
|
66
39
|
enabled?: boolean;
|
|
67
40
|
/**
|
|
68
41
|
* Callback function that is called when the checked state changes.
|
|
69
42
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
43
|
+
onCheckedChange?: (value: boolean) => void;
|
|
72
44
|
/**
|
|
73
|
-
*
|
|
45
|
+
* Colors for switch core elements.
|
|
74
46
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
47
|
+
colors?: SwitchColors;
|
|
77
48
|
/**
|
|
78
49
|
* Modifiers for the component.
|
|
79
50
|
*/
|
|
80
|
-
modifiers?:
|
|
81
|
-
|
|
51
|
+
modifiers?: ModifierConfig[];
|
|
82
52
|
/**
|
|
83
53
|
* Children containing ThumbContent slot.
|
|
84
54
|
* @platform android
|
|
85
55
|
*/
|
|
86
56
|
children?: React.ReactNode;
|
|
87
|
-
} & (SwitchSwitchVariantProps | SwitchCheckboxVariantProps | SwitchButtonVariantProps);
|
|
88
|
-
|
|
89
|
-
export type SwitchSwitchVariantProps = {
|
|
90
|
-
variant?: 'switch';
|
|
91
|
-
/**
|
|
92
|
-
* Colors for switch's core elements.
|
|
93
|
-
* @platform android
|
|
94
|
-
*/
|
|
95
|
-
elementColors?: SwitchElementColors;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type SwitchCheckboxVariantProps = {
|
|
99
|
-
variant: 'checkbox';
|
|
100
|
-
/**
|
|
101
|
-
* Colors for checkbox core elements.
|
|
102
|
-
* @platform android
|
|
103
|
-
*/
|
|
104
|
-
elementColors?: CheckboxElementColors;
|
|
105
57
|
};
|
|
106
58
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
type NativeSwitchProps = Omit<SwitchProps, 'onValueChange'> & {
|
|
113
|
-
onValueChange: (event: NativeSyntheticEvent<{ value: boolean }>) => void;
|
|
59
|
+
type NativeSwitchProps = Omit<SwitchProps, 'onCheckedChange' | 'children'> & {
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
onCheckedChange: (event: NativeSyntheticEvent<{ value: boolean }>) => void;
|
|
114
62
|
};
|
|
115
63
|
|
|
116
64
|
type NativeSlotViewProps = {
|
|
@@ -140,39 +88,21 @@ export function SwitchThumbContent(props: ThumbContentProps) {
|
|
|
140
88
|
return <SlotNativeView slotName="thumbContent">{props.children}</SlotNativeView>;
|
|
141
89
|
}
|
|
142
90
|
|
|
143
|
-
function getElementColors(props: SwitchProps) {
|
|
144
|
-
if (props.variant === 'button') {
|
|
145
|
-
return undefined;
|
|
146
|
-
}
|
|
147
|
-
if (!props.elementColors) {
|
|
148
|
-
if (props.variant === 'switch') {
|
|
149
|
-
return {
|
|
150
|
-
checkedTrackColor: props.color,
|
|
151
|
-
};
|
|
152
|
-
} else {
|
|
153
|
-
return {
|
|
154
|
-
checkedColor: props.color,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
return props.elementColors;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
91
|
function transformSwitchProps(props: SwitchProps): Omit<NativeSwitchProps, 'children'> {
|
|
162
|
-
const { modifiers, children, ...restProps } = props;
|
|
92
|
+
const { modifiers, children, onCheckedChange, ...restProps } = props;
|
|
163
93
|
return {
|
|
164
94
|
modifiers,
|
|
165
95
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
166
96
|
...restProps,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
color: props.color,
|
|
170
|
-
onValueChange: ({ nativeEvent: { value } }) => {
|
|
171
|
-
props?.onValueChange?.(value);
|
|
97
|
+
onCheckedChange: ({ nativeEvent: { value } }) => {
|
|
98
|
+
onCheckedChange?.(value);
|
|
172
99
|
},
|
|
173
|
-
}
|
|
100
|
+
};
|
|
174
101
|
}
|
|
175
102
|
|
|
103
|
+
/**
|
|
104
|
+
* A switch component.
|
|
105
|
+
*/
|
|
176
106
|
function SwitchComponent(props: SwitchProps) {
|
|
177
107
|
return <SwitchNativeView {...transformSwitchProps(props)}>{props.children}</SwitchNativeView>;
|
|
178
108
|
}
|
|
@@ -13,6 +13,8 @@ export type TextInputRef = {
|
|
|
13
13
|
setText: (newText: string) => Promise<void>;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
export type TextInputVariant = 'filled' | 'outlined';
|
|
17
|
+
|
|
16
18
|
export type TextInputProps = {
|
|
17
19
|
/**
|
|
18
20
|
* Can be used for imperatively setting text on the TextInput component.
|
|
@@ -22,6 +24,14 @@ export type TextInputProps = {
|
|
|
22
24
|
* Initial value that the TextInput displays when being mounted. As the TextInput is an uncontrolled component, change the key prop if you need to change the text value.
|
|
23
25
|
*/
|
|
24
26
|
defaultValue?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The visual style of the text input field.
|
|
29
|
+
* - `filled` - A text field with a filled background (default).
|
|
30
|
+
* - `outlined` - A text field with a transparent background and a border outline.
|
|
31
|
+
* @default filled
|
|
32
|
+
* @platform android
|
|
33
|
+
*/
|
|
34
|
+
variant?: TextInputVariant;
|
|
25
35
|
/**
|
|
26
36
|
* A callback triggered when user types in text into the TextInput.
|
|
27
37
|
*/
|
|
@@ -1,83 +1,107 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { ModifierConfig, ViewEvent } from '../../types';
|
|
5
5
|
import { ExpoUIModule } from '../ExpoUIModule';
|
|
6
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Colors for toggle button elements.
|
|
10
|
+
*/
|
|
11
|
+
export type ToggleButtonColors = {
|
|
12
|
+
containerColor?: ColorValue;
|
|
13
|
+
contentColor?: ColorValue;
|
|
14
|
+
checkedContainerColor?: ColorValue;
|
|
15
|
+
checkedContentColor?: ColorValue;
|
|
16
|
+
disabledContainerColor?: ColorValue;
|
|
17
|
+
disabledContentColor?: ColorValue;
|
|
18
|
+
};
|
|
19
|
+
|
|
8
20
|
export type ToggleButtonProps = {
|
|
9
21
|
/**
|
|
10
22
|
* Whether the toggle button is checked.
|
|
11
23
|
*/
|
|
12
24
|
checked: boolean;
|
|
13
25
|
/**
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
text?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The variant of the toggle button.
|
|
19
|
-
* - `'default'` - Material 3 ToggleButton
|
|
20
|
-
* - `'icon'` - Icon toggle button
|
|
21
|
-
* - `'filledIcon'` - Filled icon toggle button
|
|
22
|
-
* - `'outlinedIcon'` - Outlined icon toggle button
|
|
23
|
-
* @default 'default'
|
|
24
|
-
*/
|
|
25
|
-
variant?: 'default' | 'icon' | 'filledIcon' | 'outlinedIcon';
|
|
26
|
-
/**
|
|
27
|
-
* The color of the toggle button when checked.
|
|
26
|
+
* Callback that is called when the checked state changes.
|
|
28
27
|
*/
|
|
29
|
-
|
|
28
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
30
29
|
/**
|
|
31
|
-
* Whether the button is
|
|
30
|
+
* Whether the button is enabled for user interaction.
|
|
31
|
+
* @default true
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
enabled?: boolean;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Colors for toggle button elements.
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
colors?: ToggleButtonColors;
|
|
38
38
|
/**
|
|
39
39
|
* Modifiers for the component.
|
|
40
40
|
*/
|
|
41
|
-
modifiers?:
|
|
42
|
-
|
|
41
|
+
modifiers?: ModifierConfig[];
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
43
|
+
* Content to display inside the toggle button.
|
|
45
44
|
*/
|
|
46
|
-
children
|
|
45
|
+
children: React.ReactNode;
|
|
47
46
|
};
|
|
48
47
|
|
|
49
|
-
type NativeToggleButtonProps = Omit<ToggleButtonProps, 'onCheckedChange'> &
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const ToggleButtonNativeView: React.ComponentType<NativeToggleButtonProps> = requireNativeView(
|
|
53
|
-
'ExpoUI',
|
|
54
|
-
'ToggleButtonView'
|
|
55
|
-
);
|
|
48
|
+
type NativeToggleButtonProps = Omit<ToggleButtonProps, 'onCheckedChange' | 'children'> & {
|
|
49
|
+
children?: React.ReactNode;
|
|
50
|
+
} & ViewEvent<'onCheckedChange', { checked: boolean }>;
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
/**
|
|
53
|
+
* @hidden
|
|
54
|
+
*/
|
|
55
|
+
export function transformToggleButtonProps(
|
|
56
|
+
props: Omit<ToggleButtonProps, 'children'>
|
|
57
|
+
): NativeToggleButtonProps {
|
|
58
|
+
const { onCheckedChange, modifiers, ...restProps } = props;
|
|
59
59
|
return {
|
|
60
60
|
modifiers,
|
|
61
61
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
62
62
|
...restProps,
|
|
63
|
+
enabled: props.enabled ?? true,
|
|
63
64
|
onCheckedChange: onCheckedChange
|
|
64
65
|
? ({ nativeEvent: { checked } }) => onCheckedChange(checked)
|
|
65
66
|
: undefined,
|
|
66
67
|
};
|
|
67
68
|
}
|
|
69
|
+
|
|
70
|
+
function createToggleButtonComponent(name: string) {
|
|
71
|
+
const NativeView: React.ComponentType<NativeToggleButtonProps> = requireNativeView(
|
|
72
|
+
'ExpoUI',
|
|
73
|
+
name
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
function Component(props: ToggleButtonProps) {
|
|
77
|
+
const { children, ...restProps } = props;
|
|
78
|
+
return <NativeView {...transformToggleButtonProps(restProps)}>{children}</NativeView>;
|
|
79
|
+
}
|
|
80
|
+
Component.displayName = name;
|
|
81
|
+
return Component;
|
|
82
|
+
}
|
|
83
|
+
|
|
68
84
|
/**
|
|
69
85
|
* A toggle button component that can be toggled on and off.
|
|
70
|
-
*
|
|
71
|
-
* When `text` prop is provided, it displays the text.
|
|
72
|
-
* Otherwise, custom children can be passed to render custom content.
|
|
73
86
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
const ToggleButton = Object.assign(createToggleButtonComponent('ToggleButton'), {
|
|
88
|
+
DefaultIconSpacing: ExpoUIModule.ToggleButtonIconSpacing as number,
|
|
89
|
+
DefaultIconSize: ExpoUIModule.ToggleButtonIconSize as number,
|
|
90
|
+
});
|
|
76
91
|
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
/**
|
|
93
|
+
* An icon toggle button with no background.
|
|
94
|
+
*/
|
|
95
|
+
const IconToggleButton = createToggleButtonComponent('IconToggleButton');
|
|
79
96
|
|
|
80
|
-
|
|
81
|
-
|
|
97
|
+
/**
|
|
98
|
+
* A filled icon toggle button with a solid background.
|
|
99
|
+
*/
|
|
100
|
+
const FilledIconToggleButton = createToggleButtonComponent('FilledIconToggleButton');
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* An outlined icon toggle button with a border and no fill.
|
|
104
|
+
*/
|
|
105
|
+
const OutlinedIconToggleButton = createToggleButtonComponent('OutlinedIconToggleButton');
|
|
82
106
|
|
|
83
|
-
export { ToggleButton };
|
|
107
|
+
export { ToggleButton, IconToggleButton, FilledIconToggleButton, OutlinedIconToggleButton };
|
|
@@ -3,24 +3,23 @@ import './MaterialSymbolsAssetsTransformer.fx';
|
|
|
3
3
|
export * from './AlertDialog';
|
|
4
4
|
export * from './BasicAlertDialog';
|
|
5
5
|
export * from './Card';
|
|
6
|
+
export * from './Checkbox';
|
|
6
7
|
export * from './Chip';
|
|
7
|
-
export * from './FilterChip';
|
|
8
8
|
export * from './Button';
|
|
9
9
|
export * from './Icon';
|
|
10
10
|
export * from './IconButton';
|
|
11
|
-
export * from './
|
|
11
|
+
export * from './DropdownMenu';
|
|
12
12
|
export * from './Divider';
|
|
13
13
|
export * from './Host';
|
|
14
14
|
export * from './LazyColumn';
|
|
15
15
|
export * from './ListItem';
|
|
16
16
|
export * from './RNHostView';
|
|
17
17
|
export * from './DatePicker';
|
|
18
|
-
export * from './
|
|
18
|
+
export * from './SegmentedButton';
|
|
19
19
|
export * from './Progress';
|
|
20
20
|
export * from './Slider';
|
|
21
21
|
export * from './Spacer';
|
|
22
22
|
export * from './Switch';
|
|
23
|
-
export * from './TextButton';
|
|
24
23
|
export * from './TextInput';
|
|
25
24
|
export * from './ToggleButton';
|
|
26
25
|
export * from './Shape';
|
|
@@ -29,11 +28,13 @@ export * from './Carousel';
|
|
|
29
28
|
export * from './SearchBar';
|
|
30
29
|
export * from './DockedSearchBar';
|
|
31
30
|
export * from './HorizontalFloatingToolbar';
|
|
31
|
+
export * from './FloatingActionButton';
|
|
32
32
|
export * from './PullToRefreshBox';
|
|
33
33
|
export * from './RadioButton';
|
|
34
34
|
export * from './Surface';
|
|
35
35
|
export * from './Text';
|
|
36
36
|
|
|
37
|
+
export * from './AnimatedVisibility';
|
|
37
38
|
export * from './Box';
|
|
38
39
|
export * from './Row';
|
|
39
40
|
export * from './Column';
|
|
@@ -262,9 +262,33 @@ export const clickable = (handler: () => void, options?: { indication?: boolean
|
|
|
262
262
|
* Makes the view selectable, like a radio button row.
|
|
263
263
|
* @param selected - Whether the item is currently selected.
|
|
264
264
|
* @param handler - Function to call when the item is clicked.
|
|
265
|
+
* @param role - Optional semantic role for accessibility: 'radioButton', 'checkbox', 'switch', or 'tab'.
|
|
265
266
|
*/
|
|
266
|
-
export const selectable = (
|
|
267
|
-
|
|
267
|
+
export const selectable = (
|
|
268
|
+
selected: boolean,
|
|
269
|
+
handler: () => void,
|
|
270
|
+
role?: 'radioButton' | 'checkbox' | 'switch' | 'tab'
|
|
271
|
+
) => createModifierWithEventListener('selectable', handler, { selected, role });
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Marks a column/row as a selectable group for accessibility.
|
|
275
|
+
* Screen readers will treat the children as a group of selectable items.
|
|
276
|
+
*/
|
|
277
|
+
export const selectableGroup = () => createModifier('selectableGroup');
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Makes the view toggleable with accessibility semantics.
|
|
281
|
+
* Use this to make a row containing a checkbox or switch tappable as a whole.
|
|
282
|
+
* @param value - The current toggle state.
|
|
283
|
+
* @param handler - Function to call when toggled.
|
|
284
|
+
* @param options - Optional configuration.
|
|
285
|
+
* @param options.role - The semantic role for accessibility: `'checkbox'`, `'radioButton'`, `'switch'`, or `'tab'`.
|
|
286
|
+
*/
|
|
287
|
+
export const toggleable = (
|
|
288
|
+
value: boolean,
|
|
289
|
+
handler: () => void,
|
|
290
|
+
options?: { role?: 'checkbox' | 'radioButton' | 'switch' | 'tab' }
|
|
291
|
+
) => createModifierWithEventListener('toggleable', handler, { value, role: options?.role });
|
|
268
292
|
|
|
269
293
|
// =============================================================================
|
|
270
294
|
// Utility Modifiers
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
|
+
import { type CommonViewModifierProps } from '../types';
|
|
5
|
+
|
|
6
|
+
export type LinkProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The text label for the Link. Use this for simple text links.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The URL for the link.
|
|
13
|
+
*/
|
|
14
|
+
destination: string;
|
|
15
|
+
/**
|
|
16
|
+
* Custom content for the link label. Use this for custom label views.
|
|
17
|
+
* Only nested elements are supported, not plain strings.
|
|
18
|
+
*/
|
|
19
|
+
children?: React.ReactElement | React.ReactElement[];
|
|
20
|
+
} & CommonViewModifierProps;
|
|
21
|
+
|
|
22
|
+
const LinkNativeView: React.ComponentType<LinkProps> = requireNativeView('ExpoUI', 'LinkView');
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Displays a native link component.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import { Link } from '@expo/ui/swift-ui';
|
|
30
|
+
* import { foregroundStyle, font } from '@expo/ui/swift-ui/modifiers';
|
|
31
|
+
*
|
|
32
|
+
* <Link
|
|
33
|
+
* label="Open"
|
|
34
|
+
* destination="https://expo.dev"
|
|
35
|
+
* modifiers={[
|
|
36
|
+
* foregroundStyle('red'),
|
|
37
|
+
* font({ size: 24, weight: 'bold' })
|
|
38
|
+
* ]}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function Link(props: LinkProps) {
|
|
43
|
+
const { children, modifiers, ...restProps } = props;
|
|
44
|
+
|
|
45
|
+
const baseProps = {
|
|
46
|
+
...restProps,
|
|
47
|
+
modifiers,
|
|
48
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return <LinkNativeView {...baseProps}>{children}</LinkNativeView>;
|
|
52
|
+
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
|
|
3
3
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
|
-
import { type CommonViewModifierProps } from '../types';
|
|
5
|
-
|
|
6
|
-
export type ClosedRangeDate = { lower: Date; upper: Date };
|
|
4
|
+
import { type ClosedRangeDate, type CommonViewModifierProps } from '../types';
|
|
7
5
|
|
|
8
6
|
export type ProgressViewProps = {
|
|
9
7
|
/**
|
|
@@ -10,9 +10,9 @@ export type StepperProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
label: string;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The current value of the stepper.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
value?: number;
|
|
16
16
|
/**
|
|
17
17
|
* The step value for increment/decrement operations.
|
|
18
18
|
*/
|
|
@@ -28,11 +28,11 @@ export type StepperProps = {
|
|
|
28
28
|
/**
|
|
29
29
|
* Called when the stepper value changes.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
onValueChange: (value: number) => void;
|
|
32
32
|
} & CommonViewModifierProps;
|
|
33
33
|
|
|
34
|
-
type NativeStepperProps = Omit<StepperProps, '
|
|
35
|
-
ViewEvent<'
|
|
34
|
+
type NativeStepperProps = Omit<StepperProps, 'onValueChange'> &
|
|
35
|
+
ViewEvent<'onValueChange', { value: number }>;
|
|
36
36
|
|
|
37
37
|
const StepperNativeView: React.ComponentType<NativeStepperProps> = requireNativeView(
|
|
38
38
|
'ExpoUI',
|
|
@@ -45,8 +45,8 @@ function transformStepperProps(props: StepperProps): NativeStepperProps {
|
|
|
45
45
|
modifiers,
|
|
46
46
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
47
47
|
...restProps,
|
|
48
|
-
|
|
49
|
-
props.
|
|
48
|
+
onValueChange: ({ nativeEvent: { value } }) => {
|
|
49
|
+
props.onValueChange(value);
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
}
|