@expo/ui 55.0.0-preview.6 → 55.0.0
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 +20 -0
- package/android/build.gradle +27 -8
- package/android/src/main/java/expo/modules/ui/BasicAlertDialogView.kt +26 -0
- package/android/src/main/java/expo/modules/ui/BottomSheetView.kt +12 -37
- package/android/src/main/java/expo/modules/ui/CardView.kt +72 -0
- package/android/src/main/java/expo/modules/ui/CarouselView.kt +2 -5
- package/android/src/main/java/expo/modules/ui/ComposeViews.kt +91 -130
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +2 -2
- package/android/src/main/java/expo/modules/ui/DividerView.kt +1 -1
- package/android/src/main/java/expo/modules/ui/DockedSearchBarView.kt +53 -0
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +136 -17
- package/android/src/main/java/expo/modules/ui/FilterChipView.kt +59 -0
- package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +63 -0
- package/android/src/main/java/expo/modules/ui/LazyColumnView.kt +95 -0
- package/android/src/main/java/expo/modules/ui/ListItemView.kt +89 -0
- package/android/src/main/java/expo/modules/ui/MaterialShapes.kt +77 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +168 -30
- package/android/src/main/java/expo/modules/ui/PickerView.kt +2 -2
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +1 -1
- package/android/src/main/java/expo/modules/ui/PullToRefreshBoxView.kt +40 -0
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +87 -0
- package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +28 -0
- package/android/src/main/java/expo/modules/ui/SearchBarView.kt +60 -0
- package/android/src/main/java/expo/modules/ui/ShapeView.kt +36 -5
- package/android/src/main/java/expo/modules/ui/SliderView.kt +1 -1
- package/android/src/main/java/expo/modules/ui/SlotView.kt +53 -0
- package/android/src/main/java/expo/modules/ui/SpacerView.kt +15 -0
- package/android/src/main/java/expo/modules/ui/SurfaceView.kt +36 -0
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +24 -4
- package/android/src/main/java/expo/modules/ui/TextButtonView.kt +33 -0
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +1 -2
- package/android/src/main/java/expo/modules/ui/TextView.kt +194 -0
- package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +96 -0
- package/android/src/main/java/expo/modules/ui/Utils.kt +6 -0
- package/android/src/main/java/expo/modules/ui/button/Button.kt +1 -1
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +2 -6
- package/android/src/main/java/expo/modules/ui/convertibles/Alignment.kt +112 -0
- package/android/src/main/java/expo/modules/ui/convertibles/Arrangement.kt +72 -0
- package/android/src/main/java/expo/modules/ui/icon/IconView.kt +159 -0
- package/android/src/main/java/expo/modules/ui/icon/ResourceIdHelper.kt +47 -0
- package/android/src/main/java/expo/modules/ui/icon/VectorIconLoader.kt +369 -0
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +1 -1
- package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts +22 -0
- package/build/jetpack-compose/BasicAlertDialog/index.d.ts.map +1 -0
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts +40 -0
- package/build/jetpack-compose/Card/index.d.ts.map +1 -0
- package/build/jetpack-compose/Carousel/index.d.ts.map +1 -1
- package/build/jetpack-compose/Chip/index.d.ts +0 -4
- package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +1 -12
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/Divider/index.d.ts.map +1 -1
- package/build/jetpack-compose/DockedSearchBar/index.d.ts +30 -0
- package/build/jetpack-compose/DockedSearchBar/index.d.ts.map +1 -0
- package/build/jetpack-compose/ExpoUIModule.d.ts +2 -0
- package/build/jetpack-compose/ExpoUIModule.d.ts.map +1 -0
- package/build/jetpack-compose/FilterChip/index.d.ts +49 -0
- package/build/jetpack-compose/FilterChip/index.d.ts.map +1 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +41 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -0
- package/build/jetpack-compose/Icon/index.d.ts +112 -0
- package/build/jetpack-compose/Icon/index.d.ts.map +1 -0
- package/build/jetpack-compose/IconButton/index.d.ts +0 -4
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/LazyColumn/index.d.ts +55 -0
- package/build/jetpack-compose/LazyColumn/index.d.ts.map +1 -0
- package/build/jetpack-compose/ListItem/index.d.ts +81 -0
- package/build/jetpack-compose/ListItem/index.d.ts.map +1 -0
- package/build/jetpack-compose/MaterialSymbolsAssetsTransformer.fx.d.ts +2 -0
- package/build/jetpack-compose/MaterialSymbolsAssetsTransformer.fx.d.ts.map +1 -0
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts +34 -0
- package/build/jetpack-compose/ModalBottomSheet/index.d.ts.map +1 -0
- package/build/jetpack-compose/Picker/index.d.ts +0 -6
- package/build/jetpack-compose/Picker/index.d.ts.map +1 -1
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts +31 -0
- package/build/jetpack-compose/PullToRefreshBox/index.d.ts.map +1 -0
- package/build/jetpack-compose/RNHostView/index.d.ts +28 -0
- package/build/jetpack-compose/RNHostView/index.d.ts.map +1 -0
- package/build/jetpack-compose/RadioButton/index.d.ts +20 -0
- package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/SearchBar/index.d.ts +47 -0
- package/build/jetpack-compose/SearchBar/index.d.ts.map +1 -0
- package/build/jetpack-compose/Shape/index.d.ts +29 -2
- package/build/jetpack-compose/Shape/index.d.ts.map +1 -1
- package/build/jetpack-compose/Slider/index.d.ts +1 -9
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Spacer/index.d.ts +22 -0
- package/build/jetpack-compose/Spacer/index.d.ts.map +1 -0
- package/build/jetpack-compose/Surface/index.d.ts +44 -0
- package/build/jetpack-compose/Surface/index.d.ts.map +1 -0
- package/build/jetpack-compose/Switch/index.d.ts +17 -9
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/Text/index.d.ts +182 -0
- package/build/jetpack-compose/Text/index.d.ts.map +1 -0
- package/build/jetpack-compose/TextButton/index.d.ts +29 -0
- package/build/jetpack-compose/TextButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/TextInput/index.d.ts.map +1 -1
- package/build/jetpack-compose/ToggleButton/index.d.ts +54 -0
- package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/index.d.ts +20 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/layout.d.ts +16 -19
- package/build/jetpack-compose/layout.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/createModifier.d.ts +18 -0
- package/build/jetpack-compose/modifiers/createModifier.d.ts.map +1 -0
- package/build/jetpack-compose/modifiers/index.d.ts +133 -41
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/utils.d.ts +15 -0
- package/build/jetpack-compose/modifiers/utils.d.ts.map +1 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts +47 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -0
- package/build/swift-ui/ScrollView/index.d.ts +16 -0
- package/build/swift-ui/ScrollView/index.d.ts.map +1 -0
- package/build/swift-ui/index.d.ts +2 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +12 -3
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/expo-module.config.json +2 -1
- package/ios/ColorPickerView.swift +2 -2
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +65 -0
- package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +26 -0
- package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +15 -0
- package/ios/Convertibles/VisibilityOptions.swift +19 -0
- package/ios/ExpoUIModule.swift +5 -0
- package/ios/Modifiers/ForegroundStyleModifier.swift +124 -0
- package/ios/Modifiers/PresentationModifiers.swift +1 -18
- package/ios/Modifiers/ViewModifierRegistry.swift +30 -121
- package/ios/ScrollViewComponent.swift +23 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module → 55.0.0/expo.modules.ui-55.0.0.module} +46 -28
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom → 55.0.0/expo.modules.ui-55.0.0.pom} +36 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0/expo.modules.ui-55.0.0.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 +5 -3
- package/src/jetpack-compose/AlertDialog/index.tsx +11 -1
- package/src/jetpack-compose/BasicAlertDialog/index.tsx +51 -0
- package/src/jetpack-compose/Button/index.tsx +13 -1
- package/src/jetpack-compose/Card/index.tsx +62 -0
- package/src/jetpack-compose/Carousel/index.tsx +7 -1
- package/src/jetpack-compose/Chip/index.tsx +14 -7
- package/src/jetpack-compose/ContextMenu/index.tsx +5 -2
- package/src/jetpack-compose/DatePicker/index.tsx +5 -5
- package/src/jetpack-compose/Divider/index.tsx +13 -2
- package/src/jetpack-compose/DockedSearchBar/index.tsx +78 -0
- package/src/jetpack-compose/ExpoUIModule.ts +3 -0
- package/src/jetpack-compose/FilterChip/index.tsx +89 -0
- package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +90 -0
- package/src/jetpack-compose/Icon/index.tsx +144 -0
- package/src/jetpack-compose/IconButton/index.tsx +5 -5
- package/src/jetpack-compose/LazyColumn/index.tsx +82 -0
- package/src/jetpack-compose/ListItem/index.tsx +129 -0
- package/src/jetpack-compose/MaterialSymbolsAssetsTransformer.fx.ts +22 -0
- package/src/jetpack-compose/ModalBottomSheet/index.tsx +61 -0
- package/src/jetpack-compose/Picker/index.tsx +6 -5
- package/src/jetpack-compose/Progress/index.tsx +14 -4
- package/src/jetpack-compose/PullToRefreshBox/index.tsx +66 -0
- package/src/jetpack-compose/RNHostView/index.tsx +56 -0
- package/src/jetpack-compose/RadioButton/index.tsx +48 -0
- package/src/jetpack-compose/SearchBar/index.tsx +96 -0
- package/src/jetpack-compose/Shape/index.tsx +65 -22
- package/src/jetpack-compose/Slider/index.tsx +6 -5
- package/src/jetpack-compose/Spacer/index.tsx +43 -0
- package/src/jetpack-compose/Surface/index.tsx +66 -0
- package/src/jetpack-compose/Switch/index.tsx +43 -8
- package/src/jetpack-compose/Text/index.tsx +274 -0
- package/src/jetpack-compose/TextButton/index.tsx +55 -0
- package/src/jetpack-compose/TextInput/index.tsx +5 -4
- package/src/jetpack-compose/ToggleButton/index.tsx +83 -0
- package/src/jetpack-compose/index.ts +21 -1
- package/src/jetpack-compose/layout.tsx +55 -70
- package/src/jetpack-compose/modifiers/createModifier.ts +27 -0
- package/src/jetpack-compose/modifiers/index.ts +204 -83
- package/src/jetpack-compose/modifiers/utils.ts +30 -0
- package/src/swift-ui/ConfirmationDialog/index.tsx +98 -0
- package/src/swift-ui/ScrollView/index.tsx +34 -0
- package/src/swift-ui/index.tsx +2 -0
- package/src/swift-ui/modifiers/index.ts +19 -3
- package/src/ts-declarations/react-native-assets.d.ts +31 -0
- package/build/jetpack-compose/BottomSheet/index.d.ts +0 -21
- package/build/jetpack-compose/BottomSheet/index.d.ts.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.6/expo.modules.ui-55.0.0-preview.6.pom.sha512 +0 -1
- package/src/jetpack-compose/BottomSheet/index.tsx +0 -46
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
|
|
3
|
+
import { ExpoModifier } from '../../types';
|
|
4
|
+
import { getTextFromChildren } from '../../utils';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Font weight options for text styling.
|
|
9
|
+
*/
|
|
10
|
+
export type TextFontWeight =
|
|
11
|
+
| 'normal'
|
|
12
|
+
| 'bold'
|
|
13
|
+
| '100'
|
|
14
|
+
| '200'
|
|
15
|
+
| '300'
|
|
16
|
+
| '400'
|
|
17
|
+
| '500'
|
|
18
|
+
| '600'
|
|
19
|
+
| '700'
|
|
20
|
+
| '800'
|
|
21
|
+
| '900';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Font style options for text styling.
|
|
25
|
+
*/
|
|
26
|
+
export type TextFontStyle = 'normal' | 'italic';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Text alignment options.
|
|
30
|
+
*/
|
|
31
|
+
export type TextAlign = 'left' | 'right' | 'center' | 'justify' | 'start' | 'end';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Text decoration options.
|
|
35
|
+
*/
|
|
36
|
+
export type TextDecoration = 'none' | 'underline' | 'lineThrough';
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Text overflow behavior options.
|
|
40
|
+
*/
|
|
41
|
+
export type TextOverflow = 'clip' | 'ellipsis' | 'visible';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Material 3 Typography scale styles.
|
|
45
|
+
* Corresponds to MaterialTheme.typography in Jetpack Compose.
|
|
46
|
+
*/
|
|
47
|
+
export type TypographyStyle =
|
|
48
|
+
| 'displayLarge'
|
|
49
|
+
| 'displayMedium'
|
|
50
|
+
| 'displaySmall'
|
|
51
|
+
| 'headlineLarge'
|
|
52
|
+
| 'headlineMedium'
|
|
53
|
+
| 'headlineSmall'
|
|
54
|
+
| 'titleLarge'
|
|
55
|
+
| 'titleMedium'
|
|
56
|
+
| 'titleSmall'
|
|
57
|
+
| 'bodyLarge'
|
|
58
|
+
| 'bodyMedium'
|
|
59
|
+
| 'bodySmall'
|
|
60
|
+
| 'labelLarge'
|
|
61
|
+
| 'labelMedium'
|
|
62
|
+
| 'labelSmall';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Text style properties that can be applied to text.
|
|
66
|
+
* Corresponds to Jetpack Compose's TextStyle.
|
|
67
|
+
*/
|
|
68
|
+
export type TextStyle = {
|
|
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
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The font size in sp (scale-independent pixels).
|
|
84
|
+
*/
|
|
85
|
+
fontSize?: number;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The font weight of the text.
|
|
89
|
+
*/
|
|
90
|
+
fontWeight?: TextFontWeight;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The font style of the text.
|
|
94
|
+
*/
|
|
95
|
+
fontStyle?: TextFontStyle;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The text alignment.
|
|
99
|
+
*/
|
|
100
|
+
textAlign?: TextAlign;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The text decoration.
|
|
104
|
+
*/
|
|
105
|
+
textDecoration?: TextDecoration;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The letter spacing in sp.
|
|
109
|
+
*/
|
|
110
|
+
letterSpacing?: number;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The line height in sp.
|
|
114
|
+
*/
|
|
115
|
+
lineHeight?: number;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export type TextProps = {
|
|
119
|
+
/**
|
|
120
|
+
* The text content to display.
|
|
121
|
+
*/
|
|
122
|
+
children?: React.ReactNode;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The color of the text.
|
|
126
|
+
*/
|
|
127
|
+
color?: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* 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
|
+
*/
|
|
135
|
+
overflow?: TextOverflow;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Whether the text should break at soft line breaks.
|
|
139
|
+
* If false, the glyphs in the text will be positioned as if there was unlimited horizontal space.
|
|
140
|
+
*/
|
|
141
|
+
softWrap?: boolean;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* An optional maximum number of lines for the text to span, wrapping if necessary.
|
|
145
|
+
* If the text exceeds the given number of lines, it will be truncated according to overflow.
|
|
146
|
+
*/
|
|
147
|
+
maxLines?: number;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The minimum height in terms of minimum number of visible lines.
|
|
151
|
+
*/
|
|
152
|
+
minLines?: number;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Style configuration for the text.
|
|
156
|
+
* Corresponds to Jetpack Compose's TextStyle parameter.
|
|
157
|
+
*/
|
|
158
|
+
style?: TextStyle;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Modifiers for the component.
|
|
162
|
+
*/
|
|
163
|
+
modifiers?: ExpoModifier[];
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
type NativeTextProps = Omit<TextProps, 'children' | 'style'> & {
|
|
167
|
+
text: string;
|
|
168
|
+
typography?: TypographyStyle;
|
|
169
|
+
fontSize?: number;
|
|
170
|
+
fontWeight?: TextFontWeight;
|
|
171
|
+
fontStyle?: TextFontStyle;
|
|
172
|
+
textAlign?: TextAlign;
|
|
173
|
+
textDecoration?: TextDecoration;
|
|
174
|
+
letterSpacing?: number;
|
|
175
|
+
lineHeight?: number;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const TextNativeView: React.ComponentType<NativeTextProps> = requireNativeView(
|
|
179
|
+
'ExpoUI',
|
|
180
|
+
'TextView'
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
function transformTextProps(props: TextProps): NativeTextProps {
|
|
184
|
+
const { children, modifiers, style, ...restProps } = props;
|
|
185
|
+
|
|
186
|
+
return {
|
|
187
|
+
modifiers,
|
|
188
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
189
|
+
...restProps,
|
|
190
|
+
text: getTextFromChildren(children) ?? '',
|
|
191
|
+
// Extract typography from style (used as base style)
|
|
192
|
+
typography: style?.typography,
|
|
193
|
+
// Flatten other style properties (these override the typography style)
|
|
194
|
+
fontSize: style?.fontSize,
|
|
195
|
+
fontWeight: style?.fontWeight,
|
|
196
|
+
fontStyle: style?.fontStyle,
|
|
197
|
+
textAlign: style?.textAlign,
|
|
198
|
+
textDecoration: style?.textDecoration,
|
|
199
|
+
letterSpacing: style?.letterSpacing,
|
|
200
|
+
lineHeight: style?.lineHeight,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* 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
|
+
*/
|
|
272
|
+
export function Text(props: TextProps) {
|
|
273
|
+
return <TextNativeView {...transformTextProps(props)} />;
|
|
274
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { type ColorValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { ExpoModifier, ViewEvent } from '../../types';
|
|
5
|
+
import { getTextFromChildren } from '../../utils';
|
|
6
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
|
+
|
|
8
|
+
export type TextButtonProps = {
|
|
9
|
+
/**
|
|
10
|
+
* The text content to display in the button.
|
|
11
|
+
*/
|
|
12
|
+
children?: string | string[] | React.JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* The color of the button text.
|
|
15
|
+
*/
|
|
16
|
+
color?: ColorValue;
|
|
17
|
+
/**
|
|
18
|
+
* Whether the button is disabled.
|
|
19
|
+
*/
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Callback that is called when the button is pressed.
|
|
23
|
+
*/
|
|
24
|
+
onPress?: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Modifiers for the component.
|
|
27
|
+
*/
|
|
28
|
+
modifiers?: ExpoModifier[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type NativeTextButtonProps = Omit<TextButtonProps, 'children' | 'onPress'> & {
|
|
32
|
+
text: string;
|
|
33
|
+
} & ViewEvent<'onButtonPressed', void>;
|
|
34
|
+
|
|
35
|
+
const TextButtonNativeView: React.ComponentType<NativeTextButtonProps> = requireNativeView(
|
|
36
|
+
'ExpoUI',
|
|
37
|
+
'TextButtonView'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
function transformProps(props: TextButtonProps): NativeTextButtonProps {
|
|
41
|
+
const { children, modifiers, onPress, ...restProps } = props;
|
|
42
|
+
return {
|
|
43
|
+
modifiers,
|
|
44
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
45
|
+
...restProps,
|
|
46
|
+
text: getTextFromChildren(children) ?? '',
|
|
47
|
+
onButtonPressed: onPress,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A text button component that displays a clickable text label.
|
|
52
|
+
*/
|
|
53
|
+
export function TextButton(props: TextButtonProps) {
|
|
54
|
+
return <TextButtonNativeView {...transformProps(props)} />;
|
|
55
|
+
}
|
|
@@ -2,6 +2,7 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import { Ref } from 'react';
|
|
3
3
|
|
|
4
4
|
import { ExpoModifier, ViewEvent } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @hidden Not used anywhere yet.
|
|
@@ -96,12 +97,12 @@ const TextInputNativeView: React.ComponentType<NativeTextInputProps> = requireNa
|
|
|
96
97
|
'TextInputView'
|
|
97
98
|
);
|
|
98
99
|
|
|
99
|
-
/**
|
|
100
|
-
* @hidden
|
|
101
|
-
*/
|
|
102
100
|
function transformTextInputProps(props: TextInputProps): NativeTextInputProps {
|
|
101
|
+
const { modifiers, ...restProps } = props;
|
|
103
102
|
return {
|
|
104
|
-
|
|
103
|
+
modifiers,
|
|
104
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
105
|
+
...restProps,
|
|
105
106
|
onValueChanged: (event) => {
|
|
106
107
|
props.onChangeText?.(event.nativeEvent.value);
|
|
107
108
|
},
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { type ColorValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { type ExpoModifier, type ViewEvent } from '../../types';
|
|
5
|
+
import { ExpoUIModule } from '../ExpoUIModule';
|
|
6
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
7
|
+
|
|
8
|
+
export type ToggleButtonProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether the toggle button is checked.
|
|
11
|
+
*/
|
|
12
|
+
checked: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Text to display in the button.
|
|
15
|
+
*/
|
|
16
|
+
text?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The variant of the toggle button.
|
|
19
|
+
* - `'default'` - Material 3 ToggleButton
|
|
20
|
+
* - `'icon'` - Icon toggle button
|
|
21
|
+
* - `'filledIcon'` - Filled icon toggle button
|
|
22
|
+
* - `'outlinedIcon'` - Outlined icon toggle button
|
|
23
|
+
* @default 'default'
|
|
24
|
+
*/
|
|
25
|
+
variant?: 'default' | 'icon' | 'filledIcon' | 'outlinedIcon';
|
|
26
|
+
/**
|
|
27
|
+
* The color of the toggle button when checked.
|
|
28
|
+
*/
|
|
29
|
+
color?: ColorValue;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the button is disabled.
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Callback that is called when the checked state changes.
|
|
36
|
+
*/
|
|
37
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Modifiers for the component.
|
|
40
|
+
*/
|
|
41
|
+
modifiers?: ExpoModifier[];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The content to display inside the toggle button.
|
|
45
|
+
*/
|
|
46
|
+
children?: React.ReactNode;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type NativeToggleButtonProps = Omit<ToggleButtonProps, 'onCheckedChange'> &
|
|
50
|
+
ViewEvent<'onCheckedChange', { checked: boolean }>;
|
|
51
|
+
|
|
52
|
+
const ToggleButtonNativeView: React.ComponentType<NativeToggleButtonProps> = requireNativeView(
|
|
53
|
+
'ExpoUI',
|
|
54
|
+
'ToggleButtonView'
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
function transformProps(props: ToggleButtonProps): Omit<NativeToggleButtonProps, 'children'> {
|
|
58
|
+
const { modifiers, onCheckedChange, children, ...restProps } = props;
|
|
59
|
+
return {
|
|
60
|
+
modifiers,
|
|
61
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
62
|
+
...restProps,
|
|
63
|
+
onCheckedChange: onCheckedChange
|
|
64
|
+
? ({ nativeEvent: { checked } }) => onCheckedChange(checked)
|
|
65
|
+
: undefined,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A toggle button component that can be toggled on and off.
|
|
70
|
+
*
|
|
71
|
+
* When `text` prop is provided, it displays the text.
|
|
72
|
+
* Otherwise, custom children can be passed to render custom content.
|
|
73
|
+
*/
|
|
74
|
+
function ToggleButton(props: ToggleButtonProps) {
|
|
75
|
+
const { children } = props;
|
|
76
|
+
|
|
77
|
+
return <ToggleButtonNativeView {...transformProps(props)}>{children}</ToggleButtonNativeView>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ToggleButton.DefaultIconSpacing = ExpoUIModule.ToggleButtonIconSpacing;
|
|
81
|
+
ToggleButton.DefaultIconSize = ExpoUIModule.ToggleButtonIconSize;
|
|
82
|
+
|
|
83
|
+
export { ToggleButton };
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
+
import './MaterialSymbolsAssetsTransformer.fx';
|
|
2
|
+
|
|
1
3
|
export * from './AlertDialog';
|
|
4
|
+
export * from './BasicAlertDialog';
|
|
5
|
+
export * from './Card';
|
|
2
6
|
export * from './Chip';
|
|
7
|
+
export * from './FilterChip';
|
|
3
8
|
export * from './Button';
|
|
9
|
+
export * from './Icon';
|
|
4
10
|
export * from './IconButton';
|
|
5
11
|
export * from './ContextMenu';
|
|
6
12
|
export * from './Divider';
|
|
7
13
|
export * from './Host';
|
|
14
|
+
export * from './LazyColumn';
|
|
15
|
+
export * from './ListItem';
|
|
16
|
+
export * from './RNHostView';
|
|
8
17
|
export * from './DatePicker';
|
|
9
18
|
export * from './Picker';
|
|
10
19
|
export * from './Progress';
|
|
11
20
|
export * from './Slider';
|
|
21
|
+
export * from './Spacer';
|
|
12
22
|
export * from './Switch';
|
|
23
|
+
export * from './TextButton';
|
|
13
24
|
export * from './TextInput';
|
|
25
|
+
export * from './ToggleButton';
|
|
14
26
|
export * from './Shape';
|
|
15
|
-
export * from './
|
|
27
|
+
export * from './ModalBottomSheet';
|
|
16
28
|
export * from './Carousel';
|
|
29
|
+
export * from './SearchBar';
|
|
30
|
+
export * from './DockedSearchBar';
|
|
31
|
+
export * from './HorizontalFloatingToolbar';
|
|
32
|
+
export * from './PullToRefreshBox';
|
|
33
|
+
export * from './RadioButton';
|
|
34
|
+
export * from './Surface';
|
|
35
|
+
export * from './Text';
|
|
17
36
|
|
|
18
37
|
export * from './layout';
|
|
38
|
+
export { ViewEvent } from '../types';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
|
-
import { ColorValue, Platform } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import { ExpoModifier } from '../types';
|
|
5
|
-
import {
|
|
4
|
+
import { createViewModifierEventListener } from './modifiers/utils';
|
|
6
5
|
|
|
7
6
|
export type PrimitiveBaseProps = {
|
|
8
7
|
/**
|
|
@@ -17,16 +16,29 @@ export type HorizontalArrangement =
|
|
|
17
16
|
| 'center'
|
|
18
17
|
| 'spaceBetween'
|
|
19
18
|
| 'spaceAround'
|
|
20
|
-
| 'spaceEvenly'
|
|
19
|
+
| 'spaceEvenly'
|
|
20
|
+
| { spacedBy: number };
|
|
21
21
|
export type VerticalArrangement =
|
|
22
22
|
| 'top'
|
|
23
23
|
| 'bottom'
|
|
24
24
|
| 'center'
|
|
25
25
|
| 'spaceBetween'
|
|
26
26
|
| 'spaceAround'
|
|
27
|
-
| 'spaceEvenly'
|
|
27
|
+
| 'spaceEvenly'
|
|
28
|
+
| { spacedBy: number };
|
|
28
29
|
export type HorizontalAlignment = 'start' | 'end' | 'center';
|
|
29
30
|
export type VerticalAlignment = 'top' | 'bottom' | 'center';
|
|
31
|
+
export type ContentAlignment =
|
|
32
|
+
| 'topStart'
|
|
33
|
+
| 'topCenter'
|
|
34
|
+
| 'topEnd'
|
|
35
|
+
| 'centerStart'
|
|
36
|
+
| 'center'
|
|
37
|
+
| 'centerEnd'
|
|
38
|
+
| 'bottomStart'
|
|
39
|
+
| 'bottomCenter'
|
|
40
|
+
| 'bottomEnd';
|
|
41
|
+
export type FloatingToolbarExitAlwaysScrollBehavior = 'top' | 'bottom' | 'start' | 'end';
|
|
30
42
|
|
|
31
43
|
type LayoutBaseProps = {
|
|
32
44
|
children?: React.ReactNode;
|
|
@@ -34,88 +46,61 @@ type LayoutBaseProps = {
|
|
|
34
46
|
verticalArrangement?: VerticalArrangement;
|
|
35
47
|
horizontalAlignment?: HorizontalAlignment;
|
|
36
48
|
verticalAlignment?: VerticalAlignment;
|
|
49
|
+
contentAlignment?: ContentAlignment;
|
|
50
|
+
floatingToolbarExitAlwaysScrollBehavior?: FloatingToolbarExitAlwaysScrollBehavior;
|
|
37
51
|
modifiers?: ExpoModifier[];
|
|
38
52
|
} & PrimitiveBaseProps;
|
|
39
53
|
|
|
54
|
+
function transformProps(props: LayoutBaseProps) {
|
|
55
|
+
const { modifiers, ...restProps } = props;
|
|
56
|
+
return {
|
|
57
|
+
modifiers,
|
|
58
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
59
|
+
...restProps,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
40
63
|
//#region Box Component
|
|
41
|
-
export type BoxProps = Pick<
|
|
42
|
-
|
|
43
|
-
|
|
64
|
+
export type BoxProps = Pick<
|
|
65
|
+
LayoutBaseProps,
|
|
66
|
+
'children' | 'modifiers' | 'contentAlignment' | 'floatingToolbarExitAlwaysScrollBehavior'
|
|
67
|
+
>;
|
|
68
|
+
const BoxNativeView: React.ComponentType<BoxProps> = requireNativeView('ExpoUI', 'BoxView');
|
|
69
|
+
|
|
44
70
|
export function Box(props: BoxProps) {
|
|
45
|
-
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return <BoxNativeView {...props} />;
|
|
71
|
+
return <BoxNativeView {...transformProps(props)} />;
|
|
49
72
|
}
|
|
50
73
|
//#endregion
|
|
51
74
|
|
|
52
75
|
//#region Row Component
|
|
53
76
|
export type RowProps = LayoutBaseProps;
|
|
54
|
-
const RowNativeView: React.ComponentType<RowProps>
|
|
55
|
-
Platform.OS === 'android' ? requireNativeView('ExpoUI', 'RowView') : null;
|
|
77
|
+
const RowNativeView: React.ComponentType<RowProps> = requireNativeView('ExpoUI', 'RowView');
|
|
56
78
|
export function Row(props: RowProps) {
|
|
57
|
-
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
return <RowNativeView {...props} />;
|
|
79
|
+
return <RowNativeView {...transformProps(props)} />;
|
|
61
80
|
}
|
|
62
81
|
//#endregion
|
|
63
82
|
|
|
64
|
-
//#region
|
|
65
|
-
export type
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
//#region FlowRow Component
|
|
84
|
+
export type FlowRowProps = Pick<
|
|
85
|
+
LayoutBaseProps,
|
|
86
|
+
'children' | 'modifiers' | 'horizontalArrangement' | 'verticalArrangement'
|
|
87
|
+
>;
|
|
88
|
+
const FlowRowNativeView: React.ComponentType<FlowRowProps> = requireNativeView(
|
|
89
|
+
'ExpoUI',
|
|
90
|
+
'FlowRowView'
|
|
91
|
+
);
|
|
92
|
+
export function FlowRow(props: FlowRowProps) {
|
|
93
|
+
return <FlowRowNativeView {...transformProps(props)} />;
|
|
73
94
|
}
|
|
74
95
|
//#endregion
|
|
75
96
|
|
|
76
|
-
//#region
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
| '400'
|
|
85
|
-
| '500'
|
|
86
|
-
| '600'
|
|
87
|
-
| '700'
|
|
88
|
-
| '800'
|
|
89
|
-
| '900';
|
|
90
|
-
|
|
91
|
-
export type TextProps = {
|
|
92
|
-
/**
|
|
93
|
-
* The children of the text.
|
|
94
|
-
* Only string and number are supported.
|
|
95
|
-
*/
|
|
96
|
-
children?: React.ReactNode;
|
|
97
|
-
color?: ColorValue;
|
|
98
|
-
fontSize?: number;
|
|
99
|
-
fontWeight?: TextFontWeight;
|
|
100
|
-
} & PrimitiveBaseProps;
|
|
101
|
-
|
|
102
|
-
const TextNativeView: React.ComponentType<Omit<TextProps, 'children'> & { text: string }> | null =
|
|
103
|
-
Platform.OS === 'android' ? requireNativeView('ExpoUI', 'TextView') : null;
|
|
104
|
-
type NativeTextProps = Omit<TextProps, 'children'> & {
|
|
105
|
-
text: string;
|
|
106
|
-
};
|
|
107
|
-
function transformTextProps(props: TextProps): NativeTextProps {
|
|
108
|
-
const { children, ...restProps } = props;
|
|
109
|
-
const text = getTextFromChildren(children);
|
|
110
|
-
return {
|
|
111
|
-
...restProps,
|
|
112
|
-
text: text ?? '',
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
export function Text(props: TextProps) {
|
|
116
|
-
if (!TextNativeView) {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
return <TextNativeView {...transformTextProps(props)} />;
|
|
97
|
+
//#region Column Component
|
|
98
|
+
export type ColumnProps = LayoutBaseProps;
|
|
99
|
+
const ColumnNativeView: React.ComponentType<ColumnProps> = requireNativeView(
|
|
100
|
+
'ExpoUI',
|
|
101
|
+
'ColumnView'
|
|
102
|
+
);
|
|
103
|
+
export function Column(props: ColumnProps) {
|
|
104
|
+
return <ColumnNativeView {...transformProps(props)} />;
|
|
120
105
|
}
|
|
121
106
|
//#endregion
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base interface for all view modifiers.
|
|
3
|
+
* All modifiers must have a type field and can include arbitrary parameters.
|
|
4
|
+
*/
|
|
5
|
+
export interface ModifierConfig {
|
|
6
|
+
$type: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
eventListener?: (args: any) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Factory function to create modifier configuration objects.
|
|
13
|
+
*/
|
|
14
|
+
export function createModifier(type: string, params: Record<string, any> = {}): ModifierConfig {
|
|
15
|
+
return { $type: type, ...params };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a modifier with an event listener.
|
|
20
|
+
*/
|
|
21
|
+
export function createModifierWithEventListener(
|
|
22
|
+
type: string,
|
|
23
|
+
eventListener: (args: any) => void,
|
|
24
|
+
params: Record<string, any> = {}
|
|
25
|
+
): ModifierConfig {
|
|
26
|
+
return { $type: type, ...params, eventListener };
|
|
27
|
+
}
|