@expo/ui 55.0.0-beta.3 → 55.0.0-preview.4
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 +11 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AlertDialogView.kt +3 -4
- package/android/src/main/java/expo/modules/ui/BottomSheetView.kt +4 -3
- package/android/src/main/java/expo/modules/ui/CarouselView.kt +10 -11
- package/android/src/main/java/expo/modules/ui/ChipView.kt +20 -7
- package/android/src/main/java/expo/modules/ui/ComposeViews.kt +13 -14
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +5 -5
- package/android/src/main/java/expo/modules/ui/DividerView.kt +4 -6
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +34 -28
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +259 -194
- package/android/src/main/java/expo/modules/ui/PickerView.kt +6 -6
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +4 -5
- package/android/src/main/java/expo/modules/ui/ShapeView.kt +10 -11
- package/android/src/main/java/expo/modules/ui/SliderView.kt +4 -6
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +4 -4
- package/android/src/main/java/expo/modules/ui/TextInputView.kt +2 -2
- package/android/src/main/java/expo/modules/ui/UIBaseView.kt +15 -0
- package/android/src/main/java/expo/modules/ui/button/Button.kt +7 -7
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +7 -8
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +3 -3
- package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +4 -3
- package/build/jetpack-compose/AlertDialog/index.d.ts +3 -2
- package/build/jetpack-compose/AlertDialog/index.d.ts.map +1 -1
- package/build/jetpack-compose/Button/index.d.ts +6 -5
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts +2 -2
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +2 -1
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/IconButton/index.d.ts +2 -1
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/Picker/index.d.ts +14 -13
- package/build/jetpack-compose/Picker/index.d.ts.map +1 -1
- package/build/jetpack-compose/Shape/index.d.ts +2 -1
- package/build/jetpack-compose/Shape/index.d.ts.map +1 -1
- package/build/jetpack-compose/Slider/index.d.ts +7 -6
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +12 -12
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +0 -1
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/{modifiers.d.ts → modifiers/index.d.ts} +5 -4
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -0
- package/build/swift-ui/ContextMenu/index.d.ts +1 -1
- package/build/swift-ui/ContextMenu/types.d.ts +1 -1
- package/build/swift-ui/Host/index.d.ts +4 -4
- package/build/swift-ui/Host/index.d.ts.map +1 -1
- package/build/swift-ui/Menu/types.d.ts +1 -1
- package/build/swift-ui/index.d.ts +0 -1
- package/build/swift-ui/index.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/HostView.swift +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.module → 55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.pom → 55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-preview.4/expo.modules.ui-55.0.0-preview.4.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 +6 -2
- package/src/jetpack-compose/AlertDialog/index.tsx +3 -2
- package/src/jetpack-compose/Button/index.tsx +6 -5
- package/src/jetpack-compose/ContextMenu/index.tsx +2 -2
- package/src/jetpack-compose/DatePicker/index.tsx +2 -1
- package/src/jetpack-compose/IconButton/index.tsx +2 -1
- package/src/jetpack-compose/Picker/index.tsx +14 -13
- package/src/jetpack-compose/Shape/index.tsx +2 -1
- package/src/jetpack-compose/Slider/index.tsx +7 -6
- package/src/jetpack-compose/Switch/index.tsx +12 -12
- package/src/jetpack-compose/index.ts +0 -1
- package/src/jetpack-compose/{modifiers.ts → modifiers/index.ts} +5 -3
- package/src/swift-ui/ContextMenu/index.tsx +1 -1
- package/src/swift-ui/ContextMenu/types.ts +1 -1
- package/src/swift-ui/Host/index.tsx +6 -6
- package/src/swift-ui/Menu/types.ts +1 -1
- package/src/swift-ui/index.tsx +0 -1
- package/build/jetpack-compose/modifiers.d.ts.map +0 -1
- package/build/swift-ui/Switch/index.d.ts +0 -45
- package/build/swift-ui/Switch/index.d.ts.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.0-beta.3/expo.modules.ui-55.0.0-beta.3.pom.sha512 +0 -1
- package/src/swift-ui/Switch/index.tsx +0 -81
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,17 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 55.0.0-preview.4 — 2026-02-03
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- [iOS] Renamed `ignoreSafeAreaKeyboardInsets` to `ignoreSafeArea` on `Host` component. It now accepts `'all'` or `'keyboard'` instead of a boolean. ([#42598](https://github.com/expo/expo/pull/42598) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
18
|
+
|
|
19
|
+
### 💡 Others
|
|
20
|
+
|
|
21
|
+
- [iOS] Remove leftover `Switch` TypeScript exports from swift-ui package. Use `Toggle` instead. ([#42571](https://github.com/expo/expo/pull/42571) by [@shubh73](https://github.com/shubh73))
|
|
22
|
+
- Improved Jetpack Compose integration for Expo UI. ([#42450](https://github.com/expo/expo/pull/42450) by [@kudo](https://github.com/kudo))
|
|
23
|
+
|
|
13
24
|
## 55.0.0-beta.3 — 2026-01-27
|
|
14
25
|
|
|
15
26
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'expo.modules.ui'
|
|
15
|
-
version = '55.0.0-
|
|
15
|
+
version = '55.0.0-preview.4'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "55.0.0-
|
|
21
|
+
versionName "55.0.0-preview.4"
|
|
22
22
|
}
|
|
23
23
|
buildFeatures {
|
|
24
24
|
compose true
|
|
@@ -4,10 +4,9 @@ import androidx.compose.material3.AlertDialog
|
|
|
4
4
|
import androidx.compose.material3.Text
|
|
5
5
|
import androidx.compose.material3.TextButton
|
|
6
6
|
import androidx.compose.runtime.Composable
|
|
7
|
-
import androidx.compose.ui.Modifier
|
|
8
7
|
import expo.modules.kotlin.records.Record
|
|
9
8
|
import expo.modules.kotlin.views.ComposeProps
|
|
10
|
-
import expo.modules.kotlin.views.
|
|
9
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
11
10
|
import java.io.Serializable
|
|
12
11
|
|
|
13
12
|
open class AlertDialogButtonPressedEvent() : Record, Serializable
|
|
@@ -18,11 +17,11 @@ data class AlertDialogProps(
|
|
|
18
17
|
val confirmButtonText: String? = null,
|
|
19
18
|
val dismissButtonText: String? = null,
|
|
20
19
|
val visible: Boolean = false,
|
|
21
|
-
val modifiers:
|
|
20
|
+
val modifiers: ModifierList = emptyList()
|
|
22
21
|
) : ComposeProps
|
|
23
22
|
|
|
24
23
|
@Composable
|
|
25
|
-
fun
|
|
24
|
+
fun FunctionalComposableScope.AlertDialogContent(
|
|
26
25
|
props: AlertDialogProps,
|
|
27
26
|
onDismissPressed: (AlertDialogButtonPressedEvent) -> Unit,
|
|
28
27
|
onConfirmPressed: (AlertDialogButtonPressedEvent) -> Unit
|
|
@@ -11,7 +11,7 @@ import expo.modules.kotlin.records.Field
|
|
|
11
11
|
import expo.modules.kotlin.records.Record
|
|
12
12
|
import expo.modules.kotlin.views.ComposableScope
|
|
13
13
|
import expo.modules.kotlin.views.ComposeProps
|
|
14
|
-
import expo.modules.kotlin.views.
|
|
14
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
15
15
|
import java.io.Serializable
|
|
16
16
|
|
|
17
17
|
open class IsOpenedChangeEvent(
|
|
@@ -36,11 +36,12 @@ fun BottomSheetComposable(skipPartiallyExpanded: Boolean, isOpened: Boolean, onI
|
|
|
36
36
|
|
|
37
37
|
data class BottomSheetProps(
|
|
38
38
|
val isOpened: Boolean = false,
|
|
39
|
-
val skipPartiallyExpanded: Boolean = false
|
|
39
|
+
val skipPartiallyExpanded: Boolean = false,
|
|
40
|
+
val modifiers: ModifierList = emptyList()
|
|
40
41
|
) : ComposeProps
|
|
41
42
|
|
|
42
43
|
@Composable
|
|
43
|
-
fun
|
|
44
|
+
fun FunctionalComposableScope.BottomSheetContent(props: BottomSheetProps, onIsOpenedChange: (IsOpenedChangeEvent) -> Unit) {
|
|
44
45
|
Box {
|
|
45
46
|
BottomSheetComposable(
|
|
46
47
|
props.skipPartiallyExpanded,
|
|
@@ -5,22 +5,21 @@ package expo.modules.ui
|
|
|
5
5
|
import androidx.compose.foundation.gestures.TargetedFlingBehavior
|
|
6
6
|
import androidx.compose.foundation.layout.PaddingValues
|
|
7
7
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
8
|
+
import androidx.compose.material3.carousel.CarouselDefaults
|
|
8
9
|
import androidx.compose.material3.carousel.HorizontalMultiBrowseCarousel
|
|
9
10
|
import androidx.compose.material3.carousel.HorizontalUncontainedCarousel
|
|
10
11
|
import androidx.compose.material3.carousel.rememberCarouselState
|
|
11
|
-
import androidx.compose.material3.carousel.CarouselDefaults
|
|
12
12
|
import androidx.compose.runtime.Composable
|
|
13
|
-
import androidx.compose.ui.Modifier
|
|
14
13
|
import androidx.compose.ui.unit.dp
|
|
14
|
+
import androidx.core.view.size
|
|
15
15
|
import expo.modules.kotlin.apifeatures.EitherType
|
|
16
|
-
import expo.modules.kotlin.types.Enumerable
|
|
17
16
|
import expo.modules.kotlin.records.Field
|
|
18
17
|
import expo.modules.kotlin.records.Record
|
|
19
18
|
import expo.modules.kotlin.types.Either
|
|
20
|
-
import
|
|
21
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
22
|
-
import expo.modules.kotlin.views.ExpoViewComposableScope
|
|
19
|
+
import expo.modules.kotlin.types.Enumerable
|
|
23
20
|
import expo.modules.kotlin.views.ComposableScope
|
|
21
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
22
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
24
23
|
|
|
25
24
|
enum class CarouselVariant(val value: String) : Enumerable {
|
|
26
25
|
MULTI_BROWSE("multiBrowse"),
|
|
@@ -69,14 +68,14 @@ fun paddingValuesFromEither(either: Either<Float, PaddingValuesRecord>?): Paddin
|
|
|
69
68
|
|
|
70
69
|
data class CarouselProps(
|
|
71
70
|
val variant: CarouselVariant? = null,
|
|
72
|
-
val modifiers: List<ModifierConfig>? = null,
|
|
73
71
|
val itemSpacing: Float? = null,
|
|
74
72
|
val contentPadding: Either<Float, PaddingValuesRecord>? = null,
|
|
75
73
|
val minSmallItemWidth: Float? = null,
|
|
76
74
|
val maxSmallItemWidth: Float? = null,
|
|
77
75
|
val flingBehavior: FlingBehaviorType? = null,
|
|
78
76
|
val preferredItemWidth: Float? = null,
|
|
79
|
-
val itemWidth: Float? = null
|
|
77
|
+
val itemWidth: Float? = null,
|
|
78
|
+
val modifiers: ModifierList = emptyList()
|
|
80
79
|
) : ComposeProps
|
|
81
80
|
|
|
82
81
|
const val DEFAULT_MIN_SMALL_ITEM_WIDTH = 40f
|
|
@@ -86,7 +85,7 @@ const val DEFAULT_ITEM_WIDTH = 200f
|
|
|
86
85
|
|
|
87
86
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
88
87
|
@Composable
|
|
89
|
-
fun
|
|
88
|
+
fun FunctionalComposableScope.CarouselContent(props: CarouselProps) {
|
|
90
89
|
val variant = props.variant ?: CarouselVariant.MULTI_BROWSE
|
|
91
90
|
val modifiers = props.modifiers ?: emptyList()
|
|
92
91
|
val itemSpacing = (props.itemSpacing ?: 0f).dp
|
|
@@ -111,7 +110,7 @@ fun ExpoViewComposableScope.CarouselContent(props: CarouselProps) {
|
|
|
111
110
|
HorizontalMultiBrowseCarousel(
|
|
112
111
|
state = carouselState,
|
|
113
112
|
preferredItemWidth = preferredItemWidth,
|
|
114
|
-
modifier = ModifierRegistry.applyModifiers(modifiers),
|
|
113
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope),
|
|
115
114
|
itemSpacing = itemSpacing,
|
|
116
115
|
flingBehavior = flingBehavior,
|
|
117
116
|
minSmallItemWidth = minSmallItemWidth,
|
|
@@ -127,7 +126,7 @@ fun ExpoViewComposableScope.CarouselContent(props: CarouselProps) {
|
|
|
127
126
|
HorizontalUncontainedCarousel(
|
|
128
127
|
state = carouselState,
|
|
129
128
|
itemWidth = itemWidth,
|
|
130
|
-
modifier = ModifierRegistry.applyModifiers(modifiers),
|
|
129
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope),
|
|
131
130
|
itemSpacing = itemSpacing,
|
|
132
131
|
flingBehavior = flingBehavior,
|
|
133
132
|
contentPadding = contentPadding
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
package expo.modules.ui
|
|
2
2
|
|
|
3
|
-
import androidx.compose.foundation.layout
|
|
4
|
-
import androidx.compose.
|
|
5
|
-
import androidx.compose.
|
|
3
|
+
import androidx.compose.foundation.layout.Box
|
|
4
|
+
import androidx.compose.foundation.layout.padding
|
|
5
|
+
import androidx.compose.foundation.layout.size
|
|
6
|
+
import androidx.compose.foundation.layout.wrapContentSize
|
|
7
|
+
import androidx.compose.material3.AssistChip
|
|
8
|
+
import androidx.compose.material3.AssistChipDefaults
|
|
9
|
+
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
10
|
+
import androidx.compose.material3.FilterChip
|
|
11
|
+
import androidx.compose.material3.FilterChipDefaults
|
|
12
|
+
import androidx.compose.material3.Icon
|
|
13
|
+
import androidx.compose.material3.InputChip
|
|
14
|
+
import androidx.compose.material3.MaterialTheme
|
|
15
|
+
import androidx.compose.material3.SuggestionChip
|
|
16
|
+
import androidx.compose.material3.Text
|
|
17
|
+
import androidx.compose.runtime.Composable
|
|
6
18
|
import androidx.compose.ui.Alignment
|
|
7
19
|
import androidx.compose.ui.Modifier
|
|
8
20
|
import androidx.compose.ui.graphics.Color
|
|
@@ -10,7 +22,7 @@ import androidx.compose.ui.text.style.TextAlign
|
|
|
10
22
|
import androidx.compose.ui.unit.dp
|
|
11
23
|
import expo.modules.kotlin.records.Record
|
|
12
24
|
import expo.modules.kotlin.views.ComposeProps
|
|
13
|
-
import expo.modules.kotlin.views.
|
|
25
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
14
26
|
import java.io.Serializable
|
|
15
27
|
|
|
16
28
|
open class ChipPressedEvent : Record, Serializable
|
|
@@ -23,12 +35,13 @@ data class ChipProps(
|
|
|
23
35
|
val iconSize: Int = 18,
|
|
24
36
|
val textStyle: String = "labelSmall",
|
|
25
37
|
val enabled: Boolean = true,
|
|
26
|
-
val selected: Boolean = false
|
|
38
|
+
val selected: Boolean = false,
|
|
39
|
+
val modifiers: ModifierList = emptyList()
|
|
27
40
|
) : ComposeProps
|
|
28
41
|
|
|
29
42
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
30
43
|
@Composable
|
|
31
|
-
fun
|
|
44
|
+
fun FunctionalComposableScope.ChipContent(
|
|
32
45
|
props: ChipProps,
|
|
33
46
|
onPress: (ChipPressedEvent) -> Unit,
|
|
34
47
|
onDismiss: (ChipPressedEvent) -> Unit
|
|
@@ -133,7 +146,7 @@ fun ExpoViewComposableScope.ChipContent(
|
|
|
133
146
|
@Composable
|
|
134
147
|
private fun ChipText(label: String, textStyle: String = "labelSmall") {
|
|
135
148
|
Box(
|
|
136
|
-
contentAlignment = Alignment.Center
|
|
149
|
+
contentAlignment = Alignment.Center
|
|
137
150
|
) {
|
|
138
151
|
Text(
|
|
139
152
|
text = label,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
package expo.modules.ui
|
|
2
2
|
|
|
3
|
-
import android.graphics.Color as AndroidColor
|
|
4
3
|
import androidx.compose.foundation.layout.Arrangement
|
|
5
4
|
import androidx.compose.foundation.layout.Box
|
|
6
5
|
import androidx.compose.foundation.layout.Column
|
|
@@ -8,15 +7,15 @@ import androidx.compose.foundation.layout.Row
|
|
|
8
7
|
import androidx.compose.material3.Text
|
|
9
8
|
import androidx.compose.runtime.Composable
|
|
10
9
|
import androidx.compose.ui.Alignment
|
|
11
|
-
import androidx.compose.ui.Modifier
|
|
12
10
|
import androidx.compose.ui.text.TextStyle
|
|
13
11
|
import androidx.compose.ui.text.font.FontWeight
|
|
14
12
|
import androidx.compose.ui.unit.sp
|
|
15
13
|
import expo.modules.kotlin.types.Enumerable
|
|
16
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
17
14
|
import expo.modules.kotlin.views.ComposableScope
|
|
18
|
-
import expo.modules.kotlin.views.
|
|
15
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
16
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
19
17
|
import expo.modules.kotlin.views.with
|
|
18
|
+
import android.graphics.Color as AndroidColor
|
|
20
19
|
|
|
21
20
|
enum class HorizontalArrangement(val value: String) : Enumerable {
|
|
22
21
|
START("start"),
|
|
@@ -91,35 +90,35 @@ data class LayoutProps(
|
|
|
91
90
|
val verticalArrangement: VerticalArrangement = VerticalArrangement.TOP,
|
|
92
91
|
val horizontalAlignment: HorizontalAlignment = HorizontalAlignment.START,
|
|
93
92
|
val verticalAlignment: VerticalAlignment = VerticalAlignment.TOP,
|
|
94
|
-
val modifiers:
|
|
93
|
+
val modifiers: ModifierList = emptyList()
|
|
95
94
|
) : ComposeProps
|
|
96
95
|
|
|
97
96
|
@Composable
|
|
98
|
-
fun
|
|
97
|
+
internal fun FunctionalComposableScope.RowContent(props: LayoutProps) {
|
|
99
98
|
Row(
|
|
100
99
|
horizontalArrangement = props.horizontalArrangement.toComposeArrangement(),
|
|
101
100
|
verticalAlignment = props.verticalAlignment.toComposeAlignment(),
|
|
102
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers)
|
|
101
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope)
|
|
103
102
|
) {
|
|
104
103
|
Children(ComposableScope().with(rowScope = this@Row))
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
@Composable
|
|
109
|
-
fun
|
|
108
|
+
internal fun FunctionalComposableScope.ColumnContent(props: LayoutProps) {
|
|
110
109
|
Column(
|
|
111
110
|
verticalArrangement = props.verticalArrangement.toComposeArrangement(),
|
|
112
111
|
horizontalAlignment = props.horizontalAlignment.toComposeAlignment(),
|
|
113
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers)
|
|
112
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope)
|
|
114
113
|
) {
|
|
115
114
|
Children(ComposableScope().with(columnScope = this@Column))
|
|
116
115
|
}
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
@Composable
|
|
120
|
-
fun
|
|
119
|
+
fun FunctionalComposableScope.BoxContent(props: LayoutProps) {
|
|
121
120
|
Box(
|
|
122
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers)
|
|
121
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope)
|
|
123
122
|
) {
|
|
124
123
|
Children(ComposableScope().with(boxScope = this@Box))
|
|
125
124
|
}
|
|
@@ -160,14 +159,14 @@ data class TextProps(
|
|
|
160
159
|
val color: AndroidColor? = null,
|
|
161
160
|
val fontSize: Float = 16f,
|
|
162
161
|
val fontWeight: TextFontWeight = TextFontWeight.NORMAL,
|
|
163
|
-
val modifiers:
|
|
162
|
+
val modifiers: ModifierList = emptyList()
|
|
164
163
|
) : ComposeProps
|
|
165
164
|
|
|
166
165
|
@Composable
|
|
167
|
-
fun
|
|
166
|
+
fun FunctionalComposableScope.TextContent(props: TextProps) {
|
|
168
167
|
Text(
|
|
169
168
|
text = props.text,
|
|
170
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers),
|
|
169
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope),
|
|
171
170
|
color = colorToComposeColor(props.color),
|
|
172
171
|
style = TextStyle(
|
|
173
172
|
fontSize = props.fontSize.sp,
|
|
@@ -18,7 +18,7 @@ import expo.modules.kotlin.records.Field
|
|
|
18
18
|
import expo.modules.kotlin.records.Record
|
|
19
19
|
import expo.modules.kotlin.types.Enumerable
|
|
20
20
|
import expo.modules.kotlin.views.ComposeProps
|
|
21
|
-
import expo.modules.kotlin.views.
|
|
21
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
22
22
|
import java.util.Calendar
|
|
23
23
|
import java.util.Date
|
|
24
24
|
import android.graphics.Color as AndroidColor
|
|
@@ -55,18 +55,18 @@ data class DateTimePickerProps(
|
|
|
55
55
|
val showVariantToggle: Boolean = true,
|
|
56
56
|
val is24Hour: Boolean = true,
|
|
57
57
|
val color: AndroidColor? = null,
|
|
58
|
-
val modifiers:
|
|
58
|
+
val modifiers: ModifierList = emptyList()
|
|
59
59
|
) : ComposeProps
|
|
60
60
|
|
|
61
61
|
@OptIn(ExperimentalMaterial3Api::class)
|
|
62
62
|
@Composable
|
|
63
|
-
fun
|
|
63
|
+
fun FunctionalComposableScope.DateTimePickerContent(props: DateTimePickerProps, onDateSelected: (DatePickerResult) -> Unit) {
|
|
64
64
|
if (props.displayedComponents == DisplayedComponents.HOUR_AND_MINUTE) {
|
|
65
|
-
ExpoTimePicker(props = props, modifier = ModifierRegistry.applyModifiers(props.modifiers)) {
|
|
65
|
+
ExpoTimePicker(props = props, modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope)) {
|
|
66
66
|
onDateSelected(it)
|
|
67
67
|
}
|
|
68
68
|
} else {
|
|
69
|
-
ExpoDatePicker(props = props, modifier = ModifierRegistry.applyModifiers(props.modifiers)) {
|
|
69
|
+
ExpoDatePicker(props = props, modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope)) {
|
|
70
70
|
onDateSelected(it)
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -2,16 +2,14 @@ package expo.modules.ui
|
|
|
2
2
|
|
|
3
3
|
import androidx.compose.material3.HorizontalDivider
|
|
4
4
|
import androidx.compose.runtime.Composable
|
|
5
|
-
import androidx.compose.ui.Modifier
|
|
6
5
|
import expo.modules.kotlin.views.ComposeProps
|
|
7
|
-
import expo.modules.kotlin.views.
|
|
6
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
8
7
|
|
|
9
8
|
data class DividerProps(
|
|
10
|
-
val modifiers:
|
|
9
|
+
val modifiers: ModifierList = emptyList()
|
|
11
10
|
) : ComposeProps
|
|
12
11
|
|
|
13
12
|
@Composable
|
|
14
|
-
fun
|
|
15
|
-
HorizontalDivider(modifier = ModifierRegistry.applyModifiers(props.modifiers))
|
|
13
|
+
fun FunctionalComposableScope.DividerContent(props: DividerProps) {
|
|
14
|
+
HorizontalDivider(modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope))
|
|
16
15
|
}
|
|
17
|
-
|
|
@@ -3,7 +3,6 @@ package expo.modules.ui
|
|
|
3
3
|
import androidx.compose.runtime.remember
|
|
4
4
|
import expo.modules.kotlin.modules.Module
|
|
5
5
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
6
|
-
import expo.modules.kotlin.viewevent.EventDispatcher
|
|
7
6
|
import expo.modules.kotlin.viewevent.getValue
|
|
8
7
|
import expo.modules.ui.button.ButtonContent
|
|
9
8
|
import expo.modules.ui.button.ButtonPressedEvent
|
|
@@ -20,7 +19,21 @@ class ExpoUIModule : Module() {
|
|
|
20
19
|
override fun definition() = ModuleDefinition {
|
|
21
20
|
Name("ExpoUI")
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
//region Views use expo-modules-core DSL for uncommon features
|
|
23
|
+
|
|
24
|
+
View(HostView::class) {
|
|
25
|
+
Events("onLayoutContent")
|
|
26
|
+
|
|
27
|
+
OnViewDidUpdateProps { view ->
|
|
28
|
+
view.onViewDidUpdateProps()
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//endregion Views use expo-modules-core DSL for uncommon features
|
|
33
|
+
|
|
34
|
+
//region Expo UI views
|
|
35
|
+
|
|
36
|
+
ExpoUIView("BottomSheetView", events = {
|
|
24
37
|
Events("onIsOpenedChange")
|
|
25
38
|
}) { props: BottomSheetProps ->
|
|
26
39
|
val onIsOpenedChange by remember { EventDispatcher<IsOpenedChangeEvent>() }
|
|
@@ -28,56 +41,56 @@ class ExpoUIModule : Module() {
|
|
|
28
41
|
}
|
|
29
42
|
|
|
30
43
|
// Defines a single view for now – a single choice segmented control
|
|
31
|
-
|
|
44
|
+
ExpoUIView("PickerView", events = {
|
|
32
45
|
Events("onOptionSelected")
|
|
33
46
|
}) { props: PickerProps ->
|
|
34
47
|
val onOptionSelected by remember { EventDispatcher<PickerOptionSelectedEvent>() }
|
|
35
48
|
PickerContent(props) { onOptionSelected(it) }
|
|
36
49
|
}
|
|
37
50
|
|
|
38
|
-
|
|
51
|
+
ExpoUIView("SwitchView", events = {
|
|
39
52
|
Events("onValueChange")
|
|
40
53
|
}) { props: SwitchProps ->
|
|
41
54
|
val onValueChange by remember { EventDispatcher<ValueChangeEvent>() }
|
|
42
55
|
SwitchContent(props) { onValueChange(it) }
|
|
43
56
|
}
|
|
44
57
|
|
|
45
|
-
|
|
58
|
+
ExpoUIView("Button", events = {
|
|
46
59
|
Events("onButtonPressed")
|
|
47
60
|
}) { props: ButtonProps ->
|
|
48
61
|
val onButtonPressed by remember { EventDispatcher<ButtonPressedEvent>() }
|
|
49
62
|
ButtonContent(props) { onButtonPressed(it) }
|
|
50
63
|
}
|
|
51
64
|
|
|
52
|
-
|
|
65
|
+
ExpoUIView("IconButton", events = {
|
|
53
66
|
Events("onButtonPressed")
|
|
54
67
|
}) { props: IconButtonProps ->
|
|
55
68
|
val onButtonPressed by remember { EventDispatcher<ButtonPressedEvent>() }
|
|
56
69
|
IconButtonContent(props) { onButtonPressed(it) }
|
|
57
70
|
}
|
|
58
71
|
|
|
59
|
-
|
|
72
|
+
ExpoUIView("SliderView", events = {
|
|
60
73
|
Events("onValueChanged")
|
|
61
74
|
}) { props: SliderProps ->
|
|
62
75
|
SliderContent(props)
|
|
63
76
|
}
|
|
64
77
|
|
|
65
|
-
|
|
78
|
+
ExpoUIView("ShapeView") { props: ShapeProps ->
|
|
66
79
|
ShapeContent(props)
|
|
67
80
|
}
|
|
68
81
|
|
|
69
|
-
|
|
82
|
+
ExpoUIView("DividerView") { props: DividerProps ->
|
|
70
83
|
DividerContent(props)
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
|
|
86
|
+
ExpoUIView("DateTimePickerView", events = {
|
|
74
87
|
Events("onDateSelected")
|
|
75
88
|
}) { props: DateTimePickerProps ->
|
|
76
89
|
val onDateSelected by remember { EventDispatcher<DatePickerResult>() }
|
|
77
90
|
DateTimePickerContent(props) { onDateSelected(it) }
|
|
78
91
|
}
|
|
79
92
|
|
|
80
|
-
|
|
93
|
+
ExpoUIView("ContextMenuView", events = {
|
|
81
94
|
Events(
|
|
82
95
|
"onContextMenuButtonPressed",
|
|
83
96
|
"onContextMenuSwitchValueChanged",
|
|
@@ -95,7 +108,7 @@ class ExpoUIModule : Module() {
|
|
|
95
108
|
)
|
|
96
109
|
}
|
|
97
110
|
|
|
98
|
-
|
|
111
|
+
ExpoUIView("ProgressView") { props: ProgressProps ->
|
|
99
112
|
ProgressContent(props)
|
|
100
113
|
}
|
|
101
114
|
|
|
@@ -111,36 +124,27 @@ class ExpoUIModule : Module() {
|
|
|
111
124
|
}
|
|
112
125
|
}
|
|
113
126
|
|
|
114
|
-
|
|
127
|
+
ExpoUIView("BoxView") { props: LayoutProps ->
|
|
115
128
|
BoxContent(props)
|
|
116
129
|
}
|
|
117
130
|
|
|
118
|
-
|
|
131
|
+
ExpoUIView("RowView") { props: LayoutProps ->
|
|
119
132
|
RowContent(props)
|
|
120
133
|
}
|
|
121
134
|
|
|
122
|
-
|
|
135
|
+
ExpoUIView("ColumnView") { props: LayoutProps ->
|
|
123
136
|
ColumnContent(props)
|
|
124
137
|
}
|
|
125
138
|
|
|
126
|
-
|
|
127
|
-
View(HostView::class) {
|
|
128
|
-
Events("onLayoutContent")
|
|
129
|
-
|
|
130
|
-
OnViewDidUpdateProps { view ->
|
|
131
|
-
view.onViewDidUpdateProps()
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
View("TextView") { props: TextProps ->
|
|
139
|
+
ExpoUIView("TextView") { props: TextProps ->
|
|
136
140
|
TextContent(props)
|
|
137
141
|
}
|
|
138
142
|
|
|
139
|
-
|
|
143
|
+
ExpoUIView("CarouselView") { props: CarouselProps ->
|
|
140
144
|
CarouselContent(props)
|
|
141
145
|
}
|
|
142
146
|
|
|
143
|
-
|
|
147
|
+
ExpoUIView("AlertDialogView", events = {
|
|
144
148
|
Events(
|
|
145
149
|
"onDismissPressed",
|
|
146
150
|
"onConfirmPressed"
|
|
@@ -155,7 +159,7 @@ class ExpoUIModule : Module() {
|
|
|
155
159
|
)
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
|
|
162
|
+
ExpoUIView("ChipView", events = {
|
|
159
163
|
Events(
|
|
160
164
|
"onPress",
|
|
161
165
|
"onDismiss"
|
|
@@ -165,5 +169,7 @@ class ExpoUIModule : Module() {
|
|
|
165
169
|
val onDismiss by remember { EventDispatcher<ChipPressedEvent>() }
|
|
166
170
|
ChipContent(props, { onPress(it) }, { onDismiss(it) })
|
|
167
171
|
}
|
|
172
|
+
|
|
173
|
+
//endregion Expo UI views
|
|
168
174
|
}
|
|
169
175
|
}
|