@expo/ui 56.0.16 → 56.0.18
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/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +40 -6
- package/android/src/main/java/expo/modules/ui/HostView.kt +0 -2
- package/android/src/main/java/expo/modules/ui/ModalBottomSheetView.kt +14 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +20 -0
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +182 -6
- package/android/src/main/java/expo/modules/ui/textfield/BasicTextField.kt +203 -0
- package/android/src/main/java/expo/modules/ui/{TextFieldView.kt → textfield/TextField.kt} +34 -248
- package/android/src/main/java/expo/modules/ui/textfield/TextFieldShared.kt +299 -0
- package/build/State/useNativeState.d.ts +8 -3
- package/build/State/useNativeState.d.ts.map +1 -1
- package/build/community/bottom-sheet/BottomSheet.android.d.ts.map +1 -1
- package/build/community/pager-view/PagerView.android.d.ts.map +1 -1
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts +6 -0
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts.map +1 -1
- package/build/jetpack-compose/RNHostView/index.d.ts +8 -0
- package/build/jetpack-compose/RNHostView/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextField/BasicTextField.d.ts +36 -0
- package/build/jetpack-compose/TextField/BasicTextField.d.ts.map +1 -0
- package/build/jetpack-compose/TextField/TextField.d.ts +131 -0
- package/build/jetpack-compose/TextField/TextField.d.ts.map +1 -0
- package/build/jetpack-compose/TextField/index.d.ts +3 -244
- package/build/jetpack-compose/TextField/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextField/shared.d.ts +171 -0
- package/build/jetpack-compose/TextField/shared.d.ts.map +1 -0
- package/build/jetpack-compose/index.d.ts +1 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +11 -0
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/Image/index.d.ts +3 -1
- package/build/swift-ui/Image/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +34 -5
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/widgets.d.ts +7 -0
- package/build/swift-ui/modifiers/widgets.d.ts.map +1 -1
- package/build/universal/Button/index.ios.d.ts.map +1 -1
- package/build/universal/FieldGroup/FieldSectionSlots.d.ts.map +1 -1
- package/build/universal/FieldGroup/groupChildren.d.ts.map +1 -1
- package/build/universal/Text/index.ios.d.ts.map +1 -1
- package/build/universal/TextInput/index.android.d.ts.map +1 -1
- package/build/universal/TextInput/types.d.ts +5 -1
- package/build/universal/TextInput/types.d.ts.map +1 -1
- package/build/universal/modifierUtils.d.ts +16 -0
- package/build/universal/modifierUtils.d.ts.map +1 -0
- package/build/universal/transformStyle.android.d.ts +3 -0
- package/build/universal/transformStyle.android.d.ts.map +1 -1
- package/build/universal/transformStyle.ios.d.ts +3 -0
- package/build/universal/transformStyle.ios.d.ts.map +1 -1
- package/build/universal/types.d.ts +2 -0
- package/build/universal/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ImageView.swift +1 -5
- package/ios/Modifiers/ImageScaleModifier.swift +29 -0
- package/ios/Modifiers/OnGeometryChangeModifier.swift +8 -16
- package/ios/Modifiers/ViewModifierRegistry.swift +36 -0
- package/ios/Modifiers/WidgetModifiers.swift +12 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.16/expo.modules.ui-56.0.16-sources.jar → 56.0.18/expo.modules.ui-56.0.18-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.16/expo.modules.ui-56.0.16.module → 56.0.18/expo.modules.ui-56.0.18.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.16/expo.modules.ui-56.0.16.pom → 56.0.18/expo.modules.ui-56.0.18.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.18/expo.modules.ui-56.0.18.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 +3 -3
- package/src/State/index.fx.ts +4 -1
- package/src/State/useNativeState.ts +24 -5
- package/src/community/bottom-sheet/BottomSheet.android.tsx +2 -13
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +1 -1
- package/src/community/datetime-picker/DateTimePicker.tsx +1 -1
- package/src/community/menu/MenuView.ios.tsx +1 -1
- package/src/community/pager-view/PagerView.android.tsx +21 -3
- package/src/community/pager-view/PagerView.ios.tsx +1 -1
- package/src/community/picker/Picker.ios.tsx +1 -1
- package/src/community/slider/Slider.ios.tsx +1 -1
- package/src/jetpack-compose/ModalBottomSheet/index.tsx +7 -0
- package/src/jetpack-compose/RNHostView/index.tsx +8 -0
- package/src/jetpack-compose/TextField/BasicTextField.tsx +118 -0
- package/src/jetpack-compose/TextField/TextField.tsx +198 -0
- package/src/jetpack-compose/TextField/index.ts +19 -0
- package/src/jetpack-compose/TextField/{index.tsx → shared.ts} +71 -203
- package/src/jetpack-compose/index.ts +6 -0
- package/src/jetpack-compose/modifiers/index.ts +13 -0
- package/src/swift-ui/BottomSheet/index.tsx +1 -1
- package/src/swift-ui/Image/index.tsx +12 -3
- package/src/swift-ui/modifiers/index.ts +44 -6
- package/src/swift-ui/modifiers/widgets.ts +9 -0
- package/src/universal/Button/index.ios.tsx +6 -1
- package/src/universal/FieldGroup/FieldSectionSlots.tsx +3 -0
- package/src/universal/FieldGroup/groupChildren.tsx +3 -0
- package/src/universal/Text/index.ios.tsx +3 -1
- package/src/universal/TextInput/index.android.tsx +26 -60
- package/src/universal/TextInput/types.ts +5 -1
- package/src/universal/modifierUtils.ts +23 -0
- package/src/universal/transformStyle.android.ts +9 -1
- package/src/universal/transformStyle.ios.ts +9 -1
- package/src/universal/types.ts +2 -0
- package/android/src/main/java/expo/modules/ui/ShadowNodeSyncFlush.kt +0 -28
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.16/expo.modules.ui-56.0.16.pom.sha512 +0 -1
|
@@ -32,7 +32,7 @@ export function Slider(props: SliderProps) {
|
|
|
32
32
|
modifiers.push(tintModifier(minimumTrackTintColor as string));
|
|
33
33
|
}
|
|
34
34
|
return (
|
|
35
|
-
<Host matchContents={{ vertical: true }} style={hostStyle}>
|
|
35
|
+
<Host matchContents={{ vertical: true }} style={hostStyle} ignoreSafeArea="all">
|
|
36
36
|
<SwiftUISlider
|
|
37
37
|
value={value}
|
|
38
38
|
min={minimumValue}
|
|
@@ -62,6 +62,12 @@ export type ModalBottomSheetProps = {
|
|
|
62
62
|
* @default false
|
|
63
63
|
*/
|
|
64
64
|
skipPartiallyExpanded?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Opens the sheet fully expanded on first composition. Ignored when `skipPartiallyExpanded` is `true`.
|
|
67
|
+
* @default false
|
|
68
|
+
* @platform android
|
|
69
|
+
*/
|
|
70
|
+
initialFullyExpanded?: boolean;
|
|
65
71
|
/**
|
|
66
72
|
* The background color of the bottom sheet.
|
|
67
73
|
*/
|
|
@@ -111,6 +117,7 @@ function transformProps(props: ModalBottomSheetProps): NativeModalBottomSheetPro
|
|
|
111
117
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
112
118
|
...restProps,
|
|
113
119
|
skipPartiallyExpanded: props.skipPartiallyExpanded ?? false,
|
|
120
|
+
initialFullyExpanded: props.initialFullyExpanded ?? false,
|
|
114
121
|
onDismissRequest: () => {
|
|
115
122
|
onDismissRequest?.();
|
|
116
123
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import type { ReactElement, ComponentType } from 'react';
|
|
3
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
4
|
|
|
4
5
|
import type { ModifierConfig } from '../../types';
|
|
5
6
|
import type { PrimitiveBaseProps } from '../layout';
|
|
@@ -21,6 +22,13 @@ export interface RNHostProps extends PrimitiveBaseProps {
|
|
|
21
22
|
* Modifiers for the component.
|
|
22
23
|
*/
|
|
23
24
|
modifiers?: ModifierConfig[];
|
|
25
|
+
/**
|
|
26
|
+
* Style applied to the host view's React Native shadow node. Useful for
|
|
27
|
+
* controlling its layout position (e.g. `position: 'absolute'`) so the shadow
|
|
28
|
+
* layout matches where the hosting Compose component draws the content —
|
|
29
|
+
* important for `measure()`-based hit-testing such as `Pressable`.
|
|
30
|
+
*/
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
type NativeRNHostProps = RNHostProps;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import type { ColorValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type CommonNativeTextFieldProps,
|
|
6
|
+
type CommonTextFieldProperties,
|
|
7
|
+
type TextFieldRef,
|
|
8
|
+
useCommonTextFieldProps,
|
|
9
|
+
} from './shared';
|
|
10
|
+
import { Slot } from '../SlotView';
|
|
11
|
+
|
|
12
|
+
// region Types
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Imperative methods for `BasicTextField`. Identical to {@link TextFieldRef}.
|
|
16
|
+
*/
|
|
17
|
+
export type BasicTextFieldRef = TextFieldRef;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Props for `BasicTextField`. Mirrors Compose's `BasicTextField`: a bare,
|
|
21
|
+
* unstyled text field with no Material chrome (no container, indicator, or
|
|
22
|
+
* built-in padding). Shares {@link CommonTextFieldProperties} with `TextField` and
|
|
23
|
+
* `OutlinedTextField`; use `BasicTextField.DecorationBox` to add your own
|
|
24
|
+
* decoration.
|
|
25
|
+
*/
|
|
26
|
+
export type BasicTextFieldProps = CommonTextFieldProperties & {
|
|
27
|
+
/**
|
|
28
|
+
* Color of the text cursor. Maps to Compose's `cursorBrush` via
|
|
29
|
+
* `SolidColor(color)`. Defaults to the theme's primary color
|
|
30
|
+
* (`MaterialTheme.colorScheme.primary`) so it stays visible in light and dark.
|
|
31
|
+
*/
|
|
32
|
+
cursorColor?: ColorValue;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// endregion Types
|
|
36
|
+
|
|
37
|
+
// region Native
|
|
38
|
+
|
|
39
|
+
type NativeBasicTextFieldProps = Omit<
|
|
40
|
+
BasicTextFieldProps,
|
|
41
|
+
| 'value'
|
|
42
|
+
| 'selection'
|
|
43
|
+
| 'onValueChange'
|
|
44
|
+
| 'onFocusChanged'
|
|
45
|
+
| 'onSelectionChange'
|
|
46
|
+
| 'keyboardActions'
|
|
47
|
+
| 'children'
|
|
48
|
+
> &
|
|
49
|
+
CommonNativeTextFieldProps;
|
|
50
|
+
|
|
51
|
+
const BasicTextFieldNativeView: React.ComponentType<NativeBasicTextFieldProps> = requireNativeView(
|
|
52
|
+
'ExpoUI',
|
|
53
|
+
'BasicTextFieldView'
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const InnerTextFieldNativeView: React.ComponentType<object> = requireNativeView(
|
|
57
|
+
'ExpoUI',
|
|
58
|
+
'InnerTextFieldView'
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const PlaceholderNativeView: React.ComponentType<{ children?: React.ReactNode }> =
|
|
62
|
+
requireNativeView('ExpoUI', 'PlaceholderView');
|
|
63
|
+
|
|
64
|
+
function useTransformedProps(props: BasicTextFieldProps): NativeBasicTextFieldProps {
|
|
65
|
+
return useCommonTextFieldProps(props);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// endregion Native
|
|
69
|
+
|
|
70
|
+
// region Slot components
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Wraps the editable text with custom decoration. Maps to Compose's
|
|
74
|
+
* `decorationBox`. Place {@link InnerTextField} inside it where the text
|
|
75
|
+
* should render.
|
|
76
|
+
*/
|
|
77
|
+
function DecorationBox(props: { children: React.ReactNode }) {
|
|
78
|
+
return <Slot slotName="decorationBox">{props.children}</Slot>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The editable text itself, placed wherever you want it inside
|
|
83
|
+
* {@link DecorationBox}. Maps to the `innerTextField` lambda Compose passes to
|
|
84
|
+
* `decorationBox`.
|
|
85
|
+
*/
|
|
86
|
+
function InnerTextField() {
|
|
87
|
+
return <InnerTextFieldNativeView />;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* A placeholder shown only while the field is empty. Place it inside
|
|
92
|
+
* {@link DecorationBox}, typically overlaying {@link InnerTextField}. Its
|
|
93
|
+
* visibility is toggled natively from the field's text, so it stays correct for
|
|
94
|
+
* every change — typing, `clear()`, `setText`, and writes to the `value`
|
|
95
|
+
* observable — without a JS round-trip.
|
|
96
|
+
*/
|
|
97
|
+
function Placeholder(props: { children: React.ReactNode }) {
|
|
98
|
+
return <PlaceholderNativeView>{props.children}</PlaceholderNativeView>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// endregion Slot components
|
|
102
|
+
|
|
103
|
+
// region Component
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A bare, unstyled Compose `BasicTextField` with no Material decoration.
|
|
107
|
+
*/
|
|
108
|
+
function BasicTextFieldComponent(props: BasicTextFieldProps) {
|
|
109
|
+
return <BasicTextFieldNativeView {...useTransformedProps(props)} />;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
BasicTextFieldComponent.DecorationBox = DecorationBox;
|
|
113
|
+
BasicTextFieldComponent.InnerTextField = InnerTextField;
|
|
114
|
+
BasicTextFieldComponent.Placeholder = Placeholder;
|
|
115
|
+
|
|
116
|
+
// endregion Component
|
|
117
|
+
|
|
118
|
+
export { BasicTextFieldComponent as BasicTextField };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import type { ColorValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type CommonNativeTextFieldProps,
|
|
6
|
+
type CommonTextFieldProperties,
|
|
7
|
+
useCommonTextFieldProps,
|
|
8
|
+
} from './shared';
|
|
9
|
+
import { type ObservableState } from '../../State';
|
|
10
|
+
import { parseJSXShape, type ShapeJSXElement, type ShapeRecordProps } from '../Shape';
|
|
11
|
+
import { Slot } from '../SlotView';
|
|
12
|
+
|
|
13
|
+
// region Types
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Colors for `TextField` and `OutlinedTextField`.
|
|
17
|
+
* Maps to `TextFieldColors` in Compose, shared by both variants.
|
|
18
|
+
*/
|
|
19
|
+
export type TextFieldColors = {
|
|
20
|
+
focusedTextColor?: ColorValue;
|
|
21
|
+
unfocusedTextColor?: ColorValue;
|
|
22
|
+
disabledTextColor?: ColorValue;
|
|
23
|
+
errorTextColor?: ColorValue;
|
|
24
|
+
focusedContainerColor?: ColorValue;
|
|
25
|
+
unfocusedContainerColor?: ColorValue;
|
|
26
|
+
disabledContainerColor?: ColorValue;
|
|
27
|
+
errorContainerColor?: ColorValue;
|
|
28
|
+
cursorColor?: ColorValue;
|
|
29
|
+
errorCursorColor?: ColorValue;
|
|
30
|
+
focusedIndicatorColor?: ColorValue;
|
|
31
|
+
unfocusedIndicatorColor?: ColorValue;
|
|
32
|
+
disabledIndicatorColor?: ColorValue;
|
|
33
|
+
errorIndicatorColor?: ColorValue;
|
|
34
|
+
focusedLeadingIconColor?: ColorValue;
|
|
35
|
+
unfocusedLeadingIconColor?: ColorValue;
|
|
36
|
+
disabledLeadingIconColor?: ColorValue;
|
|
37
|
+
errorLeadingIconColor?: ColorValue;
|
|
38
|
+
focusedTrailingIconColor?: ColorValue;
|
|
39
|
+
unfocusedTrailingIconColor?: ColorValue;
|
|
40
|
+
disabledTrailingIconColor?: ColorValue;
|
|
41
|
+
errorTrailingIconColor?: ColorValue;
|
|
42
|
+
focusedLabelColor?: ColorValue;
|
|
43
|
+
unfocusedLabelColor?: ColorValue;
|
|
44
|
+
disabledLabelColor?: ColorValue;
|
|
45
|
+
errorLabelColor?: ColorValue;
|
|
46
|
+
focusedPlaceholderColor?: ColorValue;
|
|
47
|
+
unfocusedPlaceholderColor?: ColorValue;
|
|
48
|
+
disabledPlaceholderColor?: ColorValue;
|
|
49
|
+
errorPlaceholderColor?: ColorValue;
|
|
50
|
+
focusedSupportingTextColor?: ColorValue;
|
|
51
|
+
unfocusedSupportingTextColor?: ColorValue;
|
|
52
|
+
disabledSupportingTextColor?: ColorValue;
|
|
53
|
+
errorSupportingTextColor?: ColorValue;
|
|
54
|
+
focusedPrefixColor?: ColorValue;
|
|
55
|
+
unfocusedPrefixColor?: ColorValue;
|
|
56
|
+
disabledPrefixColor?: ColorValue;
|
|
57
|
+
errorPrefixColor?: ColorValue;
|
|
58
|
+
focusedSuffixColor?: ColorValue;
|
|
59
|
+
unfocusedSuffixColor?: ColorValue;
|
|
60
|
+
disabledSuffixColor?: ColorValue;
|
|
61
|
+
errorSuffixColor?: ColorValue;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Material props inlined per variant (not a shared named base) so docs render them directly.
|
|
65
|
+
export type TextFieldProps = CommonTextFieldProperties & {
|
|
66
|
+
/** @default false */
|
|
67
|
+
isError?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Shape used for the field's container outline/fill. Use the helpers from
|
|
70
|
+
* `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
|
|
71
|
+
* Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
|
|
72
|
+
*/
|
|
73
|
+
shape?: ShapeJSXElement;
|
|
74
|
+
colors?: TextFieldColors;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type OutlinedTextFieldProps = CommonTextFieldProperties & {
|
|
78
|
+
/** @default false */
|
|
79
|
+
isError?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Shape used for the field's container outline/fill. Use the helpers from
|
|
82
|
+
* `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
|
|
83
|
+
* Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
|
|
84
|
+
*/
|
|
85
|
+
shape?: ShapeJSXElement;
|
|
86
|
+
colors?: TextFieldColors;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// endregion Types
|
|
90
|
+
|
|
91
|
+
// region Native
|
|
92
|
+
|
|
93
|
+
type NativeTextFieldProps = Omit<
|
|
94
|
+
TextFieldProps,
|
|
95
|
+
| 'value'
|
|
96
|
+
| 'selection'
|
|
97
|
+
| 'onValueChange'
|
|
98
|
+
| 'onFocusChanged'
|
|
99
|
+
| 'onSelectionChange'
|
|
100
|
+
| 'keyboardActions'
|
|
101
|
+
| 'children'
|
|
102
|
+
| 'shape'
|
|
103
|
+
> &
|
|
104
|
+
CommonNativeTextFieldProps & {
|
|
105
|
+
variant: 'filled' | 'outlined';
|
|
106
|
+
colors?: TextFieldColors;
|
|
107
|
+
shape?: ShapeRecordProps;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const TextFieldNativeView: React.ComponentType<NativeTextFieldProps> = requireNativeView(
|
|
111
|
+
'ExpoUI',
|
|
112
|
+
'TextFieldView'
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
function useTransformedProps(
|
|
116
|
+
props: TextFieldProps | OutlinedTextFieldProps,
|
|
117
|
+
variant: 'filled' | 'outlined'
|
|
118
|
+
): NativeTextFieldProps {
|
|
119
|
+
const { shape, ...rest } = props;
|
|
120
|
+
return {
|
|
121
|
+
...useCommonTextFieldProps(rest),
|
|
122
|
+
variant,
|
|
123
|
+
shape: parseJSXShape(shape),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// endregion Native
|
|
128
|
+
|
|
129
|
+
// region Slot components
|
|
130
|
+
|
|
131
|
+
function Label(props: { children: React.ReactNode }) {
|
|
132
|
+
return <Slot slotName="label">{props.children}</Slot>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function Placeholder(props: { children: React.ReactNode }) {
|
|
136
|
+
return <Slot slotName="placeholder">{props.children}</Slot>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function LeadingIcon(props: { children: React.ReactNode }) {
|
|
140
|
+
return <Slot slotName="leadingIcon">{props.children}</Slot>;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function TrailingIcon(props: { children: React.ReactNode }) {
|
|
144
|
+
return <Slot slotName="trailingIcon">{props.children}</Slot>;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function Prefix(props: { children: React.ReactNode }) {
|
|
148
|
+
return <Slot slotName="prefix">{props.children}</Slot>;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function Suffix(props: { children: React.ReactNode }) {
|
|
152
|
+
return <Slot slotName="suffix">{props.children}</Slot>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function SupportingText(props: { children: React.ReactNode }) {
|
|
156
|
+
return <Slot slotName="supportingText">{props.children}</Slot>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// endregion Slot components
|
|
160
|
+
|
|
161
|
+
// region Components
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* A Material3 `TextField`.
|
|
165
|
+
*/
|
|
166
|
+
function TextFieldComponent(props: TextFieldProps) {
|
|
167
|
+
return <TextFieldNativeView {...useTransformedProps(props, 'filled')} />;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
TextFieldComponent.Label = Label;
|
|
171
|
+
TextFieldComponent.Placeholder = Placeholder;
|
|
172
|
+
TextFieldComponent.LeadingIcon = LeadingIcon;
|
|
173
|
+
TextFieldComponent.TrailingIcon = TrailingIcon;
|
|
174
|
+
TextFieldComponent.Prefix = Prefix;
|
|
175
|
+
TextFieldComponent.Suffix = Suffix;
|
|
176
|
+
TextFieldComponent.SupportingText = SupportingText;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* A Material3 `OutlinedTextField` with a transparent background and border outline.
|
|
180
|
+
*/
|
|
181
|
+
function OutlinedTextFieldComponent(props: OutlinedTextFieldProps) {
|
|
182
|
+
return <TextFieldNativeView {...useTransformedProps(props, 'outlined')} />;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
OutlinedTextFieldComponent.Label = Label;
|
|
186
|
+
OutlinedTextFieldComponent.Placeholder = Placeholder;
|
|
187
|
+
OutlinedTextFieldComponent.LeadingIcon = LeadingIcon;
|
|
188
|
+
OutlinedTextFieldComponent.TrailingIcon = TrailingIcon;
|
|
189
|
+
OutlinedTextFieldComponent.Prefix = Prefix;
|
|
190
|
+
OutlinedTextFieldComponent.Suffix = Suffix;
|
|
191
|
+
OutlinedTextFieldComponent.SupportingText = SupportingText;
|
|
192
|
+
|
|
193
|
+
// endregion Components
|
|
194
|
+
|
|
195
|
+
export { TextFieldComponent as TextField, OutlinedTextFieldComponent as OutlinedTextField };
|
|
196
|
+
|
|
197
|
+
// Exported for docs api data
|
|
198
|
+
export { type ObservableState };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export {
|
|
2
|
+
TextField,
|
|
3
|
+
OutlinedTextField,
|
|
4
|
+
type TextFieldColors,
|
|
5
|
+
type TextFieldProps,
|
|
6
|
+
type OutlinedTextFieldProps,
|
|
7
|
+
type ObservableState,
|
|
8
|
+
} from './TextField';
|
|
9
|
+
export { BasicTextField, type BasicTextFieldProps, type BasicTextFieldRef } from './BasicTextField';
|
|
10
|
+
export type {
|
|
11
|
+
TextFieldRef,
|
|
12
|
+
TextFieldCapitalization,
|
|
13
|
+
TextFieldImeAction,
|
|
14
|
+
TextFieldKeyboardType,
|
|
15
|
+
TextFieldKeyboardOptions,
|
|
16
|
+
TextFieldKeyboardActions,
|
|
17
|
+
TextFieldTextStyle,
|
|
18
|
+
CommonTextFieldProperties,
|
|
19
|
+
} from './shared';
|