@expo/ui 55.0.1 → 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 +58 -0
- package/CONTRIBUTING.md +30 -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 +302 -31
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
- package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +21 -8
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +149 -40
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +204 -50
- 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 +62 -104
- 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 -80
- package/android/src/main/java/expo/modules/ui/convertibles/AnimatableFloat.kt +26 -0
- package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +93 -0
- package/android/src/main/java/expo/modules/ui/convertibles/GraphicsLayerParams.kt +24 -0
- 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 +137 -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/Spacer/index.d.ts +2 -2
- package/build/jetpack-compose/Switch/index.d.ts +25 -47
- 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/animation.d.ts +44 -0
- package/build/jetpack-compose/modifiers/animation.d.ts.map +1 -0
- package/build/jetpack-compose/modifiers/index.d.ts +68 -4
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/AccessoryWidgetBackground/index.d.ts +4 -0
- package/build/swift-ui/AccessoryWidgetBackground/index.d.ts.map +1 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
- package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
- package/build/swift-ui/ControlGroup/index.d.ts +29 -0
- package/build/swift-ui/ControlGroup/index.d.ts.map +1 -0
- package/build/swift-ui/Gauge/index.d.ts.map +1 -1
- package/build/swift-ui/Image/index.d.ts +7 -1
- package/build/swift-ui/Image/index.d.ts.map +1 -1
- package/build/swift-ui/Label/index.d.ts.map +1 -1
- package/build/swift-ui/LabeledContent/index.d.ts.map +1 -1
- package/build/swift-ui/Menu/index.d.ts.map +1 -1
- package/build/swift-ui/Picker/index.d.ts.map +1 -1
- package/build/swift-ui/Popover/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/Section/index.d.ts.map +1 -1
- package/build/swift-ui/Slider/index.d.ts.map +1 -1
- package/build/swift-ui/SlotView.d.ts +5 -0
- package/build/swift-ui/SlotView.d.ts.map +1 -0
- 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/index.d.ts +2 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +54 -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/AccessoryWidgetBackgroundView.swift +27 -0
- package/ios/BottomSheetView.swift +1 -6
- package/ios/ClosedRangeDateRecord.swift +10 -0
- package/ios/ColorPickerView.swift +9 -8
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +7 -15
- package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +0 -5
- package/ios/ContextMenu/ContextMenu.swift +27 -22
- package/ios/ContextMenu/ContextMenuRecords.swift +0 -6
- package/ios/ControlGroupView.swift +33 -0
- package/ios/DatePickerView.swift +7 -5
- package/ios/DisclosureGroupView.swift +5 -7
- package/ios/ExpoUIModule.swift +10 -32
- package/ios/GaugeView.swift +4 -26
- package/ios/HostView.swift +1 -2
- package/ios/ImageView.swift +22 -11
- package/ios/Label.swift +2 -17
- package/ios/LabeledContentView.swift +3 -27
- package/ios/ListView.swift +6 -14
- package/ios/Menu/MenuRecords.swift +0 -2
- package/ios/Menu/MenuView.swift +2 -5
- package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
- package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
- package/ios/Modifiers/ResizableModifier.swift +24 -0
- package/ios/Modifiers/Rotation3DEffectModifier.swift +20 -0
- package/ios/Modifiers/View+ModifierArray.swift +29 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +37 -3
- package/ios/Modifiers/WidgetModifiers.swift +46 -0
- package/ios/Picker/PickerView.swift +8 -16
- package/ios/Popover/PopoverProps.swift +0 -4
- package/ios/Popover/PopoverView.swift +5 -11
- package/ios/ProgressView.swift +0 -5
- package/ios/RNHostView.swift +91 -10
- package/ios/SectionView.swift +9 -17
- package/ios/SecureFieldView.swift +0 -1
- package/ios/ShareLink/ShareLinkView.swift +1 -1
- package/ios/SliderView.swift +16 -31
- package/ios/SlotView.swift +38 -0
- package/ios/StepperView.swift +12 -16
- package/ios/TextFieldView.swift +0 -1
- package/ios/TextView.swift +37 -1
- package/ios/Toggle/ToggleView.swift +5 -7
- package/ios/UIBaseView.swift +34 -3
- 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.1/expo.modules.ui-55.0.1.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.1/expo.modules.ui-55.0.1.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 +215 -6
- 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/Spacer/index.tsx +2 -2
- package/src/jetpack-compose/Switch/index.tsx +32 -84
- package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
- package/src/jetpack-compose/index.ts +5 -4
- package/src/jetpack-compose/modifiers/animation.ts +37 -0
- package/src/jetpack-compose/modifiers/index.ts +86 -6
- package/src/swift-ui/AccessoryWidgetBackground/index.tsx +12 -0
- package/src/swift-ui/ConfirmationDialog/index.tsx +4 -12
- package/src/swift-ui/ContextMenu/index.tsx +6 -20
- package/src/swift-ui/ControlGroup/index.tsx +59 -0
- package/src/swift-ui/Gauge/index.tsx +5 -20
- package/src/swift-ui/Image/index.tsx +7 -1
- package/src/swift-ui/Label/index.tsx +2 -5
- package/src/swift-ui/LabeledContent/index.tsx +3 -12
- package/src/swift-ui/Menu/index.tsx +2 -6
- package/src/swift-ui/Picker/index.tsx +4 -11
- package/src/swift-ui/Popover/index.tsx +3 -12
- package/src/swift-ui/ProgressView/index.tsx +1 -3
- package/src/swift-ui/Section/index.tsx +4 -9
- package/src/swift-ui/Slider/index.tsx +4 -12
- package/src/swift-ui/SlotView.tsx +8 -0
- package/src/swift-ui/Stepper/index.tsx +7 -7
- package/src/swift-ui/Text/index.tsx +66 -2
- package/src/swift-ui/index.tsx +2 -0
- package/src/swift-ui/modifiers/index.ts +87 -1
- 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/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +0 -26
- package/ios/ContextMenu/ContextMenuComponents.swift +0 -37
- package/ios/Menu/MenuComponents.swift +0 -12
- package/ios/Picker/PickerComponents.swift +0 -24
- package/ios/Popover/PopoverComponents.swift +0 -18
- package/ios/SectionComponents.swift +0 -34
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.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
|
@@ -10,9 +10,9 @@ export type StepperProps = {
|
|
|
10
10
|
*/
|
|
11
11
|
label: string;
|
|
12
12
|
/**
|
|
13
|
-
* The
|
|
13
|
+
* The current value of the stepper.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
value?: number;
|
|
16
16
|
/**
|
|
17
17
|
* The step value for increment/decrement operations.
|
|
18
18
|
*/
|
|
@@ -28,11 +28,11 @@ export type StepperProps = {
|
|
|
28
28
|
/**
|
|
29
29
|
* Called when the stepper value changes.
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
onValueChange: (value: number) => void;
|
|
32
32
|
} & CommonViewModifierProps;
|
|
33
33
|
|
|
34
|
-
type NativeStepperProps = Omit<StepperProps, '
|
|
35
|
-
ViewEvent<'
|
|
34
|
+
type NativeStepperProps = Omit<StepperProps, 'onValueChange'> &
|
|
35
|
+
ViewEvent<'onValueChange', { value: number }>;
|
|
36
36
|
|
|
37
37
|
const StepperNativeView: React.ComponentType<NativeStepperProps> = requireNativeView(
|
|
38
38
|
'ExpoUI',
|
|
@@ -45,8 +45,8 @@ function transformStepperProps(props: StepperProps): NativeStepperProps {
|
|
|
45
45
|
modifiers,
|
|
46
46
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
47
47
|
...restProps,
|
|
48
|
-
|
|
49
|
-
props.
|
|
48
|
+
onValueChange: ({ nativeEvent: { value } }) => {
|
|
49
|
+
props.onValueChange(value);
|
|
50
50
|
},
|
|
51
51
|
};
|
|
52
52
|
}
|
|
@@ -2,7 +2,12 @@ import { requireNativeView } from 'expo';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
5
|
-
import { type CommonViewModifierProps } from '../types';
|
|
5
|
+
import { type ClosedRangeDate, type CommonViewModifierProps } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The style used to format a date in a SwiftUI `Text` view.
|
|
9
|
+
*/
|
|
10
|
+
export type TextDateStyle = 'timer' | 'relative' | 'offset' | 'date' | 'time';
|
|
6
11
|
|
|
7
12
|
export interface TextProps extends CommonViewModifierProps {
|
|
8
13
|
/**
|
|
@@ -14,12 +19,50 @@ export interface TextProps extends CommonViewModifierProps {
|
|
|
14
19
|
* Enables Markdown formatting for the text content using SwiftUI LocalizedStringKey.
|
|
15
20
|
*/
|
|
16
21
|
markdownEnabled?: boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A date to display using the specified `dateStyle`. The text auto-updates as time passes.
|
|
25
|
+
*/
|
|
26
|
+
date?: Date;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The style used to format the `date` prop.
|
|
30
|
+
* @default 'date'
|
|
31
|
+
*/
|
|
32
|
+
dateStyle?: TextDateStyle;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A time interval to display as a live-updating timer.
|
|
36
|
+
* @platform ios 16.0+
|
|
37
|
+
* @platform tvos 16.0+
|
|
38
|
+
*/
|
|
39
|
+
timerInterval?: ClosedRangeDate;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Whether the timer counts down (`true`) or up (`false`).
|
|
43
|
+
* @default true
|
|
44
|
+
* @platform ios 16.0+
|
|
45
|
+
* @platform tvos 16.0+
|
|
46
|
+
*/
|
|
47
|
+
countsDown?: boolean;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A date at which the timer should appear paused.
|
|
51
|
+
* @platform ios 16.0+
|
|
52
|
+
* @platform tvos 16.0+
|
|
53
|
+
*/
|
|
54
|
+
pauseTime?: Date;
|
|
17
55
|
}
|
|
18
56
|
|
|
19
57
|
type NativeTextProps = CommonViewModifierProps & {
|
|
20
58
|
text?: string;
|
|
21
59
|
children?: React.ReactNode;
|
|
22
60
|
markdownEnabled?: boolean;
|
|
61
|
+
date?: number;
|
|
62
|
+
dateStyle?: TextDateStyle;
|
|
63
|
+
timerInterval?: { lower: number; upper: number };
|
|
64
|
+
countsDown?: boolean;
|
|
65
|
+
pauseTime?: number;
|
|
23
66
|
};
|
|
24
67
|
|
|
25
68
|
const TextNativeView: React.ComponentType<NativeTextProps> = requireNativeView(
|
|
@@ -28,7 +71,28 @@ const TextNativeView: React.ComponentType<NativeTextProps> = requireNativeView(
|
|
|
28
71
|
);
|
|
29
72
|
|
|
30
73
|
export function Text(props: TextProps) {
|
|
31
|
-
const { children, modifiers, ...restProps } = props;
|
|
74
|
+
const { children, modifiers, date, timerInterval, pauseTime, ...restProps } = props;
|
|
75
|
+
|
|
76
|
+
// Date/timer mode: pass converted timestamps to native, ignore children
|
|
77
|
+
if (date != null || timerInterval != null) {
|
|
78
|
+
return (
|
|
79
|
+
<TextNativeView
|
|
80
|
+
modifiers={modifiers}
|
|
81
|
+
{...(modifiers ? createViewModifierEventListener(modifiers) : undefined)}
|
|
82
|
+
{...restProps}
|
|
83
|
+
date={date ? date.getTime() : undefined}
|
|
84
|
+
timerInterval={
|
|
85
|
+
timerInterval
|
|
86
|
+
? {
|
|
87
|
+
lower: timerInterval.lower.getTime(),
|
|
88
|
+
upper: timerInterval.upper.getTime(),
|
|
89
|
+
}
|
|
90
|
+
: undefined
|
|
91
|
+
}
|
|
92
|
+
pauseTime={pauseTime ? pauseTime.getTime() : undefined}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
32
96
|
|
|
33
97
|
if (children === undefined || children === null) {
|
|
34
98
|
return null;
|
package/src/swift-ui/index.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
export * from './AccessoryWidgetBackground';
|
|
1
2
|
export * from './BottomSheet';
|
|
2
3
|
export * from './Button';
|
|
3
4
|
export * from './Chart';
|
|
4
5
|
export * from './ColorPicker';
|
|
5
6
|
export * from './ContentUnavailableView';
|
|
6
7
|
export * from './ConfirmationDialog';
|
|
8
|
+
export * from './ControlGroup';
|
|
7
9
|
export * from './ContextMenu';
|
|
8
10
|
export * from './DatePicker';
|
|
9
11
|
export * from './Divider';
|
|
@@ -238,6 +238,24 @@ export const scaleEffect = (scale: number | { x: number; y: number }) =>
|
|
|
238
238
|
*/
|
|
239
239
|
export const rotationEffect = (angle: number) => createModifier('rotationEffect', { angle });
|
|
240
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Applies a 3D rotation transformation.
|
|
243
|
+
* @param params - The rotation parameters: `angle` (in degrees), `axis` (x, y, z), and `perspective`.
|
|
244
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/rotation3deffect(_:axis:anchor:anchorz:perspective:)).
|
|
245
|
+
*/
|
|
246
|
+
export const rotation3DEffect = (params: {
|
|
247
|
+
angle: number;
|
|
248
|
+
axis?: { x?: number; y?: number; z?: number };
|
|
249
|
+
perspective?: number;
|
|
250
|
+
}) =>
|
|
251
|
+
createModifier('rotation3DEffect', {
|
|
252
|
+
angle: params.angle,
|
|
253
|
+
axisX: params.axis?.x ?? 0,
|
|
254
|
+
axisY: params.axis?.y ?? 0,
|
|
255
|
+
axisZ: params.axis?.z ?? 0,
|
|
256
|
+
perspective: params.perspective ?? 1,
|
|
257
|
+
});
|
|
258
|
+
|
|
241
259
|
/**
|
|
242
260
|
* Applies an offset (translation) to a view.
|
|
243
261
|
* @param params - The offset parameters: `x` and `y`.
|
|
@@ -549,6 +567,44 @@ export const scrollDismissesKeyboard = (
|
|
|
549
567
|
export const scrollDisabled = (disabled: boolean = true) =>
|
|
550
568
|
createModifier('scrollDisabled', { disabled });
|
|
551
569
|
|
|
570
|
+
type UnitPointValue =
|
|
571
|
+
| 'zero'
|
|
572
|
+
| 'topLeading'
|
|
573
|
+
| 'top'
|
|
574
|
+
| 'topTrailing'
|
|
575
|
+
| 'leading'
|
|
576
|
+
| 'center'
|
|
577
|
+
| 'trailing'
|
|
578
|
+
| 'bottomLeading'
|
|
579
|
+
| 'bottom'
|
|
580
|
+
| 'bottomTrailing';
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Sets the default anchor point for a scroll view's content.
|
|
584
|
+
* @param anchor - The anchor point for initial scroll position and content size changes, or `null` to reset.
|
|
585
|
+
* @platform ios 17.0+
|
|
586
|
+
* @platform tvos 17.0+
|
|
587
|
+
* @platform macos 14.0+
|
|
588
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/defaultscrollanchor(_:)).
|
|
589
|
+
*/
|
|
590
|
+
export const defaultScrollAnchor = (anchor: UnitPointValue | null) =>
|
|
591
|
+
createModifier('defaultScrollAnchor', { anchor });
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Sets the default anchor point for a scroll view for a specific role.
|
|
595
|
+
* Pass `null` to opt out of a specific role while keeping anchors for other roles.
|
|
596
|
+
* @param anchor - The anchor point, or `null` to opt out of this role.
|
|
597
|
+
* @param role - The scroll anchor role: `'initialOffset'`, `'sizeChanges'`, or `'alignment'`.
|
|
598
|
+
* @platform ios 18.0+
|
|
599
|
+
* @platform tvos 18.0+
|
|
600
|
+
* @platform macos 15.0+
|
|
601
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/view/defaultscrollanchor(_:for:)).
|
|
602
|
+
*/
|
|
603
|
+
export const defaultScrollAnchorForRole = (
|
|
604
|
+
anchor: UnitPointValue | null,
|
|
605
|
+
role: 'initialOffset' | 'sizeChanges' | 'alignment'
|
|
606
|
+
) => createModifier('defaultScrollAnchorForRole', { anchor, role });
|
|
607
|
+
|
|
552
608
|
/**
|
|
553
609
|
* Disables the move action for a view in a list.
|
|
554
610
|
* Apply to items within a `ForEach` to prevent them from being moved.
|
|
@@ -984,6 +1040,31 @@ export const listStyle = (style: ListStyle) => createModifier('listStyle', { sty
|
|
|
984
1040
|
*/
|
|
985
1041
|
export const luminanceToAlpha = () => createModifier('luminanceToAlpha', {});
|
|
986
1042
|
|
|
1043
|
+
/**
|
|
1044
|
+
* Sets the mode by which SwiftUI resizes an image to fit its space.
|
|
1045
|
+
* @param capInsets - Inset values that indicate a portion of the image that SwiftUI doesn’t resize.
|
|
1046
|
+
* @param resizingMode - The mode by which SwiftUI resizes the image.
|
|
1047
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/image/resizable(capinsets:resizingmode:)).
|
|
1048
|
+
*/
|
|
1049
|
+
export const resizable = (
|
|
1050
|
+
capInsets?: {
|
|
1051
|
+
top?: number;
|
|
1052
|
+
bottom?: number;
|
|
1053
|
+
leading?: number;
|
|
1054
|
+
trailing?: number;
|
|
1055
|
+
},
|
|
1056
|
+
resizingMode?: 'stretch' | 'tile'
|
|
1057
|
+
) => createModifier('resizable', { ...capInsets, resizingMode });
|
|
1058
|
+
|
|
1059
|
+
/**
|
|
1060
|
+
* Specifies the how to render an Image when using the WidgetKit/WidgetRenderingMode/accented mode.
|
|
1061
|
+
* @param renderingMode - A constant describing how the Image should be rendered.
|
|
1062
|
+
* @see Official [SwiftUI documentation](https://developer.apple.com/documentation/swiftui/image/widgetaccentedrenderingmode(_:)).
|
|
1063
|
+
*/
|
|
1064
|
+
export const widgetAccentedRenderingMode = (
|
|
1065
|
+
renderingMode: 'fullColor' | 'accented' | 'desaturated' | 'accentedDesaturated'
|
|
1066
|
+
) => createModifier('widgetAccentedRenderingMode', { renderingMode });
|
|
1067
|
+
|
|
987
1068
|
// =============================================================================
|
|
988
1069
|
// Type Definitions
|
|
989
1070
|
// =============================================================================
|
|
@@ -1012,6 +1093,7 @@ export type BuiltInModifier =
|
|
|
1012
1093
|
| ReturnType<typeof border>
|
|
1013
1094
|
| ReturnType<typeof scaleEffect>
|
|
1014
1095
|
| ReturnType<typeof rotationEffect>
|
|
1096
|
+
| ReturnType<typeof rotation3DEffect>
|
|
1015
1097
|
| ReturnType<typeof offset>
|
|
1016
1098
|
| ReturnType<typeof foregroundColor>
|
|
1017
1099
|
| ReturnType<typeof foregroundStyle>
|
|
@@ -1053,6 +1135,8 @@ export type BuiltInModifier =
|
|
|
1053
1135
|
| ReturnType<typeof containerRelativeFrame>
|
|
1054
1136
|
| ReturnType<typeof scrollContentBackground>
|
|
1055
1137
|
| ReturnType<typeof scrollDisabled>
|
|
1138
|
+
| ReturnType<typeof defaultScrollAnchor>
|
|
1139
|
+
| ReturnType<typeof defaultScrollAnchorForRole>
|
|
1056
1140
|
| ReturnType<typeof moveDisabled>
|
|
1057
1141
|
| ReturnType<typeof deleteDisabled>
|
|
1058
1142
|
| ReturnType<typeof environment>
|
|
@@ -1083,7 +1167,9 @@ export type BuiltInModifier =
|
|
|
1083
1167
|
| ReturnType<typeof progressViewStyle>
|
|
1084
1168
|
| ReturnType<typeof gaugeStyle>
|
|
1085
1169
|
| ReturnType<typeof listStyle>
|
|
1086
|
-
| ReturnType<typeof contentTransition
|
|
1170
|
+
| ReturnType<typeof contentTransition>
|
|
1171
|
+
| ReturnType<typeof resizable>
|
|
1172
|
+
| ReturnType<typeof widgetAccentedRenderingMode>;
|
|
1087
1173
|
|
|
1088
1174
|
/**
|
|
1089
1175
|
* Main ViewModifier type that supports both built-in and 3rd party modifiers.
|
package/src/swift-ui/types.ts
CHANGED
|
@@ -73,6 +73,11 @@ export interface PaddingProps {
|
|
|
73
73
|
trailing?: number;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* A closed date range with lower and upper bounds.
|
|
78
|
+
*/
|
|
79
|
+
export type ClosedRangeDate = { lower: Date; upper: Date };
|
|
80
|
+
|
|
76
81
|
/**
|
|
77
82
|
* Common props that can be applied to any view.
|
|
78
83
|
*/
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
package expo.modules.ui
|
|
2
|
-
|
|
3
|
-
import androidx.compose.material3.FilterChip
|
|
4
|
-
import androidx.compose.material3.FilterChipDefaults
|
|
5
|
-
import androidx.compose.material3.Text
|
|
6
|
-
import androidx.compose.runtime.Composable
|
|
7
|
-
import expo.modules.kotlin.records.Record
|
|
8
|
-
import expo.modules.kotlin.views.ComposableScope
|
|
9
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
10
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
11
|
-
import java.io.Serializable
|
|
12
|
-
|
|
13
|
-
open class FilterChipPressedEvent : Record, Serializable
|
|
14
|
-
|
|
15
|
-
data class FilterChipProps(
|
|
16
|
-
val selected: Boolean = false,
|
|
17
|
-
val label: String = "",
|
|
18
|
-
val enabled: Boolean = true,
|
|
19
|
-
val modifiers: ModifierList = emptyList()
|
|
20
|
-
) : ComposeProps
|
|
21
|
-
|
|
22
|
-
@Composable
|
|
23
|
-
fun FunctionalComposableScope.FilterChipContent(
|
|
24
|
-
props: FilterChipProps,
|
|
25
|
-
onPress: (FilterChipPressedEvent) -> Unit
|
|
26
|
-
) {
|
|
27
|
-
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
28
|
-
|
|
29
|
-
val leadingIconSlotView = findChildSlotView(view, "leadingIcon")
|
|
30
|
-
val trailingIconSlotView = findChildSlotView(view, "trailingIcon")
|
|
31
|
-
|
|
32
|
-
FilterChip(
|
|
33
|
-
selected = props.selected,
|
|
34
|
-
onClick = { onPress(FilterChipPressedEvent()) },
|
|
35
|
-
label = { Text(props.label) },
|
|
36
|
-
enabled = props.enabled,
|
|
37
|
-
leadingIcon = leadingIconSlotView?.let {
|
|
38
|
-
{
|
|
39
|
-
with(ComposableScope()) {
|
|
40
|
-
with(it) {
|
|
41
|
-
Content()
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
trailingIcon = trailingIconSlotView?.let {
|
|
47
|
-
{
|
|
48
|
-
with(ComposableScope()) {
|
|
49
|
-
with(it) {
|
|
50
|
-
Content()
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
colors = FilterChipDefaults.filterChipColors(),
|
|
56
|
-
border = FilterChipDefaults.filterChipBorder(enabled = props.enabled, selected = props.selected),
|
|
57
|
-
modifier = modifier
|
|
58
|
-
)
|
|
59
|
-
}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
package expo.modules.ui
|
|
2
|
-
|
|
3
|
-
import android.graphics.Color
|
|
4
|
-
import androidx.compose.foundation.layout.Column
|
|
5
|
-
import androidx.compose.foundation.layout.Row
|
|
6
|
-
import androidx.compose.foundation.layout.fillMaxWidth
|
|
7
|
-
import androidx.compose.foundation.layout.height
|
|
8
|
-
import androidx.compose.foundation.layout.padding
|
|
9
|
-
import androidx.compose.foundation.selection.selectable
|
|
10
|
-
import androidx.compose.foundation.selection.selectableGroup
|
|
11
|
-
import androidx.compose.material3.RadioButton
|
|
12
|
-
import androidx.compose.material3.SegmentedButton
|
|
13
|
-
import androidx.compose.material3.SegmentedButtonDefaults
|
|
14
|
-
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
|
|
15
|
-
import androidx.compose.material3.Text
|
|
16
|
-
import androidx.compose.runtime.Composable
|
|
17
|
-
import androidx.compose.ui.Alignment
|
|
18
|
-
import androidx.compose.ui.Modifier
|
|
19
|
-
import androidx.compose.ui.semantics.Role
|
|
20
|
-
import androidx.compose.ui.unit.dp
|
|
21
|
-
import expo.modules.kotlin.records.Field
|
|
22
|
-
import expo.modules.kotlin.records.Record
|
|
23
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
24
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
25
|
-
|
|
26
|
-
class PickerColors : Record {
|
|
27
|
-
@Field
|
|
28
|
-
val activeBorderColor: Color? = null
|
|
29
|
-
|
|
30
|
-
@Field
|
|
31
|
-
val activeContentColor: Color? = null
|
|
32
|
-
|
|
33
|
-
@Field
|
|
34
|
-
val inactiveBorderColor: Color? = null
|
|
35
|
-
|
|
36
|
-
@Field
|
|
37
|
-
val inactiveContentColor: Color? = null
|
|
38
|
-
|
|
39
|
-
@Field
|
|
40
|
-
val disabledActiveBorderColor: Color? = null
|
|
41
|
-
|
|
42
|
-
@Field
|
|
43
|
-
val disabledActiveContentColor: Color? = null
|
|
44
|
-
|
|
45
|
-
@Field
|
|
46
|
-
val disabledInactiveBorderColor: Color? = null
|
|
47
|
-
|
|
48
|
-
@Field
|
|
49
|
-
val disabledInactiveContentColor: Color? = null
|
|
50
|
-
|
|
51
|
-
@Field
|
|
52
|
-
val activeContainerColor: Color? = null
|
|
53
|
-
|
|
54
|
-
@Field
|
|
55
|
-
val inactiveContainerColor: Color? = null
|
|
56
|
-
|
|
57
|
-
@Field
|
|
58
|
-
val disabledActiveContainerColor: Color? = null
|
|
59
|
-
|
|
60
|
-
@Field
|
|
61
|
-
val disabledInactiveContainerColor: Color? = null
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
data class PickerProps(
|
|
65
|
-
val options: Array<String> = emptyArray(),
|
|
66
|
-
val selectedIndex: Int? = null,
|
|
67
|
-
val elementColors: PickerColors = PickerColors(),
|
|
68
|
-
val variant: String = "segmented",
|
|
69
|
-
val buttonModifiers: List<ModifierType> = emptyList(),
|
|
70
|
-
val modifiers: ModifierList = emptyList()
|
|
71
|
-
) : ComposeProps
|
|
72
|
-
|
|
73
|
-
data class PickerOptionSelectedEvent(
|
|
74
|
-
@Field val index: Int,
|
|
75
|
-
@Field val label: String
|
|
76
|
-
) : Record
|
|
77
|
-
|
|
78
|
-
@Composable
|
|
79
|
-
fun FunctionalComposableScope.PickerContent(
|
|
80
|
-
props: PickerProps,
|
|
81
|
-
onOptionSelected: (PickerOptionSelectedEvent) -> Unit
|
|
82
|
-
) {
|
|
83
|
-
val selectedIndex = props.selectedIndex
|
|
84
|
-
val options = props.options
|
|
85
|
-
val colors = props.elementColors
|
|
86
|
-
val variant = props.variant
|
|
87
|
-
|
|
88
|
-
@Composable
|
|
89
|
-
fun SegmentedComposable() {
|
|
90
|
-
SingleChoiceSegmentedButtonRow(
|
|
91
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
92
|
-
) {
|
|
93
|
-
options.forEachIndexed { index, label ->
|
|
94
|
-
SegmentedButton(
|
|
95
|
-
shape = SegmentedButtonDefaults.itemShape(
|
|
96
|
-
index = index,
|
|
97
|
-
count = options.size
|
|
98
|
-
),
|
|
99
|
-
onClick = {
|
|
100
|
-
onOptionSelected(PickerOptionSelectedEvent(index, label))
|
|
101
|
-
},
|
|
102
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
|
|
103
|
-
selected = index == selectedIndex,
|
|
104
|
-
label = { Text(label) },
|
|
105
|
-
colors = SegmentedButtonDefaults.colors(
|
|
106
|
-
activeBorderColor = colors.activeBorderColor.compose,
|
|
107
|
-
activeContentColor = colors.activeContentColor.compose,
|
|
108
|
-
inactiveBorderColor = colors.inactiveBorderColor.compose,
|
|
109
|
-
inactiveContentColor = colors.inactiveContentColor.compose,
|
|
110
|
-
disabledActiveBorderColor = colors.disabledActiveBorderColor.compose,
|
|
111
|
-
disabledActiveContentColor = colors.disabledActiveContentColor.compose,
|
|
112
|
-
disabledInactiveBorderColor = colors.disabledInactiveBorderColor.compose,
|
|
113
|
-
disabledInactiveContentColor = colors.disabledInactiveContentColor.compose,
|
|
114
|
-
activeContainerColor = colors.activeContainerColor.compose,
|
|
115
|
-
inactiveContainerColor = colors.inactiveContainerColor.compose,
|
|
116
|
-
disabledActiveContainerColor = colors.disabledActiveContainerColor.compose,
|
|
117
|
-
disabledInactiveContainerColor = colors.disabledInactiveContainerColor.compose
|
|
118
|
-
)
|
|
119
|
-
)
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@Composable
|
|
125
|
-
fun RadioComposable() {
|
|
126
|
-
Column(Modifier.selectableGroup()) {
|
|
127
|
-
options.forEachIndexed { index, label ->
|
|
128
|
-
Row(
|
|
129
|
-
Modifier.fillMaxWidth()
|
|
130
|
-
.height(28.dp)
|
|
131
|
-
.selectable(
|
|
132
|
-
selected = index == selectedIndex,
|
|
133
|
-
onClick = {
|
|
134
|
-
onOptionSelected(PickerOptionSelectedEvent(index, label))
|
|
135
|
-
},
|
|
136
|
-
role = Role.RadioButton
|
|
137
|
-
),
|
|
138
|
-
verticalAlignment = Alignment.CenterVertically
|
|
139
|
-
) {
|
|
140
|
-
RadioButton(
|
|
141
|
-
selected = index == selectedIndex,
|
|
142
|
-
onClick = null
|
|
143
|
-
)
|
|
144
|
-
Text(
|
|
145
|
-
text = label,
|
|
146
|
-
modifier = Modifier.padding(start = 12.dp)
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (variant == "segmented") {
|
|
154
|
-
SegmentedComposable()
|
|
155
|
-
} else if (variant == "radio") {
|
|
156
|
-
RadioComposable()
|
|
157
|
-
} else {
|
|
158
|
-
// Default to segmented picker
|
|
159
|
-
SegmentedComposable()
|
|
160
|
-
}
|
|
161
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
package expo.modules.ui
|
|
2
|
-
|
|
3
|
-
import android.graphics.Color
|
|
4
|
-
import androidx.compose.material3.Text
|
|
5
|
-
import androidx.compose.material3.TextButton
|
|
6
|
-
import androidx.compose.runtime.Composable
|
|
7
|
-
import expo.modules.kotlin.views.ComposeProps
|
|
8
|
-
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
9
|
-
import expo.modules.ui.button.ButtonPressedEvent
|
|
10
|
-
|
|
11
|
-
data class TextButtonProps(
|
|
12
|
-
val text: String = "",
|
|
13
|
-
val color: Color? = null,
|
|
14
|
-
val disabled: Boolean = false,
|
|
15
|
-
val modifiers: ModifierList = emptyList()
|
|
16
|
-
) : ComposeProps
|
|
17
|
-
|
|
18
|
-
@Composable
|
|
19
|
-
fun FunctionalComposableScope.TextButtonContent(
|
|
20
|
-
props: TextButtonProps,
|
|
21
|
-
onButtonPressed: (ButtonPressedEvent) -> Unit
|
|
22
|
-
) {
|
|
23
|
-
TextButton(
|
|
24
|
-
onClick = { onButtonPressed(ButtonPressedEvent()) },
|
|
25
|
-
enabled = !props.disabled,
|
|
26
|
-
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
27
|
-
) {
|
|
28
|
-
Text(
|
|
29
|
-
text = props.text,
|
|
30
|
-
color = props.color.composeOrNull ?: androidx.compose.ui.graphics.Color.Unspecified
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
}
|