@expo/ui 56.0.15 → 56.0.17
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 +47 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +54 -6
- package/android/src/main/java/expo/modules/ui/HostView.kt +0 -2
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +65 -0
- package/android/src/main/java/expo/modules/ui/NavigationBarView.kt +95 -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} +63 -267
- 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/pager-view/PagerView.android.d.ts.map +1 -1
- package/build/jetpack-compose/NavigationBar/index.d.ts +101 -0
- package/build/jetpack-compose/NavigationBar/index.d.ts.map +1 -0
- 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 +2 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +42 -0
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/DisclosureGroup/index.d.ts +11 -2
- package/build/swift-ui/DisclosureGroup/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 +5 -0
- package/build/swift-ui/Label/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +100 -4
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/universal/Collapsible/index.android.d.ts +1 -1
- package/build/universal/Collapsible/index.android.d.ts.map +1 -1
- package/build/universal/Collapsible/index.d.ts +1 -1
- package/build/universal/Collapsible/index.d.ts.map +1 -1
- package/build/universal/Collapsible/index.ios.d.ts +1 -1
- package/build/universal/Collapsible/index.ios.d.ts.map +1 -1
- package/build/universal/Collapsible/types.d.ts +5 -0
- package/build/universal/Collapsible/types.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/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +1 -1
- package/ios/DisclosureGroupView.swift +36 -13
- package/ios/ImageView.swift +20 -14
- package/ios/Label.swift +26 -2
- package/ios/Modifiers/ButtonBorderShapeModifier.swift +46 -0
- package/ios/Modifiers/DynamicTypeSizeModifier.swift +56 -0
- package/ios/Modifiers/FontModifier.swift +4 -1
- package/ios/Modifiers/ImageScaleModifier.swift +29 -0
- package/ios/Modifiers/OnGeometryChangeModifier.swift +8 -16
- package/ios/Modifiers/ViewModifierRegistry.swift +89 -8
- package/ios/SecureFieldView.swift +17 -1
- package/ios/TextFieldView.swift +33 -2
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15-sources.jar → 56.0.17/expo.modules.ui-56.0.17-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15.module → 56.0.17/expo.modules.ui-56.0.17.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.15/expo.modules.ui-56.0.15.pom → 56.0.17/expo.modules.ui-56.0.17.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.17/expo.modules.ui-56.0.17.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 +4 -4
- package/src/State/index.fx.ts +4 -1
- package/src/State/useNativeState.ts +24 -13
- 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 +16 -2
- package/src/community/pager-view/PagerView.ios.tsx +1 -1
- package/src/community/picker/Picker.ios.tsx +1 -1
- package/src/community/segmented-control/SegmentedControl.ios.tsx +1 -1
- package/src/community/slider/Slider.ios.tsx +1 -1
- package/src/jetpack-compose/NavigationBar/index.tsx +174 -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 +7 -0
- package/src/jetpack-compose/modifiers/index.ts +49 -0
- package/src/swift-ui/BottomSheet/index.tsx +1 -1
- package/src/swift-ui/DisclosureGroup/index.tsx +14 -2
- package/src/swift-ui/Image/index.tsx +16 -3
- package/src/swift-ui/Label/index.tsx +8 -1
- package/src/swift-ui/modifiers/index.ts +143 -5
- package/src/universal/Collapsible/index.android.tsx +10 -2
- package/src/universal/Collapsible/index.ios.tsx +17 -3
- package/src/universal/Collapsible/index.tsx +8 -2
- package/src/universal/Collapsible/types.ts +7 -0
- package/src/universal/TextInput/index.android.tsx +26 -33
- package/src/universal/TextInput/types.ts +5 -1
- package/android/src/main/java/expo/modules/ui/ShadowNodeSyncFlush.kt +0 -28
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.15/expo.modules.ui-56.0.15.pom.sha512 +0 -1
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Ref } from 'react';
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
3
2
|
import type { ColorValue } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { getStateId, type ObservableState, useWorkletProp, worklets } from '../../State';
|
|
6
5
|
import type { ModifierConfig, ViewEvent } from '../../types';
|
|
7
|
-
import { parseJSXShape, type ShapeJSXElement, type ShapeRecordProps } from '../Shape';
|
|
8
|
-
import { Slot } from '../SlotView';
|
|
9
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
10
7
|
|
|
11
|
-
// region Types
|
|
12
|
-
|
|
13
8
|
/**
|
|
14
|
-
* Can be used for imperatively focusing and setting text/selection on the
|
|
9
|
+
* Can be used for imperatively focusing and setting text/selection on the
|
|
10
|
+
* `TextField`, `OutlinedTextField`, and `BasicTextField` components.
|
|
15
11
|
*/
|
|
16
12
|
export type TextFieldRef = {
|
|
17
13
|
setText: (newText: string) => Promise<void>;
|
|
@@ -76,56 +72,37 @@ export type TextFieldKeyboardActions = {
|
|
|
76
72
|
};
|
|
77
73
|
|
|
78
74
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
75
|
+
* Text styling for a text field's content. Maps to Compose's `TextStyle`.
|
|
76
|
+
* Shared by `TextField`, `OutlinedTextField`, and `BasicTextField`.
|
|
81
77
|
*/
|
|
82
|
-
export type
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
focusedTrailingIconColor?: ColorValue;
|
|
102
|
-
unfocusedTrailingIconColor?: ColorValue;
|
|
103
|
-
disabledTrailingIconColor?: ColorValue;
|
|
104
|
-
errorTrailingIconColor?: ColorValue;
|
|
105
|
-
focusedLabelColor?: ColorValue;
|
|
106
|
-
unfocusedLabelColor?: ColorValue;
|
|
107
|
-
disabledLabelColor?: ColorValue;
|
|
108
|
-
errorLabelColor?: ColorValue;
|
|
109
|
-
focusedPlaceholderColor?: ColorValue;
|
|
110
|
-
unfocusedPlaceholderColor?: ColorValue;
|
|
111
|
-
disabledPlaceholderColor?: ColorValue;
|
|
112
|
-
errorPlaceholderColor?: ColorValue;
|
|
113
|
-
focusedSupportingTextColor?: ColorValue;
|
|
114
|
-
unfocusedSupportingTextColor?: ColorValue;
|
|
115
|
-
disabledSupportingTextColor?: ColorValue;
|
|
116
|
-
errorSupportingTextColor?: ColorValue;
|
|
117
|
-
focusedPrefixColor?: ColorValue;
|
|
118
|
-
unfocusedPrefixColor?: ColorValue;
|
|
119
|
-
disabledPrefixColor?: ColorValue;
|
|
120
|
-
errorPrefixColor?: ColorValue;
|
|
121
|
-
focusedSuffixColor?: ColorValue;
|
|
122
|
-
unfocusedSuffixColor?: ColorValue;
|
|
123
|
-
disabledSuffixColor?: ColorValue;
|
|
124
|
-
errorSuffixColor?: ColorValue;
|
|
78
|
+
export type TextFieldTextStyle = {
|
|
79
|
+
textAlign?: 'left' | 'right' | 'center' | 'justify';
|
|
80
|
+
color?: ColorValue;
|
|
81
|
+
fontSize?: number;
|
|
82
|
+
fontFamily?: string;
|
|
83
|
+
fontWeight?:
|
|
84
|
+
| '100'
|
|
85
|
+
| '200'
|
|
86
|
+
| '300'
|
|
87
|
+
| '400'
|
|
88
|
+
| '500'
|
|
89
|
+
| '600'
|
|
90
|
+
| '700'
|
|
91
|
+
| '800'
|
|
92
|
+
| '900'
|
|
93
|
+
| 'normal'
|
|
94
|
+
| 'bold';
|
|
95
|
+
lineHeight?: number;
|
|
96
|
+
letterSpacing?: number;
|
|
125
97
|
};
|
|
126
98
|
|
|
127
|
-
/**
|
|
128
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Props shared by every Compose text field variant — `TextField`,
|
|
101
|
+
* `OutlinedTextField`, and `BasicTextField`. The Material variants add their
|
|
102
|
+
* own decoration props (`isError`, `shape`, `colors`, slot children);
|
|
103
|
+
* `BasicTextField` adds `cursorColor`.
|
|
104
|
+
*/
|
|
105
|
+
export type CommonTextFieldProperties = {
|
|
129
106
|
ref?: Ref<TextFieldRef>;
|
|
130
107
|
/**
|
|
131
108
|
* An observable state that holds the current text value. Create one with
|
|
@@ -140,8 +117,6 @@ type BaseTextFieldProps = {
|
|
|
140
117
|
/** @default false */
|
|
141
118
|
readOnly?: boolean;
|
|
142
119
|
/** @default false */
|
|
143
|
-
isError?: boolean;
|
|
144
|
-
/** @default false */
|
|
145
120
|
singleLine?: boolean;
|
|
146
121
|
maxLines?: number;
|
|
147
122
|
minLines?: number;
|
|
@@ -151,17 +126,6 @@ type BaseTextFieldProps = {
|
|
|
151
126
|
*/
|
|
152
127
|
visualTransformation?: 'password' | 'none';
|
|
153
128
|
|
|
154
|
-
/**
|
|
155
|
-
* Selection-related colors. Maps to Compose's `TextSelectionColors` via
|
|
156
|
-
* `LocalTextSelectionColors`. `handleColor` controls the drag handles;
|
|
157
|
-
* `backgroundColor` is the highlighted-text background (typically the same
|
|
158
|
-
* tint at lower alpha so the underlying text stays readable).
|
|
159
|
-
*/
|
|
160
|
-
textSelectionColors?: {
|
|
161
|
-
handleColor?: ColorValue;
|
|
162
|
-
backgroundColor?: ColorValue;
|
|
163
|
-
};
|
|
164
|
-
|
|
165
129
|
/**
|
|
166
130
|
* Observable state holding the current selection range. Create with
|
|
167
131
|
* `useNativeState({ start: 0, end: 0 })`. The field writes user-driven
|
|
@@ -178,28 +142,21 @@ type BaseTextFieldProps = {
|
|
|
178
142
|
onSelectionChange?: (selection: { start: number; end: number }) => void;
|
|
179
143
|
|
|
180
144
|
/**
|
|
181
|
-
*
|
|
145
|
+
* Selection-related colors. Maps to Compose's `TextSelectionColors` via
|
|
146
|
+
* `LocalTextSelectionColors`. `handleColor` controls the drag handles (and
|
|
147
|
+
* the caret's drag handle); `backgroundColor` is the highlighted-text
|
|
148
|
+
* background (typically the same tint at lower alpha so the underlying text
|
|
149
|
+
* stays readable). Independent of `cursorColor`, which tints the caret line.
|
|
182
150
|
*/
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
fontSize?: number;
|
|
187
|
-
fontFamily?: string;
|
|
188
|
-
fontWeight?:
|
|
189
|
-
| '100'
|
|
190
|
-
| '200'
|
|
191
|
-
| '300'
|
|
192
|
-
| '400'
|
|
193
|
-
| '500'
|
|
194
|
-
| '600'
|
|
195
|
-
| '700'
|
|
196
|
-
| '800'
|
|
197
|
-
| '900'
|
|
198
|
-
| 'normal'
|
|
199
|
-
| 'bold';
|
|
200
|
-
lineHeight?: number;
|
|
201
|
-
letterSpacing?: number;
|
|
151
|
+
textSelectionColors?: {
|
|
152
|
+
handleColor?: ColorValue;
|
|
153
|
+
backgroundColor?: ColorValue;
|
|
202
154
|
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Text styling for the field's content. Maps to Compose's `TextStyle`.
|
|
158
|
+
*/
|
|
159
|
+
textStyle?: TextFieldTextStyle;
|
|
203
160
|
keyboardOptions?: TextFieldKeyboardOptions;
|
|
204
161
|
keyboardActions?: TextFieldKeyboardActions;
|
|
205
162
|
/**
|
|
@@ -211,44 +168,35 @@ type BaseTextFieldProps = {
|
|
|
211
168
|
onValueChange?: (value: string) => void;
|
|
212
169
|
/** A callback triggered when the field gains or loses focus. */
|
|
213
170
|
onFocusChanged?: (focused: boolean) => void;
|
|
214
|
-
/**
|
|
215
|
-
* Shape used for the field's container outline/fill. Use the helpers from
|
|
216
|
-
* `Shape` (for example, `<Shape.Pill />` or `<Shape.RoundedCorner cornerRadii={...} />`).
|
|
217
|
-
* Defaults to the Material `OutlinedTextFieldDefaults.shape`/`TextFieldDefaults.shape`.
|
|
218
|
-
*/
|
|
219
|
-
shape?: ShapeJSXElement;
|
|
220
171
|
modifiers?: ModifierConfig[];
|
|
221
|
-
/** Slot children
|
|
222
|
-
children?:
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export type TextFieldProps = BaseTextFieldProps & {
|
|
226
|
-
colors?: TextFieldColors;
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
export type OutlinedTextFieldProps = BaseTextFieldProps & {
|
|
230
|
-
colors?: TextFieldColors;
|
|
172
|
+
/** Slot children that configure the field's decoration. */
|
|
173
|
+
children?: ReactNode;
|
|
231
174
|
};
|
|
232
175
|
|
|
233
|
-
//
|
|
176
|
+
// region Native transform
|
|
234
177
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
178
|
+
/**
|
|
179
|
+
* Keys consumed (and reshaped) by {@link useCommonTextFieldProps}. Everything
|
|
180
|
+
* else on the props passes through untouched.
|
|
181
|
+
*/
|
|
182
|
+
type TransformedKeys =
|
|
239
183
|
| 'value'
|
|
240
184
|
| 'selection'
|
|
185
|
+
| 'modifiers'
|
|
186
|
+
| 'children'
|
|
187
|
+
| 'keyboardActions'
|
|
241
188
|
| 'onValueChange'
|
|
242
189
|
| 'onFocusChanged'
|
|
243
|
-
| 'onSelectionChange'
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
190
|
+
| 'onSelectionChange';
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Native-facing prop shape shared by every Compose text field variant. The
|
|
194
|
+
* observable-backed props collapse to shared-object ids, and the public
|
|
195
|
+
* callbacks become `nativeEvent`-wrapped listeners.
|
|
196
|
+
*/
|
|
197
|
+
export type CommonNativeTextFieldProps = {
|
|
198
|
+
modifiers?: ModifierConfig[];
|
|
199
|
+
children?: ReactNode;
|
|
252
200
|
value?: number | null;
|
|
253
201
|
selection?: number | null;
|
|
254
202
|
onValueChangeSync?: number | null;
|
|
@@ -257,15 +205,9 @@ type NativeTextFieldProps = Omit<
|
|
|
257
205
|
ViewEvent<'onSelectionChange', { start: number; end: number }> &
|
|
258
206
|
ViewEvent<'onKeyboardAction', { action: string; value: string }>;
|
|
259
207
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
function useTransformedProps(
|
|
266
|
-
props: TextFieldProps | OutlinedTextFieldProps,
|
|
267
|
-
variant: 'filled' | 'outlined'
|
|
268
|
-
): NativeTextFieldProps {
|
|
208
|
+
export function useCommonTextFieldProps<T extends CommonTextFieldProperties>(
|
|
209
|
+
props: T
|
|
210
|
+
): CommonNativeTextFieldProps & Omit<T, TransformedKeys> {
|
|
269
211
|
const {
|
|
270
212
|
value,
|
|
271
213
|
selection,
|
|
@@ -275,19 +217,16 @@ function useTransformedProps(
|
|
|
275
217
|
onValueChange,
|
|
276
218
|
onFocusChanged,
|
|
277
219
|
onSelectionChange,
|
|
278
|
-
|
|
279
|
-
...restProps
|
|
220
|
+
...rest
|
|
280
221
|
} = props;
|
|
281
222
|
|
|
282
223
|
const isWorklet = !!onValueChange && !!worklets?.isWorkletFunction?.(onValueChange);
|
|
283
224
|
const workletCallback = useWorkletProp(isWorklet ? onValueChange : undefined, 'onValueChange');
|
|
284
225
|
|
|
285
226
|
return {
|
|
227
|
+
...rest,
|
|
286
228
|
modifiers,
|
|
287
229
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
288
|
-
...restProps,
|
|
289
|
-
variant,
|
|
290
|
-
shape: parseJSXShape(shape),
|
|
291
230
|
children,
|
|
292
231
|
value: getStateId(value),
|
|
293
232
|
selection: getStateId(selection),
|
|
@@ -315,75 +254,4 @@ function useTransformedProps(
|
|
|
315
254
|
};
|
|
316
255
|
}
|
|
317
256
|
|
|
318
|
-
// endregion Native
|
|
319
|
-
|
|
320
|
-
// region Slot components
|
|
321
|
-
|
|
322
|
-
function Label(props: { children: React.ReactNode }) {
|
|
323
|
-
return <Slot slotName="label">{props.children}</Slot>;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
function Placeholder(props: { children: React.ReactNode }) {
|
|
327
|
-
return <Slot slotName="placeholder">{props.children}</Slot>;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function LeadingIcon(props: { children: React.ReactNode }) {
|
|
331
|
-
return <Slot slotName="leadingIcon">{props.children}</Slot>;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function TrailingIcon(props: { children: React.ReactNode }) {
|
|
335
|
-
return <Slot slotName="trailingIcon">{props.children}</Slot>;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
function Prefix(props: { children: React.ReactNode }) {
|
|
339
|
-
return <Slot slotName="prefix">{props.children}</Slot>;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function Suffix(props: { children: React.ReactNode }) {
|
|
343
|
-
return <Slot slotName="suffix">{props.children}</Slot>;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function SupportingText(props: { children: React.ReactNode }) {
|
|
347
|
-
return <Slot slotName="supportingText">{props.children}</Slot>;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// endregion Slot components
|
|
351
|
-
|
|
352
|
-
// region Components
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* A Material3 `TextField`.
|
|
356
|
-
*/
|
|
357
|
-
function TextFieldComponent(props: TextFieldProps) {
|
|
358
|
-
return <TextFieldNativeView {...useTransformedProps(props, 'filled')} />;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
TextFieldComponent.Label = Label;
|
|
362
|
-
TextFieldComponent.Placeholder = Placeholder;
|
|
363
|
-
TextFieldComponent.LeadingIcon = LeadingIcon;
|
|
364
|
-
TextFieldComponent.TrailingIcon = TrailingIcon;
|
|
365
|
-
TextFieldComponent.Prefix = Prefix;
|
|
366
|
-
TextFieldComponent.Suffix = Suffix;
|
|
367
|
-
TextFieldComponent.SupportingText = SupportingText;
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* A Material3 `OutlinedTextField` with a transparent background and border outline.
|
|
371
|
-
*/
|
|
372
|
-
function OutlinedTextFieldComponent(props: OutlinedTextFieldProps) {
|
|
373
|
-
return <TextFieldNativeView {...useTransformedProps(props, 'outlined')} />;
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
OutlinedTextFieldComponent.Label = Label;
|
|
377
|
-
OutlinedTextFieldComponent.Placeholder = Placeholder;
|
|
378
|
-
OutlinedTextFieldComponent.LeadingIcon = LeadingIcon;
|
|
379
|
-
OutlinedTextFieldComponent.TrailingIcon = TrailingIcon;
|
|
380
|
-
OutlinedTextFieldComponent.Prefix = Prefix;
|
|
381
|
-
OutlinedTextFieldComponent.Suffix = Suffix;
|
|
382
|
-
OutlinedTextFieldComponent.SupportingText = SupportingText;
|
|
383
|
-
|
|
384
|
-
// endregion Components
|
|
385
|
-
|
|
386
|
-
export { TextFieldComponent as TextField, OutlinedTextFieldComponent as OutlinedTextField };
|
|
387
|
-
|
|
388
|
-
// Exported for docs api data
|
|
389
|
-
export { type ObservableState };
|
|
257
|
+
// endregion Native transform
|
|
@@ -29,7 +29,11 @@ export * from './SyncSwitch';
|
|
|
29
29
|
export {
|
|
30
30
|
TextField,
|
|
31
31
|
OutlinedTextField,
|
|
32
|
+
BasicTextField,
|
|
32
33
|
type TextFieldProps,
|
|
34
|
+
type OutlinedTextFieldProps,
|
|
35
|
+
type BasicTextFieldProps,
|
|
36
|
+
type BasicTextFieldRef,
|
|
33
37
|
type TextFieldRef,
|
|
34
38
|
type TextFieldCapitalization,
|
|
35
39
|
type TextFieldImeAction,
|
|
@@ -37,10 +41,13 @@ export {
|
|
|
37
41
|
type TextFieldKeyboardType,
|
|
38
42
|
type TextFieldKeyboardActions,
|
|
39
43
|
type TextFieldColors,
|
|
44
|
+
type TextFieldTextStyle,
|
|
45
|
+
type CommonTextFieldProperties,
|
|
40
46
|
} from './TextField';
|
|
41
47
|
export * from './ToggleButton';
|
|
42
48
|
export * from './Shape';
|
|
43
49
|
export * from './ModalBottomSheet';
|
|
50
|
+
export * from './NavigationBar';
|
|
44
51
|
export * from './Carousel';
|
|
45
52
|
export {
|
|
46
53
|
HorizontalPager,
|
|
@@ -163,6 +163,42 @@ export const border = (borderWidth: number, borderColor: ColorValue) =>
|
|
|
163
163
|
*/
|
|
164
164
|
export const shadow = (elevation: number) => createModifier('shadow', { elevation });
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Options for the `dropShadow` and `innerShadow` modifiers.
|
|
168
|
+
*/
|
|
169
|
+
export type ShadowConfig = {
|
|
170
|
+
/** Blur radius of the shadow in dp. */
|
|
171
|
+
radius?: number;
|
|
172
|
+
/** Amount to expand (positive) or contract (negative) the shadow geometry in dp. */
|
|
173
|
+
spread?: number;
|
|
174
|
+
/** Shadow color string (hex). Defaults to black. */
|
|
175
|
+
color?: ColorValue;
|
|
176
|
+
/** Horizontal offset of the shadow in dp. */
|
|
177
|
+
offsetX?: number;
|
|
178
|
+
/** Vertical offset of the shadow in dp. */
|
|
179
|
+
offsetY?: number;
|
|
180
|
+
/** Shadow opacity, from 0.0 to 1.0. */
|
|
181
|
+
alpha?: number;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Draws a shadow behind the view with control over the blur radius, spread, offset, and color. Unlike
|
|
186
|
+
* `shadow`, it does not require an elevation value.
|
|
187
|
+
* @param shape - The shape of the shadow, for example `Shapes.RoundedCorner(16)` or `Shapes.Circle`.
|
|
188
|
+
* @param config - Options that control the shadow's appearance.
|
|
189
|
+
*/
|
|
190
|
+
export const dropShadow = (shape: BuiltinShape, config: ShadowConfig = {}) =>
|
|
191
|
+
createModifier('dropShadow', { shape, ...config });
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Draws a shadow inside the view to create an inset effect. The view's `background` must come before
|
|
195
|
+
* this modifier for the shadow to render.
|
|
196
|
+
* @param shape - The shape of the shadow, for example `Shapes.RoundedCorner(16)` or `Shapes.Circle`.
|
|
197
|
+
* @param config - Options that control the shadow's appearance.
|
|
198
|
+
*/
|
|
199
|
+
export const innerShadow = (shape: BuiltinShape, config: ShadowConfig = {}) =>
|
|
200
|
+
createModifier('innerShadow', { shape, ...config });
|
|
201
|
+
|
|
166
202
|
/**
|
|
167
203
|
* Sets the opacity/alpha of the view.
|
|
168
204
|
* @param alpha - Opacity value (0.0 to 1.0).
|
|
@@ -384,6 +420,19 @@ export const onSizeChanged = (handler: (size: { width: number; height: number })
|
|
|
384
420
|
handler(size)
|
|
385
421
|
);
|
|
386
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Calls the handler whenever the composable is positioned, with its position and size.
|
|
425
|
+
* `x` and `y` are relative to the window. All values are in dp.
|
|
426
|
+
* @param handler - Function called with the new layout.
|
|
427
|
+
*/
|
|
428
|
+
export const onGloballyPositioned = (
|
|
429
|
+
handler: (layout: { x: number; y: number; width: number; height: number }) => void
|
|
430
|
+
) =>
|
|
431
|
+
createModifierWithEventListener(
|
|
432
|
+
'onGloballyPositioned',
|
|
433
|
+
(layout: { x: number; y: number; width: number; height: number }) => handler(layout)
|
|
434
|
+
);
|
|
435
|
+
|
|
387
436
|
// =============================================================================
|
|
388
437
|
// Utility Modifiers
|
|
389
438
|
// =============================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { useState, type ComponentType } from 'react';
|
|
3
|
-
import type
|
|
3
|
+
import { type NativeSyntheticEvent } from 'react-native';
|
|
4
4
|
|
|
5
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
6
|
import { type CommonViewModifierProps } from '../types';
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
|
|
3
3
|
import { type ViewEvent } from '../../types';
|
|
4
|
+
import { Slot } from '../SlotView';
|
|
4
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
import { type CommonViewModifierProps } from '../types';
|
|
6
7
|
|
|
7
8
|
export interface DisclosureGroupProps extends CommonViewModifierProps {
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Text label for the disclosure group. Use `DisclosureGroup.Label` for custom label content.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
9
13
|
children: React.ReactNode;
|
|
10
14
|
/**
|
|
11
15
|
* Controls whether the disclosure group is expanded.
|
|
@@ -25,7 +29,11 @@ type NativeDisclosureGroupProps = Omit<DisclosureGroupProps, 'onIsExpandedChange
|
|
|
25
29
|
const DisclosureGroupNativeView: React.ComponentType<NativeDisclosureGroupProps> =
|
|
26
30
|
requireNativeView('ExpoUI', 'DisclosureGroupView');
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
function Label({ children }: { children: React.ReactNode }) {
|
|
33
|
+
return <Slot name="label">{children}</Slot>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function DisclosureGroupComponent(props: DisclosureGroupProps) {
|
|
29
37
|
const { onIsExpandedChange, modifiers, ...rest } = props;
|
|
30
38
|
|
|
31
39
|
function handleStateChange(event: { nativeEvent: { isExpanded: boolean } }) {
|
|
@@ -40,3 +48,7 @@ export function DisclosureGroup(props: DisclosureGroupProps) {
|
|
|
40
48
|
|
|
41
49
|
return <DisclosureGroupNativeView {...transformedProps} onIsExpandedChange={handleStateChange} />;
|
|
42
50
|
}
|
|
51
|
+
|
|
52
|
+
DisclosureGroupComponent.Label = Label;
|
|
53
|
+
|
|
54
|
+
export { DisclosureGroupComponent as DisclosureGroup };
|
|
@@ -3,6 +3,7 @@ import type { ColorValue } from 'react-native';
|
|
|
3
3
|
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
4
4
|
|
|
5
5
|
import type { ViewEvent } from '../../types';
|
|
6
|
+
import { font, foregroundStyle } from '../modifiers';
|
|
6
7
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
8
|
import type { CommonViewModifierProps } from '../types';
|
|
8
9
|
|
|
@@ -12,6 +13,10 @@ export interface ImageProps extends CommonViewModifierProps {
|
|
|
12
13
|
* For example: 'photo', 'heart.fill', 'star.circle'
|
|
13
14
|
*/
|
|
14
15
|
systemName?: SFSymbol;
|
|
16
|
+
/**
|
|
17
|
+
* The asset catalog name of a custom SF Symbol imported as a symbol set.
|
|
18
|
+
*/
|
|
19
|
+
assetName?: string;
|
|
15
20
|
/**
|
|
16
21
|
* The URI of the local image file to display.
|
|
17
22
|
* For example: 'file:///path/to/image.jpg'
|
|
@@ -19,7 +24,9 @@ export interface ImageProps extends CommonViewModifierProps {
|
|
|
19
24
|
*/
|
|
20
25
|
uiImage?: string;
|
|
21
26
|
/**
|
|
22
|
-
* The size of the system image.
|
|
27
|
+
* The fixed size of the system image in points. Does not scale with Dynamic
|
|
28
|
+
* Type. Use the `font` modifier with `textStyle` for that. Ignored when a
|
|
29
|
+
* `font` modifier is supplied.
|
|
23
30
|
*/
|
|
24
31
|
size?: number;
|
|
25
32
|
/**
|
|
@@ -49,9 +56,15 @@ type TapEvent = ViewEvent<'onTap', object> & {
|
|
|
49
56
|
type NativeImageProps = Omit<ImageProps, 'onPress'> | TapEvent;
|
|
50
57
|
|
|
51
58
|
function transformNativeProps(props: ImageProps): NativeImageProps {
|
|
52
|
-
const { onPress, modifiers, ...restProps } = props;
|
|
59
|
+
const { onPress, modifiers, size, color, ...restProps } = props;
|
|
60
|
+
const hasFontModifier = modifiers?.some((modifier) => modifier.$type === 'font');
|
|
61
|
+
const allModifiers = [
|
|
62
|
+
...(modifiers ?? []),
|
|
63
|
+
...(hasFontModifier ? [] : [font({ size: size ?? 24 })]),
|
|
64
|
+
...(color != null ? [foregroundStyle(color)] : []),
|
|
65
|
+
];
|
|
53
66
|
return {
|
|
54
|
-
modifiers,
|
|
67
|
+
modifiers: allModifiers,
|
|
55
68
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
56
69
|
...restProps,
|
|
57
70
|
...(onPress ? { useTapGesture: true, onTap: () => onPress() } : null),
|
|
@@ -23,6 +23,12 @@ export type LabelProps = {
|
|
|
23
23
|
*/
|
|
24
24
|
icon?: React.ReactNode;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Custom title view. Accepts any React node (for example, a `VStack` with title and subtitle).
|
|
28
|
+
* When provided, this takes precedence over `title`.
|
|
29
|
+
*/
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* The color of the label icon.
|
|
28
34
|
* @deprecated Use `foregroundStyle` modifier instead.
|
|
@@ -40,12 +46,13 @@ const LabelNativeView: React.ComponentType<LabelProps & { children?: React.React
|
|
|
40
46
|
* @returns {JSX.Element} The rendered native Label component.
|
|
41
47
|
*/
|
|
42
48
|
export function Label(props: LabelProps) {
|
|
43
|
-
const { modifiers, icon, ...restProps } = props;
|
|
49
|
+
const { modifiers, icon, children, ...restProps } = props;
|
|
44
50
|
return (
|
|
45
51
|
<LabelNativeView
|
|
46
52
|
modifiers={modifiers}
|
|
47
53
|
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
48
54
|
{...restProps}>
|
|
55
|
+
{children && <Slot name="title">{children}</Slot>}
|
|
49
56
|
{icon && <Slot name="icon">{icon}</Slot>}
|
|
50
57
|
</LabelNativeView>
|
|
51
58
|
);
|