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