@expo/ui 55.0.2 → 55.0.3
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 +31 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
- package/android/src/main/java/expo/modules/ui/CardView.kt +138 -34
- package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
- package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +258 -70
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +44 -1
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
- package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
- package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
- package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
- package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +53 -161
- package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
- package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
- package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -86
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
- package/build/jetpack-compose/Button/index.d.ts +65 -51
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts +72 -14
- package/build/jetpack-compose/Card/index.d.ts.map +1 -1
- package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
- package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
- package/build/jetpack-compose/Chip/index.d.ts +247 -27
- package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +38 -3
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
- package/build/jetpack-compose/IconButton/index.d.ts +45 -29
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Progress/index.d.ts +78 -35
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
- package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
- package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Slider/index.d.ts +34 -10
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +10 -50
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
- package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +5 -4
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +18 -1
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/ProgressView/index.d.ts +1 -5
- package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
- package/build/swift-ui/Stepper/index.d.ts +3 -3
- package/build/swift-ui/Stepper/index.d.ts.map +1 -1
- package/build/swift-ui/Text/index.d.ts +33 -1
- package/build/swift-ui/Text/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +22 -1
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
- package/build/swift-ui/types.d.ts +7 -0
- package/build/swift-ui/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +1 -6
- package/ios/ClosedRangeDateRecord.swift +10 -0
- package/ios/ColorPickerView.swift +9 -8
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +4 -6
- package/ios/DatePickerView.swift +7 -5
- package/ios/DisclosureGroupView.swift +5 -7
- package/ios/ListView.swift +6 -14
- package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
- package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
- package/ios/Picker/PickerView.swift +6 -10
- package/ios/Popover/PopoverView.swift +3 -5
- package/ios/ProgressView.swift +0 -5
- package/ios/SectionView.swift +3 -5
- package/ios/SliderView.swift +8 -6
- package/ios/StepperView.swift +12 -16
- package/ios/TextView.swift +37 -1
- package/ios/Toggle/ToggleView.swift +5 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.module → 55.0.3/expo.modules.ui-55.0.3.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.2/expo.modules.ui-55.0.2.pom → 55.0.3/expo.modules.ui-55.0.3.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.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 -2
- package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
- package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
- package/src/jetpack-compose/Button/index.tsx +69 -92
- package/src/jetpack-compose/Card/index.tsx +105 -29
- package/src/jetpack-compose/Checkbox/index.tsx +126 -0
- package/src/jetpack-compose/Chip/index.tsx +391 -51
- package/src/jetpack-compose/DatePicker/index.tsx +112 -7
- package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
- package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
- package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
- package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
- package/src/jetpack-compose/IconButton/index.tsx +49 -56
- package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Progress/index.tsx +120 -62
- package/src/jetpack-compose/RadioButton/index.tsx +8 -9
- package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
- package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Slider/index.tsx +76 -29
- package/src/jetpack-compose/Switch/index.tsx +17 -87
- package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
- package/src/jetpack-compose/index.ts +5 -4
- package/src/jetpack-compose/modifiers/index.ts +26 -2
- package/src/swift-ui/ProgressView/index.tsx +1 -3
- package/src/swift-ui/Stepper/index.tsx +7 -7
- package/src/swift-ui/Text/index.tsx +66 -2
- package/src/swift-ui/modifiers/index.ts +40 -0
- package/src/swift-ui/types.ts +5 -0
- package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
- package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
- package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
- package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
- package/build/jetpack-compose/Button/types.d.ts +0 -5
- package/build/jetpack-compose/Button/types.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
- package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
- package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
- package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
- package/build/jetpack-compose/Picker/index.d.ts +0 -62
- package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
- package/build/jetpack-compose/TextButton/index.d.ts +0 -29
- package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.2/expo.modules.ui-55.0.2.pom.sha512 +0 -1
- package/src/jetpack-compose/Button/types.ts +0 -57
- package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
- package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
- package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
- package/src/jetpack-compose/FilterChip/index.tsx +0 -89
- package/src/jetpack-compose/Picker/index.tsx +0 -90
- package/src/jetpack-compose/TextButton/index.tsx +0 -55
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
package expo.modules.ui.button
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color
|
|
4
|
-
import androidx.compose.foundation.layout.
|
|
5
|
-
import androidx.compose.foundation.layout.RowScope
|
|
6
|
-
import androidx.compose.foundation.layout.padding
|
|
4
|
+
import androidx.compose.foundation.layout.PaddingValues
|
|
7
5
|
import androidx.compose.material3.ButtonDefaults
|
|
8
6
|
import androidx.compose.material3.ElevatedButton
|
|
9
7
|
import androidx.compose.material3.FilledTonalButton
|
|
10
|
-
import androidx.compose.material3.Icon
|
|
11
8
|
import androidx.compose.material3.OutlinedButton
|
|
12
|
-
import androidx.compose.material3.Text
|
|
13
9
|
import androidx.compose.material3.TextButton
|
|
14
10
|
import androidx.compose.runtime.Composable
|
|
15
|
-
import androidx.compose.ui.Alignment
|
|
16
|
-
import androidx.compose.ui.Modifier
|
|
17
|
-
import androidx.compose.ui.graphics.Shape
|
|
18
11
|
import androidx.compose.ui.unit.dp
|
|
19
12
|
import expo.modules.kotlin.records.Field
|
|
20
13
|
import expo.modules.kotlin.records.Record
|
|
21
|
-
import expo.modules.kotlin.types.Enumerable
|
|
22
14
|
import expo.modules.kotlin.views.ComposableScope
|
|
23
15
|
import expo.modules.kotlin.views.ComposeProps
|
|
24
16
|
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
@@ -26,180 +18,147 @@ import expo.modules.ui.ModifierList
|
|
|
26
18
|
import expo.modules.ui.ModifierRegistry
|
|
27
19
|
import expo.modules.ui.ShapeRecord
|
|
28
20
|
import expo.modules.ui.compose
|
|
29
|
-
import expo.modules.ui.getImageVector
|
|
30
|
-
import expo.modules.ui.menu.LocalContextMenuExpanded
|
|
31
21
|
import expo.modules.ui.shapeFromShapeRecord
|
|
32
22
|
import java.io.Serializable
|
|
33
23
|
|
|
34
24
|
open class ButtonPressedEvent() : Record, Serializable
|
|
35
25
|
|
|
36
|
-
enum class ButtonVariant(val value: String) : Enumerable {
|
|
37
|
-
DEFAULT("default"),
|
|
38
|
-
BORDERED("bordered"),
|
|
39
|
-
BORDERLESS("borderless"),
|
|
40
|
-
OUTLINED("outlined"),
|
|
41
|
-
ELEVATED("elevated")
|
|
42
|
-
}
|
|
43
|
-
|
|
44
26
|
class ButtonColors : Record {
|
|
45
|
-
@Field
|
|
46
|
-
val
|
|
47
|
-
|
|
48
|
-
@Field
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
@Field
|
|
52
|
-
val disabledContainerColor: Color? = null
|
|
27
|
+
@Field val containerColor: Color? = null
|
|
28
|
+
@Field val contentColor: Color? = null
|
|
29
|
+
@Field val disabledContainerColor: Color? = null
|
|
30
|
+
@Field val disabledContentColor: Color? = null
|
|
31
|
+
}
|
|
53
32
|
|
|
54
|
-
|
|
55
|
-
val
|
|
33
|
+
class ContentPaddingRecord : Record {
|
|
34
|
+
@Field val start: Double? = null
|
|
35
|
+
@Field val top: Double? = null
|
|
36
|
+
@Field val end: Double? = null
|
|
37
|
+
@Field val bottom: Double? = null
|
|
56
38
|
}
|
|
57
39
|
|
|
40
|
+
fun ContentPaddingRecord.toPaddingValues(): PaddingValues =
|
|
41
|
+
PaddingValues(
|
|
42
|
+
start = start?.dp ?: ButtonDefaults.ContentPadding.calculateLeftPadding(androidx.compose.ui.unit.LayoutDirection.Ltr),
|
|
43
|
+
top = top?.dp ?: ButtonDefaults.ContentPadding.calculateTopPadding(),
|
|
44
|
+
end = end?.dp ?: ButtonDefaults.ContentPadding.calculateRightPadding(androidx.compose.ui.unit.LayoutDirection.Ltr),
|
|
45
|
+
bottom = bottom?.dp ?: ButtonDefaults.ContentPadding.calculateBottomPadding()
|
|
46
|
+
)
|
|
47
|
+
|
|
58
48
|
data class ButtonProps(
|
|
59
|
-
val
|
|
60
|
-
val
|
|
61
|
-
val
|
|
62
|
-
val leadingIcon: String? = null,
|
|
63
|
-
val trailingIcon: String? = null,
|
|
64
|
-
val disabled: Boolean? = false,
|
|
49
|
+
val colors: ButtonColors = ButtonColors(),
|
|
50
|
+
val enabled: Boolean = true,
|
|
51
|
+
val contentPadding: ContentPaddingRecord? = null,
|
|
65
52
|
val shape: ShapeRecord? = null,
|
|
66
53
|
val modifiers: ModifierList = emptyList()
|
|
67
54
|
) : ComposeProps
|
|
68
55
|
|
|
69
56
|
@Composable
|
|
70
|
-
fun
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
disabled: Boolean,
|
|
74
|
-
onPress: () -> Unit,
|
|
75
|
-
modifier: Modifier = Modifier,
|
|
76
|
-
shape: Shape?,
|
|
77
|
-
content: @Composable (RowScope.() -> Unit)
|
|
57
|
+
fun FunctionalComposableScope.ButtonContent(
|
|
58
|
+
props: ButtonProps,
|
|
59
|
+
onClick: (ButtonPressedEvent) -> Unit
|
|
78
60
|
) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
ButtonVariant.BORDERLESS -> TextButton(
|
|
95
|
-
onPress,
|
|
96
|
-
enabled = !disabled,
|
|
97
|
-
content = content,
|
|
98
|
-
colors = ButtonDefaults.textButtonColors(
|
|
99
|
-
containerColor = colors.containerColor.compose,
|
|
100
|
-
contentColor = colors.contentColor.compose,
|
|
101
|
-
disabledContainerColor = colors.disabledContainerColor.compose,
|
|
102
|
-
disabledContentColor = colors.disabledContentColor.compose
|
|
103
|
-
),
|
|
104
|
-
shape = shape ?: ButtonDefaults.textShape,
|
|
105
|
-
modifier = modifier
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
ButtonVariant.OUTLINED -> OutlinedButton(
|
|
109
|
-
onPress,
|
|
110
|
-
enabled = !disabled,
|
|
111
|
-
content = content,
|
|
112
|
-
colors = ButtonDefaults.outlinedButtonColors(
|
|
113
|
-
containerColor = colors.containerColor.compose,
|
|
114
|
-
contentColor = colors.contentColor.compose,
|
|
115
|
-
disabledContainerColor = colors.disabledContainerColor.compose,
|
|
116
|
-
disabledContentColor = colors.disabledContentColor.compose
|
|
117
|
-
),
|
|
118
|
-
shape = shape ?: ButtonDefaults.outlinedShape,
|
|
119
|
-
modifier = modifier
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
ButtonVariant.ELEVATED -> ElevatedButton(
|
|
123
|
-
onPress,
|
|
124
|
-
enabled = !disabled,
|
|
125
|
-
content = content,
|
|
126
|
-
colors = ButtonDefaults.elevatedButtonColors(
|
|
127
|
-
containerColor = colors.containerColor.compose,
|
|
128
|
-
contentColor = colors.contentColor.compose,
|
|
129
|
-
disabledContainerColor = colors.disabledContainerColor.compose,
|
|
130
|
-
disabledContentColor = colors.disabledContentColor.compose
|
|
131
|
-
),
|
|
132
|
-
shape = shape ?: ButtonDefaults.elevatedShape,
|
|
133
|
-
modifier = modifier
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
else -> androidx.compose.material3.Button(
|
|
137
|
-
onPress,
|
|
138
|
-
enabled = !disabled,
|
|
139
|
-
content = content,
|
|
140
|
-
colors = ButtonDefaults.buttonColors(
|
|
141
|
-
containerColor = colors.containerColor.compose,
|
|
142
|
-
contentColor = colors.contentColor.compose,
|
|
143
|
-
disabledContainerColor = colors.disabledContainerColor.compose,
|
|
144
|
-
disabledContentColor = colors.disabledContentColor.compose
|
|
145
|
-
),
|
|
146
|
-
shape = shape ?: ButtonDefaults.shape,
|
|
147
|
-
modifier = modifier
|
|
148
|
-
)
|
|
61
|
+
androidx.compose.material3.Button(
|
|
62
|
+
onClick = { onClick(ButtonPressedEvent()) },
|
|
63
|
+
enabled = props.enabled,
|
|
64
|
+
contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
|
|
65
|
+
colors = ButtonDefaults.buttonColors(
|
|
66
|
+
containerColor = props.colors.containerColor.compose,
|
|
67
|
+
contentColor = props.colors.contentColor.compose,
|
|
68
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
69
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
70
|
+
),
|
|
71
|
+
shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.shape,
|
|
72
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
73
|
+
) {
|
|
74
|
+
Children(ComposableScope(rowScope = this))
|
|
149
75
|
}
|
|
150
76
|
}
|
|
151
77
|
|
|
152
78
|
@Composable
|
|
153
|
-
fun FunctionalComposableScope.
|
|
79
|
+
fun FunctionalComposableScope.FilledTonalButtonContent(
|
|
154
80
|
props: ButtonProps,
|
|
155
|
-
|
|
81
|
+
onClick: (ButtonPressedEvent) -> Unit
|
|
156
82
|
) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
83
|
+
FilledTonalButton(
|
|
84
|
+
onClick = { onClick(ButtonPressedEvent()) },
|
|
85
|
+
enabled = props.enabled,
|
|
86
|
+
contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
|
|
87
|
+
colors = ButtonDefaults.filledTonalButtonColors(
|
|
88
|
+
containerColor = props.colors.containerColor.compose,
|
|
89
|
+
contentColor = props.colors.contentColor.compose,
|
|
90
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
91
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
92
|
+
),
|
|
93
|
+
shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.filledTonalShape,
|
|
94
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
95
|
+
) {
|
|
96
|
+
Children(ComposableScope(rowScope = this))
|
|
97
|
+
}
|
|
98
|
+
}
|
|
166
99
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
100
|
+
@Composable
|
|
101
|
+
fun FunctionalComposableScope.OutlinedButtonContent(
|
|
102
|
+
props: ButtonProps,
|
|
103
|
+
onClick: (ButtonPressedEvent) -> Unit
|
|
104
|
+
) {
|
|
105
|
+
OutlinedButton(
|
|
106
|
+
onClick = { onClick(ButtonPressedEvent()) },
|
|
107
|
+
enabled = props.enabled,
|
|
108
|
+
contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
|
|
109
|
+
colors = ButtonDefaults.outlinedButtonColors(
|
|
110
|
+
containerColor = props.colors.containerColor.compose,
|
|
111
|
+
contentColor = props.colors.contentColor.compose,
|
|
112
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
113
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
114
|
+
),
|
|
115
|
+
shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.outlinedShape,
|
|
116
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
179
117
|
) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
getImageVector(iconName)?.let {
|
|
184
|
-
Icon(
|
|
185
|
-
it,
|
|
186
|
-
contentDescription = iconName,
|
|
187
|
-
modifier = Modifier.padding(end = 8.dp)
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
118
|
+
Children(ComposableScope(rowScope = this))
|
|
119
|
+
}
|
|
120
|
+
}
|
|
191
121
|
|
|
192
|
-
|
|
122
|
+
@Composable
|
|
123
|
+
fun FunctionalComposableScope.ElevatedButtonContent(
|
|
124
|
+
props: ButtonProps,
|
|
125
|
+
onClick: (ButtonPressedEvent) -> Unit
|
|
126
|
+
) {
|
|
127
|
+
ElevatedButton(
|
|
128
|
+
onClick = { onClick(ButtonPressedEvent()) },
|
|
129
|
+
enabled = props.enabled,
|
|
130
|
+
contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.ContentPadding,
|
|
131
|
+
colors = ButtonDefaults.elevatedButtonColors(
|
|
132
|
+
containerColor = props.colors.containerColor.compose,
|
|
133
|
+
contentColor = props.colors.contentColor.compose,
|
|
134
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
135
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
136
|
+
),
|
|
137
|
+
shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.elevatedShape,
|
|
138
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
139
|
+
) {
|
|
140
|
+
Children(ComposableScope(rowScope = this))
|
|
141
|
+
}
|
|
142
|
+
}
|
|
193
143
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
144
|
+
@Composable
|
|
145
|
+
fun FunctionalComposableScope.TextButtonContent(
|
|
146
|
+
props: ButtonProps,
|
|
147
|
+
onClick: (ButtonPressedEvent) -> Unit
|
|
148
|
+
) {
|
|
149
|
+
TextButton(
|
|
150
|
+
onClick = { onClick(ButtonPressedEvent()) },
|
|
151
|
+
enabled = props.enabled,
|
|
152
|
+
contentPadding = props.contentPadding?.toPaddingValues() ?: ButtonDefaults.TextButtonContentPadding,
|
|
153
|
+
colors = ButtonDefaults.textButtonColors(
|
|
154
|
+
containerColor = props.colors.containerColor.compose,
|
|
155
|
+
contentColor = props.colors.contentColor.compose,
|
|
156
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
157
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
158
|
+
),
|
|
159
|
+
shape = shapeFromShapeRecord(props.shape) ?: ButtonDefaults.textShape,
|
|
160
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
161
|
+
) {
|
|
162
|
+
Children(ComposableScope(rowScope = this))
|
|
204
163
|
}
|
|
205
164
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
package expo.modules.ui.button
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import androidx.compose.material3.ExtendedFloatingActionButton
|
|
5
|
+
import androidx.compose.material3.FloatingActionButton
|
|
6
|
+
import androidx.compose.material3.FloatingActionButtonDefaults
|
|
7
|
+
import androidx.compose.material3.LargeFloatingActionButton
|
|
8
|
+
import androidx.compose.material3.SmallFloatingActionButton
|
|
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
|
+
import expo.modules.ui.ModifierList
|
|
15
|
+
import expo.modules.ui.ModifierRegistry
|
|
16
|
+
import expo.modules.ui.compose
|
|
17
|
+
import expo.modules.ui.findChildSlotView
|
|
18
|
+
|
|
19
|
+
enum class FloatingActionButtonVariant(val value: String) : Enumerable {
|
|
20
|
+
SMALL("small"),
|
|
21
|
+
MEDIUM("medium"),
|
|
22
|
+
LARGE("large"),
|
|
23
|
+
EXTENDED("extended")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
data class FloatingActionButtonProps(
|
|
27
|
+
val variant: FloatingActionButtonVariant = FloatingActionButtonVariant.MEDIUM,
|
|
28
|
+
val expanded: Boolean = true,
|
|
29
|
+
val containerColor: Color? = null,
|
|
30
|
+
val modifiers: ModifierList = emptyList()
|
|
31
|
+
) : ComposeProps
|
|
32
|
+
|
|
33
|
+
@Composable
|
|
34
|
+
fun FunctionalComposableScope.FloatingActionButtonContent(
|
|
35
|
+
props: FloatingActionButtonProps,
|
|
36
|
+
onClick: () -> Unit
|
|
37
|
+
) {
|
|
38
|
+
val containerColor = props.containerColor?.compose ?: FloatingActionButtonDefaults.containerColor
|
|
39
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
40
|
+
|
|
41
|
+
val iconSlotView = findChildSlotView(view, "icon")
|
|
42
|
+
val iconContent: (@Composable () -> Unit) = iconSlotView?.let {
|
|
43
|
+
{
|
|
44
|
+
with(ComposableScope()) {
|
|
45
|
+
with(it) {
|
|
46
|
+
Content()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
} ?: {}
|
|
51
|
+
|
|
52
|
+
when (props.variant) {
|
|
53
|
+
FloatingActionButtonVariant.SMALL -> SmallFloatingActionButton(
|
|
54
|
+
onClick = onClick,
|
|
55
|
+
containerColor = containerColor,
|
|
56
|
+
modifier = modifier,
|
|
57
|
+
content = iconContent
|
|
58
|
+
)
|
|
59
|
+
FloatingActionButtonVariant.LARGE -> LargeFloatingActionButton(
|
|
60
|
+
onClick = onClick,
|
|
61
|
+
containerColor = containerColor,
|
|
62
|
+
modifier = modifier,
|
|
63
|
+
content = iconContent
|
|
64
|
+
)
|
|
65
|
+
FloatingActionButtonVariant.EXTENDED -> {
|
|
66
|
+
val textSlotView = findChildSlotView(view, "text")
|
|
67
|
+
val textContent: (@Composable () -> Unit) = textSlotView?.let {
|
|
68
|
+
{
|
|
69
|
+
with(ComposableScope()) {
|
|
70
|
+
with(it) {
|
|
71
|
+
Content()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} ?: {}
|
|
76
|
+
ExtendedFloatingActionButton(
|
|
77
|
+
onClick = onClick,
|
|
78
|
+
expanded = props.expanded,
|
|
79
|
+
icon = iconContent,
|
|
80
|
+
text = textContent,
|
|
81
|
+
containerColor = containerColor,
|
|
82
|
+
modifier = modifier
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
FloatingActionButtonVariant.MEDIUM -> FloatingActionButton(
|
|
86
|
+
onClick = onClick,
|
|
87
|
+
containerColor = containerColor,
|
|
88
|
+
modifier = modifier,
|
|
89
|
+
content = iconContent
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,113 +1,100 @@
|
|
|
1
1
|
package expo.modules.ui.button
|
|
2
2
|
|
|
3
|
-
import androidx.compose.material3.
|
|
3
|
+
import androidx.compose.material3.FilledIconButton
|
|
4
4
|
import androidx.compose.material3.FilledTonalIconButton
|
|
5
5
|
import androidx.compose.material3.IconButton
|
|
6
6
|
import androidx.compose.material3.IconButtonDefaults
|
|
7
7
|
import androidx.compose.material3.OutlinedIconButton
|
|
8
8
|
import androidx.compose.runtime.Composable
|
|
9
|
-
import androidx.compose.ui.Modifier
|
|
10
|
-
import androidx.compose.ui.graphics.Shape
|
|
11
|
-
import expo.modules.kotlin.types.Enumerable
|
|
12
9
|
import expo.modules.kotlin.views.ComposableScope
|
|
13
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
14
10
|
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
15
|
-
import expo.modules.ui.ModifierList
|
|
16
11
|
import expo.modules.ui.ModifierRegistry
|
|
17
|
-
import expo.modules.ui.ShapeRecord
|
|
18
12
|
import expo.modules.ui.compose
|
|
19
|
-
import expo.modules.ui.menu.LocalContextMenuExpanded
|
|
20
13
|
import expo.modules.ui.shapeFromShapeRecord
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
@Composable
|
|
16
|
+
fun FunctionalComposableScope.IconButtonContent(
|
|
17
|
+
props: ButtonProps,
|
|
18
|
+
onButtonPressed: (ButtonPressedEvent) -> Unit
|
|
19
|
+
) {
|
|
20
|
+
val shape = shapeFromShapeRecord(props.shape)
|
|
21
|
+
IconButton(
|
|
22
|
+
onClick = { onButtonPressed(ButtonPressedEvent()) },
|
|
23
|
+
enabled = props.enabled,
|
|
24
|
+
colors = IconButtonDefaults.iconButtonColors(
|
|
25
|
+
containerColor = props.colors.containerColor.compose,
|
|
26
|
+
contentColor = props.colors.contentColor.compose,
|
|
27
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
28
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
29
|
+
),
|
|
30
|
+
shape = shape ?: IconButtonDefaults.standardShape,
|
|
31
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
32
|
+
) {
|
|
33
|
+
Children(ComposableScope())
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
|
|
28
|
-
data class IconButtonProps(
|
|
29
|
-
val variant: IconButtonVariant? = IconButtonVariant.DEFAULT,
|
|
30
|
-
val elementColors: ButtonColors = ButtonColors(),
|
|
31
|
-
val disabled: Boolean? = false,
|
|
32
|
-
val shape: ShapeRecord? = null,
|
|
33
|
-
val modifiers: ModifierList = emptyList()
|
|
34
|
-
) : ComposeProps
|
|
35
|
-
|
|
36
37
|
@Composable
|
|
37
|
-
fun
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
disabled: Boolean,
|
|
41
|
-
onPress: () -> Unit,
|
|
42
|
-
modifier: Modifier = Modifier,
|
|
43
|
-
shape: Shape?,
|
|
44
|
-
content: @Composable (() -> Unit)
|
|
38
|
+
fun FunctionalComposableScope.FilledIconButtonContent(
|
|
39
|
+
props: ButtonProps,
|
|
40
|
+
onButtonPressed: (ButtonPressedEvent) -> Unit
|
|
45
41
|
) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
IconButtonVariant.OUTLINED -> OutlinedIconButton(
|
|
62
|
-
onPress,
|
|
63
|
-
enabled = !disabled,
|
|
64
|
-
content = content,
|
|
65
|
-
colors = IconButtonDefaults.outlinedIconButtonColors(
|
|
66
|
-
containerColor = colors.containerColor.compose,
|
|
67
|
-
contentColor = colors.contentColor.compose,
|
|
68
|
-
disabledContainerColor = colors.disabledContainerColor.compose,
|
|
69
|
-
disabledContentColor = colors.disabledContentColor.compose
|
|
70
|
-
),
|
|
71
|
-
shape = shape ?: ButtonDefaults.outlinedShape,
|
|
72
|
-
modifier = modifier
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
else -> IconButton(
|
|
76
|
-
onPress,
|
|
77
|
-
enabled = !disabled,
|
|
78
|
-
content = content,
|
|
79
|
-
colors = IconButtonDefaults.iconButtonColors(
|
|
80
|
-
containerColor = colors.containerColor.compose,
|
|
81
|
-
contentColor = colors.contentColor.compose,
|
|
82
|
-
disabledContainerColor = colors.disabledContainerColor.compose,
|
|
83
|
-
disabledContentColor = colors.disabledContentColor.compose
|
|
84
|
-
),
|
|
85
|
-
modifier = modifier
|
|
86
|
-
)
|
|
42
|
+
val shape = shapeFromShapeRecord(props.shape)
|
|
43
|
+
FilledIconButton(
|
|
44
|
+
onClick = { onButtonPressed(ButtonPressedEvent()) },
|
|
45
|
+
enabled = props.enabled,
|
|
46
|
+
colors = IconButtonDefaults.filledIconButtonColors(
|
|
47
|
+
containerColor = props.colors.containerColor.compose,
|
|
48
|
+
contentColor = props.colors.contentColor.compose,
|
|
49
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
50
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
51
|
+
),
|
|
52
|
+
shape = shape ?: IconButtonDefaults.filledShape,
|
|
53
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
54
|
+
) {
|
|
55
|
+
Children(ComposableScope())
|
|
87
56
|
}
|
|
88
57
|
}
|
|
89
58
|
|
|
90
59
|
@Composable
|
|
91
|
-
fun FunctionalComposableScope.
|
|
92
|
-
props:
|
|
60
|
+
fun FunctionalComposableScope.FilledTonalIconButtonContent(
|
|
61
|
+
props: ButtonProps,
|
|
93
62
|
onButtonPressed: (ButtonPressedEvent) -> Unit
|
|
94
63
|
) {
|
|
95
|
-
val
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
64
|
+
val shape = shapeFromShapeRecord(props.shape)
|
|
65
|
+
FilledTonalIconButton(
|
|
66
|
+
onClick = { onButtonPressed(ButtonPressedEvent()) },
|
|
67
|
+
enabled = props.enabled,
|
|
68
|
+
colors = IconButtonDefaults.filledTonalIconButtonColors(
|
|
69
|
+
containerColor = props.colors.containerColor.compose,
|
|
70
|
+
contentColor = props.colors.contentColor.compose,
|
|
71
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
72
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
73
|
+
),
|
|
74
|
+
shape = shape ?: IconButtonDefaults.filledShape,
|
|
75
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
76
|
+
) {
|
|
77
|
+
Children(ComposableScope())
|
|
78
|
+
}
|
|
79
|
+
}
|
|
100
80
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
|
|
81
|
+
@Composable
|
|
82
|
+
fun FunctionalComposableScope.OutlinedIconButtonContent(
|
|
83
|
+
props: ButtonProps,
|
|
84
|
+
onButtonPressed: (ButtonPressedEvent) -> Unit
|
|
85
|
+
) {
|
|
86
|
+
val shape = shapeFromShapeRecord(props.shape)
|
|
87
|
+
OutlinedIconButton(
|
|
88
|
+
onClick = { onButtonPressed(ButtonPressedEvent()) },
|
|
89
|
+
enabled = props.enabled,
|
|
90
|
+
colors = IconButtonDefaults.outlinedIconButtonColors(
|
|
91
|
+
containerColor = props.colors.containerColor.compose,
|
|
92
|
+
contentColor = props.colors.contentColor.compose,
|
|
93
|
+
disabledContainerColor = props.colors.disabledContainerColor.compose,
|
|
94
|
+
disabledContentColor = props.colors.disabledContentColor.compose
|
|
95
|
+
),
|
|
96
|
+
shape = shape ?: IconButtonDefaults.outlinedShape,
|
|
97
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
111
98
|
) {
|
|
112
99
|
Children(ComposableScope())
|
|
113
100
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package expo.modules.ui.menu
|
|
2
|
+
|
|
3
|
+
import androidx.compose.foundation.layout.Box
|
|
4
|
+
import androidx.compose.material3.DropdownMenu
|
|
5
|
+
import androidx.compose.material3.MenuDefaults
|
|
6
|
+
import androidx.compose.runtime.Composable
|
|
7
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
8
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
9
|
+
import expo.modules.ui.ModifierRegistry
|
|
10
|
+
import expo.modules.ui.composeOrNull
|
|
11
|
+
import expo.modules.ui.findChildSlotView
|
|
12
|
+
import expo.modules.ui.isSlotView
|
|
13
|
+
|
|
14
|
+
@Composable
|
|
15
|
+
fun FunctionalComposableScope.DropdownMenuContent(
|
|
16
|
+
props: DropdownMenuProps,
|
|
17
|
+
onDismissRequest: () -> Unit
|
|
18
|
+
) {
|
|
19
|
+
val itemsSlotView = findChildSlotView(view, "items")
|
|
20
|
+
|
|
21
|
+
Box(modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)) {
|
|
22
|
+
// Trigger - non-items children
|
|
23
|
+
Children(ComposableScope(), filter = { !isSlotView(it) })
|
|
24
|
+
|
|
25
|
+
DropdownMenu(
|
|
26
|
+
containerColor = props.color?.composeOrNull ?: MenuDefaults.containerColor,
|
|
27
|
+
expanded = props.expanded,
|
|
28
|
+
onDismissRequest = onDismissRequest
|
|
29
|
+
) {
|
|
30
|
+
itemsSlotView?.let {
|
|
31
|
+
with(ComposableScope()) {
|
|
32
|
+
with(it) {
|
|
33
|
+
Content()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|