@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
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
|
2
|
+
|
|
1
3
|
package expo.modules.ui
|
|
2
4
|
|
|
5
|
+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
6
|
+
import androidx.compose.material3.SwitchDefaults
|
|
7
|
+
import androidx.compose.material3.ToggleButtonDefaults
|
|
3
8
|
import androidx.compose.runtime.remember
|
|
4
9
|
import expo.modules.kotlin.modules.Module
|
|
5
10
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
@@ -9,16 +14,32 @@ import expo.modules.ui.button.ButtonPressedEvent
|
|
|
9
14
|
import expo.modules.ui.button.ButtonProps
|
|
10
15
|
import expo.modules.ui.button.IconButtonContent
|
|
11
16
|
import expo.modules.ui.button.IconButtonProps
|
|
17
|
+
import expo.modules.ui.icon.IconView
|
|
12
18
|
import expo.modules.ui.menu.ContextMenuButtonPressedEvent
|
|
13
19
|
import expo.modules.ui.menu.ContextMenuContent
|
|
14
20
|
import expo.modules.ui.menu.ContextMenuProps
|
|
15
21
|
import expo.modules.ui.menu.ContextMenuSwitchValueChangeEvent
|
|
16
22
|
import expo.modules.ui.menu.ExpandedChangedEvent
|
|
23
|
+
import okhttp3.OkHttpClient
|
|
17
24
|
|
|
18
25
|
class ExpoUIModule : Module() {
|
|
26
|
+
var okHttpClient: OkHttpClient? = null
|
|
27
|
+
private set
|
|
28
|
+
|
|
19
29
|
override fun definition() = ModuleDefinition {
|
|
20
30
|
Name("ExpoUI")
|
|
21
31
|
|
|
32
|
+
OnCreate {
|
|
33
|
+
okHttpClient = OkHttpClient.Builder().build()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
OnDestroy {
|
|
37
|
+
okHttpClient?.dispatcher?.executorService?.shutdown()
|
|
38
|
+
okHttpClient?.connectionPool?.evictAll()
|
|
39
|
+
okHttpClient?.cache?.close()
|
|
40
|
+
okHttpClient = null
|
|
41
|
+
}
|
|
42
|
+
|
|
22
43
|
//region Views use expo-modules-core DSL for uncommon features
|
|
23
44
|
|
|
24
45
|
View(HostView::class) {
|
|
@@ -29,15 +50,45 @@ class ExpoUIModule : Module() {
|
|
|
29
50
|
}
|
|
30
51
|
}
|
|
31
52
|
|
|
53
|
+
Constant("SwitchDefaultIconSize") {
|
|
54
|
+
return@Constant SwitchDefaults.IconSize.value
|
|
55
|
+
}
|
|
56
|
+
Constant("ToggleButtonIconSpacing") {
|
|
57
|
+
return@Constant ToggleButtonDefaults.IconSpacing.value
|
|
58
|
+
}
|
|
59
|
+
Constant("ToggleButtonIconSize") {
|
|
60
|
+
return@Constant ToggleButtonDefaults.IconSize.value
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
View(RNHostView::class)
|
|
64
|
+
|
|
65
|
+
View(TextInputView::class) {
|
|
66
|
+
Events("onValueChanged")
|
|
67
|
+
Prop("defaultValue", "") { view: TextInputView, text: String ->
|
|
68
|
+
if (view.text == null) {
|
|
69
|
+
view.text = text
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
AsyncFunction("setText") { view: TextInputView, text: String ->
|
|
73
|
+
view.text = text
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
View(SlotView::class) {
|
|
78
|
+
Events("onSlotEvent")
|
|
79
|
+
}
|
|
80
|
+
View(IconView::class)
|
|
81
|
+
View(LazyColumnView::class)
|
|
82
|
+
|
|
32
83
|
//endregion Views use expo-modules-core DSL for uncommon features
|
|
33
84
|
|
|
34
85
|
//region Expo UI views
|
|
35
86
|
|
|
36
|
-
ExpoUIView("
|
|
37
|
-
Events("
|
|
38
|
-
}) { props:
|
|
39
|
-
val
|
|
40
|
-
|
|
87
|
+
ExpoUIView("ModalBottomSheetView", events = {
|
|
88
|
+
Events("onDismissRequest")
|
|
89
|
+
}) { props: ModalBottomSheetProps ->
|
|
90
|
+
val onDismissRequest by remember { EventDispatcher<Unit>() }
|
|
91
|
+
ModalBottomSheetContent(props) { onDismissRequest(Unit) }
|
|
41
92
|
}
|
|
42
93
|
|
|
43
94
|
// Defines a single view for now – a single choice segmented control
|
|
@@ -112,18 +163,6 @@ class ExpoUIModule : Module() {
|
|
|
112
163
|
ProgressContent(props)
|
|
113
164
|
}
|
|
114
165
|
|
|
115
|
-
View(TextInputView::class) {
|
|
116
|
-
Events("onValueChanged")
|
|
117
|
-
Prop("defaultValue", "") { view: TextInputView, text: String ->
|
|
118
|
-
if (view.text == null) {
|
|
119
|
-
view.text = text
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
AsyncFunction("setText") { view: TextInputView, text: String ->
|
|
123
|
-
view.text = text
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
166
|
ExpoUIView("BoxView") { props: LayoutProps ->
|
|
128
167
|
BoxContent(props)
|
|
129
168
|
}
|
|
@@ -132,6 +171,10 @@ class ExpoUIModule : Module() {
|
|
|
132
171
|
RowContent(props)
|
|
133
172
|
}
|
|
134
173
|
|
|
174
|
+
ExpoUIView("FlowRowView") { props: LayoutProps ->
|
|
175
|
+
FlowRowContent(props)
|
|
176
|
+
}
|
|
177
|
+
|
|
135
178
|
ExpoUIView("ColumnView") { props: LayoutProps ->
|
|
136
179
|
ColumnContent(props)
|
|
137
180
|
}
|
|
@@ -140,6 +183,31 @@ class ExpoUIModule : Module() {
|
|
|
140
183
|
TextContent(props)
|
|
141
184
|
}
|
|
142
185
|
|
|
186
|
+
ExpoUIView("SearchBarView", events = {
|
|
187
|
+
Events("onSearch")
|
|
188
|
+
}) { props: SearchBarProps ->
|
|
189
|
+
val onSearch by remember { EventDispatcher<GenericEventPayload1<String>>() }
|
|
190
|
+
SearchBarContent(props) { onSearch(it) }
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
ExpoUIView("DockedSearchBarView", events = {
|
|
194
|
+
Events("onQueryChange")
|
|
195
|
+
}) { props: DockedSearchBarProps ->
|
|
196
|
+
val onQueryChange by remember { EventDispatcher<GenericEventPayload1<String>>() }
|
|
197
|
+
DockedSearchBarContent(props) { onQueryChange(it) }
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
ExpoUIView("HorizontalFloatingToolbarView") { props: HorizontalFloatingToolbarProps ->
|
|
201
|
+
HorizontalFloatingToolbarContent(props)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
ExpoUIView("PullToRefreshBoxView", events = {
|
|
205
|
+
Events("onRefresh")
|
|
206
|
+
}) { props: PullToRefreshBoxProps ->
|
|
207
|
+
val onRefresh by remember { EventDispatcher<Unit>() }
|
|
208
|
+
PullToRefreshBoxContent(props) { onRefresh(Unit) }
|
|
209
|
+
}
|
|
210
|
+
|
|
143
211
|
ExpoUIView("CarouselView") { props: CarouselProps ->
|
|
144
212
|
CarouselContent(props)
|
|
145
213
|
}
|
|
@@ -170,6 +238,57 @@ class ExpoUIModule : Module() {
|
|
|
170
238
|
ChipContent(props, { onPress(it) }, { onDismiss(it) })
|
|
171
239
|
}
|
|
172
240
|
|
|
241
|
+
ExpoUIView("FilterChipView", events = {
|
|
242
|
+
Events("onPress")
|
|
243
|
+
}) { props: FilterChipProps ->
|
|
244
|
+
val onPress by remember { EventDispatcher<FilterChipPressedEvent>() }
|
|
245
|
+
FilterChipContent(props) { onPress(it) }
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
ExpoUIView("TextButtonView", events = {
|
|
249
|
+
Events("onButtonPressed")
|
|
250
|
+
}) { props: TextButtonProps ->
|
|
251
|
+
val onButtonPressed by remember { EventDispatcher<expo.modules.ui.button.ButtonPressedEvent>() }
|
|
252
|
+
TextButtonContent(props) { onButtonPressed(it) }
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
ExpoUIView("ToggleButtonView", events = {
|
|
256
|
+
Events("onCheckedChange")
|
|
257
|
+
}) { props: ToggleButtonProps ->
|
|
258
|
+
val onCheckedChange by remember { EventDispatcher<ToggleButtonValueChangeEvent>() }
|
|
259
|
+
ToggleButtonContent(props) { onCheckedChange(it) }
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
ExpoUIView("CardView") { props: CardProps ->
|
|
263
|
+
CardContent(props)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
ExpoUIView("ListItemView") { props: ListItemProps ->
|
|
267
|
+
ListItemContent(props)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
ExpoUIView("SpacerView") { props: SpacerProps ->
|
|
271
|
+
SpacerContent(props)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
ExpoUIView("BasicAlertDialogView", events = {
|
|
275
|
+
Events("onDismissRequest")
|
|
276
|
+
}) { props: BasicAlertDialogProps ->
|
|
277
|
+
val onDismissRequest by remember { EventDispatcher<Unit>() }
|
|
278
|
+
BasicAlertDialogContent(props) { onDismissRequest(Unit) }
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
ExpoUIView("SurfaceView") { props: SurfaceProps ->
|
|
282
|
+
SurfaceContent(props)
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
ExpoUIView("RadioButtonView", events = {
|
|
286
|
+
Events("onNativeClick")
|
|
287
|
+
}) { props: RadioButtonProps ->
|
|
288
|
+
val onNativeClick by remember { EventDispatcher<Unit>() }
|
|
289
|
+
RadioButtonContent(props) { onNativeClick(Unit) }
|
|
290
|
+
}
|
|
291
|
+
|
|
173
292
|
//endregion Expo UI views
|
|
174
293
|
}
|
|
175
294
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
package expo.modules.ui
|
|
2
|
+
|
|
3
|
+
import androidx.compose.material3.FilterChip
|
|
4
|
+
import androidx.compose.material3.FilterChipDefaults
|
|
5
|
+
import androidx.compose.material3.Text
|
|
6
|
+
import androidx.compose.runtime.Composable
|
|
7
|
+
import expo.modules.kotlin.records.Record
|
|
8
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
9
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
10
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
11
|
+
import java.io.Serializable
|
|
12
|
+
|
|
13
|
+
open class FilterChipPressedEvent : Record, Serializable
|
|
14
|
+
|
|
15
|
+
data class FilterChipProps(
|
|
16
|
+
val selected: Boolean = false,
|
|
17
|
+
val label: String = "",
|
|
18
|
+
val enabled: Boolean = true,
|
|
19
|
+
val modifiers: ModifierList = emptyList()
|
|
20
|
+
) : ComposeProps
|
|
21
|
+
|
|
22
|
+
@Composable
|
|
23
|
+
fun FunctionalComposableScope.FilterChipContent(
|
|
24
|
+
props: FilterChipProps,
|
|
25
|
+
onPress: (FilterChipPressedEvent) -> Unit
|
|
26
|
+
) {
|
|
27
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
28
|
+
|
|
29
|
+
val leadingIconSlotView = findChildSlotView(view, "leadingIcon")
|
|
30
|
+
val trailingIconSlotView = findChildSlotView(view, "trailingIcon")
|
|
31
|
+
|
|
32
|
+
FilterChip(
|
|
33
|
+
selected = props.selected,
|
|
34
|
+
onClick = { onPress(FilterChipPressedEvent()) },
|
|
35
|
+
label = { Text(props.label) },
|
|
36
|
+
enabled = props.enabled,
|
|
37
|
+
leadingIcon = leadingIconSlotView?.let {
|
|
38
|
+
{
|
|
39
|
+
with(ComposableScope()) {
|
|
40
|
+
with(it) {
|
|
41
|
+
Content()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
trailingIcon = trailingIconSlotView?.let {
|
|
47
|
+
{
|
|
48
|
+
with(ComposableScope()) {
|
|
49
|
+
with(it) {
|
|
50
|
+
Content()
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
colors = FilterChipDefaults.filterChipColors(),
|
|
56
|
+
border = FilterChipDefaults.filterChipBorder(enabled = props.enabled, selected = props.selected),
|
|
57
|
+
modifier = modifier
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
|
2
|
+
|
|
3
|
+
package expo.modules.ui
|
|
4
|
+
|
|
5
|
+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
6
|
+
import androidx.compose.material3.FloatingToolbarDefaults
|
|
7
|
+
import androidx.compose.material3.FloatingToolbarScrollBehavior
|
|
8
|
+
import androidx.compose.material3.HorizontalFloatingToolbar
|
|
9
|
+
import androidx.compose.runtime.Composable
|
|
10
|
+
import expo.modules.kotlin.types.Enumerable
|
|
11
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
12
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
13
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
14
|
+
|
|
15
|
+
enum class HorizontalFloatingToolbarVariant(val value: String) : Enumerable {
|
|
16
|
+
STANDARD("standard"),
|
|
17
|
+
VIBRANT("vibrant")
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
data class HorizontalFloatingToolbarProps(
|
|
21
|
+
val variant: HorizontalFloatingToolbarVariant? =
|
|
22
|
+
HorizontalFloatingToolbarVariant.STANDARD,
|
|
23
|
+
val modifiers: ModifierList = emptyList()
|
|
24
|
+
) : ComposeProps
|
|
25
|
+
|
|
26
|
+
@Composable
|
|
27
|
+
fun FunctionalComposableScope.HorizontalFloatingToolbarContent(props: HorizontalFloatingToolbarProps) {
|
|
28
|
+
val colors = when (props.variant) {
|
|
29
|
+
HorizontalFloatingToolbarVariant.VIBRANT -> FloatingToolbarDefaults.vibrantFloatingToolbarColors()
|
|
30
|
+
else -> FloatingToolbarDefaults.standardFloatingToolbarColors()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Find the FAB slot and extract its onClick handler
|
|
34
|
+
val fabSlotView = findChildSlotView(view, "floatingActionButton")
|
|
35
|
+
val fabOnClick: () -> Unit = {
|
|
36
|
+
fabSlotView?.onSlotEvent?.invoke(Unit)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
val floatingActionButton = @Composable {
|
|
40
|
+
when (props.variant) {
|
|
41
|
+
HorizontalFloatingToolbarVariant.VIBRANT -> FloatingToolbarDefaults.VibrantFloatingActionButton(
|
|
42
|
+
onClick = fabOnClick
|
|
43
|
+
) {
|
|
44
|
+
Children(ComposableScope(), filter = { isSlotWithName(it, "floatingActionButton") })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
else -> FloatingToolbarDefaults.StandardFloatingActionButton(onClick = fabOnClick) {
|
|
48
|
+
Children(ComposableScope(), filter = { isSlotWithName(it, "floatingActionButton") })
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
val scrollBehavior = composableScope.nestedScrollConnection as? FloatingToolbarScrollBehavior
|
|
54
|
+
HorizontalFloatingToolbar(
|
|
55
|
+
expanded = true,
|
|
56
|
+
colors = colors,
|
|
57
|
+
scrollBehavior = scrollBehavior,
|
|
58
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
|
|
59
|
+
floatingActionButton = floatingActionButton
|
|
60
|
+
) {
|
|
61
|
+
Children(ComposableScope(), filter = { !isSlotView(it) })
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
package expo.modules.ui
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import androidx.compose.foundation.layout.Arrangement
|
|
6
|
+
import androidx.compose.foundation.layout.PaddingValues
|
|
7
|
+
import androidx.compose.foundation.lazy.LazyColumn
|
|
8
|
+
import android.view.View
|
|
9
|
+
import androidx.compose.runtime.Composable
|
|
10
|
+
import androidx.compose.runtime.MutableIntState
|
|
11
|
+
import androidx.compose.runtime.MutableState
|
|
12
|
+
import androidx.compose.runtime.currentRecomposeScope
|
|
13
|
+
import androidx.compose.runtime.mutableIntStateOf
|
|
14
|
+
import androidx.compose.runtime.mutableStateOf
|
|
15
|
+
import androidx.compose.ui.Alignment
|
|
16
|
+
import androidx.compose.ui.unit.dp
|
|
17
|
+
import expo.modules.kotlin.AppContext
|
|
18
|
+
import expo.modules.kotlin.records.Field
|
|
19
|
+
import expo.modules.kotlin.records.Record
|
|
20
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
21
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
22
|
+
import expo.modules.kotlin.views.ExpoComposeView
|
|
23
|
+
import expo.modules.ui.convertibles.VerticalArrangement
|
|
24
|
+
import expo.modules.ui.convertibles.toComposeArrangement
|
|
25
|
+
|
|
26
|
+
data class ContentPadding(
|
|
27
|
+
@Field val start: Int = 0,
|
|
28
|
+
@Field val top: Int = 0,
|
|
29
|
+
@Field val end: Int = 0,
|
|
30
|
+
@Field val bottom: Int = 0
|
|
31
|
+
) : Record
|
|
32
|
+
|
|
33
|
+
data class LazyColumnProps(
|
|
34
|
+
val verticalArrangement: MutableState<VerticalArrangement?> = mutableStateOf(null),
|
|
35
|
+
val horizontalAlignment: MutableState<String?> = mutableStateOf(null),
|
|
36
|
+
val contentPadding: MutableState<ContentPadding?> = mutableStateOf(null),
|
|
37
|
+
val modifiers: MutableState<ModifierList> = mutableStateOf(emptyList())
|
|
38
|
+
) : ComposeProps
|
|
39
|
+
|
|
40
|
+
@SuppressLint("ViewConstructor")
|
|
41
|
+
class LazyColumnView(context: Context, appContext: AppContext) :
|
|
42
|
+
ExpoComposeView<LazyColumnProps>(context, appContext) {
|
|
43
|
+
override val props = LazyColumnProps()
|
|
44
|
+
|
|
45
|
+
private val composableChildCount: MutableIntState = mutableIntStateOf(0)
|
|
46
|
+
|
|
47
|
+
override fun onViewAdded(child: View?) {
|
|
48
|
+
super.onViewAdded(child)
|
|
49
|
+
composableChildCount.intValue = childCount
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override fun onViewRemoved(child: View?) {
|
|
53
|
+
super.onViewRemoved(child)
|
|
54
|
+
composableChildCount.intValue = childCount
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Composable
|
|
58
|
+
override fun ComposableScope.Content() {
|
|
59
|
+
recomposeScope = currentRecomposeScope
|
|
60
|
+
val verticalArrangement = props.verticalArrangement.value?.toComposeArrangement() ?: Arrangement.Top
|
|
61
|
+
|
|
62
|
+
val horizontalAlignment = when (props.horizontalAlignment.value) {
|
|
63
|
+
"start" -> Alignment.Start
|
|
64
|
+
"end" -> Alignment.End
|
|
65
|
+
"center" -> Alignment.CenterHorizontally
|
|
66
|
+
else -> Alignment.Start
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
val padding = props.contentPadding.value
|
|
70
|
+
|
|
71
|
+
LazyColumn(
|
|
72
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers.value, appContext, this@Content, globalEventDispatcher),
|
|
73
|
+
verticalArrangement = verticalArrangement,
|
|
74
|
+
horizontalAlignment = horizontalAlignment,
|
|
75
|
+
contentPadding = PaddingValues(
|
|
76
|
+
start = (padding?.start ?: 0).dp,
|
|
77
|
+
top = (padding?.top ?: 0).dp,
|
|
78
|
+
end = (padding?.end ?: 0).dp,
|
|
79
|
+
bottom = (padding?.bottom ?: 0).dp
|
|
80
|
+
)
|
|
81
|
+
) {
|
|
82
|
+
val count = composableChildCount.intValue
|
|
83
|
+
for (index in 0..<count) {
|
|
84
|
+
val child = getChildAt(index) as? ExpoComposeView<*> ?: continue
|
|
85
|
+
item {
|
|
86
|
+
with(this@Content) {
|
|
87
|
+
with(child) {
|
|
88
|
+
Content()
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
package expo.modules.ui
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import androidx.compose.material3.ListItem
|
|
5
|
+
import androidx.compose.material3.ListItemDefaults
|
|
6
|
+
import androidx.compose.material3.Text
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import expo.modules.kotlin.records.Field
|
|
9
|
+
import expo.modules.kotlin.records.Record
|
|
10
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
11
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
12
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
13
|
+
|
|
14
|
+
data class ListItemColors(
|
|
15
|
+
@Field val containerColor: Color? = null,
|
|
16
|
+
@Field val headlineColor: Color? = null,
|
|
17
|
+
@Field val leadingIconColor: Color? = null,
|
|
18
|
+
@Field val trailingIconColor: Color? = null,
|
|
19
|
+
@Field val supportingColor: Color? = null,
|
|
20
|
+
@Field val overlineColor: Color? = null
|
|
21
|
+
) : Record
|
|
22
|
+
|
|
23
|
+
data class ListItemProps(
|
|
24
|
+
val headline: String = "",
|
|
25
|
+
val supportingText: String? = null,
|
|
26
|
+
val overlineText: String? = null,
|
|
27
|
+
val color: Color? = null,
|
|
28
|
+
val colors: ListItemColors? = null,
|
|
29
|
+
val modifiers: ModifierList = emptyList()
|
|
30
|
+
) : ComposeProps
|
|
31
|
+
|
|
32
|
+
@Composable
|
|
33
|
+
fun FunctionalComposableScope.ListItemContent(props: ListItemProps) {
|
|
34
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
35
|
+
|
|
36
|
+
val defaultColors = ListItemDefaults.colors()
|
|
37
|
+
val colors = ListItemDefaults.colors(
|
|
38
|
+
containerColor = props.colors?.containerColor.composeOrNull
|
|
39
|
+
?: defaultColors.containerColor,
|
|
40
|
+
contentColor = props.colors?.headlineColor.composeOrNull
|
|
41
|
+
?: defaultColors.contentColor,
|
|
42
|
+
leadingContentColor = props.colors?.leadingIconColor.composeOrNull
|
|
43
|
+
?: defaultColors.leadingContentColor,
|
|
44
|
+
trailingContentColor = props.colors?.trailingIconColor.composeOrNull
|
|
45
|
+
?: defaultColors.trailingContentColor,
|
|
46
|
+
supportingContentColor = props.colors?.supportingColor.composeOrNull
|
|
47
|
+
?: defaultColors.supportingContentColor,
|
|
48
|
+
overlineContentColor = props.colors?.overlineColor.composeOrNull
|
|
49
|
+
?: defaultColors.overlineContentColor
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
val leadingSlotView = findChildSlotView(view, "leading")
|
|
53
|
+
val trailingSlotView = findChildSlotView(view, "trailing")
|
|
54
|
+
val supportingContentSlotView = findChildSlotView(view, "supportingContent")
|
|
55
|
+
|
|
56
|
+
ListItem(
|
|
57
|
+
headlineContent = { Text(text = props.headline) },
|
|
58
|
+
modifier = modifier,
|
|
59
|
+
overlineContent = props.overlineText?.let { { Text(text = it) } },
|
|
60
|
+
supportingContent = supportingContentSlotView?.let {
|
|
61
|
+
{
|
|
62
|
+
with(ComposableScope()) {
|
|
63
|
+
with(it) {
|
|
64
|
+
Content()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
} ?: props.supportingText?.let { { Text(text = it) } },
|
|
69
|
+
leadingContent = leadingSlotView?.let {
|
|
70
|
+
{
|
|
71
|
+
with(ComposableScope()) {
|
|
72
|
+
with(it) {
|
|
73
|
+
Content()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
trailingContent = trailingSlotView?.let {
|
|
79
|
+
{
|
|
80
|
+
with(ComposableScope()) {
|
|
81
|
+
with(it) {
|
|
82
|
+
Content()
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
colors = colors
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
|
2
|
+
|
|
3
|
+
package expo.modules.ui
|
|
4
|
+
|
|
5
|
+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
6
|
+
import androidx.compose.material3.MaterialShapes
|
|
7
|
+
import androidx.graphics.shapes.RoundedPolygon
|
|
8
|
+
import expo.modules.kotlin.types.Enumerable
|
|
9
|
+
|
|
10
|
+
enum class MaterialShapeType(val value: String) : Enumerable {
|
|
11
|
+
COOKIE_4_SIDED("cookie4Sided"),
|
|
12
|
+
COOKIE_6_SIDED("cookie6Sided"),
|
|
13
|
+
COOKIE_7_SIDED("cookie7Sided"),
|
|
14
|
+
COOKIE_9_SIDED("cookie9Sided"),
|
|
15
|
+
COOKIE_12_SIDED("cookie12Sided"),
|
|
16
|
+
|
|
17
|
+
CLOVER_4_LEAF("clover4Leaf"),
|
|
18
|
+
CLOVER_8_LEAF("clover8Leaf"),
|
|
19
|
+
|
|
20
|
+
SOFT_BURST("softBurst"),
|
|
21
|
+
BOOM("boom"),
|
|
22
|
+
|
|
23
|
+
OVAL("oval"),
|
|
24
|
+
PILL("pill"),
|
|
25
|
+
TRIANGLE("triangle"),
|
|
26
|
+
DIAMOND("diamond"),
|
|
27
|
+
PENTAGON("pentagon"),
|
|
28
|
+
SUNNY("sunny"),
|
|
29
|
+
VERY_SUNNY("verySunny"),
|
|
30
|
+
|
|
31
|
+
FAN("fan"),
|
|
32
|
+
|
|
33
|
+
PIXEL_CIRCLE("pixelCircle"),
|
|
34
|
+
PIXEL_TRIANGLE("pixelTriangle"),
|
|
35
|
+
|
|
36
|
+
GHOSTISH("ghostish"),
|
|
37
|
+
|
|
38
|
+
BUN("bun"),
|
|
39
|
+
|
|
40
|
+
HEART("heart"),
|
|
41
|
+
|
|
42
|
+
ARCH("arch"),
|
|
43
|
+
|
|
44
|
+
SLANTED("slanted"),
|
|
45
|
+
|
|
46
|
+
PUFFY("puffy"),
|
|
47
|
+
PUFFY_DIAMOND("puffyDiamond");
|
|
48
|
+
|
|
49
|
+
fun toRoundedPolygon(): RoundedPolygon = when (this) {
|
|
50
|
+
COOKIE_4_SIDED -> MaterialShapes.Cookie4Sided
|
|
51
|
+
COOKIE_6_SIDED -> MaterialShapes.Cookie6Sided
|
|
52
|
+
COOKIE_7_SIDED -> MaterialShapes.Cookie7Sided
|
|
53
|
+
COOKIE_9_SIDED -> MaterialShapes.Cookie9Sided
|
|
54
|
+
COOKIE_12_SIDED -> MaterialShapes.Cookie12Sided
|
|
55
|
+
CLOVER_4_LEAF -> MaterialShapes.Clover4Leaf
|
|
56
|
+
CLOVER_8_LEAF -> MaterialShapes.Clover8Leaf
|
|
57
|
+
SOFT_BURST -> MaterialShapes.SoftBurst
|
|
58
|
+
BOOM -> MaterialShapes.Boom
|
|
59
|
+
OVAL -> MaterialShapes.Oval
|
|
60
|
+
PILL -> MaterialShapes.Pill
|
|
61
|
+
TRIANGLE -> MaterialShapes.Triangle
|
|
62
|
+
DIAMOND -> MaterialShapes.Diamond
|
|
63
|
+
PENTAGON -> MaterialShapes.Pentagon
|
|
64
|
+
SUNNY -> MaterialShapes.Sunny
|
|
65
|
+
VERY_SUNNY -> MaterialShapes.VerySunny
|
|
66
|
+
FAN -> MaterialShapes.Fan
|
|
67
|
+
PIXEL_CIRCLE -> MaterialShapes.PixelCircle
|
|
68
|
+
PIXEL_TRIANGLE -> MaterialShapes.PixelTriangle
|
|
69
|
+
GHOSTISH -> MaterialShapes.Ghostish
|
|
70
|
+
BUN -> MaterialShapes.Bun
|
|
71
|
+
HEART -> MaterialShapes.Heart
|
|
72
|
+
ARCH -> MaterialShapes.Arch
|
|
73
|
+
SLANTED -> MaterialShapes.Slanted
|
|
74
|
+
PUFFY -> MaterialShapes.Puffy
|
|
75
|
+
PUFFY_DIAMOND -> MaterialShapes.PuffyDiamond
|
|
76
|
+
}
|
|
77
|
+
}
|