@expo/ui 55.0.0 → 55.0.2
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 +33 -0
- package/CONTRIBUTING.md +30 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +90 -7
- package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +21 -8
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +105 -39
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +204 -50
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +70 -4
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +7 -1
- package/android/src/main/java/expo/modules/ui/convertibles/AnimatableFloat.kt +26 -0
- package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +93 -0
- package/android/src/main/java/expo/modules/ui/convertibles/GraphicsLayerParams.kt +24 -0
- package/build/jetpack-compose/Box/index.d.ts +14 -0
- package/build/jetpack-compose/Box/index.d.ts.map +1 -0
- package/build/jetpack-compose/Column/index.d.ts +22 -0
- package/build/jetpack-compose/Column/index.d.ts.map +1 -0
- package/build/jetpack-compose/DatePicker/index.d.ts +99 -0
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/FlowRow/index.d.ts +14 -0
- package/build/jetpack-compose/FlowRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/LazyColumn/index.d.ts +0 -3
- package/build/jetpack-compose/LazyColumn/index.d.ts.map +1 -1
- package/build/jetpack-compose/Row/index.d.ts +22 -0
- package/build/jetpack-compose/Row/index.d.ts.map +1 -0
- package/build/jetpack-compose/Spacer/index.d.ts +2 -2
- package/build/jetpack-compose/Switch/index.d.ts +18 -0
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +4 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/layout-types.d.ts +26 -0
- package/build/jetpack-compose/layout-types.d.ts.map +1 -0
- package/build/jetpack-compose/layout.d.ts +5 -36
- package/build/jetpack-compose/layout.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/animation.d.ts +44 -0
- package/build/jetpack-compose/modifiers/animation.d.ts.map +1 -0
- package/build/jetpack-compose/modifiers/index.d.ts +50 -3
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/AccessoryWidgetBackground/index.d.ts +4 -0
- package/build/swift-ui/AccessoryWidgetBackground/index.d.ts.map +1 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
- package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
- package/build/swift-ui/ControlGroup/index.d.ts +29 -0
- package/build/swift-ui/ControlGroup/index.d.ts.map +1 -0
- package/build/swift-ui/Gauge/index.d.ts.map +1 -1
- package/build/swift-ui/Image/index.d.ts +7 -1
- package/build/swift-ui/Image/index.d.ts.map +1 -1
- package/build/swift-ui/Label/index.d.ts.map +1 -1
- package/build/swift-ui/LabeledContent/index.d.ts.map +1 -1
- package/build/swift-ui/Menu/index.d.ts.map +1 -1
- package/build/swift-ui/Picker/index.d.ts.map +1 -1
- package/build/swift-ui/Popover/index.d.ts.map +1 -1
- package/build/swift-ui/Section/index.d.ts.map +1 -1
- package/build/swift-ui/Slider/index.d.ts.map +1 -1
- package/build/swift-ui/SlotView.d.ts +5 -0
- package/build/swift-ui/SlotView.d.ts.map +1 -0
- package/build/swift-ui/index.d.ts +2 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +38 -1
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/AccessoryWidgetBackgroundView.swift +27 -0
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +3 -9
- package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +0 -5
- package/ios/ContextMenu/ContextMenu.swift +27 -22
- package/ios/ContextMenu/ContextMenuRecords.swift +0 -6
- package/ios/ControlGroupView.swift +33 -0
- package/ios/ExpoUIModule.swift +10 -32
- package/ios/GaugeView.swift +4 -26
- package/ios/HostView.swift +1 -2
- package/ios/ImageView.swift +22 -11
- package/ios/Label.swift +2 -17
- package/ios/LabeledContentView.swift +3 -27
- package/ios/Menu/MenuRecords.swift +0 -2
- package/ios/Menu/MenuView.swift +2 -5
- package/ios/Modifiers/ResizableModifier.swift +24 -0
- package/ios/Modifiers/Rotation3DEffectModifier.swift +20 -0
- package/ios/Modifiers/View+ModifierArray.swift +29 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +39 -3
- package/ios/Modifiers/WidgetModifiers.swift +46 -0
- package/ios/Picker/PickerView.swift +2 -6
- package/ios/Popover/PopoverProps.swift +0 -4
- package/ios/Popover/PopoverView.swift +2 -6
- package/ios/RNHostView.swift +91 -10
- package/ios/SectionView.swift +6 -12
- package/ios/SecureFieldView.swift +0 -1
- package/ios/ShareLink/ShareLinkView.swift +1 -1
- package/ios/SliderView.swift +10 -27
- package/ios/SlotView.swift +38 -0
- package/ios/TextFieldView.swift +0 -1
- package/ios/UIBaseView.swift +34 -3
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0/expo.modules.ui-55.0.0-sources.jar → 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 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +1 -0
- 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 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0/expo.modules.ui-55.0.0.module → 55.0.2/expo.modules.ui-55.0.2.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0/expo.modules.ui-55.0.0.pom → 55.0.2/expo.modules.ui-55.0.2.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.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 +2 -2
- package/src/jetpack-compose/Box/index.tsx +26 -0
- package/src/jetpack-compose/Column/index.tsx +39 -0
- package/src/jetpack-compose/DatePicker/index.tsx +106 -2
- package/src/jetpack-compose/FlowRow/index.tsx +29 -0
- package/src/jetpack-compose/LazyColumn/index.tsx +0 -3
- package/src/jetpack-compose/Row/index.tsx +36 -0
- package/src/jetpack-compose/Spacer/index.tsx +2 -2
- package/src/jetpack-compose/Switch/index.tsx +18 -0
- package/src/jetpack-compose/index.ts +4 -1
- package/src/jetpack-compose/layout-types.ts +48 -0
- package/src/jetpack-compose/layout.tsx +5 -106
- package/src/jetpack-compose/modifiers/animation.ts +37 -0
- package/src/jetpack-compose/modifiers/index.ts +60 -4
- package/src/swift-ui/AccessoryWidgetBackground/index.tsx +12 -0
- package/src/swift-ui/ConfirmationDialog/index.tsx +4 -12
- package/src/swift-ui/ContextMenu/index.tsx +6 -20
- package/src/swift-ui/ControlGroup/index.tsx +59 -0
- package/src/swift-ui/Gauge/index.tsx +5 -20
- package/src/swift-ui/Image/index.tsx +7 -1
- package/src/swift-ui/Label/index.tsx +2 -5
- package/src/swift-ui/LabeledContent/index.tsx +3 -12
- package/src/swift-ui/Menu/index.tsx +2 -6
- package/src/swift-ui/Picker/index.tsx +4 -11
- package/src/swift-ui/Popover/index.tsx +3 -12
- package/src/swift-ui/Section/index.tsx +4 -9
- package/src/swift-ui/Slider/index.tsx +4 -12
- package/src/swift-ui/SlotView.tsx +8 -0
- package/src/swift-ui/index.tsx +2 -0
- package/src/swift-ui/modifiers/index.ts +54 -1
- package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +0 -26
- package/ios/ContextMenu/ContextMenuComponents.swift +0 -37
- package/ios/Menu/MenuComponents.swift +0 -12
- package/ios/Picker/PickerComponents.swift +0 -24
- package/ios/Popover/PopoverComponents.swift +0 -18
- package/ios/SectionComponents.swift +0 -34
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha512 +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ExpoModifier } from '../types';
|
|
2
|
+
import { createViewModifierEventListener } from './modifiers/utils';
|
|
3
|
+
|
|
4
|
+
export type PrimitiveBaseProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Modifiers for the component.
|
|
7
|
+
*/
|
|
8
|
+
modifiers?: ExpoModifier[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type HorizontalArrangement =
|
|
12
|
+
| 'start'
|
|
13
|
+
| 'end'
|
|
14
|
+
| 'center'
|
|
15
|
+
| 'spaceBetween'
|
|
16
|
+
| 'spaceAround'
|
|
17
|
+
| 'spaceEvenly'
|
|
18
|
+
| { spacedBy: number };
|
|
19
|
+
export type VerticalArrangement =
|
|
20
|
+
| 'top'
|
|
21
|
+
| 'bottom'
|
|
22
|
+
| 'center'
|
|
23
|
+
| 'spaceBetween'
|
|
24
|
+
| 'spaceAround'
|
|
25
|
+
| 'spaceEvenly'
|
|
26
|
+
| { spacedBy: number };
|
|
27
|
+
export type HorizontalAlignment = 'start' | 'end' | 'center';
|
|
28
|
+
export type VerticalAlignment = 'top' | 'bottom' | 'center';
|
|
29
|
+
export type ContentAlignment =
|
|
30
|
+
| 'topStart'
|
|
31
|
+
| 'topCenter'
|
|
32
|
+
| 'topEnd'
|
|
33
|
+
| 'centerStart'
|
|
34
|
+
| 'center'
|
|
35
|
+
| 'centerEnd'
|
|
36
|
+
| 'bottomStart'
|
|
37
|
+
| 'bottomCenter'
|
|
38
|
+
| 'bottomEnd';
|
|
39
|
+
export type FloatingToolbarExitAlwaysScrollBehavior = 'top' | 'bottom' | 'start' | 'end';
|
|
40
|
+
|
|
41
|
+
export function transformProps<T extends PrimitiveBaseProps>(props: T) {
|
|
42
|
+
const { modifiers, ...restProps } = props;
|
|
43
|
+
return {
|
|
44
|
+
modifiers,
|
|
45
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
46
|
+
...restProps,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -1,106 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type PrimitiveBaseProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Modifiers for the component.
|
|
9
|
-
*/
|
|
10
|
-
modifiers?: ExpoModifier[];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type HorizontalArrangement =
|
|
14
|
-
| 'start'
|
|
15
|
-
| 'end'
|
|
16
|
-
| 'center'
|
|
17
|
-
| 'spaceBetween'
|
|
18
|
-
| 'spaceAround'
|
|
19
|
-
| 'spaceEvenly'
|
|
20
|
-
| { spacedBy: number };
|
|
21
|
-
export type VerticalArrangement =
|
|
22
|
-
| 'top'
|
|
23
|
-
| 'bottom'
|
|
24
|
-
| 'center'
|
|
25
|
-
| 'spaceBetween'
|
|
26
|
-
| 'spaceAround'
|
|
27
|
-
| 'spaceEvenly'
|
|
28
|
-
| { spacedBy: number };
|
|
29
|
-
export type HorizontalAlignment = 'start' | 'end' | 'center';
|
|
30
|
-
export type VerticalAlignment = 'top' | 'bottom' | 'center';
|
|
31
|
-
export type ContentAlignment =
|
|
32
|
-
| 'topStart'
|
|
33
|
-
| 'topCenter'
|
|
34
|
-
| 'topEnd'
|
|
35
|
-
| 'centerStart'
|
|
36
|
-
| 'center'
|
|
37
|
-
| 'centerEnd'
|
|
38
|
-
| 'bottomStart'
|
|
39
|
-
| 'bottomCenter'
|
|
40
|
-
| 'bottomEnd';
|
|
41
|
-
export type FloatingToolbarExitAlwaysScrollBehavior = 'top' | 'bottom' | 'start' | 'end';
|
|
42
|
-
|
|
43
|
-
type LayoutBaseProps = {
|
|
44
|
-
children?: React.ReactNode;
|
|
45
|
-
horizontalArrangement?: HorizontalArrangement;
|
|
46
|
-
verticalArrangement?: VerticalArrangement;
|
|
47
|
-
horizontalAlignment?: HorizontalAlignment;
|
|
48
|
-
verticalAlignment?: VerticalAlignment;
|
|
49
|
-
contentAlignment?: ContentAlignment;
|
|
50
|
-
floatingToolbarExitAlwaysScrollBehavior?: FloatingToolbarExitAlwaysScrollBehavior;
|
|
51
|
-
modifiers?: ExpoModifier[];
|
|
52
|
-
} & PrimitiveBaseProps;
|
|
53
|
-
|
|
54
|
-
function transformProps(props: LayoutBaseProps) {
|
|
55
|
-
const { modifiers, ...restProps } = props;
|
|
56
|
-
return {
|
|
57
|
-
modifiers,
|
|
58
|
-
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
59
|
-
...restProps,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
//#region Box Component
|
|
64
|
-
export type BoxProps = Pick<
|
|
65
|
-
LayoutBaseProps,
|
|
66
|
-
'children' | 'modifiers' | 'contentAlignment' | 'floatingToolbarExitAlwaysScrollBehavior'
|
|
67
|
-
>;
|
|
68
|
-
const BoxNativeView: React.ComponentType<BoxProps> = requireNativeView('ExpoUI', 'BoxView');
|
|
69
|
-
|
|
70
|
-
export function Box(props: BoxProps) {
|
|
71
|
-
return <BoxNativeView {...transformProps(props)} />;
|
|
72
|
-
}
|
|
73
|
-
//#endregion
|
|
74
|
-
|
|
75
|
-
//#region Row Component
|
|
76
|
-
export type RowProps = LayoutBaseProps;
|
|
77
|
-
const RowNativeView: React.ComponentType<RowProps> = requireNativeView('ExpoUI', 'RowView');
|
|
78
|
-
export function Row(props: RowProps) {
|
|
79
|
-
return <RowNativeView {...transformProps(props)} />;
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
|
|
83
|
-
//#region FlowRow Component
|
|
84
|
-
export type FlowRowProps = Pick<
|
|
85
|
-
LayoutBaseProps,
|
|
86
|
-
'children' | 'modifiers' | 'horizontalArrangement' | 'verticalArrangement'
|
|
87
|
-
>;
|
|
88
|
-
const FlowRowNativeView: React.ComponentType<FlowRowProps> = requireNativeView(
|
|
89
|
-
'ExpoUI',
|
|
90
|
-
'FlowRowView'
|
|
91
|
-
);
|
|
92
|
-
export function FlowRow(props: FlowRowProps) {
|
|
93
|
-
return <FlowRowNativeView {...transformProps(props)} />;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
|
|
97
|
-
//#region Column Component
|
|
98
|
-
export type ColumnProps = LayoutBaseProps;
|
|
99
|
-
const ColumnNativeView: React.ComponentType<ColumnProps> = requireNativeView(
|
|
100
|
-
'ExpoUI',
|
|
101
|
-
'ColumnView'
|
|
102
|
-
);
|
|
103
|
-
export function Column(props: ColumnProps) {
|
|
104
|
-
return <ColumnNativeView {...transformProps(props)} />;
|
|
105
|
-
}
|
|
106
|
-
//#endregion
|
|
1
|
+
export * from './layout-types';
|
|
2
|
+
export * from './Box';
|
|
3
|
+
export * from './Row';
|
|
4
|
+
export * from './Column';
|
|
5
|
+
export * from './FlowRow';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// AnimationSpec factories — return typed JSON matching Compose's AnimationSpec subtypes
|
|
2
|
+
|
|
3
|
+
export const spring = (params?: {
|
|
4
|
+
dampingRatio?: number;
|
|
5
|
+
stiffness?: number;
|
|
6
|
+
visibilityThreshold?: number;
|
|
7
|
+
}) => ({ $type: 'spring' as const, ...params });
|
|
8
|
+
|
|
9
|
+
export const tween = (params?: {
|
|
10
|
+
durationMillis?: number;
|
|
11
|
+
delayMillis?: number;
|
|
12
|
+
easing?: 'linear' | 'fastOutSlowIn' | 'fastOutLinearIn' | 'linearOutSlowIn' | 'ease';
|
|
13
|
+
}) => ({ $type: 'tween' as const, ...params });
|
|
14
|
+
|
|
15
|
+
export const snap = (params?: { delayMillis?: number }) => ({
|
|
16
|
+
$type: 'snap' as const,
|
|
17
|
+
...params,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const keyframes = (params: {
|
|
21
|
+
durationMillis: number;
|
|
22
|
+
delayMillis?: number;
|
|
23
|
+
keyframes: Record<number, number>;
|
|
24
|
+
}) => ({ $type: 'keyframes' as const, ...params });
|
|
25
|
+
|
|
26
|
+
export type AnimationSpec = ReturnType<
|
|
27
|
+
typeof spring | typeof tween | typeof snap | typeof keyframes
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
// animated() wrapper — wraps a target value with an animation spec
|
|
31
|
+
export const animated = (targetValue: number, spec: AnimationSpec = spring()) => ({
|
|
32
|
+
$animated: true as const,
|
|
33
|
+
targetValue,
|
|
34
|
+
animationSpec: spec,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export type AnimatedValue = ReturnType<typeof animated>;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { type ColorValue } from 'react-native';
|
|
2
2
|
|
|
3
|
+
import { type AnimatedValue } from './animation';
|
|
3
4
|
import { createModifier, createModifierWithEventListener } from './createModifier';
|
|
4
5
|
export { type ExpoModifier } from '../../types';
|
|
6
|
+
export {
|
|
7
|
+
animated,
|
|
8
|
+
spring,
|
|
9
|
+
tween,
|
|
10
|
+
snap,
|
|
11
|
+
keyframes,
|
|
12
|
+
type AnimationSpec,
|
|
13
|
+
type AnimatedValue,
|
|
14
|
+
} from './animation';
|
|
5
15
|
|
|
6
16
|
export type Alignment =
|
|
7
17
|
// 2D Alignments
|
|
@@ -151,6 +161,48 @@ export const blur = (radius: number) => createModifier('blur', { radius });
|
|
|
151
161
|
*/
|
|
152
162
|
export const rotate = (degrees: number) => createModifier('rotate', { degrees });
|
|
153
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Applies a graphics layer transformation with animation support.
|
|
166
|
+
* @param params - Transform and visual effect parameters.
|
|
167
|
+
* @see [Compose graphicsLayer documentation](https://developer.android.com/develop/ui/compose/graphics/draw/modifiers).
|
|
168
|
+
*/
|
|
169
|
+
export const graphicsLayer = (params: {
|
|
170
|
+
/** Rotation around the X axis in degrees. */
|
|
171
|
+
rotationX?: number | AnimatedValue;
|
|
172
|
+
/** Rotation around the Y axis in degrees. */
|
|
173
|
+
rotationY?: number | AnimatedValue;
|
|
174
|
+
/** Rotation around the Z axis in degrees. */
|
|
175
|
+
rotationZ?: number | AnimatedValue;
|
|
176
|
+
/** Horizontal scale factor (1.0 = no change). */
|
|
177
|
+
scaleX?: number | AnimatedValue;
|
|
178
|
+
/** Vertical scale factor (1.0 = no change). */
|
|
179
|
+
scaleY?: number | AnimatedValue;
|
|
180
|
+
/** Opacity (0.0 = transparent, 1.0 = opaque). */
|
|
181
|
+
alpha?: number | AnimatedValue;
|
|
182
|
+
/** Horizontal translation in dp. */
|
|
183
|
+
translationX?: number | AnimatedValue;
|
|
184
|
+
/** Vertical translation in dp. */
|
|
185
|
+
translationY?: number | AnimatedValue;
|
|
186
|
+
/** Distance from the camera in dp. Affects 3D rotation perspective. */
|
|
187
|
+
cameraDistance?: number;
|
|
188
|
+
/** Shadow elevation in dp. */
|
|
189
|
+
shadowElevation?: number | AnimatedValue;
|
|
190
|
+
/** Horizontal pivot point for transforms (0.0 = left, 0.5 = center, 1.0 = right). */
|
|
191
|
+
transformOriginX?: number;
|
|
192
|
+
/** Vertical pivot point for transforms (0.0 = top, 0.5 = center, 1.0 = bottom). */
|
|
193
|
+
transformOriginY?: number;
|
|
194
|
+
/** Whether to clip content to the shape. */
|
|
195
|
+
clip?: boolean;
|
|
196
|
+
/** Shape for clipping and shadow. Uses the same shapes as the `clip` modifier. */
|
|
197
|
+
shape?: BuiltinShape;
|
|
198
|
+
/** Color of the ambient shadow. */
|
|
199
|
+
ambientShadowColor?: ColorValue;
|
|
200
|
+
/** Color of the spot shadow. */
|
|
201
|
+
spotShadowColor?: ColorValue;
|
|
202
|
+
/** Compositing strategy: 'auto', 'offscreen', or 'modulate'. */
|
|
203
|
+
compositingStrategy?: 'auto' | 'offscreen' | 'modulate';
|
|
204
|
+
}) => createModifier('graphicsLayer', params);
|
|
205
|
+
|
|
154
206
|
/**
|
|
155
207
|
* Sets the z-index for layering.
|
|
156
208
|
* @param index - Z-index value.
|
|
@@ -163,8 +215,8 @@ export const zIndex = (index: number) => createModifier('zIndex', { index });
|
|
|
163
215
|
|
|
164
216
|
/**
|
|
165
217
|
* Animates size changes with spring animation.
|
|
166
|
-
* @param dampingRatio - Spring damping ratio. Default is DampingRatioNoBouncy
|
|
167
|
-
* @param stiffness - Spring stiffness. Default is StiffnessMedium
|
|
218
|
+
* @param dampingRatio - Spring damping ratio. Default is `DampingRatioNoBouncy`.
|
|
219
|
+
* @param stiffness - Spring stiffness. Default is `StiffnessMedium`.
|
|
168
220
|
*/
|
|
169
221
|
export const animateContentSize = (dampingRatio?: number, stiffness?: number) =>
|
|
170
222
|
createModifier('animateContentSize', { dampingRatio, stiffness });
|
|
@@ -198,9 +250,13 @@ export const matchParentSize = () => createModifier('matchParentSize');
|
|
|
198
250
|
/**
|
|
199
251
|
* Makes the view clickable.
|
|
200
252
|
* @param handler - Function to call when clicked.
|
|
253
|
+
* @param options - Optional configuration.
|
|
254
|
+
* @param options.indication - Whether to show a ripple indication. Defaults to `true`.
|
|
201
255
|
*/
|
|
202
|
-
export const clickable = (handler: () => void) =>
|
|
203
|
-
createModifierWithEventListener('clickable', handler
|
|
256
|
+
export const clickable = (handler: () => void, options?: { indication?: boolean }) =>
|
|
257
|
+
createModifierWithEventListener('clickable', handler, {
|
|
258
|
+
indication: options?.indication ?? true,
|
|
259
|
+
});
|
|
204
260
|
|
|
205
261
|
/**
|
|
206
262
|
* Makes the view selectable, like a radio button row.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { type CommonViewModifierProps } from '../types';
|
|
4
|
+
|
|
5
|
+
export type AccessoryWidgetBackgroundProps = CommonViewModifierProps;
|
|
6
|
+
|
|
7
|
+
const AccessoryWidgetBackgroundNativeView: React.ComponentType<AccessoryWidgetBackgroundProps> =
|
|
8
|
+
requireNativeView('ExpoUI', 'AccessoryWidgetBackgroundView');
|
|
9
|
+
|
|
10
|
+
export function AccessoryWidgetBackground(props: AccessoryWidgetBackgroundProps) {
|
|
11
|
+
return <AccessoryWidgetBackgroundNativeView {...props} />;
|
|
12
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { NativeSyntheticEvent } from 'react-native';
|
|
3
3
|
|
|
4
|
+
import { Slot } from '../SlotView';
|
|
4
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
import { type CommonViewModifierProps } from '../types';
|
|
6
7
|
|
|
@@ -39,34 +40,25 @@ type NativeConfirmationDialogProps = Omit<ConfirmationDialogProps, 'onIsPresente
|
|
|
39
40
|
const ConfirmationDialogNativeView: React.ComponentType<NativeConfirmationDialogProps> =
|
|
40
41
|
requireNativeView('ExpoUI', 'ConfirmationDialogView');
|
|
41
42
|
|
|
42
|
-
const ConfirmationDialogNativeTrigger: React.ComponentType<{ children: React.ReactNode }> =
|
|
43
|
-
requireNativeView('ExpoUI', 'ConfirmationDialogTrigger');
|
|
44
|
-
|
|
45
|
-
const ConfirmationDialogNativeActions: React.ComponentType<{ children: React.ReactNode }> =
|
|
46
|
-
requireNativeView('ExpoUI', 'ConfirmationDialogActions');
|
|
47
|
-
|
|
48
|
-
const ConfirmationDialogNativeMessage: React.ComponentType<{ children: React.ReactNode }> =
|
|
49
|
-
requireNativeView('ExpoUI', 'ConfirmationDialogMessage');
|
|
50
|
-
|
|
51
43
|
/**
|
|
52
44
|
* The component visible all the time that triggers the confirmation dialog presentation.
|
|
53
45
|
*/
|
|
54
46
|
function Trigger(props: { children: React.ReactNode }) {
|
|
55
|
-
return <
|
|
47
|
+
return <Slot name="trigger">{props.children}</Slot>;
|
|
56
48
|
}
|
|
57
49
|
|
|
58
50
|
/**
|
|
59
51
|
* The action buttons displayed in the confirmation dialog. Use `Button` components from `@expo/ui/swift-ui` as children.
|
|
60
52
|
*/
|
|
61
53
|
function Actions(props: { children: React.ReactNode }) {
|
|
62
|
-
return <
|
|
54
|
+
return <Slot name="actions">{props.children}</Slot>;
|
|
63
55
|
}
|
|
64
56
|
|
|
65
57
|
/**
|
|
66
58
|
* An optional message displayed below the title in the confirmation dialog.
|
|
67
59
|
*/
|
|
68
60
|
function Message(props: { children: React.ReactNode }) {
|
|
69
|
-
return <
|
|
61
|
+
return <Slot name="message">{props.children}</Slot>;
|
|
70
62
|
}
|
|
71
63
|
|
|
72
64
|
/**
|
|
@@ -2,47 +2,33 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
import { type ContextMenuProps } from './types';
|
|
5
|
+
import { Slot } from '../SlotView';
|
|
5
6
|
|
|
6
7
|
export { type ContextMenuProps } from './types';
|
|
7
8
|
|
|
8
|
-
const MenuNativeView: ComponentType<NativeMenuProps> = requireNativeView('ExpoUI', 'ContextMenu');
|
|
9
|
-
|
|
10
|
-
const MenuNativeTriggerView: ComponentType<object> = requireNativeView(
|
|
11
|
-
'ExpoUI',
|
|
12
|
-
'ContextMenuActivationElement'
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const MenuNativePreviewView: ComponentType<object> = requireNativeView(
|
|
16
|
-
'ExpoUI',
|
|
17
|
-
'ContextMenuPreview'
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const MenuNativeItemsView: ComponentType<object> = requireNativeView(
|
|
21
|
-
'ExpoUI',
|
|
22
|
-
'ContextMenuContent'
|
|
23
|
-
);
|
|
24
|
-
|
|
25
9
|
type NativeMenuProps = ContextMenuProps;
|
|
26
10
|
|
|
11
|
+
const MenuNativeView: ComponentType<NativeMenuProps> = requireNativeView('ExpoUI', 'ContextMenu');
|
|
12
|
+
|
|
27
13
|
/**
|
|
28
14
|
* Items visible inside the context menu. It could be `Section`, `Divider`, `Button`, `Toggle`, `Picker` or even `ContextMenu` itself for nested menus. Remember to use components from the `@expo/ui/swift-ui` library.
|
|
29
15
|
*/
|
|
30
16
|
export function Items(props: { children: React.ReactNode }) {
|
|
31
|
-
return <
|
|
17
|
+
return <Slot name="items">{props.children}</Slot>;
|
|
32
18
|
}
|
|
33
19
|
|
|
34
20
|
/**
|
|
35
21
|
* The component visible all the time that triggers the context menu when long-pressed.
|
|
36
22
|
*/
|
|
37
23
|
export function Trigger(props: { children: React.ReactNode }) {
|
|
38
|
-
return <
|
|
24
|
+
return <Slot name="trigger">{props.children}</Slot>;
|
|
39
25
|
}
|
|
40
26
|
|
|
41
27
|
/**
|
|
42
28
|
* The component visible above the menu when it is opened.
|
|
43
29
|
*/
|
|
44
30
|
export function Preview(props: { children: React.ReactNode }) {
|
|
45
|
-
return <
|
|
31
|
+
return <Slot name="preview">{props.children}</Slot>;
|
|
46
32
|
}
|
|
47
33
|
|
|
48
34
|
/**
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { type ReactNode, type ComponentType } from 'react';
|
|
3
|
+
import { type SFSymbol } from 'sf-symbols-typescript';
|
|
4
|
+
|
|
5
|
+
import { Slot } from '../SlotView';
|
|
6
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
|
+
import { type CommonViewModifierProps } from '../types';
|
|
8
|
+
|
|
9
|
+
export interface ControlGroupProps extends CommonViewModifierProps {
|
|
10
|
+
/**
|
|
11
|
+
* The label for the control group. Can be a string for simple text labels,
|
|
12
|
+
* or a `Label` component for custom label content. When omitted, the control group
|
|
13
|
+
* has no label.
|
|
14
|
+
* @platform iOS 16.0+
|
|
15
|
+
* @platform tvOS 17.0+
|
|
16
|
+
*/
|
|
17
|
+
label?: string | ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* An SF Symbol name to display alongside the label.
|
|
20
|
+
* Only used when `label` is a string.
|
|
21
|
+
* @platform iOS 16.0+
|
|
22
|
+
* @platform tvOS 17.0+
|
|
23
|
+
*/
|
|
24
|
+
systemImage?: SFSymbol;
|
|
25
|
+
/**
|
|
26
|
+
* The control group's content.
|
|
27
|
+
* Can contain `Button`, `Toggle`, `Picker`, or other interactive controls.
|
|
28
|
+
* @platform iOS
|
|
29
|
+
* @platform tvOS 17.0+
|
|
30
|
+
*/
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type NativeControlGroupProps = Omit<ControlGroupProps, 'label'> & {
|
|
35
|
+
label?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const ControlGroupNativeView: ComponentType<NativeControlGroupProps> = requireNativeView(
|
|
39
|
+
'ExpoUI',
|
|
40
|
+
'ControlGroupView'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
export function ControlGroup(props: ControlGroupProps) {
|
|
44
|
+
const { label, children, systemImage, modifiers, ...rest } = props;
|
|
45
|
+
|
|
46
|
+
const isStringLabel = typeof label === 'string';
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<ControlGroupNativeView
|
|
50
|
+
label={isStringLabel ? label : undefined}
|
|
51
|
+
systemImage={systemImage}
|
|
52
|
+
modifiers={modifiers}
|
|
53
|
+
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
54
|
+
{...rest}>
|
|
55
|
+
{!isStringLabel && label != null ? <Slot name="label">{label}</Slot> : null}
|
|
56
|
+
{children}
|
|
57
|
+
</ControlGroupNativeView>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
|
|
3
|
+
import { Slot } from '../SlotView';
|
|
3
4
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
5
|
import { type CommonViewModifierProps } from '../types';
|
|
5
6
|
|
|
6
|
-
/**
|
|
7
|
-
* The type of gauge label.
|
|
8
|
-
*/
|
|
9
|
-
type GaugeLabelKind = 'label' | 'currentValue' | 'minimumValue' | 'maximumValue';
|
|
10
|
-
|
|
11
7
|
export type GaugeProps = {
|
|
12
8
|
/**
|
|
13
9
|
* The current value of the gauge.
|
|
@@ -53,11 +49,6 @@ const GaugeNativeView: React.ComponentType<NativeGaugeProps> = requireNativeView
|
|
|
53
49
|
'GaugeView'
|
|
54
50
|
);
|
|
55
51
|
|
|
56
|
-
const GaugeLabelNativeView: React.ComponentType<{
|
|
57
|
-
kind: GaugeLabelKind;
|
|
58
|
-
children?: React.ReactNode;
|
|
59
|
-
}> = requireNativeView('ExpoUI', 'GaugeLabelView');
|
|
60
|
-
|
|
61
52
|
/**
|
|
62
53
|
* Renders a SwiftUI `Gauge` component.
|
|
63
54
|
*/
|
|
@@ -76,16 +67,10 @@ export function Gauge(props: GaugeProps) {
|
|
|
76
67
|
modifiers={modifiers}
|
|
77
68
|
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
78
69
|
{...restProps}>
|
|
79
|
-
{children && <
|
|
80
|
-
{currentValueLabel &&
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{minimumValueLabel && (
|
|
84
|
-
<GaugeLabelNativeView kind="minimumValue">{minimumValueLabel}</GaugeLabelNativeView>
|
|
85
|
-
)}
|
|
86
|
-
{maximumValueLabel && (
|
|
87
|
-
<GaugeLabelNativeView kind="maximumValue">{maximumValueLabel}</GaugeLabelNativeView>
|
|
88
|
-
)}
|
|
70
|
+
{children && <Slot name="label">{children}</Slot>}
|
|
71
|
+
{currentValueLabel && <Slot name="currentValue">{currentValueLabel}</Slot>}
|
|
72
|
+
{minimumValueLabel && <Slot name="minimumValue">{minimumValueLabel}</Slot>}
|
|
73
|
+
{maximumValueLabel && <Slot name="maximumValue">{maximumValueLabel}</Slot>}
|
|
89
74
|
</GaugeNativeView>
|
|
90
75
|
);
|
|
91
76
|
}
|
|
@@ -11,7 +11,13 @@ export interface ImageProps extends CommonViewModifierProps {
|
|
|
11
11
|
* The name of the system image (SF Symbol).
|
|
12
12
|
* For example: 'photo', 'heart.fill', 'star.circle'
|
|
13
13
|
*/
|
|
14
|
-
systemName
|
|
14
|
+
systemName?: SFSymbol;
|
|
15
|
+
/**
|
|
16
|
+
* The URI of the local image file to display.
|
|
17
|
+
* For example: 'file:///path/to/image.jpg'
|
|
18
|
+
* Performs a synchronous read operation that blocks the main thread.
|
|
19
|
+
*/
|
|
20
|
+
uiImage?: string;
|
|
15
21
|
/**
|
|
16
22
|
* The size of the system image.
|
|
17
23
|
*/
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import type { ColorValue } from 'react-native';
|
|
3
3
|
import { type SFSymbol } from 'sf-symbols-typescript';
|
|
4
4
|
|
|
5
|
+
import { Slot } from '../SlotView';
|
|
5
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
7
|
import { type CommonViewModifierProps } from '../types';
|
|
7
8
|
|
|
@@ -31,10 +32,6 @@ export type LabelProps = {
|
|
|
31
32
|
|
|
32
33
|
const LabelNativeView: React.ComponentType<LabelProps & { children?: React.ReactNode }> =
|
|
33
34
|
requireNativeView('ExpoUI', 'LabelView');
|
|
34
|
-
const LabelIconNativeView: React.ComponentType<{ children?: React.ReactNode }> = requireNativeView(
|
|
35
|
-
'ExpoUI',
|
|
36
|
-
'LabelIcon'
|
|
37
|
-
);
|
|
38
35
|
|
|
39
36
|
/**
|
|
40
37
|
* Renders a native label view, which could be used in a list or section.
|
|
@@ -49,7 +46,7 @@ export function Label(props: LabelProps) {
|
|
|
49
46
|
modifiers={modifiers}
|
|
50
47
|
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
51
48
|
{...restProps}>
|
|
52
|
-
{icon && <
|
|
49
|
+
{icon && <Slot name="icon">{icon}</Slot>}
|
|
53
50
|
</LabelNativeView>
|
|
54
51
|
);
|
|
55
52
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
|
|
3
|
+
import { Slot } from '../SlotView';
|
|
3
4
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
5
|
import { type CommonViewModifierProps } from '../types';
|
|
5
6
|
|
|
@@ -16,16 +17,6 @@ const LabeledContentNativeView: React.ComponentType<LabeledContentProps> = requi
|
|
|
16
17
|
'LabeledContentView'
|
|
17
18
|
);
|
|
18
19
|
|
|
19
|
-
const LabeledContentLabel: React.ComponentType<object> = requireNativeView(
|
|
20
|
-
'ExpoUI',
|
|
21
|
-
'LabeledContentLabel'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
const LabeledContentContent: React.ComponentType<object> = requireNativeView(
|
|
25
|
-
'ExpoUI',
|
|
26
|
-
'LabeledContentContent'
|
|
27
|
-
);
|
|
28
|
-
|
|
29
20
|
/**
|
|
30
21
|
* LabeledContent component uses the native [LabeledContent](https://developer.apple.com/documentation/swiftui/labeledcontent) component.
|
|
31
22
|
* A container for attaching a label to a value-bearing view.
|
|
@@ -43,8 +34,8 @@ export function LabeledContent(props: LabeledContentProps) {
|
|
|
43
34
|
label={isLabelString ? label : undefined}
|
|
44
35
|
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
45
36
|
{...restProps}>
|
|
46
|
-
{label && !isLabelString && <
|
|
47
|
-
<
|
|
37
|
+
{label && !isLabelString && <Slot name="label">{label}</Slot>}
|
|
38
|
+
<Slot name="content">{children}</Slot>
|
|
48
39
|
</LabeledContentNativeView>
|
|
49
40
|
);
|
|
50
41
|
}
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
import { type MenuProps } from './types';
|
|
5
|
+
import { Slot } from '../SlotView';
|
|
5
6
|
|
|
6
7
|
export { type MenuProps } from './types';
|
|
7
8
|
|
|
@@ -13,11 +14,6 @@ type NativeMenuProps = Omit<MenuProps, 'label' | 'onPrimaryAction'> & {
|
|
|
13
14
|
|
|
14
15
|
const MenuNativeView: ComponentType<NativeMenuProps> = requireNativeView('ExpoUI', 'MenuView');
|
|
15
16
|
|
|
16
|
-
const MenuNativeLabelView: ComponentType<{ children: React.ReactNode }> = requireNativeView(
|
|
17
|
-
'ExpoUI',
|
|
18
|
-
'MenuLabel'
|
|
19
|
-
);
|
|
20
|
-
|
|
21
17
|
/**
|
|
22
18
|
* Displays a dropdown menu when tapped.
|
|
23
19
|
*/
|
|
@@ -33,7 +29,7 @@ export function Menu(props: MenuProps) {
|
|
|
33
29
|
hasPrimaryAction={onPrimaryAction != null}
|
|
34
30
|
onPrimaryAction={onPrimaryAction}
|
|
35
31
|
{...rest}>
|
|
36
|
-
{!isStringLabel && <
|
|
32
|
+
{!isStringLabel && <Slot name="label">{label}</Slot>}
|
|
37
33
|
{children}
|
|
38
34
|
</MenuNativeView>
|
|
39
35
|
);
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import type { NativeSyntheticEvent } from 'react-native';
|
|
3
3
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
4
4
|
|
|
5
|
+
import { Slot } from '../SlotView';
|
|
5
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
7
|
import { type CommonViewModifierProps } from '../types';
|
|
7
8
|
|
|
@@ -42,14 +43,6 @@ const PickerNativeView: React.ComponentType<NativePickerProps> = requireNativeVi
|
|
|
42
43
|
'PickerView'
|
|
43
44
|
);
|
|
44
45
|
|
|
45
|
-
const PickerContentNativeView: React.ComponentType<{ children: React.ReactNode }> =
|
|
46
|
-
requireNativeView('ExpoUI', 'PickerContentView');
|
|
47
|
-
|
|
48
|
-
const PickerLabelNativeView: React.ComponentType<{ children: React.ReactNode }> = requireNativeView(
|
|
49
|
-
'ExpoUI',
|
|
50
|
-
'PickerLabelView'
|
|
51
|
-
);
|
|
52
|
-
|
|
53
46
|
function transformPickerProps<T extends SelectionValueType>(
|
|
54
47
|
props: PickerProps<T>
|
|
55
48
|
): NativePickerProps {
|
|
@@ -81,14 +74,14 @@ export function Picker<T extends SelectionValueType>(props: PickerProps<T>) {
|
|
|
81
74
|
if (typeof label === 'string') {
|
|
82
75
|
return (
|
|
83
76
|
<PickerNativeView {...restProps} label={label}>
|
|
84
|
-
<
|
|
77
|
+
<Slot name="content">{children}</Slot>
|
|
85
78
|
</PickerNativeView>
|
|
86
79
|
);
|
|
87
80
|
} else {
|
|
88
81
|
return (
|
|
89
82
|
<PickerNativeView {...restProps}>
|
|
90
|
-
<
|
|
91
|
-
<
|
|
83
|
+
<Slot name="label">{label}</Slot>
|
|
84
|
+
<Slot name="content">{children}</Slot>
|
|
92
85
|
</PickerNativeView>
|
|
93
86
|
);
|
|
94
87
|
}
|