@expo/ui 55.0.4 → 55.0.6
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 +22 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AlertDialogView.kt +56 -28
- package/android/src/main/java/expo/modules/ui/BasicAlertDialogView.kt +9 -1
- package/android/src/main/java/expo/modules/ui/CarouselView.kt +93 -67
- package/android/src/main/java/expo/modules/ui/DividerView.kt +21 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +25 -17
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +6 -0
- package/android/src/main/java/expo/modules/ui/PullToRefreshBoxView.kt +20 -3
- package/android/src/main/java/expo/modules/ui/SlotView.kt +8 -0
- package/android/src/main/java/expo/modules/ui/SurfaceView.kt +88 -11
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +15 -3
- package/android/src/main/java/expo/modules/ui/TextView.kt +145 -12
- package/build/jetpack-compose/AlertDialog/index.d.ts +72 -36
- package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts +7 -2
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts.map +1 -1
- package/build/jetpack-compose/Carousel/index.d.ts +86 -23
- package/build/jetpack-compose/Carousel/index.d.ts.map +1 -1
- package/build/jetpack-compose/Divider/index.d.ts +20 -5
- package/build/jetpack-compose/Divider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Progress/index.d.ts +6 -7
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts +34 -9
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts.map +1 -1
- package/build/jetpack-compose/Surface/index.d.ts +52 -2
- package/build/jetpack-compose/Surface/index.d.ts.map +1 -1
- package/build/jetpack-compose/Text/index.d.ts +77 -89
- package/build/jetpack-compose/Text/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextInput/index.d.ts +18 -3
- package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +2 -2
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +5 -0
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +1 -1
- package/build/types.d.ts +26 -0
- package/build/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.4/expo.modules.ui-55.0.4-sources.jar → 55.0.6/expo.modules.ui-55.0.6-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.4/expo.modules.ui-55.0.4.module → 55.0.6/expo.modules.ui-55.0.6.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.4/expo.modules.ui-55.0.4.pom → 55.0.6/expo.modules.ui-55.0.6.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.6/expo.modules.ui-55.0.6.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/AlertDialog/index.tsx +94 -41
- package/src/jetpack-compose/BasicAlertDialog/index.tsx +9 -2
- package/src/jetpack-compose/Card/index.tsx +4 -2
- package/src/jetpack-compose/Carousel/index.tsx +118 -30
- package/src/jetpack-compose/Divider/index.tsx +34 -14
- package/src/jetpack-compose/Progress/index.tsx +11 -9
- package/src/jetpack-compose/PullToRefreshBox/index.tsx +35 -18
- package/src/jetpack-compose/Surface/index.tsx +75 -4
- package/src/jetpack-compose/Text/index.tsx +171 -101
- package/src/jetpack-compose/TextInput/index.tsx +38 -8
- package/src/jetpack-compose/index.ts +2 -2
- package/src/jetpack-compose/modifiers/index.ts +10 -0
- package/src/swift-ui/modifiers/index.ts +1 -1
- package/src/types.ts +27 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha512 +0 -1
- 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 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha512 +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
|
+
import * as React from 'react';
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import { type ModifierConfig } from '../../types';
|
|
4
5
|
import { getTextFromChildren } from '../../utils';
|
|
5
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
7
|
|
|
@@ -37,9 +38,56 @@ export type TextDecoration = 'none' | 'underline' | 'lineThrough';
|
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* Text overflow behavior options.
|
|
41
|
+
* - 'clip': Clips the overflowing text to fit its container
|
|
42
|
+
* - 'ellipsis': Uses an ellipsis to indicate that the text has overflowed
|
|
43
|
+
* - 'visible': Renders overflow text outside its container
|
|
40
44
|
*/
|
|
41
45
|
export type TextOverflow = 'clip' | 'ellipsis' | 'visible';
|
|
42
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Line break strategy options.
|
|
49
|
+
* - 'simple': Basic line breaking.
|
|
50
|
+
* - 'heading': Optimized for short text like headings.
|
|
51
|
+
* - 'paragraph': Produces more balanced line lengths for body text.
|
|
52
|
+
*/
|
|
53
|
+
export type TextLineBreak = 'simple' | 'heading' | 'paragraph';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Font family for text styling.
|
|
57
|
+
* Built-in system families: 'default', 'sansSerif', 'serif', 'monospace', 'cursive'.
|
|
58
|
+
* Custom font families loaded via expo-font can be referenced by name (for example, 'Inter-Bold').
|
|
59
|
+
*/
|
|
60
|
+
export type TextFontFamily =
|
|
61
|
+
| 'default'
|
|
62
|
+
| 'sansSerif'
|
|
63
|
+
| 'serif'
|
|
64
|
+
| 'monospace'
|
|
65
|
+
| 'cursive'
|
|
66
|
+
| (string & {});
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Text shadow configuration.
|
|
70
|
+
* Corresponds to Jetpack Compose's Shadow class.
|
|
71
|
+
*/
|
|
72
|
+
export type TextShadow = {
|
|
73
|
+
/**
|
|
74
|
+
* The color of the shadow.
|
|
75
|
+
*/
|
|
76
|
+
color?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The horizontal offset of the shadow in dp.
|
|
79
|
+
*/
|
|
80
|
+
offsetX?: number;
|
|
81
|
+
/**
|
|
82
|
+
* The vertical offset of the shadow in dp.
|
|
83
|
+
*/
|
|
84
|
+
offsetY?: number;
|
|
85
|
+
/**
|
|
86
|
+
* The blur radius of the shadow in dp.
|
|
87
|
+
*/
|
|
88
|
+
blurRadius?: number;
|
|
89
|
+
};
|
|
90
|
+
|
|
43
91
|
/**
|
|
44
92
|
* Material 3 Typography scale styles.
|
|
45
93
|
* Corresponds to MaterialTheme.typography in Jetpack Compose.
|
|
@@ -62,23 +110,10 @@ export type TypographyStyle =
|
|
|
62
110
|
| 'labelSmall';
|
|
63
111
|
|
|
64
112
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
113
|
+
* Shared span-level style properties used by both `TextStyle` and `TextSpanRecord`.
|
|
114
|
+
* Adding a property here ensures it's available on both parent text and nested spans.
|
|
67
115
|
*/
|
|
68
|
-
export type
|
|
69
|
-
/**
|
|
70
|
-
* Material 3 Typography style to use as the base style.
|
|
71
|
-
* When specified, applies the predefined Material 3 typography style.
|
|
72
|
-
* Other properties in this style object will override specific values from the typography.
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```tsx
|
|
76
|
-
* style={{ typography: "bodyLarge" }}
|
|
77
|
-
* style={{ typography: "headlineMedium", fontWeight: "bold" }}
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
typography?: TypographyStyle;
|
|
81
|
-
|
|
116
|
+
export type TextSpanStyleBase = {
|
|
82
117
|
/**
|
|
83
118
|
* The font size in sp (scale-independent pixels).
|
|
84
119
|
*/
|
|
@@ -95,9 +130,9 @@ export type TextStyle = {
|
|
|
95
130
|
fontStyle?: TextFontStyle;
|
|
96
131
|
|
|
97
132
|
/**
|
|
98
|
-
* The
|
|
133
|
+
* The font family.
|
|
99
134
|
*/
|
|
100
|
-
|
|
135
|
+
fontFamily?: TextFontFamily;
|
|
101
136
|
|
|
102
137
|
/**
|
|
103
138
|
* The text decoration.
|
|
@@ -109,15 +144,60 @@ export type TextStyle = {
|
|
|
109
144
|
*/
|
|
110
145
|
letterSpacing?: number;
|
|
111
146
|
|
|
147
|
+
/**
|
|
148
|
+
* The background color behind the text.
|
|
149
|
+
*/
|
|
150
|
+
background?: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The shadow applied to the text.
|
|
154
|
+
*/
|
|
155
|
+
shadow?: TextShadow;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Text style properties that can be applied to text.
|
|
160
|
+
* Corresponds to Jetpack Compose's `TextStyle`.
|
|
161
|
+
*/
|
|
162
|
+
export type TextStyle = TextSpanStyleBase & {
|
|
163
|
+
/**
|
|
164
|
+
* Material 3 Typography style to use as the base style.
|
|
165
|
+
* When specified, applies the predefined Material 3 typography style.
|
|
166
|
+
* Other properties in this style object will override specific values from the typography.
|
|
167
|
+
*/
|
|
168
|
+
typography?: TypographyStyle;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The text alignment.
|
|
172
|
+
*/
|
|
173
|
+
textAlign?: TextAlign;
|
|
174
|
+
|
|
112
175
|
/**
|
|
113
176
|
* The line height in sp.
|
|
114
177
|
*/
|
|
115
178
|
lineHeight?: number;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The line break strategy.
|
|
182
|
+
*/
|
|
183
|
+
lineBreak?: TextLineBreak;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* A record representing a styled text span, sent to the native side.
|
|
188
|
+
* Can be a leaf (has `text`) or a branch (has `children`).
|
|
189
|
+
* Style inheritance is handled natively via nested `withStyle` on the Kotlin side.
|
|
190
|
+
*/
|
|
191
|
+
type TextSpanRecord = TextSpanStyleBase & {
|
|
192
|
+
text?: string;
|
|
193
|
+
color?: string;
|
|
194
|
+
children?: TextSpanRecord[];
|
|
116
195
|
};
|
|
117
196
|
|
|
118
197
|
export type TextProps = {
|
|
119
198
|
/**
|
|
120
|
-
* The text content to display.
|
|
199
|
+
* The text content to display. Can be a string, number, or nested `Text` components
|
|
200
|
+
* for inline styled spans.
|
|
121
201
|
*/
|
|
122
202
|
children?: React.ReactNode;
|
|
123
203
|
|
|
@@ -128,9 +208,6 @@ export type TextProps = {
|
|
|
128
208
|
|
|
129
209
|
/**
|
|
130
210
|
* How visual overflow should be handled.
|
|
131
|
-
* - 'clip': Clips the overflowing text to fix its container
|
|
132
|
-
* - 'ellipsis': Uses an ellipsis to indicate that the text has overflowed
|
|
133
|
-
* - 'visible': Renders overflow text outside its container
|
|
134
211
|
*/
|
|
135
212
|
overflow?: TextOverflow;
|
|
136
213
|
|
|
@@ -160,114 +237,107 @@ export type TextProps = {
|
|
|
160
237
|
/**
|
|
161
238
|
* Modifiers for the component.
|
|
162
239
|
*/
|
|
163
|
-
modifiers?:
|
|
240
|
+
modifiers?: ModifierConfig[];
|
|
164
241
|
};
|
|
165
242
|
|
|
166
|
-
type NativeTextProps = Omit<TextProps, 'children' | 'style'> &
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
lineHeight?: number;
|
|
176
|
-
};
|
|
243
|
+
type NativeTextProps = Omit<TextProps, 'children' | 'style'> &
|
|
244
|
+
TextSpanStyleBase & {
|
|
245
|
+
text?: string;
|
|
246
|
+
spans?: TextSpanRecord[];
|
|
247
|
+
typography?: TypographyStyle;
|
|
248
|
+
textAlign?: TextAlign;
|
|
249
|
+
lineHeight?: number;
|
|
250
|
+
lineBreak?: TextLineBreak;
|
|
251
|
+
};
|
|
177
252
|
|
|
178
253
|
const TextNativeView: React.ComponentType<NativeTextProps> = requireNativeView(
|
|
179
254
|
'ExpoUI',
|
|
180
255
|
'TextView'
|
|
181
256
|
);
|
|
182
257
|
|
|
258
|
+
// Constructs tree of spans from nested Text components
|
|
259
|
+
function collectSpans(children: React.ReactNode): TextSpanRecord[] | null {
|
|
260
|
+
if (children === undefined || children === null) return null;
|
|
261
|
+
|
|
262
|
+
const childArray = React.Children.toArray(children);
|
|
263
|
+
if (childArray.length === 0) return null;
|
|
264
|
+
|
|
265
|
+
const hasNestedText = childArray.some(
|
|
266
|
+
(child) => React.isValidElement(child) && child.type === Text
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
if (!hasNestedText) return null;
|
|
270
|
+
|
|
271
|
+
const spans: TextSpanRecord[] = [];
|
|
272
|
+
|
|
273
|
+
for (const child of childArray) {
|
|
274
|
+
if (typeof child === 'string') {
|
|
275
|
+
spans.push({ text: child });
|
|
276
|
+
} else if (typeof child === 'number') {
|
|
277
|
+
spans.push({ text: String(child) });
|
|
278
|
+
} else if (React.isValidElement(child) && child.type === Text) {
|
|
279
|
+
const childProps = child.props as TextProps;
|
|
280
|
+
const span: TextSpanRecord = {
|
|
281
|
+
color: childProps.color,
|
|
282
|
+
fontSize: childProps.style?.fontSize,
|
|
283
|
+
fontWeight: childProps.style?.fontWeight,
|
|
284
|
+
fontStyle: childProps.style?.fontStyle,
|
|
285
|
+
fontFamily: childProps.style?.fontFamily,
|
|
286
|
+
textDecoration: childProps.style?.textDecoration,
|
|
287
|
+
letterSpacing: childProps.style?.letterSpacing,
|
|
288
|
+
background: childProps.style?.background,
|
|
289
|
+
shadow: childProps.style?.shadow,
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const nestedSpans = collectSpans(childProps.children);
|
|
293
|
+
if (nestedSpans) {
|
|
294
|
+
span.children = nestedSpans;
|
|
295
|
+
} else {
|
|
296
|
+
span.text = getTextFromChildren(childProps.children) ?? '';
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
spans.push(span);
|
|
300
|
+
} else if (__DEV__ && React.isValidElement(child)) {
|
|
301
|
+
console.warn(
|
|
302
|
+
'Text: Unsupported child element of type "%s" inside <Text>. Only <Text>, string, and number children are supported.',
|
|
303
|
+
typeof child.type === 'function' ? child.type.name || 'Unknown' : child.type
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return spans.length > 0 ? spans : null;
|
|
309
|
+
}
|
|
310
|
+
|
|
183
311
|
function transformTextProps(props: TextProps): NativeTextProps {
|
|
184
312
|
const { children, modifiers, style, ...restProps } = props;
|
|
185
313
|
|
|
314
|
+
const spans = collectSpans(children);
|
|
315
|
+
|
|
186
316
|
return {
|
|
187
317
|
modifiers,
|
|
188
318
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
189
319
|
...restProps,
|
|
190
|
-
|
|
320
|
+
// When spans are present, use them instead of flat text
|
|
321
|
+
...(spans ? { spans } : { text: getTextFromChildren(children) ?? '' }),
|
|
191
322
|
// Extract typography from style (used as base style)
|
|
192
323
|
typography: style?.typography,
|
|
193
324
|
// Flatten other style properties (these override the typography style)
|
|
194
325
|
fontSize: style?.fontSize,
|
|
195
326
|
fontWeight: style?.fontWeight,
|
|
196
327
|
fontStyle: style?.fontStyle,
|
|
328
|
+
fontFamily: style?.fontFamily,
|
|
197
329
|
textAlign: style?.textAlign,
|
|
198
330
|
textDecoration: style?.textDecoration,
|
|
199
331
|
letterSpacing: style?.letterSpacing,
|
|
200
332
|
lineHeight: style?.lineHeight,
|
|
333
|
+
lineBreak: style?.lineBreak,
|
|
334
|
+
background: style?.background,
|
|
335
|
+
shadow: style?.shadow,
|
|
201
336
|
};
|
|
202
337
|
}
|
|
203
338
|
|
|
204
339
|
/**
|
|
205
340
|
* Renders a Text component using Jetpack Compose.
|
|
206
|
-
*
|
|
207
|
-
* The Text component provides comprehensive text styling capabilities.
|
|
208
|
-
* The API is aligned with Jetpack Compose's Text composable, where:
|
|
209
|
-
* - Top-level props (color, maxLines, etc.) match Compose's Text parameters
|
|
210
|
-
* - `style` object corresponds to TextStyle, including typography, fontSize, fontWeight, textAlign, etc.
|
|
211
|
-
* - `style.typography` applies Material 3 typography styles (like MaterialTheme.typography)
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* Basic usage:
|
|
215
|
-
* ```tsx
|
|
216
|
-
* import { Text } from 'expo-ui';
|
|
217
|
-
*
|
|
218
|
-
* <Text>Hello World</Text>
|
|
219
|
-
* ```
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* Using Material 3 Typography (matches Jetpack Compose MaterialTheme.typography):
|
|
223
|
-
* ```tsx
|
|
224
|
-
* <Text style={{ typography: "bodyLarge" }}>Body text</Text>
|
|
225
|
-
* <Text style={{ typography: "headlineMedium" }}>Headline</Text>
|
|
226
|
-
* <Text style={{ typography: "titleSmall" }}>Small title</Text>
|
|
227
|
-
* ```
|
|
228
|
-
*
|
|
229
|
-
* @example
|
|
230
|
-
* Typography with style overrides:
|
|
231
|
-
* ```tsx
|
|
232
|
-
* <Text
|
|
233
|
-
* color="#007AFF"
|
|
234
|
-
* style={{
|
|
235
|
-
* typography: "bodyLarge",
|
|
236
|
-
* fontWeight: "bold" // Override the typography's font weight
|
|
237
|
-
* }}
|
|
238
|
-
* >
|
|
239
|
-
* Custom styled body text
|
|
240
|
-
* </Text>
|
|
241
|
-
* ```
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* With custom style object (matches Jetpack Compose TextStyle):
|
|
245
|
-
* ```tsx
|
|
246
|
-
* <Text
|
|
247
|
-
* color="#007AFF"
|
|
248
|
-
* style={{
|
|
249
|
-
* fontSize: 18,
|
|
250
|
-
* fontWeight: "bold",
|
|
251
|
-
* textAlign: "center",
|
|
252
|
-
* letterSpacing: 1.2
|
|
253
|
-
* }}
|
|
254
|
-
* modifiers={[ExpoUI.padding(16)]}
|
|
255
|
-
* >
|
|
256
|
-
* Styled text
|
|
257
|
-
* </Text>
|
|
258
|
-
* ```
|
|
259
|
-
*
|
|
260
|
-
* @example
|
|
261
|
-
* Text truncation with ellipsis:
|
|
262
|
-
* ```tsx
|
|
263
|
-
* <Text
|
|
264
|
-
* maxLines={2}
|
|
265
|
-
* overflow="ellipsis"
|
|
266
|
-
* >
|
|
267
|
-
* This is a very long text that will be truncated after two lines
|
|
268
|
-
* with an ellipsis at the end to indicate there's more content...
|
|
269
|
-
* </Text>
|
|
270
|
-
* ```
|
|
271
341
|
*/
|
|
272
342
|
export function Text(props: TextProps) {
|
|
273
343
|
return <TextNativeView {...transformTextProps(props)} />;
|
|
@@ -4,6 +4,16 @@ import { Ref } from 'react';
|
|
|
4
4
|
import { ExpoModifier, ViewEvent } from '../../types';
|
|
5
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
6
|
|
|
7
|
+
type SlotNativeViewProps = {
|
|
8
|
+
slotName: string;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const SlotNativeView: React.ComponentType<SlotNativeViewProps> = requireNativeView(
|
|
13
|
+
'ExpoUI',
|
|
14
|
+
'SlotView'
|
|
15
|
+
);
|
|
16
|
+
|
|
7
17
|
/**
|
|
8
18
|
* @hidden Not used anywhere yet.
|
|
9
19
|
*/
|
|
@@ -89,17 +99,22 @@ export type TextInputProps = {
|
|
|
89
99
|
* @platform android
|
|
90
100
|
*/
|
|
91
101
|
autoCapitalize?: 'characters' | 'none' | 'sentences' | 'unspecified' | 'words';
|
|
92
|
-
|
|
93
102
|
/**
|
|
94
|
-
*
|
|
103
|
+
* Placeholder text shown inside the field when empty and focused.
|
|
104
|
+
*
|
|
95
105
|
*/
|
|
106
|
+
placeholder?: string;
|
|
107
|
+
/** Modifiers for the component */
|
|
96
108
|
modifiers?: ExpoModifier[];
|
|
109
|
+
/**
|
|
110
|
+
* Slot children (e.g. `TextInput.Label`).
|
|
111
|
+
*/
|
|
112
|
+
children?: React.ReactNode;
|
|
97
113
|
};
|
|
98
114
|
|
|
99
|
-
export type NativeTextInputProps = Omit<TextInputProps, 'onChangeText'> & {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
>;
|
|
115
|
+
export type NativeTextInputProps = Omit<TextInputProps, 'onChangeText' | 'children'> & {
|
|
116
|
+
children?: React.ReactNode;
|
|
117
|
+
} & ViewEvent<'onValueChanged', { value: string }>;
|
|
103
118
|
|
|
104
119
|
// We have to work around the `role` and `onPress` props being reserved by React Native.
|
|
105
120
|
const TextInputNativeView: React.ComponentType<NativeTextInputProps> = requireNativeView(
|
|
@@ -108,20 +123,35 @@ const TextInputNativeView: React.ComponentType<NativeTextInputProps> = requireNa
|
|
|
108
123
|
);
|
|
109
124
|
|
|
110
125
|
function transformTextInputProps(props: TextInputProps): NativeTextInputProps {
|
|
111
|
-
const { modifiers, ...restProps } = props;
|
|
126
|
+
const { modifiers, children, ...restProps } = props;
|
|
112
127
|
return {
|
|
113
128
|
modifiers,
|
|
114
129
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
115
130
|
...restProps,
|
|
131
|
+
children,
|
|
116
132
|
onValueChanged: (event) => {
|
|
117
133
|
props.onChangeText?.(event.nativeEvent.value);
|
|
118
134
|
},
|
|
119
135
|
};
|
|
120
136
|
}
|
|
121
137
|
|
|
138
|
+
/**
|
|
139
|
+
* A label slot for `TextInput`.
|
|
140
|
+
* The label floats above the text field when focused or filled.
|
|
141
|
+
*
|
|
142
|
+
* @platform android
|
|
143
|
+
*/
|
|
144
|
+
function Label(props: { children: React.ReactNode }) {
|
|
145
|
+
return <SlotNativeView slotName="label">{props.children}</SlotNativeView>;
|
|
146
|
+
}
|
|
147
|
+
|
|
122
148
|
/**
|
|
123
149
|
* Renders a `TextInput` component.
|
|
124
150
|
*/
|
|
125
|
-
|
|
151
|
+
function TextInputComponent(props: TextInputProps) {
|
|
126
152
|
return <TextInputNativeView {...transformTextInputProps(props)} />;
|
|
127
153
|
}
|
|
154
|
+
|
|
155
|
+
TextInputComponent.Label = Label;
|
|
156
|
+
|
|
157
|
+
export { TextInputComponent as TextInput };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './MaterialSymbolsAssetsTransformer.fx';
|
|
2
2
|
|
|
3
3
|
export * from './AlertDialog';
|
|
4
|
-
export
|
|
4
|
+
export { BasicAlertDialog, type BasicAlertDialogProps } from './BasicAlertDialog';
|
|
5
5
|
export * from './Card';
|
|
6
6
|
export * from './Checkbox';
|
|
7
7
|
export * from './Chip';
|
|
@@ -32,7 +32,7 @@ export * from './FloatingActionButton';
|
|
|
32
32
|
export * from './PullToRefreshBox';
|
|
33
33
|
export * from './RadioButton';
|
|
34
34
|
export * from './Surface';
|
|
35
|
-
export
|
|
35
|
+
export { type TextProps, Text } from './Text';
|
|
36
36
|
|
|
37
37
|
export * from './AnimatedVisibility';
|
|
38
38
|
export * from './Box';
|
|
@@ -104,6 +104,16 @@ export const wrapContentWidth = (alignment?: 'start' | 'centerHorizontally' | 'e
|
|
|
104
104
|
export const wrapContentHeight = (alignment?: 'top' | 'centerVertically' | 'bottom') =>
|
|
105
105
|
createModifier('wrapContentHeight', alignment ? { alignment } : {});
|
|
106
106
|
|
|
107
|
+
// =============================================================================
|
|
108
|
+
// Inset Modifiers
|
|
109
|
+
// =============================================================================
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Adds padding to avoid the software keyboard (IME).
|
|
113
|
+
* When the keyboard is visible, padding is added to keep content above it.
|
|
114
|
+
*/
|
|
115
|
+
export const imePadding = () => createModifier('imePadding');
|
|
116
|
+
|
|
107
117
|
// =============================================================================
|
|
108
118
|
// Position Modifiers
|
|
109
119
|
// =============================================================================
|
|
@@ -495,7 +495,7 @@ export const grayscale = (amount: number) => createModifier('grayscale', { amoun
|
|
|
495
495
|
|
|
496
496
|
/**
|
|
497
497
|
* Sets the button style for button views.
|
|
498
|
-
* @param style - The button style.
|
|
498
|
+
* @param style - The button style. `'glass'` and `'glassProminent'` are available on iOS 26+ and tvOS 26+ only.
|
|
499
499
|
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/buttonstyle(_:)).
|
|
500
500
|
*/
|
|
501
501
|
export const buttonStyle = (
|
package/src/types.ts
CHANGED
|
@@ -23,3 +23,30 @@ export interface ModifierConfig {
|
|
|
23
23
|
* with JSON Config pattern for better DX and platform consistency.
|
|
24
24
|
*/
|
|
25
25
|
export type ExpoModifier = ModifierConfig;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Properties for the dialog window, matching `DialogProperties` in Compose.
|
|
29
|
+
*/
|
|
30
|
+
export type DialogProperties = {
|
|
31
|
+
/**
|
|
32
|
+
* Whether the dialog can be dismissed by pressing the back button.
|
|
33
|
+
* @default true
|
|
34
|
+
*/
|
|
35
|
+
dismissOnBackPress?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the dialog can be dismissed by clicking outside of it.
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
dismissOnClickOutside?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the dialog should use the platform default width.
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
usePlatformDefaultWidth?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether the dialog's decor fits system windows (status bar, navigation bar, and more).
|
|
48
|
+
* When `true`, the dialog's content will be inset to avoid overlapping with system UI.
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
decorFitsSystemWindows?: boolean;
|
|
52
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
137fa3f768ea1d63be1de27d7d663a43
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d37f422ef8d7251d743ce6bbee5e16230ee6d654
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2798646e8f071faefc4a8c8678182ac8aa59fb458469aa6cc088658f4337ada2
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3d3bc9ee569cd399519716c66d92850b7bdde1ec0b0c328b938044699727988e55dbafec203f8f1b4613dd361bcfec03a21c084e031d73d95c45b982bd8ccd76
|
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
10502ee86098bcfdce95a529c46261bb
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
734807c9b8517ef0239b2f71af20b03bef6fa322
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
7ebaf9bde2723bcb47dd8a3cf5ffbdcf0f81b2d00b9db2926469cb968da468bf
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
5ef7ef206deaa6dfef5a2e05e537a30f0403374ac99fdaa68f1c9e93971f6b61fde7ca393032684eb926a3f9ab5f54f706eb6dd8c3908c26f4cb40408401a2f0
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
8e56924bfbdfce193f64db998c3a9eed
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
b832195b632ff8761b0a6c59d4a12c0bbfb38f69
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3cde2316fb065490b2bf67953e88eb1c0490df22f69928632b795e760e13a9eb
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1cd6df7a2b2207a6167ddd1f4f34c37745a18fb16c125d58848cf3146fd8a11f43ccdc15f4c1a352a0d55efb1d2df382df19b30051197081b90a52077cb4a6e9
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
d5d19d69bd1c2c6b960efb092f40bbe1
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
31874fcef8f1e3fef61c13fe7d64a32ac62819ce
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
16bf7ce47844a5483c85b20fad391cfc6c74912b344eddb1e95f70395d9e1c68
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha512
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
f415dd7401f64dcab069526d91ecb1a42d76946ccf955930887bb74c84ac0cc3a7be6c13185cd34105466d1378532f738620c23cf6caa83444088a36d98acdb9
|