@expo/ui 56.0.8 → 56.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +38 -1
- package/android/src/main/java/expo/modules/ui/LoadingView.kt +80 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +31 -3
- package/android/src/main/java/expo/modules/ui/SnackbarView.kt +126 -0
- package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +10 -0
- package/assets/keyboard_arrow_down.xml +10 -0
- package/build/State/useNativeState.d.ts +32 -3
- package/build/State/useNativeState.d.ts.map +1 -1
- package/build/community/bottom-sheet/BottomSheet.ios.d.ts.map +1 -1
- package/build/jetpack-compose/LoadingIndicator/index.d.ts +41 -0
- package/build/jetpack-compose/LoadingIndicator/index.d.ts.map +1 -0
- package/build/jetpack-compose/Snackbar/index.d.ts +94 -0
- package/build/jetpack-compose/Snackbar/index.d.ts.map +1 -0
- package/build/jetpack-compose/index.d.ts +2 -0
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +6 -2
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/BottomSheet/index.d.ts +5 -1
- package/build/swift-ui/BottomSheet/index.d.ts.map +1 -1
- package/build/swift-ui/index.d.ts +1 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/withAnimation.d.ts +26 -0
- package/build/swift-ui/withAnimation.d.ts.map +1 -0
- package/build/universal/BottomSheet/index.android.d.ts +1 -1
- package/build/universal/BottomSheet/index.android.d.ts.map +1 -1
- package/build/universal/BottomSheet/index.d.ts +1 -1
- package/build/universal/BottomSheet/index.d.ts.map +1 -1
- package/build/universal/BottomSheet/index.ios.d.ts +1 -1
- package/build/universal/BottomSheet/index.ios.d.ts.map +1 -1
- package/build/universal/BottomSheet/types.d.ts +27 -0
- package/build/universal/BottomSheet/types.d.ts.map +1 -1
- package/build/universal/Collapsible/index.android.d.ts +8 -0
- package/build/universal/Collapsible/index.android.d.ts.map +1 -0
- package/build/universal/Collapsible/index.d.ts +8 -0
- package/build/universal/Collapsible/index.d.ts.map +1 -0
- package/build/universal/Collapsible/index.ios.d.ts +7 -0
- package/build/universal/Collapsible/index.ios.d.ts.map +1 -0
- package/build/universal/Collapsible/types.d.ts +23 -0
- package/build/universal/Collapsible/types.d.ts.map +1 -0
- package/build/universal/Column/index.d.ts.map +1 -1
- package/build/universal/Host/index.d.ts +5 -18
- package/build/universal/Host/index.d.ts.map +1 -1
- package/build/universal/Host/types.d.ts +72 -0
- package/build/universal/Host/types.d.ts.map +1 -0
- package/build/universal/List/index.android.d.ts +9 -0
- package/build/universal/List/index.android.d.ts.map +1 -0
- package/build/universal/List/index.d.ts +8 -0
- package/build/universal/List/index.d.ts.map +1 -0
- package/build/universal/List/index.ios.d.ts +8 -0
- package/build/universal/List/index.ios.d.ts.map +1 -0
- package/build/universal/List/types.d.ts +26 -0
- package/build/universal/List/types.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.android.d.ts +8 -0
- package/build/universal/ListItem/ListItem.android.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.d.ts +9 -0
- package/build/universal/ListItem/ListItem.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.ios.d.ts +8 -0
- package/build/universal/ListItem/ListItem.ios.d.ts.map +1 -0
- package/build/universal/ListItem/ListItemSlots.d.ts +21 -0
- package/build/universal/ListItem/ListItemSlots.d.ts.map +1 -0
- package/build/universal/ListItem/index.d.ts +10 -0
- package/build/universal/ListItem/index.d.ts.map +1 -0
- package/build/universal/ListItem/types.d.ts +59 -0
- package/build/universal/ListItem/types.d.ts.map +1 -0
- package/build/universal/Picker/Picker.android.d.ts +9 -0
- package/build/universal/Picker/Picker.android.d.ts.map +1 -0
- package/build/universal/Picker/Picker.d.ts +8 -0
- package/build/universal/Picker/Picker.d.ts.map +1 -0
- package/build/universal/Picker/Picker.ios.d.ts +9 -0
- package/build/universal/Picker/Picker.ios.d.ts.map +1 -0
- package/build/universal/Picker/PickerItem.d.ts +9 -0
- package/build/universal/Picker/PickerItem.d.ts.map +1 -0
- package/build/universal/Picker/index.d.ts +8 -0
- package/build/universal/Picker/index.d.ts.map +1 -0
- package/build/universal/Picker/types.d.ts +69 -0
- package/build/universal/Picker/types.d.ts.map +1 -0
- package/build/universal/index.d.ts +4 -0
- package/build/universal/index.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +4 -1
- package/ios/ExpoUIModule.swift +41 -1
- package/ios/Modifiers/AnimationConfig.swift +109 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +1 -112
- package/ios/State/ObservableState.swift +12 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8-sources.jar → 56.0.9/expo.modules.ui-56.0.9-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8.module → 56.0.9/expo.modules.ui-56.0.9.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8.pom → 56.0.9/expo.modules.ui-56.0.9.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.9/expo.modules.ui-56.0.9.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 +3 -3
- package/src/State/useNativeState.ts +70 -10
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +0 -17
- package/src/jetpack-compose/LoadingIndicator/index.tsx +92 -0
- package/src/jetpack-compose/Snackbar/index.tsx +135 -0
- package/src/jetpack-compose/index.ts +2 -0
- package/src/jetpack-compose/modifiers/index.ts +5 -2
- package/src/swift-ui/BottomSheet/index.tsx +32 -15
- package/src/swift-ui/index.tsx +1 -0
- package/src/swift-ui/withAnimation.ts +71 -0
- package/src/ts-declarations/react-native-web.d.ts +7 -0
- package/src/universal/BottomSheet/index.android.tsx +27 -3
- package/src/universal/BottomSheet/index.ios.tsx +30 -12
- package/src/universal/BottomSheet/index.tsx +46 -4
- package/src/universal/BottomSheet/types.ts +25 -0
- package/src/universal/Collapsible/index.android.tsx +72 -0
- package/src/universal/Collapsible/index.ios.tsx +16 -0
- package/src/universal/Collapsible/index.tsx +58 -0
- package/src/universal/Collapsible/types.ts +25 -0
- package/src/universal/Column/index.tsx +3 -1
- package/src/universal/Host/index.tsx +9 -10
- package/src/universal/Host/types.ts +70 -0
- package/src/universal/List/index.android.tsx +44 -0
- package/src/universal/List/index.ios.tsx +19 -0
- package/src/universal/List/index.tsx +26 -0
- package/src/universal/List/types.ts +28 -0
- package/src/universal/ListItem/ListItem.android.tsx +52 -0
- package/src/universal/ListItem/ListItem.ios.tsx +58 -0
- package/src/universal/ListItem/ListItem.tsx +72 -0
- package/src/universal/ListItem/ListItemSlots.tsx +66 -0
- package/src/universal/ListItem/index.ts +15 -0
- package/src/universal/ListItem/types.ts +67 -0
- package/src/universal/Picker/Picker.android.tsx +69 -0
- package/src/universal/Picker/Picker.ios.tsx +45 -0
- package/src/universal/Picker/Picker.tsx +52 -0
- package/src/universal/Picker/PickerItem.tsx +27 -0
- package/src/universal/Picker/index.ts +11 -0
- package/src/universal/Picker/types.ts +79 -0
- package/src/universal/index.ts +4 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha512 +0 -1
- package/src/community/bottom-sheet/CLAUDE.md +0 -55
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.9 — 2026-05-19
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- [iOS][android] Added `onChange` listener to `useNativeState`. ([#45961](https://github.com/expo/expo/pull/45961) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
18
|
+
- Allow writing to native state from the JS thread. ([#45901](https://github.com/expo/expo/pull/45901) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
19
|
+
- [iOS] Added `withAnimation(animation, body)` in `@expo/ui/swift-ui`, mirroring SwiftUI's [`withAnimation(_:_:)`](<https://developer.apple.com/documentation/swiftui/withanimation(_:_:)>). ([#45893](https://github.com/expo/expo/pull/45893) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
20
|
+
- [jetpack-compose] Added `Snackbar` component. ([#45667](https://github.com/expo/expo/pull/45667) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
21
|
+
- [android] Added `LoadingIndicator` and `ContainedLoadingIndicator` components. ([#41169](https://github.com/expo/expo/pull/41169) by [@suveshmoza](https://github.com/suveshmoza))
|
|
22
|
+
|
|
23
|
+
### 🐛 Bug fixes
|
|
24
|
+
|
|
25
|
+
- [iOS] Unmount `BottomSheet` when it is dismissed. ([#45846](https://github.com/expo/expo/pull/45846) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
26
|
+
|
|
27
|
+
### 💡 Others
|
|
28
|
+
|
|
29
|
+
- [universal] Add base styling to universal Picker on web ([#45932](https://github.com/expo/expo/pull/45932) by [@zoontek](https://github.com/zoontek))
|
|
30
|
+
|
|
13
31
|
## 56.0.8 — 2026-05-15
|
|
14
32
|
|
|
15
33
|
### 🎉 New features
|
|
@@ -34,6 +52,9 @@ _This version does not introduce any user-facing changes._
|
|
|
34
52
|
- Make `ChartView` public. ([#45674](https://github.com/expo/expo/pull/45674) by [@jakex7](https://github.com/jakex7))
|
|
35
53
|
- Added `@expo/ui/community/menu`, a drop-in replacement for `@react-native-menu/menu`. ([#45670](https://github.com/expo/expo/pull/45670) by [@vonovak](https://github.com/vonovak))
|
|
36
54
|
- [android] Added Compose `combinedClickable` modifier. ([#45670](https://github.com/expo/expo/pull/45670) by [@vonovak](https://github.com/vonovak))
|
|
55
|
+
- [universal] Added `Collapsible`, `List`, `ListItem`, and `Picker` components. ([#45754](https://github.com/expo/expo/pull/45754) by [@kudo](https://github.com/kudo))
|
|
56
|
+
- [universal] Added `snapPoints` prop on `BottomSheet` and `colorScheme` / `layoutDirection` props on `Host`. ([#45754](https://github.com/expo/expo/pull/45754) by [@kudo](https://github.com/kudo))
|
|
57
|
+
- [jetpack-compose] `background(color, { animationSpec })` accepts an optional `animationSpec` and wraps the color in `animateColorAsState` so changes between renders animate smoothly. ([#45754](https://github.com/expo/expo/pull/45754) by [@kudo](https://github.com/kudo))
|
|
37
58
|
|
|
38
59
|
### 🐛 Bug fixes
|
|
39
60
|
|
|
@@ -333,7 +354,7 @@ _This version does not introduce any user-facing changes._
|
|
|
333
354
|
|
|
334
355
|
- [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))
|
|
335
356
|
- Improved Jetpack Compose integration for Expo UI. ([#42450](https://github.com/expo/expo/pull/42450) by [@kudo](https://github.com/kudo))
|
|
336
|
-
- [iOS] Added `contentShape` modifier for SwiftUI ([#42813](https://github.com/expo/expo
|
|
357
|
+
- [iOS] Added `contentShape` modifier for SwiftUI ([#42813](https://github.com/expo/expo/pull/42813) by [@sam-shubham](https://github.com/sam-shubham))
|
|
337
358
|
|
|
338
359
|
## 55.0.0-beta.3 — 2026-01-27
|
|
339
360
|
|
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 = '56.0.
|
|
15
|
+
version = '56.0.9'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "56.0.
|
|
21
|
+
versionName "56.0.9"
|
|
22
22
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
23
23
|
}
|
|
24
24
|
buildFeatures {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
package expo.modules.ui
|
|
4
4
|
|
|
5
|
+
import android.os.Looper
|
|
5
6
|
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
6
7
|
import androidx.compose.material3.SwitchDefaults
|
|
7
8
|
import androidx.compose.material3.ToggleButtonDefaults
|
|
@@ -39,6 +40,7 @@ import expo.modules.ui.menu.ExposedDropdownMenuBoxContent
|
|
|
39
40
|
import expo.modules.ui.menu.ExposedDropdownMenuBoxProps
|
|
40
41
|
import expo.modules.ui.menu.ExposedDropdownMenuContent
|
|
41
42
|
import expo.modules.ui.menu.ExposedDropdownMenuProps
|
|
43
|
+
import kotlinx.coroutines.launch
|
|
42
44
|
import okhttp3.OkHttpClient
|
|
43
45
|
|
|
44
46
|
class ExpoUIModule : Module() {
|
|
@@ -79,7 +81,20 @@ class ExpoUIModule : Module() {
|
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
Function("setValue") { state: ObservableState, wrapper: Map<String, Any?> ->
|
|
82
|
-
|
|
84
|
+
val newValue = wrapper["value"]
|
|
85
|
+
val mainLooper = Looper.getMainLooper()
|
|
86
|
+
// Update state on the UI thread
|
|
87
|
+
if (mainLooper.isCurrentThread) {
|
|
88
|
+
state.value = newValue
|
|
89
|
+
} else {
|
|
90
|
+
appContext.mainQueue.launch {
|
|
91
|
+
state.value = newValue
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
Function("setOnChange") { state: ObservableState, callback: WorkletCallback? ->
|
|
97
|
+
state.onChange = callback
|
|
83
98
|
}
|
|
84
99
|
}
|
|
85
100
|
|
|
@@ -139,6 +154,8 @@ class ExpoUIModule : Module() {
|
|
|
139
154
|
// Class-based views so TooltipBoxView can detect them by type via findChildOfType
|
|
140
155
|
View(PlainTooltipView::class)
|
|
141
156
|
View(RichTooltipView::class)
|
|
157
|
+
// Class-based view so SnackbarHostView can read its styling via findChildOfType
|
|
158
|
+
View(SnackbarView::class)
|
|
142
159
|
|
|
143
160
|
//endregion Views use expo-modules-core DSL for uncommon features
|
|
144
161
|
|
|
@@ -340,6 +357,18 @@ class ExpoUIModule : Module() {
|
|
|
340
357
|
}
|
|
341
358
|
}
|
|
342
359
|
|
|
360
|
+
ExpoUIView<LoadingIndicatorProps>("LoadingIndicatorView") {
|
|
361
|
+
Content { props ->
|
|
362
|
+
LoadingIndicatorContent(props)
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
ExpoUIView<ContainedLoadingIndicatorProps>("ContainedLoadingIndicatorView") {
|
|
367
|
+
Content { props ->
|
|
368
|
+
ContainedLoadingIndicatorContent(props)
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
343
372
|
ExpoUIView<LinearProgressIndicatorProps>("LinearProgressIndicatorView") {
|
|
344
373
|
Content { props ->
|
|
345
374
|
LinearProgressIndicatorContent(props)
|
|
@@ -596,6 +625,14 @@ class ExpoUIModule : Module() {
|
|
|
596
625
|
}
|
|
597
626
|
}
|
|
598
627
|
|
|
628
|
+
ExpoUIView<SnackbarHostProps>("SnackbarHostView") {
|
|
629
|
+
val showSnackbar by AsyncFunction<SnackbarShowOptions>()
|
|
630
|
+
|
|
631
|
+
Content { props ->
|
|
632
|
+
SnackbarHostContent(props, showSnackbar)
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
599
636
|
ExpoUIView<TooltipBoxViewProps>("TooltipBoxView") {
|
|
600
637
|
val show by AsyncFunction()
|
|
601
638
|
val dismiss by AsyncFunction()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3ExpressiveApi::class)
|
|
2
|
+
|
|
3
|
+
package expo.modules.ui
|
|
4
|
+
|
|
5
|
+
import android.graphics.Color
|
|
6
|
+
import androidx.compose.material3.ContainedLoadingIndicator
|
|
7
|
+
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
8
|
+
import androidx.compose.material3.LoadingIndicator
|
|
9
|
+
import androidx.compose.material3.LoadingIndicatorDefaults
|
|
10
|
+
import androidx.compose.runtime.Composable
|
|
11
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
12
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
13
|
+
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
14
|
+
import expo.modules.ui.state.ObservableState
|
|
15
|
+
|
|
16
|
+
// region LoadingIndicator
|
|
17
|
+
|
|
18
|
+
@OptimizedComposeProps
|
|
19
|
+
data class LoadingIndicatorProps(
|
|
20
|
+
val progress: ObservableState? = null,
|
|
21
|
+
val color: Color? = null,
|
|
22
|
+
val modifiers: ModifierList = emptyList()
|
|
23
|
+
) : ComposeProps
|
|
24
|
+
|
|
25
|
+
@Composable
|
|
26
|
+
fun FunctionalComposableScope.LoadingIndicatorContent(props: LoadingIndicatorProps) {
|
|
27
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
28
|
+
val indicatorColor = props.color.composeOrNull ?: LoadingIndicatorDefaults.indicatorColor
|
|
29
|
+
|
|
30
|
+
val progressState = props.progress
|
|
31
|
+
if (progressState != null) {
|
|
32
|
+
LoadingIndicator(
|
|
33
|
+
progress = { (progressState.value as? Number)?.toFloat() ?: 0f },
|
|
34
|
+
modifier = modifier,
|
|
35
|
+
color = indicatorColor
|
|
36
|
+
)
|
|
37
|
+
} else {
|
|
38
|
+
LoadingIndicator(
|
|
39
|
+
modifier = modifier,
|
|
40
|
+
color = indicatorColor
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// endregion
|
|
46
|
+
|
|
47
|
+
// region ContainedLoadingIndicator
|
|
48
|
+
|
|
49
|
+
@OptimizedComposeProps
|
|
50
|
+
data class ContainedLoadingIndicatorProps(
|
|
51
|
+
val progress: ObservableState? = null,
|
|
52
|
+
val color: Color? = null,
|
|
53
|
+
val containerColor: Color? = null,
|
|
54
|
+
val modifiers: ModifierList = emptyList()
|
|
55
|
+
) : ComposeProps
|
|
56
|
+
|
|
57
|
+
@Composable
|
|
58
|
+
fun FunctionalComposableScope.ContainedLoadingIndicatorContent(props: ContainedLoadingIndicatorProps) {
|
|
59
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
60
|
+
val indicatorColor = props.color.composeOrNull ?: LoadingIndicatorDefaults.containedIndicatorColor
|
|
61
|
+
val containerColor = props.containerColor.composeOrNull ?: LoadingIndicatorDefaults.containedContainerColor
|
|
62
|
+
|
|
63
|
+
val progressState = props.progress
|
|
64
|
+
if (progressState != null) {
|
|
65
|
+
ContainedLoadingIndicator(
|
|
66
|
+
progress = { (progressState.value as? Number)?.toFloat() ?: 0f },
|
|
67
|
+
modifier = modifier,
|
|
68
|
+
indicatorColor = indicatorColor,
|
|
69
|
+
containerColor = containerColor
|
|
70
|
+
)
|
|
71
|
+
} else {
|
|
72
|
+
ContainedLoadingIndicator(
|
|
73
|
+
modifier = modifier,
|
|
74
|
+
indicatorColor = indicatorColor,
|
|
75
|
+
containerColor = containerColor
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// endregion
|
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
package expo.modules.ui
|
|
4
4
|
|
|
5
5
|
import android.graphics.Color
|
|
6
|
+
import androidx.compose.animation.animateColorAsState
|
|
6
7
|
import androidx.compose.animation.animateContentSize
|
|
8
|
+
import androidx.compose.animation.core.AnimationSpec
|
|
7
9
|
import androidx.compose.animation.core.Spring
|
|
10
|
+
import androidx.compose.animation.core.snap
|
|
8
11
|
import androidx.compose.animation.core.spring
|
|
12
|
+
import androidx.compose.animation.core.tween
|
|
9
13
|
import androidx.compose.foundation.BorderStroke
|
|
10
14
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
11
15
|
import androidx.compose.foundation.background
|
|
@@ -38,6 +42,7 @@ import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
|
|
38
42
|
import androidx.compose.material3.ExposedDropdownMenuAnchorType
|
|
39
43
|
import androidx.compose.material3.toShape
|
|
40
44
|
import androidx.compose.runtime.Composable
|
|
45
|
+
import androidx.compose.runtime.getValue
|
|
41
46
|
import androidx.compose.ui.Modifier
|
|
42
47
|
import androidx.compose.ui.draw.alpha
|
|
43
48
|
import androidx.compose.ui.draw.blur
|
|
@@ -147,6 +152,24 @@ internal data class BackgroundParams(
|
|
|
147
152
|
@Field val color: Color? = null
|
|
148
153
|
) : Record
|
|
149
154
|
|
|
155
|
+
// Color animation specs reuse the JS `$type` shape from `@expo/ui/jetpack-compose/modifiers/animation` (spring / tween / snap).
|
|
156
|
+
// Keyframes are float-only and aren't supported for colors.
|
|
157
|
+
private fun parseColorAnimationSpec(raw: Any?): AnimationSpec<androidx.compose.ui.graphics.Color>? {
|
|
158
|
+
if (raw !is Map<*, *>) return null
|
|
159
|
+
return when (raw["\$type"]) {
|
|
160
|
+
"spring" -> spring(
|
|
161
|
+
dampingRatio = (raw["dampingRatio"] as? Number)?.toFloat() ?: Spring.DampingRatioNoBouncy,
|
|
162
|
+
stiffness = (raw["stiffness"] as? Number)?.toFloat() ?: Spring.StiffnessMedium
|
|
163
|
+
)
|
|
164
|
+
"tween" -> tween(
|
|
165
|
+
durationMillis = (raw["durationMillis"] as? Number)?.toInt() ?: 300,
|
|
166
|
+
delayMillis = (raw["delayMillis"] as? Number)?.toInt() ?: 0
|
|
167
|
+
)
|
|
168
|
+
"snap" -> snap(delayMillis = (raw["delayMillis"] as? Number)?.toInt() ?: 0)
|
|
169
|
+
else -> null
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
150
173
|
@OptimizedRecord
|
|
151
174
|
internal data class BorderParams(
|
|
152
175
|
@Field val borderWidth: Int = 1,
|
|
@@ -457,9 +480,14 @@ object ModifierRegistry {
|
|
|
457
480
|
// Appearance modifiers
|
|
458
481
|
register("background") { map, _, _, _ ->
|
|
459
482
|
val params = recordFromMap<BackgroundParams>(map)
|
|
460
|
-
params.color?.
|
|
461
|
-
|
|
462
|
-
|
|
483
|
+
val color = params.color?.compose ?: return@register Modifier
|
|
484
|
+
val spec = parseColorAnimationSpec(map["animationSpec"])
|
|
485
|
+
if (spec != null) {
|
|
486
|
+
val animated by animateColorAsState(color, spec, label = "background-color")
|
|
487
|
+
Modifier.background(animated)
|
|
488
|
+
} else {
|
|
489
|
+
Modifier.background(color)
|
|
490
|
+
}
|
|
463
491
|
}
|
|
464
492
|
|
|
465
493
|
register("border") { map, _, _, _ ->
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3Api::class)
|
|
2
|
+
|
|
3
|
+
package expo.modules.ui
|
|
4
|
+
|
|
5
|
+
import android.annotation.SuppressLint
|
|
6
|
+
import android.content.Context
|
|
7
|
+
import android.graphics.Color
|
|
8
|
+
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
9
|
+
import androidx.compose.material3.Snackbar
|
|
10
|
+
import androidx.compose.material3.SnackbarDefaults
|
|
11
|
+
import androidx.compose.material3.SnackbarDuration
|
|
12
|
+
import androidx.compose.material3.SnackbarHost
|
|
13
|
+
import androidx.compose.material3.SnackbarHostState
|
|
14
|
+
import androidx.compose.material3.SnackbarResult
|
|
15
|
+
import androidx.compose.runtime.Composable
|
|
16
|
+
import androidx.compose.runtime.MutableState
|
|
17
|
+
import androidx.compose.runtime.mutableStateOf
|
|
18
|
+
import androidx.compose.runtime.remember
|
|
19
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
20
|
+
import expo.modules.kotlin.AppContext
|
|
21
|
+
import expo.modules.kotlin.records.Field
|
|
22
|
+
import expo.modules.kotlin.records.Record
|
|
23
|
+
import expo.modules.kotlin.types.OptimizedRecord
|
|
24
|
+
import expo.modules.kotlin.views.AsyncFunctionHandle
|
|
25
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
26
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
27
|
+
import expo.modules.kotlin.views.ExpoComposeView
|
|
28
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
29
|
+
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
30
|
+
import kotlinx.coroutines.withContext
|
|
31
|
+
import kotlin.coroutines.cancellation.CancellationException
|
|
32
|
+
|
|
33
|
+
// Holds styling props that `SnackbarHost` reads via `findChildOfType`.
|
|
34
|
+
|
|
35
|
+
@OptimizedComposeProps
|
|
36
|
+
data class SnackbarViewProps(
|
|
37
|
+
val containerColor: MutableState<Color?> = mutableStateOf(null),
|
|
38
|
+
val contentColor: MutableState<Color?> = mutableStateOf(null),
|
|
39
|
+
val actionContentColor: MutableState<Color?> = mutableStateOf(null),
|
|
40
|
+
val dismissActionContentColor: MutableState<Color?> = mutableStateOf(null),
|
|
41
|
+
val actionOnNewLine: MutableState<Boolean> = mutableStateOf(false),
|
|
42
|
+
val modifiers: MutableState<ModifierList> = mutableStateOf(emptyList())
|
|
43
|
+
) : ComposeProps
|
|
44
|
+
|
|
45
|
+
@SuppressLint("ViewConstructor")
|
|
46
|
+
class SnackbarView(context: Context, appContext: AppContext) :
|
|
47
|
+
ExpoComposeView<SnackbarViewProps>(context, appContext) {
|
|
48
|
+
override val props = SnackbarViewProps()
|
|
49
|
+
|
|
50
|
+
@Composable
|
|
51
|
+
override fun ComposableScope.Content() {
|
|
52
|
+
// Empty by design: `SnackbarHost` renders the snackbar using the props above.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// --- SnackbarHostView ---
|
|
57
|
+
|
|
58
|
+
@OptimizedRecord
|
|
59
|
+
data class SnackbarShowOptions(
|
|
60
|
+
@Field val message: String = "",
|
|
61
|
+
@Field val actionLabel: String? = null,
|
|
62
|
+
@Field val withDismissAction: Boolean = false,
|
|
63
|
+
@Field val duration: String? = null
|
|
64
|
+
) : Record
|
|
65
|
+
|
|
66
|
+
@OptimizedComposeProps
|
|
67
|
+
data class SnackbarHostProps(
|
|
68
|
+
val modifiers: ModifierList = emptyList()
|
|
69
|
+
) : ComposeProps
|
|
70
|
+
|
|
71
|
+
@Composable
|
|
72
|
+
fun FunctionalComposableScope.SnackbarHostContent(
|
|
73
|
+
props: SnackbarHostProps,
|
|
74
|
+
showSnackbar: AsyncFunctionHandle<SnackbarShowOptions>
|
|
75
|
+
) {
|
|
76
|
+
val hostState = remember { SnackbarHostState() }
|
|
77
|
+
val scope = rememberCoroutineScope()
|
|
78
|
+
val snackbarConfig = findChildOfType<SnackbarView>(view)
|
|
79
|
+
|
|
80
|
+
showSnackbar.handle { options ->
|
|
81
|
+
val duration = when (options.duration) {
|
|
82
|
+
"short" -> SnackbarDuration.Short
|
|
83
|
+
"long" -> SnackbarDuration.Long
|
|
84
|
+
"indefinite" -> SnackbarDuration.Indefinite
|
|
85
|
+
// M3 default: indefinite when there's an action label, else short.
|
|
86
|
+
else -> if (options.actionLabel == null) SnackbarDuration.Short else SnackbarDuration.Indefinite
|
|
87
|
+
}
|
|
88
|
+
val result = try {
|
|
89
|
+
withContext(scope.coroutineContext) {
|
|
90
|
+
hostState.showSnackbar(
|
|
91
|
+
message = options.message,
|
|
92
|
+
actionLabel = options.actionLabel,
|
|
93
|
+
withDismissAction = options.withDismissAction,
|
|
94
|
+
duration = duration
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
} catch (_: CancellationException) {
|
|
98
|
+
// The compose scope can be cancelled if the view is disposed before user dismisses the snackbar or performs the action.
|
|
99
|
+
// In that case, we treat it as if the snackbar was dismissed.
|
|
100
|
+
SnackbarResult.Dismissed
|
|
101
|
+
}
|
|
102
|
+
when (result) {
|
|
103
|
+
SnackbarResult.ActionPerformed -> "actionPerformed"
|
|
104
|
+
SnackbarResult.Dismissed -> "dismissed"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
SnackbarHost(
|
|
109
|
+
hostState = hostState,
|
|
110
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
111
|
+
) { data ->
|
|
112
|
+
Snackbar(
|
|
113
|
+
snackbarData = data,
|
|
114
|
+
modifier = snackbarConfig?.let {
|
|
115
|
+
ModifierRegistry.applyModifiers(it.props.modifiers.value, appContext, composableScope, globalEventDispatcher)
|
|
116
|
+
} ?: androidx.compose.ui.Modifier,
|
|
117
|
+
actionOnNewLine = snackbarConfig?.props?.actionOnNewLine?.value ?: false,
|
|
118
|
+
containerColor = snackbarConfig?.props?.containerColor?.value.composeOrNull ?: SnackbarDefaults.color,
|
|
119
|
+
contentColor = snackbarConfig?.props?.contentColor?.value.composeOrNull ?: SnackbarDefaults.contentColor,
|
|
120
|
+
actionContentColor = snackbarConfig?.props?.actionContentColor?.value.composeOrNull
|
|
121
|
+
?: SnackbarDefaults.actionContentColor,
|
|
122
|
+
dismissActionContentColor = snackbarConfig?.props?.dismissActionContentColor?.value.composeOrNull
|
|
123
|
+
?: SnackbarDefaults.dismissActionContentColor
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -11,11 +11,21 @@ import expo.modules.kotlin.sharedobjects.SharedObject
|
|
|
11
11
|
*/
|
|
12
12
|
class ObservableState(initialValue: Any? = null) : SharedObject() {
|
|
13
13
|
private val _state: MutableState<Any?> = mutableStateOf(initialValue)
|
|
14
|
+
internal var onChange: WorkletCallback? = null
|
|
15
|
+
private var isNotifying = false
|
|
14
16
|
|
|
15
17
|
var value: Any?
|
|
16
18
|
get() = _state.value
|
|
17
19
|
set(v) {
|
|
18
20
|
_state.value = v
|
|
21
|
+
// Skip re-invoking onChange if state.value was written from inside onChange.
|
|
22
|
+
if (isNotifying) return
|
|
23
|
+
isNotifying = true
|
|
24
|
+
try {
|
|
25
|
+
onChange?.invoke(v)
|
|
26
|
+
} finally {
|
|
27
|
+
isNotifying = false
|
|
28
|
+
}
|
|
19
29
|
}
|
|
20
30
|
|
|
21
31
|
@Suppress("UNCHECKED_CAST")
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:width="24dp"
|
|
3
|
+
android:height="24dp"
|
|
4
|
+
android:viewportWidth="960"
|
|
5
|
+
android:viewportHeight="960"
|
|
6
|
+
android:tint="?attr/colorControlNormal">
|
|
7
|
+
<path
|
|
8
|
+
android:fillColor="@android:color/white"
|
|
9
|
+
android:pathData="M480,616L240,376L296,320L480,504L664,320L720,376L480,616Z"/>
|
|
10
|
+
</vector>
|
|
@@ -5,11 +5,40 @@ import { type SharedObject } from 'expo-modules-core';
|
|
|
5
5
|
*/
|
|
6
6
|
export type ObservableState<T> = SharedObject & {
|
|
7
7
|
/**
|
|
8
|
-
* The current value.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The current value.
|
|
9
|
+
*
|
|
10
|
+
* Writes from a UI worklet are synchronous and immediately readable. Writes
|
|
11
|
+
* from the JS thread are scheduled to the UI thread asynchronously, the new value is not readable until the update has been
|
|
12
|
+
* applied. Prefer writing from a worklet when you need synchronous updates
|
|
11
13
|
*/
|
|
12
14
|
value: T;
|
|
15
|
+
/**
|
|
16
|
+
* A single listener invoked on the native UI runtime whenever the value changes
|
|
17
|
+
* (after iOS `didSet` and Android's setter). Assigning replaces the previous
|
|
18
|
+
* listener; assign `null` to clear. The initial value does not fire `onChange`.
|
|
19
|
+
*
|
|
20
|
+
* The callback must be a worklet so it can run synchronously on the UI thread.
|
|
21
|
+
* Attach it inside `useEffect` and clear it in the cleanup so the listener
|
|
22
|
+
* lifecycle matches the component lifecycle.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* const state = useNativeState(0);
|
|
27
|
+
*
|
|
28
|
+
* useEffect(() => {
|
|
29
|
+
* state.onChange = (value) => {
|
|
30
|
+
* 'worklet';
|
|
31
|
+
* console.log('changed to', value);
|
|
32
|
+
* };
|
|
33
|
+
* return () => {
|
|
34
|
+
* state.onChange = null;
|
|
35
|
+
* };
|
|
36
|
+
* }, []);
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
onChange: {
|
|
40
|
+
listener(value: T): void;
|
|
41
|
+
}['listener'] | null;
|
|
13
42
|
};
|
|
14
43
|
/**
|
|
15
44
|
* Creates an observable native state that is automatically cleaned up when the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNativeState.d.ts","sourceRoot":"","sources":["../../src/State/useNativeState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAOhF;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,YAAY,GAAG;IAC9C
|
|
1
|
+
{"version":3,"file":"useNativeState.d.ts","sourceRoot":"","sources":["../../src/State/useNativeState.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAA4B,MAAM,mBAAmB,CAAC;AAOhF;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,YAAY,GAAG;IAC9C;;;;;;OAMG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;KAAE,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CAC3D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAQrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.ios.d.ts","sourceRoot":"","sources":["../../../src/community/bottom-sheet/BottomSheet.ios.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAapE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAiD3C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"BottomSheet.ios.d.ts","sourceRoot":"","sources":["../../../src/community/bottom-sheet/BottomSheet.ios.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAapE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAiD3C;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CA8KlD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ColorValue } from 'react-native';
|
|
2
|
+
import type { ObservableState } from '../../State/useNativeState';
|
|
3
|
+
import { type ModifierConfig } from '../../types';
|
|
4
|
+
/**
|
|
5
|
+
* Common props shared by loading indicator variants.
|
|
6
|
+
*/
|
|
7
|
+
export type LoadingIndicatorCommonConfig = {
|
|
8
|
+
/**
|
|
9
|
+
* An observable state that holds the current progress value.
|
|
10
|
+
* Create one with `useNativeState(0)`. Omit for indeterminate loading.
|
|
11
|
+
*/
|
|
12
|
+
progress?: ObservableState<number | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Loading indicator color.
|
|
15
|
+
*/
|
|
16
|
+
color?: ColorValue;
|
|
17
|
+
/**
|
|
18
|
+
* Modifiers for the component.
|
|
19
|
+
*/
|
|
20
|
+
modifiers?: ModifierConfig[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A loading indicator that displays loading using morphing shapes.
|
|
24
|
+
*
|
|
25
|
+
* Matches the Jetpack Compose `LoadingIndicator`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const LoadingIndicator: import("react").ComponentType<LoadingIndicatorCommonConfig>;
|
|
28
|
+
export type ContainedLoadingIndicatorProps = LoadingIndicatorCommonConfig & {
|
|
29
|
+
/**
|
|
30
|
+
* Loading indicator's container color
|
|
31
|
+
*/
|
|
32
|
+
containerColor?: ColorValue;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A loading indicator that displays loading using morphing shapes inside a container.
|
|
36
|
+
*
|
|
37
|
+
* Matches the Jetpack Compose `ContainedLoadingIndicator`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ContainedLoadingIndicator: import("react").ComponentType<ContainedLoadingIndicatorProps>;
|
|
40
|
+
export { type ObservableState };
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/LoadingIndicator/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC1C;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B,CAAC;AAsCF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,6DAA0D,CAAC;AAMxF,MAAM,MAAM,8BAA8B,GAAG,4BAA4B,GAAG;IAC1E;;OAEG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,+DAC4D,CAAC;AAInG,OAAO,EAAE,KAAK,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
import { type ColorValue } from 'react-native';
|
|
3
|
+
import { type ModifierConfig } from '../../types';
|
|
4
|
+
export type SnackbarProps = {
|
|
5
|
+
/**
|
|
6
|
+
* The background color of the snackbar container.
|
|
7
|
+
*/
|
|
8
|
+
containerColor?: ColorValue;
|
|
9
|
+
/**
|
|
10
|
+
* The preferred content color used for the message text.
|
|
11
|
+
*/
|
|
12
|
+
contentColor?: ColorValue;
|
|
13
|
+
/**
|
|
14
|
+
* The content color used for the action button.
|
|
15
|
+
*/
|
|
16
|
+
actionContentColor?: ColorValue;
|
|
17
|
+
/**
|
|
18
|
+
* The content color used for the dismiss-action icon button.
|
|
19
|
+
*/
|
|
20
|
+
dismissActionContentColor?: ColorValue;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the action should be placed on a new line below the message.
|
|
23
|
+
* Useful for long action labels.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
actionOnNewLine?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Modifiers for the component.
|
|
29
|
+
*/
|
|
30
|
+
modifiers?: ModifierConfig[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Styling configuration for the snackbar shown by `SnackbarHost`. Pass as a
|
|
34
|
+
* child to override colors or place the action on a new line.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Snackbar(props: SnackbarProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* How long the snackbar is shown. Mirrors Compose's `SnackbarDuration` enum.
|
|
39
|
+
*/
|
|
40
|
+
export type SnackbarDuration = 'short' | 'long' | 'indefinite';
|
|
41
|
+
/**
|
|
42
|
+
* Reason a snackbar invocation resolved. Mirrors Compose's `SnackbarResult` enum.
|
|
43
|
+
*/
|
|
44
|
+
export type SnackbarResult = 'actionPerformed' | 'dismissed';
|
|
45
|
+
export type SnackbarShowOptions = {
|
|
46
|
+
/**
|
|
47
|
+
* The message body of the snackbar.
|
|
48
|
+
*/
|
|
49
|
+
message: string;
|
|
50
|
+
/**
|
|
51
|
+
* Label for the optional action button. When omitted, no action button is shown.
|
|
52
|
+
*/
|
|
53
|
+
actionLabel?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Whether to show a trailing close (X) icon button to dismiss the snackbar.
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
withDismissAction?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* How long to show the snackbar. Defaults to `'short'` when an `actionLabel`
|
|
61
|
+
* is not provided, and `'indefinite'` when it is, matching Compose.
|
|
62
|
+
*/
|
|
63
|
+
duration?: SnackbarDuration;
|
|
64
|
+
};
|
|
65
|
+
export type SnackbarHostRef = {
|
|
66
|
+
/**
|
|
67
|
+
* Shows a snackbar and resolves with `'actionPerformed'` when the user taps
|
|
68
|
+
* the action, or `'dismissed'` when it times out or the dismiss-action
|
|
69
|
+
* button is tapped. Subsequent calls queue and show after the current
|
|
70
|
+
* snackbar is dismissed.
|
|
71
|
+
*/
|
|
72
|
+
showSnackbar: (options: SnackbarShowOptions) => Promise<SnackbarResult>;
|
|
73
|
+
};
|
|
74
|
+
export type SnackbarHostProps = {
|
|
75
|
+
/**
|
|
76
|
+
* Ref exposing the imperative `showSnackbar` method.
|
|
77
|
+
*/
|
|
78
|
+
ref?: Ref<SnackbarHostRef>;
|
|
79
|
+
/**
|
|
80
|
+
* Modifiers for the component.
|
|
81
|
+
*/
|
|
82
|
+
modifiers?: ModifierConfig[];
|
|
83
|
+
/**
|
|
84
|
+
* Optional `Snackbar` child supplying styling for shown snackbars. Mirrors
|
|
85
|
+
* Compose's `SnackbarHost(hostState) { data -> Snackbar(data, ...) }` lambda.
|
|
86
|
+
*/
|
|
87
|
+
children?: React.ReactNode;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* A Material 3 [SnackbarHost](https://developer.android.com/develop/ui/compose/components/snackbar)
|
|
91
|
+
* that displays snackbars triggered via its ref's `showSnackbar` method.
|
|
92
|
+
*/
|
|
93
|
+
export declare function SnackbarHost(props: SnackbarHostProps): import("react/jsx-runtime").JSX.Element;
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/jetpack-compose/Snackbar/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,kBAAkB,CAAC,EAAE,UAAU,CAAC;IAChC;;OAEG;IACH,yBAAyB,CAAC,EAAE,UAAU,CAAC;IACvC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;CAC9B,CAAC;AAOF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAS5C;AAID;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,WAAW,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;OAKG;IACH,YAAY,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACzE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAOF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAUpD"}
|
|
@@ -33,6 +33,7 @@ export * from './ModalBottomSheet';
|
|
|
33
33
|
export * from './Carousel';
|
|
34
34
|
export { HorizontalPager, type HorizontalPagerHandle, type HorizontalPagerProps, } from './HorizontalPager';
|
|
35
35
|
export * from './SearchBar';
|
|
36
|
+
export * from './Snackbar';
|
|
36
37
|
export * from './DockedSearchBar';
|
|
37
38
|
export * from './HorizontalFloatingToolbar';
|
|
38
39
|
export * from './FloatingActionButton';
|
|
@@ -41,6 +42,7 @@ export * from './RadioButton';
|
|
|
41
42
|
export * from './Surface';
|
|
42
43
|
export { type TextProps, Text } from './Text';
|
|
43
44
|
export * from './Tooltip';
|
|
45
|
+
export * from './LoadingIndicator';
|
|
44
46
|
export * from './AnimatedVisibility';
|
|
45
47
|
export * from './Box';
|
|
46
48
|
export * from './Row';
|