@expo/ui 55.0.2 → 55.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -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/BottomSheetView.kt +91 -13
- 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 +209 -61
- 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/TextInputView.kt +39 -15
- 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/datetime-picker/DateTimePicker.android.d.ts +3 -0
- package/build/datetime-picker/DateTimePicker.android.d.ts.map +1 -0
- package/build/datetime-picker/DateTimePicker.d.ts +3 -0
- package/build/datetime-picker/DateTimePicker.d.ts.map +1 -0
- package/build/datetime-picker/DateTimePicker.web.d.ts +3 -0
- package/build/datetime-picker/DateTimePicker.web.d.ts.map +1 -0
- package/build/datetime-picker/index.d.ts +5 -0
- package/build/datetime-picker/index.d.ts.map +1 -0
- package/build/datetime-picker/types.d.ts +128 -0
- package/build/datetime-picker/types.d.ts.map +1 -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/ModalBottomSheet/index.d.ts +65 -13
- package/build/jetpack-compose/ModalBottomSheet/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/TextInput/index.d.ts +9 -0
- package/build/jetpack-compose/TextInput/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/Link/index.d.ts +36 -0
- package/build/swift-ui/Link/index.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/environment.d.ts +16 -1
- package/build/swift-ui/modifiers/environment.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +24 -7
- 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/modifiers/widgets.d.ts +14 -0
- package/build/swift-ui/modifiers/widgets.d.ts.map +1 -0
- 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/ExpoUIModule.swift +1 -0
- package/ios/LinkView.swift +29 -0
- package/ios/ListView.swift +6 -14
- package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
- package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
- package/ios/Modifiers/EnvironmentModifier.swift +14 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +12 -0
- package/ios/Modifiers/WidgetModifiers.swift +12 -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.4/expo.modules.ui-55.0.4-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.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.4/expo.modules.ui-55.0.4.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.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.4/expo.modules.ui-55.0.4.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.4/expo.modules.ui-55.0.4.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +9 -2
- package/src/datetime-picker/DateTimePicker.android.tsx +126 -0
- package/src/datetime-picker/DateTimePicker.tsx +94 -0
- package/src/datetime-picker/DateTimePicker.web.tsx +5 -0
- package/src/datetime-picker/index.tsx +11 -0
- package/src/datetime-picker/types.tsx +147 -0
- 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/ModalBottomSheet/index.tsx +85 -15
- 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/TextInput/index.tsx +10 -0
- 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/Link/index.tsx +52 -0
- 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/index.tsx +1 -0
- package/src/swift-ui/modifiers/environment.ts +17 -4
- package/src/swift-ui/modifiers/index.ts +44 -10
- package/src/swift-ui/modifiers/widgets.ts +18 -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
package/CHANGELOG.md
CHANGED
|
@@ -10,12 +10,52 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 55.0.4 — 2026-03-18
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- [iOS] Add `Link` view. ([#43983](https://github.com/expo/expo/pull/43983) by [@jakex7](https://github.com/jakex7))
|
|
18
|
+
- [iOS] Add `widgetURL` modifier. ([#43984](https://github.com/expo/expo/pull/43984) by [@jakex7](https://github.com/jakex7))
|
|
19
|
+
|
|
20
|
+
## 55.0.3 — 2026-03-17
|
|
21
|
+
|
|
22
|
+
### 🛠 Breaking changes
|
|
23
|
+
|
|
24
|
+
- [iOS] Renamed Stepper `defaultValue` to `value` and `onValueChanged` to `onValueChange`. ([#43954](https://github.com/expo/expo/pull/43954) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
25
|
+
- [android] Replace `Picker` with `SingleChoiceSegmentedButtonRow`, `MultiChoiceSegmentedButtonRow`, and `SegmentedButton` components. Replace `RadioButton` `nativeClickable` prop with `onClick` event. ([#43809](https://github.com/expo/expo/pull/43809) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
26
|
+
- [android] Split `ToggleButton` into separate M3 components: `ToggleButton`, `IconToggleButton`, `FilledIconToggleButton`, `OutlinedIconToggleButton`. Removed `variant`, `text`, `color`, `disabled` props. Added `colors` with checked/unchecked variants. ([#43974](https://github.com/expo/expo/pull/43974) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
27
|
+
- [android] Match `Switch` API to native: removed `variant` prop and split into separate `Switch` and `Checkbox` components matching native M3 APIs. Renamed `elementColors` to `colors`, `onValueChange` to `onCheckedChange`, removed `color` convenience prop. ([#43887](https://github.com/expo/expo/pull/43887) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
28
|
+
- [android] Refactored Progress Indicators to match native Compose API: split into `LinearProgressIndicator`, `CircularProgressIndicator`, `LinearWavyProgressIndicator`, `CircularWavyProgressIndicator`. Flattened `elementColors.trackColor` to `trackColor`. Added `strokeCap`, `gapSize`, `strokeWidth` props. ([#43907](https://github.com/expo/expo/pull/43907) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
29
|
+
- [android] Refactored `Card` to match native Material3 API: split into `Card`/`ElevatedCard`/`OutlinedCard` with type-specific props (`elevation`, `border`). ([#43896](https://github.com/expo/expo/pull/43896) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
30
|
+
- [android] Split `Button` into separate M3 components: `Button`, `FilledTonalButton`, `OutlinedButton`, `ElevatedButton`, `TextButton`. Removed `variant`, `text`, `leadingIcon`, `trailingIcon`, `color`, `elementColors`, `disabled` props. ([#43859](https://github.com/expo/expo/pull/43859) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
31
|
+
- [android] Split `IconButton` into separate M3 components: `IconButton`, `FilledIconButton`, `FilledTonalIconButton`, `OutlinedIconButton`. Removed `variant`, `color`, `elementColors`, `disabled`, `onPress` props. ([#43859](https://github.com/expo/expo/pull/43859) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
32
|
+
- [android] Refactored `Chip` to match native Material3 API: split into `AssistChip`/`FilterChip`/`InputChip`/`SuggestionChip` with slot-based content, added `colors`/`elevation`/`border` props. Merged `FilterChip` into `Chip` module. ([#43900](https://github.com/expo/expo/pull/43900) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
33
|
+
- [android] Refactored `Slider` to match native Material3 API: renamed `elementColors` to `colors`, removed `color` convenience prop. ([#43840](https://github.com/expo/expo/pull/43840) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
34
|
+
- [android] rename ContextMenu to DropdownMenu ([#43794](https://github.com/expo/expo/pull/43794) by [@Ubax](https://github.com/Ubax))
|
|
35
|
+
- [android] configure ContextMenu by using native children ([#43792](https://github.com/expo/expo/pull/43792) by [@Ubax](https://github.com/Ubax))
|
|
36
|
+
- [android] control ContextMenu expanded state from JS ([#43793](https://github.com/expo/expo/pull/43793) by [@Ubax](https://github.com/Ubax))
|
|
37
|
+
|
|
38
|
+
### 🎉 New features
|
|
39
|
+
|
|
40
|
+
- [android] Added `outlined` variant to `TextInput` component. ([#43719](https://github.com/expo/expo/pull/43719) by [@benjaminkomen](https://github.com/benjaminkomen))
|
|
41
|
+
- Added `@expo/ui/datetimepicker` — a cross-platform `DateTimePicker` drop-in replacement for `@react-native-community/datetimepicker`. ([#44014](https://github.com/expo/expo/pull/44014) by [@vonovak](https://github.com/vonovak))
|
|
42
|
+
- [iOS] Added `locale` and `timeZone` support to `modifiers`. ([#44013](https://github.com/expo/expo/pull/44013) by [@vonovak](https://github.com/vonovak))
|
|
43
|
+
- [android] Added `ref.hide()` for animated dismiss and more configurable props (`containerColor`, `contentColor`, `scrimColor`, `showDragHandle`, `sheetGesturesEnabled`, `properties`, `DragHandle` slot) to `BottomSheet`. ([#43972](https://github.com/expo/expo/pull/43972) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
44
|
+
- [iOS] Added `date`, `dateStyle`, `timerInterval`, `countsDown`, and `pauseTime` props to `Text` component for displaying auto-updating dates, timers, and countdowns using SwiftUI's `Text.DateStyle`. ([#43552](https://github.com/expo/expo/pull/43552) by [@LouisRaverdy](https://github.com/LouisRaverdy))
|
|
45
|
+
- [android] Added `Checkbox` and `TriStateCheckbox` components. ([#43887](https://github.com/expo/expo/pull/43887) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
46
|
+
- [Android] Added `DatePickerDialog` and `TimePickerDialog` components, and `selectableDates` prop to `DateTimePicker`. ([#43895](https://github.com/expo/expo/pull/43895) by [@vonovak](https://github.com/vonovak))
|
|
47
|
+
- [android] Added `FloatingActionButton` component. ([#43738](https://github.com/expo/expo/pull/43738) by [@benjaminkomen](https://github.com/benjaminkomen))
|
|
48
|
+
- [android] Added `enabled`, `onValueChangeFinished`, and `Slider.Thumb`/`Slider.Track` slot support to `Slider` component. ([#43840](https://github.com/expo/expo/pull/43840) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
49
|
+
- [android] add AnimatedVisibility transition API ([#43632](https://github.com/expo/expo/pull/43632) by [@Ubax](https://github.com/Ubax))
|
|
50
|
+
|
|
13
51
|
## 55.0.2 — 2026-03-11
|
|
14
52
|
|
|
15
53
|
### 🎉 New features
|
|
16
54
|
|
|
17
55
|
- [Android] Added `graphicsLayer` modifier and animation helpers for per-value animation in it. Added `indication` option to `clickable` modifier to control ripple effects. ([#43655](https://github.com/expo/expo/pull/43655) by [@vonovak](https://github.com/vonovak))
|
|
18
56
|
- [Android] Added border color customization for `Switch` and `Checkbox` components. ([#43770](https://github.com/expo/expo/pull/43770) by [@liestig](https://github.com/liestig))
|
|
57
|
+
- [iOS] Added `defaultScrollAnchor` modifier for controlling initial scroll position (iOS 17+). ([#43914](https://github.com/expo/expo/pull/43914) by [@ramonclaudio](https://github.com/ramonclaudio))
|
|
58
|
+
- [iOS] Added `defaultScrollAnchorForRole` modifier for per-role scroll anchor control (iOS 18+). ([#43923](https://github.com/expo/expo/pull/43923) by [@ramonclaudio](https://github.com/ramonclaudio))
|
|
19
59
|
- [iOS] Added `rotation3DEffect` modifier for 3D rotation transforms ([#43640](https://github.com/expo/expo/pull/43640) by [@vonovak](https://github.com/vonovak))
|
|
20
60
|
- [iOS] Added `ControlGroup` component. ([#43581](https://github.com/expo/expo/pull/43581) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
21
61
|
- [android] detect FAB in HorizontalFloatingToolbar ([#43601](https://github.com/expo/expo/pull/43601) by [@Ubax](https://github.com/Ubax))
|
|
@@ -25,6 +65,8 @@
|
|
|
25
65
|
|
|
26
66
|
### 🐛 Bug fixes
|
|
27
67
|
|
|
68
|
+
- [iOS] Fix initial prop values not being applied since `init` runs before `updateProps`. ([#43954](https://github.com/expo/expo/pull/43954) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
69
|
+
- [iOS] Fix prop syncing race condition where stale values override user interactions. Replace `onReceive(Sequence.publisher)` with `onAppear` + `onChange` across all SwiftUI views. ([#43954](https://github.com/expo/expo/pull/43954) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
28
70
|
- [iOS] Fix `Slider` thumb snapping back during drag by guarding `.onReceive` with `isEditing` state. ([#43701](https://github.com/expo/expo/issues/43701) by [@fedeciancaglini](https://github.com/fedeciancaglini)) ([#43797](https://github.com/expo/expo/pull/43797) by [@fedeciancaglini](https://github.com/fedeciancaglini))
|
|
29
71
|
- [Android] Fix touch events for RN views inside Compose BottomSheet. ([#43716](https://github.com/expo/expo/pull/43716) by [@nishan](https://github.com/intergalacticspacehighway))
|
|
30
72
|
- [Android] Fix `RNHostView` child parent related crash. ([#43691](https://github.com/expo/expo/pull/43691) by [@nishan](https://github.com/intergalacticspacehighway))
|
package/android/build.gradle
CHANGED
|
@@ -12,13 +12,13 @@ apply plugin: 'expo-module-gradle-plugin'
|
|
|
12
12
|
apply plugin: 'org.jetbrains.kotlin.plugin.compose'
|
|
13
13
|
|
|
14
14
|
group = 'expo.modules.ui'
|
|
15
|
-
version = '55.0.
|
|
15
|
+
version = '55.0.4'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "55.0.
|
|
21
|
+
versionName "55.0.4"
|
|
22
22
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
23
23
|
}
|
|
24
24
|
buildFeatures {
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
package expo.modules.ui
|
|
2
|
+
|
|
3
|
+
import androidx.compose.animation.AnimatedVisibility
|
|
4
|
+
import androidx.compose.animation.EnterTransition
|
|
5
|
+
import androidx.compose.animation.ExitTransition
|
|
6
|
+
import androidx.compose.animation.expandHorizontally
|
|
7
|
+
import androidx.compose.animation.expandIn
|
|
8
|
+
import androidx.compose.animation.expandVertically
|
|
9
|
+
import androidx.compose.animation.fadeIn
|
|
10
|
+
import androidx.compose.animation.fadeOut
|
|
11
|
+
import androidx.compose.animation.scaleIn
|
|
12
|
+
import androidx.compose.animation.scaleOut
|
|
13
|
+
import androidx.compose.animation.shrinkHorizontally
|
|
14
|
+
import androidx.compose.animation.shrinkOut
|
|
15
|
+
import androidx.compose.animation.shrinkVertically
|
|
16
|
+
import androidx.compose.animation.slideInHorizontally
|
|
17
|
+
import androidx.compose.animation.slideInVertically
|
|
18
|
+
import androidx.compose.animation.slideOutHorizontally
|
|
19
|
+
import androidx.compose.animation.slideOutVertically
|
|
20
|
+
import androidx.compose.runtime.Composable
|
|
21
|
+
import expo.modules.kotlin.records.Field
|
|
22
|
+
import expo.modules.kotlin.records.Record
|
|
23
|
+
import expo.modules.kotlin.types.Enumerable
|
|
24
|
+
import expo.modules.kotlin.views.ComposableScope
|
|
25
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
26
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
27
|
+
|
|
28
|
+
// region Transition types
|
|
29
|
+
|
|
30
|
+
enum class EnterTransitionType(val value: String) : Enumerable {
|
|
31
|
+
FADE_IN("fadeIn"),
|
|
32
|
+
SLIDE_IN_HORIZONTALLY("slideInHorizontally"),
|
|
33
|
+
SLIDE_IN_VERTICALLY("slideInVertically"),
|
|
34
|
+
EXPAND_IN("expandIn"),
|
|
35
|
+
EXPAND_HORIZONTALLY("expandHorizontally"),
|
|
36
|
+
EXPAND_VERTICALLY("expandVertically"),
|
|
37
|
+
SCALE_IN("scaleIn")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
enum class ExitTransitionType(val value: String) : Enumerable {
|
|
41
|
+
FADE_OUT("fadeOut"),
|
|
42
|
+
SLIDE_OUT_HORIZONTALLY("slideOutHorizontally"),
|
|
43
|
+
SLIDE_OUT_VERTICALLY("slideOutVertically"),
|
|
44
|
+
SHRINK_OUT("shrinkOut"),
|
|
45
|
+
SHRINK_HORIZONTALLY("shrinkHorizontally"),
|
|
46
|
+
SHRINK_VERTICALLY("shrinkVertically"),
|
|
47
|
+
SCALE_OUT("scaleOut")
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
data class EnterTransitionRecord(
|
|
51
|
+
@Field val type: EnterTransitionType = EnterTransitionType.FADE_IN,
|
|
52
|
+
@Field val initialAlpha: Float? = null,
|
|
53
|
+
@Field val initialOffsetX: Float? = null,
|
|
54
|
+
@Field val initialOffsetY: Float? = null,
|
|
55
|
+
@Field val initialScale: Float? = null
|
|
56
|
+
) : Record
|
|
57
|
+
|
|
58
|
+
data class ExitTransitionRecord(
|
|
59
|
+
@Field val type: ExitTransitionType = ExitTransitionType.FADE_OUT,
|
|
60
|
+
@Field val targetAlpha: Float? = null,
|
|
61
|
+
@Field val targetOffsetX: Float? = null,
|
|
62
|
+
@Field val targetOffsetY: Float? = null,
|
|
63
|
+
@Field val targetScale: Float? = null
|
|
64
|
+
) : Record
|
|
65
|
+
|
|
66
|
+
// endregion
|
|
67
|
+
|
|
68
|
+
// region Transition conversion
|
|
69
|
+
|
|
70
|
+
// TODO(@ubax): expose animationSpec parameter (tween, spring, duration) for all transitions
|
|
71
|
+
private fun EnterTransitionRecord.toComposeTransition(): EnterTransition = when (type) {
|
|
72
|
+
EnterTransitionType.FADE_IN ->
|
|
73
|
+
if (initialAlpha != null) fadeIn(initialAlpha = initialAlpha) else fadeIn()
|
|
74
|
+
EnterTransitionType.SLIDE_IN_HORIZONTALLY ->
|
|
75
|
+
if (initialOffsetX != null) slideInHorizontally { (it * initialOffsetX).toInt() } else slideInHorizontally()
|
|
76
|
+
EnterTransitionType.SLIDE_IN_VERTICALLY ->
|
|
77
|
+
if (initialOffsetY != null) slideInVertically { (it * initialOffsetY).toInt() } else slideInVertically()
|
|
78
|
+
// TODO(@ubax): expose expandFrom (Alignment) and initialSize parameters for expand transitions
|
|
79
|
+
EnterTransitionType.EXPAND_IN -> expandIn()
|
|
80
|
+
EnterTransitionType.EXPAND_HORIZONTALLY -> expandHorizontally()
|
|
81
|
+
EnterTransitionType.EXPAND_VERTICALLY -> expandVertically()
|
|
82
|
+
EnterTransitionType.SCALE_IN ->
|
|
83
|
+
if (initialScale != null) scaleIn(initialScale = initialScale) else scaleIn()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
private fun ExitTransitionRecord.toComposeTransition(): ExitTransition = when (type) {
|
|
87
|
+
ExitTransitionType.FADE_OUT ->
|
|
88
|
+
if (targetAlpha != null) fadeOut(targetAlpha = targetAlpha) else fadeOut()
|
|
89
|
+
ExitTransitionType.SLIDE_OUT_HORIZONTALLY ->
|
|
90
|
+
if (targetOffsetX != null) slideOutHorizontally { (it * targetOffsetX).toInt() } else slideOutHorizontally()
|
|
91
|
+
ExitTransitionType.SLIDE_OUT_VERTICALLY ->
|
|
92
|
+
if (targetOffsetY != null) slideOutVertically { (it * targetOffsetY).toInt() } else slideOutVertically()
|
|
93
|
+
// TODO(@ubax): expose shrinkTowards (Alignment) and targetSize parameters for shrink transitions
|
|
94
|
+
ExitTransitionType.SHRINK_OUT -> shrinkOut()
|
|
95
|
+
ExitTransitionType.SHRINK_HORIZONTALLY -> shrinkHorizontally()
|
|
96
|
+
ExitTransitionType.SHRINK_VERTICALLY -> shrinkVertically()
|
|
97
|
+
ExitTransitionType.SCALE_OUT ->
|
|
98
|
+
if (targetScale != null) scaleOut(targetScale = targetScale) else scaleOut()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private fun List<EnterTransitionRecord>.toComposedEnterTransition(): EnterTransition? =
|
|
102
|
+
map { it.toComposeTransition() }.reduceOrNull { acc, transition -> acc + transition }
|
|
103
|
+
|
|
104
|
+
private fun List<ExitTransitionRecord>.toComposedExitTransition(): ExitTransition? =
|
|
105
|
+
map { it.toComposeTransition() }.reduceOrNull { acc, transition -> acc + transition }
|
|
106
|
+
|
|
107
|
+
// endregion
|
|
108
|
+
|
|
109
|
+
data class AnimatedVisibilityProps(
|
|
110
|
+
val visible: Boolean = true,
|
|
111
|
+
val enterTransition: List<EnterTransitionRecord>? = null,
|
|
112
|
+
val exitTransition: List<ExitTransitionRecord>? = null,
|
|
113
|
+
val modifiers: ModifierList = emptyList()
|
|
114
|
+
) : ComposeProps
|
|
115
|
+
|
|
116
|
+
@Composable
|
|
117
|
+
fun FunctionalComposableScope.AnimatedVisibilityContent(props: AnimatedVisibilityProps) {
|
|
118
|
+
val enter = props.enterTransition?.takeIf { it.isNotEmpty() }?.toComposedEnterTransition()
|
|
119
|
+
val exit = props.exitTransition?.takeIf { it.isNotEmpty() }?.toComposedExitTransition()
|
|
120
|
+
|
|
121
|
+
AnimatedVisibility(
|
|
122
|
+
visible = props.visible,
|
|
123
|
+
enter = enter ?: (fadeIn() + expandIn()),
|
|
124
|
+
exit = exit ?: (fadeOut() + shrinkOut()),
|
|
125
|
+
modifier = ModifierRegistry
|
|
126
|
+
.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
127
|
+
) {
|
|
128
|
+
Children(ComposableScope())
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -2,28 +2,106 @@
|
|
|
2
2
|
|
|
3
3
|
package expo.modules.ui
|
|
4
4
|
|
|
5
|
+
import android.annotation.SuppressLint
|
|
6
|
+
import android.content.Context
|
|
7
|
+
import android.graphics.Color
|
|
8
|
+
import androidx.compose.material3.BottomSheetDefaults
|
|
5
9
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
6
10
|
import androidx.compose.material3.ModalBottomSheet
|
|
11
|
+
import androidx.compose.material3.ModalBottomSheetProperties
|
|
12
|
+
import androidx.compose.material3.SheetState
|
|
13
|
+
import androidx.compose.material3.contentColorFor
|
|
7
14
|
import androidx.compose.material3.rememberModalBottomSheetState
|
|
8
15
|
import androidx.compose.runtime.Composable
|
|
16
|
+
import androidx.compose.runtime.MutableState
|
|
17
|
+
import androidx.compose.runtime.mutableStateOf
|
|
18
|
+
import androidx.compose.runtime.rememberCoroutineScope
|
|
19
|
+
import kotlin.coroutines.cancellation.CancellationException
|
|
20
|
+
import kotlinx.coroutines.CoroutineScope
|
|
21
|
+
import kotlinx.coroutines.withContext
|
|
22
|
+
import expo.modules.kotlin.AppContext
|
|
23
|
+
import expo.modules.kotlin.records.Field
|
|
24
|
+
import expo.modules.kotlin.records.Record
|
|
25
|
+
import expo.modules.kotlin.viewevent.EventDispatcher
|
|
9
26
|
import expo.modules.kotlin.views.ComposableScope
|
|
10
27
|
import expo.modules.kotlin.views.ComposeProps
|
|
11
|
-
import expo.modules.kotlin.views.
|
|
28
|
+
import expo.modules.kotlin.views.ExpoComposeView
|
|
12
29
|
|
|
13
|
-
data class
|
|
14
|
-
val
|
|
15
|
-
val
|
|
30
|
+
data class ModalBottomSheetPropertiesRecord(
|
|
31
|
+
@Field val shouldDismissOnBackPress: Boolean = true,
|
|
32
|
+
@Field val shouldDismissOnClickOutside: Boolean = true
|
|
33
|
+
) : Record
|
|
34
|
+
|
|
35
|
+
data class ModalBottomSheetViewProps(
|
|
36
|
+
val skipPartiallyExpanded: MutableState<Boolean> = mutableStateOf(false),
|
|
37
|
+
val containerColor: MutableState<Color?> = mutableStateOf(null),
|
|
38
|
+
val contentColor: MutableState<Color?> = mutableStateOf(null),
|
|
39
|
+
val scrimColor: MutableState<Color?> = mutableStateOf(null),
|
|
40
|
+
val showDragHandle: MutableState<Boolean> = mutableStateOf(true),
|
|
41
|
+
val sheetGesturesEnabled: MutableState<Boolean> = mutableStateOf(true),
|
|
42
|
+
val properties: MutableState<ModalBottomSheetPropertiesRecord> = mutableStateOf(ModalBottomSheetPropertiesRecord()),
|
|
43
|
+
val modifiers: MutableState<ModifierList> = mutableStateOf(emptyList())
|
|
16
44
|
) : ComposeProps
|
|
17
45
|
|
|
18
|
-
@
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
@SuppressLint("ViewConstructor")
|
|
47
|
+
class ModalBottomSheetView(context: Context, appContext: AppContext) :
|
|
48
|
+
ExpoComposeView<ModalBottomSheetViewProps>(context, appContext) {
|
|
49
|
+
override val props = ModalBottomSheetViewProps()
|
|
50
|
+
internal val onDismissRequest by EventDispatcher<Unit>()
|
|
51
|
+
|
|
52
|
+
internal var sheetState: SheetState? = null
|
|
53
|
+
private var composeScope: CoroutineScope? = null
|
|
54
|
+
|
|
55
|
+
suspend fun hide() {
|
|
56
|
+
val scope = composeScope ?: return
|
|
57
|
+
val state = sheetState ?: return
|
|
58
|
+
try {
|
|
59
|
+
withContext(scope.coroutineContext) {
|
|
60
|
+
state.hide()
|
|
61
|
+
}
|
|
62
|
+
} catch (_: CancellationException) {
|
|
63
|
+
// Swipe-dismiss may cancel the coroutine scope while hide() is in-flight.
|
|
64
|
+
// Swallowing the exception avoids an unhandled promise rejection on the JS side.
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Composable
|
|
69
|
+
override fun ComposableScope.Content() {
|
|
70
|
+
val sheetState = rememberModalBottomSheetState(props.skipPartiallyExpanded.value)
|
|
71
|
+
val scope = rememberCoroutineScope()
|
|
72
|
+
this@ModalBottomSheetView.sheetState = sheetState
|
|
73
|
+
this@ModalBottomSheetView.composeScope = scope
|
|
74
|
+
|
|
75
|
+
val resolvedContainerColor = props.containerColor.value.composeOrNull ?: BottomSheetDefaults.ContainerColor
|
|
76
|
+
val resolvedContentColor = props.contentColor.value.composeOrNull ?: contentColorFor(resolvedContainerColor)
|
|
77
|
+
val resolvedScrimColor = props.scrimColor.value.composeOrNull ?: BottomSheetDefaults.ScrimColor
|
|
78
|
+
val dragHandleSlotView = findChildSlotView(this@ModalBottomSheetView, "dragHandle")
|
|
21
79
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
80
|
+
ModalBottomSheet(
|
|
81
|
+
sheetState = sheetState,
|
|
82
|
+
onDismissRequest = {
|
|
83
|
+
onDismissRequest(Unit)
|
|
84
|
+
},
|
|
85
|
+
containerColor = resolvedContainerColor,
|
|
86
|
+
contentColor = resolvedContentColor,
|
|
87
|
+
scrimColor = resolvedScrimColor,
|
|
88
|
+
sheetGesturesEnabled = props.sheetGesturesEnabled.value,
|
|
89
|
+
dragHandle = when {
|
|
90
|
+
dragHandleSlotView != null -> {
|
|
91
|
+
{ with(ComposableScope()) { with(dragHandleSlotView) { Content() } } }
|
|
92
|
+
}
|
|
93
|
+
props.showDragHandle.value -> {
|
|
94
|
+
{ BottomSheetDefaults.DragHandle() }
|
|
95
|
+
}
|
|
96
|
+
else -> null
|
|
97
|
+
},
|
|
98
|
+
properties = ModalBottomSheetProperties(
|
|
99
|
+
shouldDismissOnBackPress = props.properties.value.shouldDismissOnBackPress,
|
|
100
|
+
shouldDismissOnClickOutside = props.properties.value.shouldDismissOnClickOutside
|
|
101
|
+
),
|
|
102
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers.value, appContext, this@Content, globalEventDispatcher)
|
|
103
|
+
) {
|
|
104
|
+
Children(ComposableScope(), filter = { !isSlotView(it) })
|
|
105
|
+
}
|
|
28
106
|
}
|
|
29
107
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
package expo.modules.ui
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color
|
|
4
|
+
import androidx.compose.foundation.BorderStroke
|
|
4
5
|
import androidx.compose.foundation.layout.ColumnScope
|
|
5
6
|
import androidx.compose.material3.Card
|
|
6
7
|
import androidx.compose.material3.CardDefaults
|
|
7
8
|
import androidx.compose.material3.ElevatedCard
|
|
8
9
|
import androidx.compose.material3.OutlinedCard
|
|
9
10
|
import androidx.compose.runtime.Composable
|
|
11
|
+
import androidx.compose.ui.unit.dp
|
|
10
12
|
import expo.modules.kotlin.records.Field
|
|
11
13
|
import expo.modules.kotlin.records.Record
|
|
12
14
|
import expo.modules.kotlin.views.ComposableScope
|
|
@@ -14,15 +16,22 @@ import expo.modules.kotlin.views.ComposeProps
|
|
|
14
16
|
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
15
17
|
import expo.modules.kotlin.views.with
|
|
16
18
|
|
|
17
|
-
data class
|
|
19
|
+
data class CardColors(
|
|
18
20
|
@Field val containerColor: Color? = null,
|
|
19
21
|
@Field val contentColor: Color? = null
|
|
20
22
|
) : Record
|
|
21
23
|
|
|
24
|
+
data class CardBorder(
|
|
25
|
+
@Field val width: Float = 1f,
|
|
26
|
+
@Field val color: Color? = null
|
|
27
|
+
) : Record
|
|
28
|
+
|
|
29
|
+
// region Card
|
|
30
|
+
|
|
22
31
|
data class CardProps(
|
|
23
|
-
val
|
|
24
|
-
val
|
|
25
|
-
val
|
|
32
|
+
val colors: CardColors = CardColors(),
|
|
33
|
+
val elevation: Float? = null,
|
|
34
|
+
val border: CardBorder? = null,
|
|
26
35
|
val modifiers: ModifierList = emptyList()
|
|
27
36
|
) : ComposeProps
|
|
28
37
|
|
|
@@ -30,15 +39,29 @@ data class CardProps(
|
|
|
30
39
|
fun FunctionalComposableScope.CardContent(props: CardProps) {
|
|
31
40
|
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
32
41
|
|
|
33
|
-
val
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
val defaults = CardDefaults.cardColors()
|
|
43
|
+
val colors = CardDefaults.cardColors(
|
|
44
|
+
containerColor = props.colors.containerColor.composeOrNull
|
|
45
|
+
?: defaults.containerColor,
|
|
46
|
+
contentColor = props.colors.contentColor.composeOrNull
|
|
47
|
+
?: defaults.contentColor
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
val elevation = if (props.elevation != null) {
|
|
51
|
+
CardDefaults.cardElevation(defaultElevation = props.elevation.dp)
|
|
52
|
+
} else {
|
|
53
|
+
CardDefaults.cardElevation()
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
val border = if (props.border != null) {
|
|
57
|
+
val borderColor = props.border.color.composeOrNull
|
|
58
|
+
if (borderColor != null) {
|
|
59
|
+
BorderStroke(props.border.width.dp, borderColor)
|
|
60
|
+
} else {
|
|
61
|
+
BorderStroke(props.border.width.dp, CardDefaults.outlinedCardBorder().brush)
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
null
|
|
42
65
|
}
|
|
43
66
|
|
|
44
67
|
val content: @Composable ColumnScope.() -> Unit = {
|
|
@@ -46,27 +69,108 @@ fun FunctionalComposableScope.CardContent(props: CardProps) {
|
|
|
46
69
|
Children(scope)
|
|
47
70
|
}
|
|
48
71
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
72
|
+
Card(
|
|
73
|
+
modifier = modifier,
|
|
74
|
+
colors = colors,
|
|
75
|
+
elevation = elevation,
|
|
76
|
+
border = border,
|
|
77
|
+
content = content
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// endregion
|
|
82
|
+
|
|
83
|
+
// region ElevatedCard
|
|
84
|
+
|
|
85
|
+
data class ElevatedCardProps(
|
|
86
|
+
val colors: CardColors = CardColors(),
|
|
87
|
+
val elevation: Float? = null,
|
|
88
|
+
val modifiers: ModifierList = emptyList()
|
|
89
|
+
) : ComposeProps
|
|
90
|
+
|
|
91
|
+
@Composable
|
|
92
|
+
fun FunctionalComposableScope.ElevatedCardContent(props: ElevatedCardProps) {
|
|
93
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
94
|
+
|
|
95
|
+
val defaults = CardDefaults.elevatedCardColors()
|
|
96
|
+
val colors = CardDefaults.elevatedCardColors(
|
|
97
|
+
containerColor = props.colors.containerColor.composeOrNull
|
|
98
|
+
?: defaults.containerColor,
|
|
99
|
+
contentColor = props.colors.contentColor.composeOrNull
|
|
100
|
+
?: defaults.contentColor
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
val elevation = if (props.elevation != null) {
|
|
104
|
+
CardDefaults.elevatedCardElevation(defaultElevation = props.elevation.dp)
|
|
105
|
+
} else {
|
|
106
|
+
CardDefaults.elevatedCardElevation()
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
val content: @Composable ColumnScope.() -> Unit = {
|
|
110
|
+
val scope = ComposableScope().with(columnScope = this)
|
|
111
|
+
Children(scope)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
ElevatedCard(
|
|
115
|
+
modifier = modifier,
|
|
116
|
+
colors = colors,
|
|
117
|
+
elevation = elevation,
|
|
118
|
+
content = content
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// endregion
|
|
123
|
+
|
|
124
|
+
// region OutlinedCard
|
|
125
|
+
|
|
126
|
+
data class OutlinedCardProps(
|
|
127
|
+
val colors: CardColors = CardColors(),
|
|
128
|
+
val elevation: Float? = null,
|
|
129
|
+
val border: CardBorder? = null,
|
|
130
|
+
val modifiers: ModifierList = emptyList()
|
|
131
|
+
) : ComposeProps
|
|
132
|
+
|
|
133
|
+
@Composable
|
|
134
|
+
fun FunctionalComposableScope.OutlinedCardContent(props: OutlinedCardProps) {
|
|
135
|
+
val modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
136
|
+
|
|
137
|
+
val defaults = CardDefaults.outlinedCardColors()
|
|
138
|
+
val colors = CardDefaults.outlinedCardColors(
|
|
139
|
+
containerColor = props.colors.containerColor.composeOrNull
|
|
140
|
+
?: defaults.containerColor,
|
|
141
|
+
contentColor = props.colors.contentColor.composeOrNull
|
|
142
|
+
?: defaults.contentColor
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
val elevation = if (props.elevation != null) {
|
|
146
|
+
CardDefaults.outlinedCardElevation(defaultElevation = props.elevation.dp)
|
|
147
|
+
} else {
|
|
148
|
+
CardDefaults.outlinedCardElevation()
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
val border = if (props.border != null) {
|
|
152
|
+
val borderColor = props.border.color.composeOrNull
|
|
153
|
+
if (borderColor != null) {
|
|
154
|
+
BorderStroke(props.border.width.dp, borderColor)
|
|
155
|
+
} else {
|
|
156
|
+
BorderStroke(props.border.width.dp, CardDefaults.outlinedCardBorder().brush)
|
|
70
157
|
}
|
|
158
|
+
} else {
|
|
159
|
+
CardDefaults.outlinedCardBorder()
|
|
71
160
|
}
|
|
161
|
+
|
|
162
|
+
val content: @Composable ColumnScope.() -> Unit = {
|
|
163
|
+
val scope = ComposableScope().with(columnScope = this)
|
|
164
|
+
Children(scope)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
OutlinedCard(
|
|
168
|
+
modifier = modifier,
|
|
169
|
+
colors = colors,
|
|
170
|
+
elevation = elevation,
|
|
171
|
+
border = border,
|
|
172
|
+
content = content
|
|
173
|
+
)
|
|
72
174
|
}
|
|
175
|
+
|
|
176
|
+
// endregion
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
package expo.modules.ui
|
|
2
|
+
|
|
3
|
+
import android.graphics.Color
|
|
4
|
+
import androidx.compose.material3.Checkbox
|
|
5
|
+
import androidx.compose.material3.CheckboxDefaults
|
|
6
|
+
import androidx.compose.material3.TriStateCheckbox
|
|
7
|
+
import androidx.compose.runtime.Composable
|
|
8
|
+
import androidx.compose.ui.state.ToggleableState
|
|
9
|
+
import expo.modules.kotlin.records.Field
|
|
10
|
+
import expo.modules.kotlin.records.Record
|
|
11
|
+
import expo.modules.kotlin.types.Enumerable
|
|
12
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
13
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
14
|
+
|
|
15
|
+
data class CheckboxColors(
|
|
16
|
+
@Field val checkedColor: Color? = null,
|
|
17
|
+
@Field val disabledCheckedColor: Color? = null,
|
|
18
|
+
@Field val uncheckedColor: Color? = null,
|
|
19
|
+
@Field val disabledUncheckedColor: Color? = null,
|
|
20
|
+
@Field val checkmarkColor: Color? = null,
|
|
21
|
+
@Field val disabledIndeterminateColor: Color? = null
|
|
22
|
+
) : Record
|
|
23
|
+
|
|
24
|
+
data class CheckboxProps(
|
|
25
|
+
val value: Boolean = false,
|
|
26
|
+
val enabled: Boolean = true,
|
|
27
|
+
val nativeClickable: Boolean = true,
|
|
28
|
+
val colors: CheckboxColors = CheckboxColors(),
|
|
29
|
+
val modifiers: ModifierList = emptyList()
|
|
30
|
+
) : ComposeProps
|
|
31
|
+
|
|
32
|
+
@Composable
|
|
33
|
+
fun FunctionalComposableScope.CheckboxContent(
|
|
34
|
+
props: CheckboxProps,
|
|
35
|
+
onCheckedChange: (Boolean) -> Unit
|
|
36
|
+
) {
|
|
37
|
+
Checkbox(
|
|
38
|
+
checked = props.value,
|
|
39
|
+
onCheckedChange = if (props.nativeClickable) {
|
|
40
|
+
onCheckedChange
|
|
41
|
+
} else {
|
|
42
|
+
null
|
|
43
|
+
},
|
|
44
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
|
|
45
|
+
enabled = props.enabled,
|
|
46
|
+
colors = CheckboxDefaults.colors(
|
|
47
|
+
checkedColor = props.colors.checkedColor.compose,
|
|
48
|
+
disabledCheckedColor = props.colors.disabledCheckedColor.compose,
|
|
49
|
+
uncheckedColor = props.colors.uncheckedColor.compose,
|
|
50
|
+
disabledUncheckedColor = props.colors.disabledUncheckedColor.compose,
|
|
51
|
+
checkmarkColor = props.colors.checkmarkColor.compose,
|
|
52
|
+
disabledIndeterminateColor = props.colors.disabledIndeterminateColor.compose
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
enum class ToggleableStateValue(val value: String) : Enumerable {
|
|
58
|
+
ON("on"),
|
|
59
|
+
OFF("off"),
|
|
60
|
+
INDETERMINATE("indeterminate")
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
data class TriStateCheckboxProps(
|
|
64
|
+
val state: ToggleableStateValue = ToggleableStateValue.OFF,
|
|
65
|
+
val enabled: Boolean = true,
|
|
66
|
+
val nativeClickable: Boolean = true,
|
|
67
|
+
val colors: CheckboxColors = CheckboxColors(),
|
|
68
|
+
val modifiers: ModifierList = emptyList()
|
|
69
|
+
) : ComposeProps
|
|
70
|
+
|
|
71
|
+
@Composable
|
|
72
|
+
fun FunctionalComposableScope.TriStateCheckboxContent(
|
|
73
|
+
props: TriStateCheckboxProps,
|
|
74
|
+
onClick: () -> Unit
|
|
75
|
+
) {
|
|
76
|
+
TriStateCheckbox(
|
|
77
|
+
state = when (props.state) {
|
|
78
|
+
ToggleableStateValue.ON -> ToggleableState.On
|
|
79
|
+
ToggleableStateValue.OFF -> ToggleableState.Off
|
|
80
|
+
ToggleableStateValue.INDETERMINATE -> ToggleableState.Indeterminate
|
|
81
|
+
},
|
|
82
|
+
onClick = if (props.nativeClickable) {
|
|
83
|
+
onClick
|
|
84
|
+
} else {
|
|
85
|
+
null
|
|
86
|
+
},
|
|
87
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
|
|
88
|
+
enabled = props.enabled,
|
|
89
|
+
colors = CheckboxDefaults.colors(
|
|
90
|
+
checkedColor = props.colors.checkedColor.compose,
|
|
91
|
+
disabledCheckedColor = props.colors.disabledCheckedColor.compose,
|
|
92
|
+
uncheckedColor = props.colors.uncheckedColor.compose,
|
|
93
|
+
disabledUncheckedColor = props.colors.disabledUncheckedColor.compose,
|
|
94
|
+
checkmarkColor = props.colors.checkmarkColor.compose,
|
|
95
|
+
disabledIndeterminateColor = props.colors.disabledIndeterminateColor.compose
|
|
96
|
+
)
|
|
97
|
+
)
|
|
98
|
+
}
|