@expo/ui 55.0.3 → 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 +11 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/BottomSheetView.kt +91 -13
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +5 -4
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +39 -15
- 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/ModalBottomSheet/index.d.ts +65 -13
- package/build/jetpack-compose/ModalBottomSheet/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/swift-ui/Link/index.d.ts +36 -0
- package/build/swift-ui/Link/index.d.ts.map +1 -0
- 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 +3 -7
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/widgets.d.ts +14 -0
- package/build/swift-ui/modifiers/widgets.d.ts.map +1 -0
- package/expo-module.config.json +1 -1
- package/ios/ExpoUIModule.swift +1 -0
- package/ios/LinkView.swift +29 -0
- package/ios/Modifiers/EnvironmentModifier.swift +14 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +4 -0
- package/ios/Modifiers/WidgetModifiers.swift +12 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.3/expo.modules.ui-55.0.3-sources.jar → 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.3/expo.modules.ui-55.0.3.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.3/expo.modules.ui-55.0.3.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 +6 -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/ModalBottomSheet/index.tsx +85 -15
- package/src/jetpack-compose/TextInput/index.tsx +10 -0
- package/src/swift-ui/Link/index.tsx +52 -0
- package/src/swift-ui/index.tsx +1 -0
- package/src/swift-ui/modifiers/environment.ts +17 -4
- package/src/swift-ui/modifiers/index.ts +4 -10
- package/src/swift-ui/modifiers/widgets.ts +18 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +0 -1
- 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 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512 +0 -1
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { buildEvent, buildChangeEvent, type DateTimePickerProps } from './types';
|
|
2
|
+
import { DatePicker, type DatePickerProps } from '../swift-ui/DatePicker';
|
|
3
|
+
import { Host } from '../swift-ui/Host';
|
|
4
|
+
import { disabled as disabledModifier, ModifierConfig, tint } from '../swift-ui/modifiers';
|
|
5
|
+
import { datePickerStyle } from '../swift-ui/modifiers/datePickerStyle';
|
|
6
|
+
import { environment } from '../swift-ui/modifiers/environment';
|
|
7
|
+
|
|
8
|
+
type DatePickerStyleType = 'automatic' | 'compact' | 'graphical' | 'wheel';
|
|
9
|
+
|
|
10
|
+
function modeToDisplayedComponents(
|
|
11
|
+
mode: DateTimePickerProps['mode']
|
|
12
|
+
): DatePickerProps['displayedComponents'] {
|
|
13
|
+
switch (mode) {
|
|
14
|
+
case 'time':
|
|
15
|
+
return ['hourAndMinute'];
|
|
16
|
+
case 'datetime':
|
|
17
|
+
return ['date', 'hourAndMinute'];
|
|
18
|
+
case 'date':
|
|
19
|
+
default:
|
|
20
|
+
return ['date'];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function displayToDatePickerStyle(display: DateTimePickerProps['display']): DatePickerStyleType {
|
|
25
|
+
switch (display) {
|
|
26
|
+
case 'spinner':
|
|
27
|
+
return 'wheel';
|
|
28
|
+
case 'compact':
|
|
29
|
+
return 'compact';
|
|
30
|
+
case 'inline':
|
|
31
|
+
return 'graphical';
|
|
32
|
+
default:
|
|
33
|
+
return 'automatic';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function DateTimePicker(props: DateTimePickerProps) {
|
|
38
|
+
const {
|
|
39
|
+
value,
|
|
40
|
+
onChange,
|
|
41
|
+
onValueChange,
|
|
42
|
+
mode = 'date',
|
|
43
|
+
minimumDate,
|
|
44
|
+
maximumDate,
|
|
45
|
+
display = 'default',
|
|
46
|
+
testID,
|
|
47
|
+
style,
|
|
48
|
+
accentColor,
|
|
49
|
+
disabled,
|
|
50
|
+
locale,
|
|
51
|
+
themeVariant,
|
|
52
|
+
timeZoneName,
|
|
53
|
+
} = props;
|
|
54
|
+
|
|
55
|
+
const pickerStyle = displayToDatePickerStyle(display);
|
|
56
|
+
|
|
57
|
+
const modifiers: ModifierConfig[] = [datePickerStyle(pickerStyle)];
|
|
58
|
+
if (accentColor) {
|
|
59
|
+
modifiers.push(tint(accentColor));
|
|
60
|
+
}
|
|
61
|
+
if (disabled != null) {
|
|
62
|
+
modifiers.push(disabledModifier(disabled));
|
|
63
|
+
}
|
|
64
|
+
if (locale) {
|
|
65
|
+
modifiers.push(environment('locale', locale));
|
|
66
|
+
}
|
|
67
|
+
if (themeVariant) {
|
|
68
|
+
modifiers.push(environment('colorScheme', themeVariant));
|
|
69
|
+
}
|
|
70
|
+
if (timeZoneName) {
|
|
71
|
+
modifiers.push(environment('timeZone', timeZoneName));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const iosProps: DatePickerProps = {
|
|
75
|
+
selection: value,
|
|
76
|
+
displayedComponents: modeToDisplayedComponents(mode),
|
|
77
|
+
range: minimumDate || maximumDate ? { start: minimumDate, end: maximumDate } : undefined,
|
|
78
|
+
onDateChange: (date: Date) => {
|
|
79
|
+
if (onValueChange) {
|
|
80
|
+
onValueChange(buildChangeEvent(date), date);
|
|
81
|
+
} else {
|
|
82
|
+
onChange?.(buildEvent(date), date);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
modifiers,
|
|
86
|
+
testID,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Host matchContents={{ vertical: true }} style={style}>
|
|
91
|
+
<DatePicker {...iosProps} />
|
|
92
|
+
</Host>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DateTimePicker } from './DateTimePicker';
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
type DateTimePickerEvent,
|
|
5
|
+
type DateTimePickerChangeEvent,
|
|
6
|
+
type DateTimePickerProps,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
export default DateTimePicker;
|
|
10
|
+
// named export needed for docs generator
|
|
11
|
+
export { DateTimePicker };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
// -- Public types matching @react-native-community/datetimepicker ----------
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated used with the deprecated `onChange` prop
|
|
7
|
+
* */
|
|
8
|
+
export type DateTimePickerEvent = {
|
|
9
|
+
/**
|
|
10
|
+
* `'set'` when the user selects a date. `'dismissed'` when the user cancels
|
|
11
|
+
* an Android dialog picker. iOS never fires `'dismissed'`.
|
|
12
|
+
*/
|
|
13
|
+
type: 'set' | 'dismissed';
|
|
14
|
+
nativeEvent: {
|
|
15
|
+
timestamp: number;
|
|
16
|
+
utcOffset: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type DateTimePickerChangeEvent = {
|
|
21
|
+
nativeEvent: {
|
|
22
|
+
timestamp: number;
|
|
23
|
+
utcOffset: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type DateTimePickerProps = {
|
|
28
|
+
/**
|
|
29
|
+
* The current date value (controlled).
|
|
30
|
+
*/
|
|
31
|
+
value: Date;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `onValueChange` and `onDismiss` instead.
|
|
34
|
+
*
|
|
35
|
+
* Called when the user changes the date/time or dismisses the picker.
|
|
36
|
+
* The event type is encoded in `event.type`.
|
|
37
|
+
* If the new specific listeners are provided, they take precedence.
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (event: DateTimePickerEvent, date?: Date) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Called when the user selects a date or time.
|
|
42
|
+
*/
|
|
43
|
+
onValueChange?: (event: DateTimePickerChangeEvent, date: Date) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Called when the picker is dismissed without selecting a value.
|
|
46
|
+
* @platform android
|
|
47
|
+
*/
|
|
48
|
+
onDismiss?: () => void;
|
|
49
|
+
/**
|
|
50
|
+
* The picker mode.
|
|
51
|
+
* @default 'date'
|
|
52
|
+
*/
|
|
53
|
+
mode?: 'date' | 'time' | 'datetime';
|
|
54
|
+
/**
|
|
55
|
+
* The earliest selectable date.
|
|
56
|
+
*/
|
|
57
|
+
minimumDate?: Date;
|
|
58
|
+
/**
|
|
59
|
+
* The latest selectable date.
|
|
60
|
+
*/
|
|
61
|
+
maximumDate?: Date;
|
|
62
|
+
/**
|
|
63
|
+
* A test ID forwarded to the native view.
|
|
64
|
+
* Note: on Android dialog presentation, the test ID is not forwarded.
|
|
65
|
+
*/
|
|
66
|
+
testID?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Display style. Android supports `'default' | 'spinner'` — `'spinner'` shows a text input
|
|
69
|
+
* rather than a scroll wheel (Material 3 does not have a wheel-style picker).
|
|
70
|
+
* iOS supports `'default' | 'spinner' | 'compact' | 'inline'`.
|
|
71
|
+
* @default 'default'
|
|
72
|
+
*/
|
|
73
|
+
display?: 'default' | 'spinner' | 'compact' | 'inline' | 'calendar' | 'clock';
|
|
74
|
+
/**
|
|
75
|
+
* Use 24-hour format.
|
|
76
|
+
* @platform android
|
|
77
|
+
*/
|
|
78
|
+
is24Hour?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Accent/tint color applied to the picker.
|
|
81
|
+
* Maps to `color` on Android and `tint` on iOS.
|
|
82
|
+
*/
|
|
83
|
+
accentColor?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Whether the picker is disabled.
|
|
86
|
+
* @platform ios
|
|
87
|
+
*/
|
|
88
|
+
disabled?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Locale identifier (e.g. 'en_US', 'fr_FR') for the picker display.
|
|
91
|
+
* @platform ios
|
|
92
|
+
*/
|
|
93
|
+
locale?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Force a specific color scheme on the picker.
|
|
96
|
+
* @platform ios
|
|
97
|
+
*/
|
|
98
|
+
themeVariant?: 'dark' | 'light';
|
|
99
|
+
/**
|
|
100
|
+
* IANA time zone name (e.g. 'America/New_York') for the picker display.
|
|
101
|
+
* @platform ios
|
|
102
|
+
*/
|
|
103
|
+
timeZoneName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* How the picker is presented.
|
|
106
|
+
* - `'inline'` renders the picker directly in the view hierarchy.
|
|
107
|
+
* - `'dialog'` shows a modal dialog that opens on mount. Fires `onValueChange` on confirmation, `onDismiss` on cancel. The caller should
|
|
108
|
+
* unmount the component in response.
|
|
109
|
+
*
|
|
110
|
+
* On iOS this prop is accepted but ignored (always inline).
|
|
111
|
+
* On Android the default is `'dialog'`.
|
|
112
|
+
* @default 'dialog'
|
|
113
|
+
* @platform android
|
|
114
|
+
*/
|
|
115
|
+
presentation?: 'inline' | 'dialog';
|
|
116
|
+
/**
|
|
117
|
+
* Set the positive (confirm) button label.
|
|
118
|
+
* @platform android
|
|
119
|
+
*/
|
|
120
|
+
positiveButton?: { label?: string };
|
|
121
|
+
/**
|
|
122
|
+
* Set the negative (cancel) button label.
|
|
123
|
+
* @platform android
|
|
124
|
+
*/
|
|
125
|
+
negativeButton?: { label?: string };
|
|
126
|
+
} & Pick<ViewProps, 'style'>;
|
|
127
|
+
|
|
128
|
+
// -- Helpers ---------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
export function buildEvent(date: Date): DateTimePickerEvent {
|
|
131
|
+
return {
|
|
132
|
+
type: 'set',
|
|
133
|
+
nativeEvent: {
|
|
134
|
+
timestamp: date.getTime(),
|
|
135
|
+
utcOffset: -date.getTimezoneOffset(),
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function buildChangeEvent(date: Date): DateTimePickerChangeEvent {
|
|
141
|
+
return {
|
|
142
|
+
nativeEvent: {
|
|
143
|
+
timestamp: date.getTime(),
|
|
144
|
+
utcOffset: -date.getTimezoneOffset(),
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -1,16 +1,54 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { Ref } from 'react';
|
|
3
|
+
import { type ColorValue } from 'react-native';
|
|
3
4
|
|
|
4
|
-
import { type
|
|
5
|
+
import { type ModifierConfig } from '../../types';
|
|
5
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
7
|
|
|
8
|
+
type SlotNativeViewProps = {
|
|
9
|
+
slotName: string;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const SlotNativeView: React.ComponentType<SlotNativeViewProps> = requireNativeView(
|
|
14
|
+
'ExpoUI',
|
|
15
|
+
'SlotView'
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export type ModalBottomSheetRef = {
|
|
19
|
+
/**
|
|
20
|
+
* Programmatically hides the bottom sheet with an animation.
|
|
21
|
+
* The returned promise resolves after the dismiss animation completes.
|
|
22
|
+
*/
|
|
23
|
+
hide: () => Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type ModalBottomSheetProperties = {
|
|
27
|
+
/**
|
|
28
|
+
* Whether the bottom sheet can be dismissed by pressing the back button.
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
shouldDismissOnBackPress?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the bottom sheet can be dismissed by clicking outside (on the scrim).
|
|
34
|
+
* @default true
|
|
35
|
+
*/
|
|
36
|
+
shouldDismissOnClickOutside?: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
7
39
|
export type ModalBottomSheetProps = {
|
|
8
40
|
/**
|
|
9
41
|
* The children of the `ModalBottomSheet` component.
|
|
42
|
+
* Can include a `ModalBottomSheet.DragHandle` slot for a custom drag handle.
|
|
10
43
|
*/
|
|
11
44
|
children: React.ReactNode;
|
|
12
45
|
/**
|
|
13
|
-
*
|
|
46
|
+
* Can be used to imperatively hide the bottom sheet with an animation.
|
|
47
|
+
*/
|
|
48
|
+
ref?: Ref<ModalBottomSheetRef>;
|
|
49
|
+
/**
|
|
50
|
+
* Callback function that is called when the user dismisses the bottom sheet
|
|
51
|
+
* (via swipe, back press, or tapping outside the scrim).
|
|
14
52
|
*/
|
|
15
53
|
onDismissRequest: () => void;
|
|
16
54
|
/**
|
|
@@ -18,14 +56,42 @@ export type ModalBottomSheetProps = {
|
|
|
18
56
|
* @default false
|
|
19
57
|
*/
|
|
20
58
|
skipPartiallyExpanded?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The background color of the bottom sheet.
|
|
61
|
+
*/
|
|
62
|
+
containerColor?: ColorValue;
|
|
63
|
+
/**
|
|
64
|
+
* The preferred color of the content inside the bottom sheet.
|
|
65
|
+
*/
|
|
66
|
+
contentColor?: ColorValue;
|
|
67
|
+
/**
|
|
68
|
+
* The color of the scrim overlay behind the bottom sheet.
|
|
69
|
+
*/
|
|
70
|
+
scrimColor?: ColorValue;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to show the default drag handle at the top of the bottom sheet.
|
|
73
|
+
* Ignored if a custom `ModalBottomSheet.DragHandle` slot is provided.
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
showDragHandle?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Whether gestures (swipe to dismiss) are enabled on the bottom sheet.
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
sheetGesturesEnabled?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Properties for the modal window behavior.
|
|
84
|
+
*/
|
|
85
|
+
properties?: ModalBottomSheetProperties;
|
|
21
86
|
/**
|
|
22
87
|
* Modifiers for the component.
|
|
23
88
|
*/
|
|
24
|
-
modifiers?:
|
|
89
|
+
modifiers?: ModifierConfig[];
|
|
25
90
|
};
|
|
26
91
|
|
|
27
|
-
type NativeModalBottomSheetProps = Omit<ModalBottomSheetProps, 'onDismissRequest'> &
|
|
28
|
-
|
|
92
|
+
type NativeModalBottomSheetProps = Omit<ModalBottomSheetProps, 'onDismissRequest'> & {
|
|
93
|
+
onDismissRequest: () => void;
|
|
94
|
+
};
|
|
29
95
|
|
|
30
96
|
const ModalBottomSheetNativeView: React.ComponentType<NativeModalBottomSheetProps> =
|
|
31
97
|
requireNativeView('ExpoUI', 'ModalBottomSheetView');
|
|
@@ -44,18 +110,22 @@ function transformProps(props: ModalBottomSheetProps): NativeModalBottomSheetPro
|
|
|
44
110
|
}
|
|
45
111
|
|
|
46
112
|
/**
|
|
47
|
-
* A
|
|
113
|
+
* A custom drag handle slot for `ModalBottomSheet`.
|
|
114
|
+
* Wrap any content to use as the sheet's drag handle.
|
|
115
|
+
*
|
|
116
|
+
* @platform android
|
|
48
117
|
*/
|
|
49
|
-
|
|
50
|
-
return <
|
|
118
|
+
function DragHandle(props: { children: React.ReactNode }) {
|
|
119
|
+
return <SlotNativeView slotName="dragHandle">{props.children}</SlotNativeView>;
|
|
51
120
|
}
|
|
52
121
|
|
|
53
122
|
/**
|
|
54
|
-
*
|
|
123
|
+
* A Material Design modal bottom sheet.
|
|
55
124
|
*/
|
|
56
|
-
|
|
125
|
+
function ModalBottomSheetComponent(props: ModalBottomSheetProps) {
|
|
126
|
+
return <ModalBottomSheetNativeView {...transformProps(props)} />;
|
|
127
|
+
}
|
|
57
128
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export type BottomSheetProps = ModalBottomSheetProps;
|
|
129
|
+
ModalBottomSheetComponent.DragHandle = DragHandle;
|
|
130
|
+
|
|
131
|
+
export const ModalBottomSheet = ModalBottomSheetComponent;
|
|
@@ -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
|
*/
|
|
@@ -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
|
+
}
|
package/src/swift-ui/index.tsx
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { createModifier } from './createModifier';
|
|
2
2
|
|
|
3
|
+
export type EnvironmentConfig =
|
|
4
|
+
| { key: 'editMode'; value: 'active' | 'inactive' | 'transient' }
|
|
5
|
+
| { key: 'colorScheme'; value: 'light' | 'dark' }
|
|
6
|
+
| { key: 'locale'; value: string }
|
|
7
|
+
| { key: 'timeZone'; value: string };
|
|
8
|
+
|
|
3
9
|
/**
|
|
4
10
|
* Sets a SwiftUI environment value.
|
|
5
11
|
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/environment(_:_:)).
|
|
6
12
|
*/
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
export function environment(config: EnvironmentConfig): ReturnType<typeof createModifier>;
|
|
14
|
+
export function environment(
|
|
15
|
+
key: EnvironmentConfig['key'],
|
|
16
|
+
value: string
|
|
17
|
+
): ReturnType<typeof createModifier>;
|
|
18
|
+
export function environment(configOrKey: EnvironmentConfig | string, value?: string) {
|
|
19
|
+
if (typeof configOrKey === 'string') {
|
|
20
|
+
return createModifier('environment', { key: configOrKey, value });
|
|
21
|
+
}
|
|
22
|
+
return createModifier('environment', configOrKey);
|
|
23
|
+
}
|
|
@@ -15,6 +15,7 @@ import { environment } from './environment';
|
|
|
15
15
|
import { gaugeStyle } from './gaugeStyle';
|
|
16
16
|
import { progressViewStyle } from './progressViewStyle';
|
|
17
17
|
import type { Color } from './types';
|
|
18
|
+
import { widgetAccentedRenderingMode, widgetURL } from './widgets';
|
|
18
19
|
|
|
19
20
|
const ExpoUI = requireNativeModule('ExpoUI');
|
|
20
21
|
|
|
@@ -1056,15 +1057,6 @@ export const resizable = (
|
|
|
1056
1057
|
resizingMode?: 'stretch' | 'tile'
|
|
1057
1058
|
) => createModifier('resizable', { ...capInsets, resizingMode });
|
|
1058
1059
|
|
|
1059
|
-
/**
|
|
1060
|
-
* Specifies the how to render an Image when using the WidgetKit/WidgetRenderingMode/accented mode.
|
|
1061
|
-
* @param renderingMode - A constant describing how the Image should be rendered.
|
|
1062
|
-
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/image/widgetaccentedrenderingmode(_:)).
|
|
1063
|
-
*/
|
|
1064
|
-
export const widgetAccentedRenderingMode = (
|
|
1065
|
-
renderingMode: 'fullColor' | 'accented' | 'desaturated' | 'accentedDesaturated'
|
|
1066
|
-
) => createModifier('widgetAccentedRenderingMode', { renderingMode });
|
|
1067
|
-
|
|
1068
1060
|
// =============================================================================
|
|
1069
1061
|
// Type Definitions
|
|
1070
1062
|
// =============================================================================
|
|
@@ -1169,7 +1161,8 @@ export type BuiltInModifier =
|
|
|
1169
1161
|
| ReturnType<typeof listStyle>
|
|
1170
1162
|
| ReturnType<typeof contentTransition>
|
|
1171
1163
|
| ReturnType<typeof resizable>
|
|
1172
|
-
| ReturnType<typeof widgetAccentedRenderingMode
|
|
1164
|
+
| ReturnType<typeof widgetAccentedRenderingMode>
|
|
1165
|
+
| ReturnType<typeof widgetURL>;
|
|
1173
1166
|
|
|
1174
1167
|
/**
|
|
1175
1168
|
* Main ViewModifier type that supports both built-in and 3rd party modifiers.
|
|
@@ -1214,6 +1207,7 @@ export * from './progressViewStyle';
|
|
|
1214
1207
|
export * from './gaugeStyle';
|
|
1215
1208
|
export * from './presentationModifiers';
|
|
1216
1209
|
export * from './environment';
|
|
1210
|
+
export * from './widgets';
|
|
1217
1211
|
export type {
|
|
1218
1212
|
TimingAnimationParams,
|
|
1219
1213
|
SpringAnimationParams,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createModifier } from './createModifier';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Specifies the how to render an Image when using the WidgetKit/WidgetRenderingMode/accented mode.
|
|
5
|
+
* @param renderingMode - A constant describing how the Image should be rendered.
|
|
6
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/image/widgetaccentedrenderingmode(_:)).
|
|
7
|
+
*/
|
|
8
|
+
export const widgetAccentedRenderingMode = (
|
|
9
|
+
renderingMode: 'fullColor' | 'accented' | 'desaturated' | 'accentedDesaturated'
|
|
10
|
+
) => createModifier('widgetAccentedRenderingMode', { renderingMode });
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sets the URL to open in the containing app when the user clicks the widget.
|
|
14
|
+
* Widgets support one widgetURL modifier in their view hierarchy. If multiple views have widgetURL modifiers, the behavior is undefined.
|
|
15
|
+
* @param url - The URL to open in the containing app.
|
|
16
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/SwiftUI/View/widgetURL(_:)).
|
|
17
|
+
*/
|
|
18
|
+
export const widgetURL = (url: string) => createModifier('widgetURL', { url });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0a032184d0eac4ef04d3f10fe2ee4bbd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
946e37bf3649dc1cd162039cb8a8f09dda746589
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
c57afb701286b9952b45654e012a91a385a29294de33d0513f8d198f304e2469
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
17c66704e0a4a36020c483c7fa57c36e3a00859c0ec6a021f4c05d265d211fc861c7181e5ae44d2982418c3e463da8b3bec84ecd26da1361513712e77b5ba479
|
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
e71e2dd13981dbfb7885feb0b0bfe390
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
cfdba1b98a6054184b39f6b71d33c18f385c26d2
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b28fefc8ae185432f8d8988a2701d0f38bab89a15eebeb60a3e27462ad814be6
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1cadb83d41093807cf37e093484e7f8206f11e856e6eebb3d77c679800b75b9ad8dbfa074cc2f4ff75c60b9de7cba4099d76c37c11158a7551fb827b4808e615
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fc4fc4dd0ecfb0dc5b0541f32d7c4219
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
4d309366193fb9e93dfc2f528d842ef199d9356f
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8538fc44dce117d85e63175555983fbe9c41be3e21c0c1a38bd8284538348cfb
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
9b945333e9fabb773714dc66ccfd5556156ad6804aa63126a4d8db3351df53287def6a225bda7c5822ed780b7aaddbd36cac41fd31094df091b99b2c4cc75780
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a3df23f7e9d010b71fdfe87e96789d6d
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3296958fe9f35c69d8d5c4b2557dc5a71c45935f
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7c81267db605b109cc861c92c6c76b415dd5c7387766652b399877e6cd485481
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
20a8aefc780090feeeffd634b020ce55a5288bd2c12ba66ef0c19e81b78633cb13916d8dd5fea9b4cf1b3a07c00dbeb0599c4f283800bfe7bf44c90570841e07
|