@expo/ui 58.0.21 → 58.0.23
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 +34 -0
- package/README.md +86 -2
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ComposeViews.kt +53 -29
- package/android/src/main/java/expo/modules/ui/CompositionLocalProviderView.kt +26 -0
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +12 -0
- package/android/src/main/java/expo/modules/ui/HostView.kt +56 -9
- package/android/src/main/java/expo/modules/ui/MaskView.kt +3 -2
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +43 -13
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +11 -7
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +6 -1
- package/android/src/main/java/expo/modules/ui/TopAppBarView.kt +62 -0
- package/android/src/main/java/expo/modules/ui/UniversalLayout.kt +610 -0
- package/android/src/main/java/expo/modules/ui/colors/MaterialColors.kt +61 -0
- package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +2 -0
- package/android/src/main/java/expo/modules/ui/state/WorkletCallback.kt +2 -0
- package/build/community/bottom-sheet/BottomSheet.ios.js +8 -3
- package/build/community/bottom-sheet/BottomSheet.ios.js.map +1 -1
- package/build/community/pager-view/PagerView.ios.js +25 -8
- package/build/community/pager-view/PagerView.ios.js.map +1 -1
- package/build/community/segmented-control/SegmentedControl.ios.js +11 -2
- package/build/community/segmented-control/SegmentedControl.ios.js.map +1 -1
- package/build/community/segmented-control/types.d.ts +5 -1
- package/build/community/segmented-control/types.js.map +1 -1
- package/build/jetpack-compose/Column/index.d.ts +5 -0
- package/build/jetpack-compose/Column/index.js.map +1 -1
- package/build/jetpack-compose/CompositionLocalProvider/index.d.ts +28 -0
- package/build/jetpack-compose/CompositionLocalProvider/index.js +15 -0
- package/build/jetpack-compose/CompositionLocalProvider/index.js.map +1 -0
- package/build/jetpack-compose/Host/index.d.ts +8 -0
- package/build/jetpack-compose/Host/index.js +38 -5
- package/build/jetpack-compose/Host/index.js.map +1 -1
- package/build/jetpack-compose/Row/index.d.ts +5 -0
- package/build/jetpack-compose/Row/index.js.map +1 -1
- package/build/jetpack-compose/Switch/index.d.ts +2 -0
- package/build/jetpack-compose/Switch/index.js +1 -0
- package/build/jetpack-compose/Switch/index.js.map +1 -1
- package/build/jetpack-compose/TopAppBar/index.d.ts +72 -0
- package/build/jetpack-compose/TopAppBar/index.js +45 -0
- package/build/jetpack-compose/TopAppBar/index.js.map +1 -0
- package/build/jetpack-compose/index.d.ts +2 -0
- package/build/jetpack-compose/index.js +2 -0
- package/build/jetpack-compose/index.js.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +5 -1
- package/build/jetpack-compose/modifiers/index.js +6 -2
- package/build/jetpack-compose/modifiers/index.js.map +1 -1
- package/build/recycling/useRecycledRows.d.ts +2 -0
- package/build/recycling/useRecycledRows.js +1 -0
- package/build/recycling/useRecycledRows.js.map +1 -1
- package/build/swift-ui/BottomSheet/index.d.ts +6 -0
- package/build/swift-ui/BottomSheet/index.js +9 -3
- package/build/swift-ui/BottomSheet/index.js.map +1 -1
- package/build/swift-ui/HStack/index.d.ts +6 -0
- package/build/swift-ui/HStack/index.js.map +1 -1
- package/build/swift-ui/VStack/index.d.ts +6 -0
- package/build/swift-ui/VStack/index.js.map +1 -1
- package/build/universal/Button/index.android.js +3 -1
- package/build/universal/Button/index.android.js.map +1 -1
- package/build/universal/Button/index.ios.js +3 -1
- package/build/universal/Button/index.ios.js.map +1 -1
- package/build/universal/Checkbox/index.android.js +16 -4
- package/build/universal/Checkbox/index.android.js.map +1 -1
- package/build/universal/Collapsible/index.ios.js +1 -0
- package/build/universal/Collapsible/index.ios.js.map +1 -1
- package/build/universal/Column/index.android.js +4 -1
- package/build/universal/Column/index.android.js.map +1 -1
- package/build/universal/Column/index.ios.js +2 -0
- package/build/universal/Column/index.ios.js.map +1 -1
- package/build/universal/Column/index.js +13 -4
- package/build/universal/Column/index.js.map +1 -1
- package/build/universal/FieldGroup/FieldGroup.android.js +3 -1
- package/build/universal/FieldGroup/FieldGroup.android.js.map +1 -1
- package/build/universal/FieldGroup/FieldGroup.ios.js +3 -1
- package/build/universal/FieldGroup/FieldGroup.ios.js.map +1 -1
- package/build/universal/FieldGroup/FieldSection.android.js +13 -4
- package/build/universal/FieldGroup/FieldSection.android.js.map +1 -1
- package/build/universal/FieldGroup/FieldSection.ios.js +3 -1
- package/build/universal/FieldGroup/FieldSection.ios.js.map +1 -1
- package/build/universal/Icon/index.android.js +3 -1
- package/build/universal/Icon/index.android.js.map +1 -1
- package/build/universal/Icon/index.ios.js +3 -1
- package/build/universal/Icon/index.ios.js.map +1 -1
- package/build/universal/List/ListForEach.android.d.ts +7 -0
- package/build/universal/List/ListForEach.android.js +6 -0
- package/build/universal/List/ListForEach.android.js.map +1 -0
- package/build/universal/List/ListForEach.d.ts +5 -0
- package/build/universal/List/ListForEach.ios.d.ts +5 -0
- package/build/universal/List/ListForEach.ios.js +11 -0
- package/build/universal/List/ListForEach.ios.js.map +1 -0
- package/build/universal/List/ListForEach.js +263 -0
- package/build/universal/List/ListForEach.js.map +1 -0
- package/build/universal/List/ListScrollContext.d.ts +5 -0
- package/build/universal/List/ListScrollContext.js +6 -0
- package/build/universal/List/ListScrollContext.js.map +1 -0
- package/build/universal/List/index.android.d.ts +5 -0
- package/build/universal/List/index.android.js +3 -0
- package/build/universal/List/index.android.js.map +1 -1
- package/build/universal/List/index.d.ts +5 -0
- package/build/universal/List/index.ios.d.ts +5 -0
- package/build/universal/List/index.ios.js +3 -0
- package/build/universal/List/index.ios.js.map +1 -1
- package/build/universal/List/index.js +12 -1
- package/build/universal/List/index.js.map +1 -1
- package/build/universal/List/types.d.ts +42 -1
- package/build/universal/List/types.js +1 -3
- package/build/universal/List/types.js.map +1 -1
- package/build/universal/RNHostView/index.android.js +3 -1
- package/build/universal/RNHostView/index.android.js.map +1 -1
- package/build/universal/Row/index.android.js +4 -1
- package/build/universal/Row/index.android.js.map +1 -1
- package/build/universal/Row/index.ios.js +2 -0
- package/build/universal/Row/index.ios.js.map +1 -1
- package/build/universal/Row/index.js +13 -7
- package/build/universal/Row/index.js.map +1 -1
- package/build/universal/ScrollView/index.android.js +8 -1
- package/build/universal/ScrollView/index.android.js.map +1 -1
- package/build/universal/ScrollView/index.ios.js +15 -7
- package/build/universal/ScrollView/index.ios.js.map +1 -1
- package/build/universal/Spacer/index.android.js +3 -1
- package/build/universal/Spacer/index.android.js.map +1 -1
- package/build/universal/Spacer/index.ios.js +3 -1
- package/build/universal/Spacer/index.ios.js.map +1 -1
- package/build/universal/Switch/index.android.js +17 -4
- package/build/universal/Switch/index.android.js.map +1 -1
- package/build/universal/Switch/index.js +1 -0
- package/build/universal/Switch/index.js.map +1 -1
- package/build/universal/Text/index.android.js +3 -1
- package/build/universal/Text/index.android.js.map +1 -1
- package/build/universal/Text/index.ios.js +3 -1
- package/build/universal/Text/index.ios.js.map +1 -1
- package/build/universal/Text/index.js +2 -2
- package/build/universal/Text/index.js.map +1 -1
- package/build/universal/TextInput/index.android.js +22 -7
- package/build/universal/TextInput/index.android.js.map +1 -1
- package/build/universal/TextInput/index.ios.js +1 -0
- package/build/universal/TextInput/index.ios.js.map +1 -1
- package/build/universal/index.d.ts +1 -1
- package/build/universal/modifierUtils.d.ts +34 -1
- package/build/universal/modifierUtils.js +98 -2
- package/build/universal/modifierUtils.js.map +1 -1
- package/build/universal/stackAxis.d.ts +9 -0
- package/build/universal/stackAxis.js +11 -0
- package/build/universal/stackAxis.js.map +1 -0
- package/build/universal/transformStyle.android.d.ts +6 -2
- package/build/universal/transformStyle.android.js +18 -11
- package/build/universal/transformStyle.android.js.map +1 -1
- package/build/universal/transformStyle.ios.d.ts +5 -1
- package/build/universal/transformStyle.ios.js +29 -11
- package/build/universal/transformStyle.ios.js.map +1 -1
- package/build/universal/types.d.ts +26 -1
- package/build/universal/types.js.map +1 -1
- package/build/universal/webUtils.js +4 -0
- package/build/universal/webUtils.js.map +1 -1
- package/ios/BottomSheetView.swift +11 -2
- package/ios/DatePickerView.swift +134 -9
- package/ios/GroupView.swift +3 -0
- package/ios/HStackView.swift +26 -2
- package/ios/HostView.swift +21 -12
- package/ios/Modifiers/SelectedSegmentTintColorModifier.swift +86 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +8 -0
- package/ios/RNHostView.swift +34 -16
- package/ios/ScrollViewComponent.swift +20 -0
- package/ios/UIBaseView.swift +4 -1
- package/ios/UniversalLayout.swift +691 -0
- package/ios/VStackView.swift +26 -2
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21-sources.jar → 58.0.23/expo.modules.ui-58.0.23-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21.module → 58.0.23/expo.modules.ui-58.0.23.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.21/expo.modules.ui-58.0.21.pom → 58.0.23/expo.modules.ui-58.0.23.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.23/expo.modules.ui-58.0.23.pom.sha512 +1 -0
- package/package.json +2 -2
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +7 -3
- package/src/community/pager-view/PagerView.ios.tsx +25 -8
- package/src/community/segmented-control/SegmentedControl.ios.tsx +13 -1
- package/src/community/segmented-control/types.tsx +5 -1
- package/src/jetpack-compose/Column/index.tsx +5 -0
- package/src/jetpack-compose/CompositionLocalProvider/index.tsx +43 -0
- package/src/jetpack-compose/Host/index.tsx +50 -4
- package/src/jetpack-compose/Row/index.tsx +5 -0
- package/src/jetpack-compose/Switch/index.tsx +4 -0
- package/src/jetpack-compose/TopAppBar/index.tsx +113 -0
- package/src/jetpack-compose/index.ts +2 -0
- package/src/jetpack-compose/modifiers/index.ts +11 -3
- package/src/recycling/useRecycledRows.tsx +3 -0
- package/src/swift-ui/BottomSheet/index.tsx +24 -3
- package/src/swift-ui/HStack/index.tsx +6 -0
- package/src/swift-ui/VStack/index.tsx +6 -0
- package/src/universal/Button/index.android.tsx +3 -1
- package/src/universal/Button/index.ios.tsx +2 -1
- package/src/universal/Checkbox/index.android.tsx +24 -5
- package/src/universal/Collapsible/index.ios.tsx +4 -1
- package/src/universal/Column/index.android.tsx +3 -1
- package/src/universal/Column/index.ios.tsx +2 -1
- package/src/universal/Column/index.tsx +9 -4
- package/src/universal/FieldGroup/FieldGroup.android.tsx +8 -1
- package/src/universal/FieldGroup/FieldGroup.ios.tsx +2 -1
- package/src/universal/FieldGroup/FieldSection.android.tsx +17 -4
- package/src/universal/FieldGroup/FieldSection.ios.tsx +2 -1
- package/src/universal/Icon/index.android.tsx +2 -1
- package/src/universal/Icon/index.ios.tsx +2 -1
- package/src/universal/List/ListForEach.android.tsx +6 -0
- package/src/universal/List/ListForEach.ios.tsx +9 -0
- package/src/universal/List/ListForEach.tsx +246 -0
- package/src/universal/List/ListScrollContext.ts +6 -0
- package/src/universal/List/index.android.tsx +5 -0
- package/src/universal/List/index.ios.tsx +5 -0
- package/src/universal/List/index.tsx +11 -2
- package/src/universal/List/types.ts +45 -1
- package/src/universal/RNHostView/index.android.tsx +2 -1
- package/src/universal/Row/index.android.tsx +3 -1
- package/src/universal/Row/index.ios.tsx +2 -1
- package/src/universal/Row/index.tsx +9 -10
- package/src/universal/ScrollView/index.android.tsx +15 -3
- package/src/universal/ScrollView/index.ios.tsx +16 -4
- package/src/universal/Spacer/index.android.tsx +6 -4
- package/src/universal/Spacer/index.ios.tsx +2 -1
- package/src/universal/Switch/index.android.tsx +23 -4
- package/src/universal/Switch/index.tsx +1 -0
- package/src/universal/Text/index.android.tsx +2 -1
- package/src/universal/Text/index.ios.tsx +2 -1
- package/src/universal/Text/index.tsx +2 -2
- package/src/universal/TextInput/index.android.tsx +26 -5
- package/src/universal/TextInput/index.ios.tsx +1 -1
- package/src/universal/index.ts +6 -1
- package/src/universal/modifierUtils.ts +159 -2
- package/src/universal/stackAxis.ts +17 -0
- package/src/universal/transformStyle.android.ts +30 -12
- package/src/universal/transformStyle.ios.ts +41 -13
- package/src/universal/types.ts +27 -3
- package/src/universal/webUtils.ts +4 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.21/expo.modules.ui-58.0.21.pom.sha512 +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 58.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [Android] Fix "Cannot use shared object that was already released" errors when a view with a shared object prop, such as the `@expo/ui` `TextInput`, is remounted right after its first render. ([#51934](https://github.com/expo/expo/pull/51934) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
8
|
+
- Universal `Row` and `Column` on Android resolve a child `width` or `height` percentage, such as `'50%'`, against their own size. ([#51118](https://github.com/expo/expo/pull/51118) by [@Kudo](https://github.com/Kudo))
|
|
9
|
+
- Universal `Row` and `Column` on iOS resolve a child `width` or `height` percentage, such as `'50%'`, against their own size. The default `spacing` of a universal `Row` or `Column` on iOS is now `0`, as on Android and web. ([#51119](https://github.com/expo/expo/pull/51119) by [@Kudo](https://github.com/Kudo))
|
|
10
|
+
- Add `List.ForEach` to the universal `List`. It renders rows from `data` and recycles them on Android, iOS, and web. The web `List` now fills its parent, so it scrolls. ([#52047](https://github.com/expo/expo/pull/52047) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway))
|
|
11
|
+
- Universal `style.width` and `style.height` accept a percentage of the parent, such as `'50%'`. ([#51117](https://github.com/expo/expo/pull/51117) by [@Kudo](https://github.com/Kudo))
|
|
12
|
+
- On web, a universal `Row` or `Column` with a size on its parent's cross axis no longer stretches, so the parent's alignment can place it. ([#51120](https://github.com/expo/expo/pull/51120) by [@Kudo](https://github.com/Kudo))
|
|
13
|
+
- [Android] Fixed `TextInput` with `secureTextEntry` showing the typed password in the keyboard's suggestion strip. A secure field now asks the keyboard for a password layout and turns off autocorrect. ([#52010](https://github.com/expo/expo/pull/52010) by [@enzomanuelmangano](https://github.com/enzomanuelmangano))
|
|
14
|
+
|
|
15
|
+
## 58.0.22
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [Android] Fix screen readers not announcing the label of a labeled universal `Switch` or `Checkbox`. ([#51896](https://github.com/expo/expo/pull/51896) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
20
|
+
- [Android] Fix touches not reaching the content of `MaskedView`. ([#51988](https://github.com/expo/expo/pull/51988) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
21
|
+
- [Android] Fix `RNHostView` showing the previous, emptied child after its child is remounted, for example by a `key` change. ([#51914](https://github.com/expo/expo/pull/51914) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
22
|
+
- [Android] Add `CompositionLocalProvider` with `minimumInteractiveComponentSize`, so Material components can be smaller than the 48dp minimum touch target. ([#51954](https://github.com/expo/expo/pull/51954) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
23
|
+
- [Android] Add `colorOverrides` to the Jetpack Compose `Host`. It replaces individual Material 3 color roles in the palette from `colorScheme` and `seedColor`. Compose children and `useMaterialColors()` use the result. ([#51650](https://github.com/expo/expo/pull/51650) by [@juliusmarminge](https://github.com/juliusmarminge))
|
|
24
|
+
- [iOS] Fix the graphical `DatePicker` keeping a wrong height when it appears after launch, for example in a sheet. ([#51958](https://github.com/expo/expo/pull/51958) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
25
|
+
- [iOS] Lay out children of a horizontal universal `ScrollView` in a row. They were stacked vertically. ([#51888](https://github.com/expo/expo/pull/51888) by [@itisrmk](https://github.com/itisrmk))
|
|
26
|
+
- [iOS] Add a `presentationBackground` prop to `BottomSheet` that fills the sheet with a view, so a material stays translucent on iOS 26 and later. ([#51971](https://github.com/expo/expo/pull/51971) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
27
|
+
- Update `README.md` with the package overview, entry points, available components and installation instructions. ([#50024](https://github.com/expo/expo/pull/50024) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
28
|
+
- [iOS] Fix hosted React Native content going blank or keeping a stale size after its child view is remounted, for example by a `key` change in an `RNHostView`. ([#51906](https://github.com/expo/expo/pull/51906) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
29
|
+
- [iOS] Add `accessibilityLabel` to the community `SegmentedControl`, so screen readers announce a name for the control. ([#51899](https://github.com/expo/expo/pull/51899) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
30
|
+
- [iOS] Support `tintColor` in the community `SegmentedControl`. ([#51904](https://github.com/expo/expo/pull/51904) by [@expo-tuft](https://github.com/apps/expo-tuft))
|
|
31
|
+
- [Android] Add the Jetpack Compose `TopAppBar` component with `TopAppBar.Title`, `TopAppBar.NavigationIcon`, and `TopAppBar.Actions` slots, `colors`, and `windowInsets`. ([#51651](https://github.com/expo/expo/pull/51651) by [@juliusmarminge](https://github.com/juliusmarminge))
|
|
32
|
+
- [web] Fix the universal `Text` ignoring the `colorScheme` of its `Host`. Its default color followed the browser color scheme, so a `Text` in a dark `Host` was black in a light browser. It now uses the `Host` foreground color and keeps the old color when no `Host` is on the page. A light `Host` now also gets the light colors when the browser or an outer `Host` is dark. ([#51698](https://github.com/expo/expo/pull/51698) by [@expo-bot](https://github.com/expo-bot))
|
|
33
|
+
- Fix bottom sheet modals closing on iOS when the snap point count changes. ([#51889](https://github.com/expo/expo/pull/51889) by [@Fizzbow](https://github.com/Fizzbow))
|
|
34
|
+
- [iOS] Stop the community `PagerView` from pressing a `Pressable` on a page when a swipe starts or ends on it, or when a tap stops a moving page. The pager now takes the touch from its pages while it scrolls, like React Native's `ScrollView`. This needs iOS 18 or later. ([#51799](https://github.com/expo/expo/pull/51799) by [@julian-gargicevich](https://github.com/julian-gargicevich))
|
|
35
|
+
- [Web] Put a labeled `Switch` at the trailing edge of its row, as on Android and iOS. ([#51867](https://github.com/expo/expo/pull/51867) by [@miniware9](https://github.com/miniware9))
|
|
36
|
+
|
|
3
37
|
## 58.0.21
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
|
|
1
|
+
<p>
|
|
2
|
+
<a href="https://docs.expo.dev/versions/latest/sdk/ui/">
|
|
3
|
+
<img
|
|
4
|
+
src="../../.github/resources/expo-ui.svg"
|
|
5
|
+
alt="expo-ui"
|
|
6
|
+
height="64" />
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
2
9
|
|
|
3
|
-
A
|
|
10
|
+
A set of native input components that let you build interfaces with Jetpack Compose on Android and SwiftUI on iOS, from React.
|
|
11
|
+
|
|
12
|
+
## Main features
|
|
13
|
+
|
|
14
|
+
- Real native components. Jetpack Compose on Android, SwiftUI on iOS — not reimplementations.
|
|
15
|
+
- The JavaScript API mirrors the native API. Component, prop, and event names match the platform.
|
|
16
|
+
- Three tiers, so you can pick how much platform detail you want to handle.
|
|
17
|
+
- Modifiers stay modifiers, from `@expo/ui/swift-ui/modifiers` and `@expo/ui/jetpack-compose/modifiers`.
|
|
18
|
+
|
|
19
|
+
## The three tiers
|
|
20
|
+
|
|
21
|
+
### Platform (low-level)
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { ... } from '@expo/ui/swift-ui';
|
|
25
|
+
import { ... } from '@expo/ui/jetpack-compose';
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
One export per platform, each mapping directly onto the underlying native component. Use these when you want the full SwiftUI or Jetpack Compose surface and are willing to write a `.ios` and `.android` file.
|
|
29
|
+
|
|
30
|
+
### Universal
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { ... } from '@expo/ui';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Cross-platform components that run on Android, iOS, and web from one source. Each one is built on top of the platform tier — a universal `Switch` renders a SwiftUI `Toggle` on iOS and a Jetpack Compose `Switch` on Android — so you write once and still get the native experience. This is the tier to start with.
|
|
37
|
+
|
|
38
|
+
### Drop-in replacements
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import { ... } from '@expo/ui/community/...';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
API-compatible replacements for popular React Native community libraries, backed by the same native components. Swapping the import is usually the whole migration.
|
|
45
|
+
|
|
46
|
+
| Replaces | Import from |
|
|
47
|
+
| --------------------------------------------------- | -------------------------------------- |
|
|
48
|
+
| `@gorhom/bottom-sheet` | `@expo/ui/community/bottom-sheet` |
|
|
49
|
+
| `@react-native-community/datetimepicker` | `@expo/ui/community/datetime-picker` |
|
|
50
|
+
| `@react-native-community/slider` | `@expo/ui/community/slider` |
|
|
51
|
+
| `@react-native-masked-view/masked-view` | `@expo/ui/community/masked-view` |
|
|
52
|
+
| `@react-native-menu/menu` | `@expo/ui/community/menu` |
|
|
53
|
+
| `@react-native-picker/picker` | `@expo/ui/community/picker` |
|
|
54
|
+
| `@react-native-segmented-control/segmented-control` | `@expo/ui/community/segmented-control` |
|
|
55
|
+
| `react-native-pager-view` | `@expo/ui/community/pager-view` |
|
|
56
|
+
|
|
57
|
+
# API documentation
|
|
58
|
+
|
|
59
|
+
- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/ui/)
|
|
60
|
+
|
|
61
|
+
# Installation in managed Expo projects
|
|
62
|
+
|
|
63
|
+
For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/ui/).
|
|
64
|
+
|
|
65
|
+
# Installation in bare React Native projects
|
|
66
|
+
|
|
67
|
+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
68
|
+
|
|
69
|
+
### Add the package to your npm dependencies
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
npx expo install @expo/ui
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Configure for iOS
|
|
76
|
+
|
|
77
|
+
Run `npx pod-install` after installing the npm package.
|
|
78
|
+
|
|
79
|
+
### Configure for Android
|
|
80
|
+
|
|
81
|
+
No additional setup necessary.
|
|
82
|
+
|
|
83
|
+
# Contributing
|
|
84
|
+
|
|
85
|
+
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
|
|
86
|
+
|
|
87
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for notes specific to this package.
|
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 = '58.0.
|
|
15
|
+
version = '58.0.23'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "58.0.
|
|
21
|
+
versionName "58.0.23"
|
|
22
22
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
23
23
|
}
|
|
24
24
|
buildFeatures {
|
|
@@ -50,7 +50,9 @@ data class LayoutProps(
|
|
|
50
50
|
val verticalAlignment: VerticalAlignment? = null,
|
|
51
51
|
val contentAlignment: ContentAlignment? = null,
|
|
52
52
|
val floatingToolbarExitAlwaysScrollBehavior: FloatingToolbarExitAlwaysScrollBehavior? = null,
|
|
53
|
-
val modifiers: ModifierList = emptyList()
|
|
53
|
+
val modifiers: ModifierList = emptyList(),
|
|
54
|
+
// Universal `Row` and `Column` set this. Compose `Row` and `Column` leave it false.
|
|
55
|
+
val resolvesChildPercentages: Boolean = false
|
|
54
56
|
) : ComposeProps
|
|
55
57
|
|
|
56
58
|
@Composable
|
|
@@ -60,20 +62,31 @@ internal fun FunctionalComposableScope.RowContent(props: LayoutProps) {
|
|
|
60
62
|
?.let {
|
|
61
63
|
FloatingToolbarDefaults.exitAlwaysScrollBehavior(exitDirection = it)
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
val modifier = ModifierRegistry
|
|
66
|
+
.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
67
|
+
.then(
|
|
68
|
+
if (scrollBehavior != null) {
|
|
69
|
+
Modifier.nestedScroll(scrollBehavior)
|
|
70
|
+
} else {
|
|
71
|
+
Modifier
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
if (props.resolvesChildPercentages) {
|
|
75
|
+
UniversalRow(
|
|
76
|
+
horizontalArrangement = props.horizontalArrangement?.toComposeArrangement() ?: Arrangement.Start,
|
|
77
|
+
verticalAlignment = props.verticalAlignment?.toComposeAlignment() ?: Alignment.Top,
|
|
78
|
+
modifier = modifier
|
|
79
|
+
) {
|
|
80
|
+
Children(UIComposableScope(nestedScrollConnection = scrollBehavior))
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
Row(
|
|
84
|
+
horizontalArrangement = props.horizontalArrangement?.toComposeArrangement() ?: Arrangement.Start,
|
|
85
|
+
verticalAlignment = props.verticalAlignment?.toComposeAlignment() ?: Alignment.Top,
|
|
86
|
+
modifier = modifier
|
|
87
|
+
) {
|
|
88
|
+
Children(UIComposableScope(rowScope = this@Row, nestedScrollConnection = scrollBehavior))
|
|
89
|
+
}
|
|
77
90
|
}
|
|
78
91
|
}
|
|
79
92
|
|
|
@@ -96,20 +109,31 @@ internal fun FunctionalComposableScope.ColumnContent(props: LayoutProps) {
|
|
|
96
109
|
?.let {
|
|
97
110
|
FloatingToolbarDefaults.exitAlwaysScrollBehavior(exitDirection = it)
|
|
98
111
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
)
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
val modifier = ModifierRegistry
|
|
113
|
+
.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
114
|
+
.then(
|
|
115
|
+
if (scrollBehavior != null) {
|
|
116
|
+
Modifier.nestedScroll(scrollBehavior)
|
|
117
|
+
} else {
|
|
118
|
+
Modifier
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
if (props.resolvesChildPercentages) {
|
|
122
|
+
UniversalColumn(
|
|
123
|
+
verticalArrangement = props.verticalArrangement?.toComposeArrangement() ?: Arrangement.Top,
|
|
124
|
+
horizontalAlignment = props.horizontalAlignment?.toComposeAlignment() ?: Alignment.Start,
|
|
125
|
+
modifier = modifier
|
|
126
|
+
) {
|
|
127
|
+
Children(UIComposableScope(nestedScrollConnection = scrollBehavior))
|
|
128
|
+
}
|
|
129
|
+
} else {
|
|
130
|
+
Column(
|
|
131
|
+
verticalArrangement = props.verticalArrangement?.toComposeArrangement() ?: Arrangement.Top,
|
|
132
|
+
horizontalAlignment = props.horizontalAlignment?.toComposeAlignment() ?: Alignment.Start,
|
|
133
|
+
modifier = modifier
|
|
134
|
+
) {
|
|
135
|
+
Children(UIComposableScope(columnScope = this@Column, nestedScrollConnection = scrollBehavior))
|
|
136
|
+
}
|
|
113
137
|
}
|
|
114
138
|
}
|
|
115
139
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package expo.modules.ui
|
|
2
|
+
|
|
3
|
+
import androidx.compose.material3.LocalMinimumInteractiveComponentSize
|
|
4
|
+
import androidx.compose.runtime.Composable
|
|
5
|
+
import androidx.compose.runtime.CompositionLocalProvider
|
|
6
|
+
import androidx.compose.runtime.ProvidedValue
|
|
7
|
+
import androidx.compose.ui.unit.dp
|
|
8
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
9
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
10
|
+
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
11
|
+
|
|
12
|
+
@OptimizedComposeProps
|
|
13
|
+
data class CompositionLocalProviderProps(
|
|
14
|
+
val minimumInteractiveComponentSize: Float? = null
|
|
15
|
+
) : ComposeProps
|
|
16
|
+
|
|
17
|
+
@Composable
|
|
18
|
+
fun FunctionalComposableScope.CompositionLocalProviderContent(props: CompositionLocalProviderProps) {
|
|
19
|
+
val values = buildList<ProvidedValue<*>> {
|
|
20
|
+
props.minimumInteractiveComponentSize?.let { add(LocalMinimumInteractiveComponentSize provides it.dp) }
|
|
21
|
+
}
|
|
22
|
+
// Passes the parent's scope through, so children keep modifiers like `weight` from the surrounding layout.
|
|
23
|
+
CompositionLocalProvider(*values.toTypedArray()) {
|
|
24
|
+
Children(composableScope)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -487,6 +487,12 @@ class ExpoUIModule : Module() {
|
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
+
ExpoUIView<CompositionLocalProviderProps>("CompositionLocalProviderView") {
|
|
491
|
+
Content { props ->
|
|
492
|
+
CompositionLocalProviderContent(props)
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
490
496
|
ExpoUIView<LayoutProps>("BoxView") {
|
|
491
497
|
Content { props ->
|
|
492
498
|
BoxContent(props)
|
|
@@ -533,6 +539,12 @@ class ExpoUIModule : Module() {
|
|
|
533
539
|
}
|
|
534
540
|
}
|
|
535
541
|
|
|
542
|
+
ExpoUIView<TopAppBarProps>("TopAppBarView") {
|
|
543
|
+
Content { props ->
|
|
544
|
+
TopAppBarContent(props)
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
536
548
|
ExpoUIView<HorizontalFloatingToolbarProps>("HorizontalFloatingToolbarView") {
|
|
537
549
|
Content { props ->
|
|
538
550
|
HorizontalFloatingToolbarContent(props)
|
|
@@ -52,6 +52,7 @@ import expo.modules.kotlin.views.ExpoComposeView
|
|
|
52
52
|
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
53
53
|
import expo.modules.ui.colors.isDynamicColorSupported
|
|
54
54
|
import expo.modules.ui.colors.seedColorScheme
|
|
55
|
+
import expo.modules.ui.colors.withOverrides
|
|
55
56
|
|
|
56
57
|
internal enum class ExpoLayoutDirection(val value: String) : Enumerable {
|
|
57
58
|
LeftToRight("leftToRight"),
|
|
@@ -69,6 +70,7 @@ internal enum class ExpoLayoutDirection(val value: String) : Enumerable {
|
|
|
69
70
|
internal data class HostProps(
|
|
70
71
|
val colorScheme: MutableState<ExpoColorScheme?> = mutableStateOf(null),
|
|
71
72
|
val seedColor: MutableState<android.graphics.Color?> = mutableStateOf(null),
|
|
73
|
+
val colorOverrides: MutableState<Map<String, android.graphics.Color>?> = mutableStateOf(null),
|
|
72
74
|
val layoutDirection: MutableState<ExpoLayoutDirection> = mutableStateOf(ExpoLayoutDirection.LeftToRight),
|
|
73
75
|
val useViewportSizeMeasurement: MutableState<Boolean> = mutableStateOf(false),
|
|
74
76
|
val ignoreSafeAreaKeyboardInsets: MutableState<Boolean> = mutableStateOf(false),
|
|
@@ -121,6 +123,11 @@ internal class HostView(context: Context, appContext: AppContext) :
|
|
|
121
123
|
private val onLayoutContent by EventDispatcher<LayoutContentEvent>()
|
|
122
124
|
private var lastDispatchedContentSize: IntSize? = null
|
|
123
125
|
|
|
126
|
+
// The size a child fraction was resolved against, in dp.
|
|
127
|
+
// matchContents would otherwise publish the percentage result and the next pass divides it again.
|
|
128
|
+
private var percentageBaseWidthDp: Double? = null
|
|
129
|
+
private var percentageBaseHeightDp: Double? = null
|
|
130
|
+
|
|
124
131
|
/**
|
|
125
132
|
* True while this view passes down an `ACTION_CANCEL` that came from its React Native parent,
|
|
126
133
|
* not from a Compose gesture detector. React Native already owns that gesture: the usual cause is
|
|
@@ -153,9 +160,10 @@ internal class HostView(context: Context, appContext: AppContext) :
|
|
|
153
160
|
val seededScheme = remember(seedArgb, isDark) {
|
|
154
161
|
seedArgb?.let { seedColorScheme(it, isDark) }
|
|
155
162
|
}
|
|
156
|
-
val
|
|
163
|
+
val baseColorScheme = seededScheme
|
|
157
164
|
?: props.colorScheme.value?.toColorScheme(context)
|
|
158
165
|
?: ExpoColorScheme.defaultColorScheme(context, isSystemInDarkTheme())
|
|
166
|
+
val colorScheme = baseColorScheme.withOverrides(props.colorOverrides.value.orEmpty())
|
|
159
167
|
val layoutDirection = props.layoutDirection.value.toLayoutDirection()
|
|
160
168
|
|
|
161
169
|
// Material3's `MaterialTheme` does not provide `LocalContentColor` — only `Surface` does — so
|
|
@@ -237,15 +245,54 @@ internal class HostView(context: Context, appContext: AppContext) :
|
|
|
237
245
|
constraints.maxHeight
|
|
238
246
|
}
|
|
239
247
|
)
|
|
240
|
-
|
|
248
|
+
// `measure` does not read a child percentage, so apply it here when this host
|
|
249
|
+
// has a size on that axis. A child with no percentage keeps these constraints.
|
|
250
|
+
// Compose Row and Column do not read that percentage.
|
|
251
|
+
val definiteWidth = boundedConstraints.maxWidth.takeIf {
|
|
252
|
+
it != Constraints.Infinity && (boundedConstraints.minWidth == it || useViewportSizeMeasurement)
|
|
253
|
+
}
|
|
254
|
+
val definiteHeight = boundedConstraints.maxHeight.takeIf {
|
|
255
|
+
it != Constraints.Infinity && (boundedConstraints.minHeight == it || useViewportSizeMeasurement)
|
|
256
|
+
}
|
|
257
|
+
val placeables = measurables.map {
|
|
258
|
+
measureUniversalChild(it, boundedConstraints, definiteWidth, definiteHeight)
|
|
259
|
+
}
|
|
241
260
|
|
|
242
261
|
val contentWidthPx = placeables.maxOfOrNull { it.width } ?: 0
|
|
243
262
|
val contentHeightPx = placeables.maxOfOrNull { it.height } ?: 0
|
|
263
|
+
// A child percentage is a fraction of the safe area proposed above.
|
|
264
|
+
// Publishing that result as the view size makes the next pass resolve it again.
|
|
265
|
+
val widthFromPercentage = definiteWidth != null && measurables.any {
|
|
266
|
+
it.parentData.asUniversalLayoutParentData().dimensions.widthFraction != null
|
|
267
|
+
}
|
|
268
|
+
val heightFromPercentage = definiteHeight != null && measurables.any {
|
|
269
|
+
it.parentData.asUniversalLayoutParentData().dimensions.heightFraction != null
|
|
270
|
+
}
|
|
271
|
+
// setStyleSize replaces the pending setViewSize flush.
|
|
272
|
+
// Publish this base for a viewport fraction so both updates describe the same size.
|
|
273
|
+
percentageBaseWidthDp = if (useViewportSizeMeasurement && widthFromPercentage && definiteWidth != null) {
|
|
274
|
+
with(density) { definiteWidth.toDp().value.toDouble() }
|
|
275
|
+
} else {
|
|
276
|
+
null
|
|
277
|
+
}
|
|
278
|
+
percentageBaseHeightDp = if (useViewportSizeMeasurement && heightFromPercentage && definiteHeight != null) {
|
|
279
|
+
with(density) { definiteHeight.toDp().value.toDouble() }
|
|
280
|
+
} else {
|
|
281
|
+
null
|
|
282
|
+
}
|
|
244
283
|
|
|
245
284
|
if (useViewportSizeMeasurement && (constraints.maxWidth == 0 || constraints.maxHeight == 0)) {
|
|
246
285
|
with(density) {
|
|
247
|
-
val widthDp =
|
|
248
|
-
|
|
286
|
+
val widthDp = if (widthFromPercentage) {
|
|
287
|
+
safeWidthPx.toDp().value.toDouble()
|
|
288
|
+
} else {
|
|
289
|
+
contentWidthPx.toDp().value.toDouble()
|
|
290
|
+
}
|
|
291
|
+
val heightDp = if (heightFromPercentage) {
|
|
292
|
+
safeHeightPx.toDp().value.toDouble()
|
|
293
|
+
} else {
|
|
294
|
+
contentHeightPx.toDp().value.toDouble()
|
|
295
|
+
}
|
|
249
296
|
|
|
250
297
|
shadowNodeProxy.setViewSize(
|
|
251
298
|
if (constraints.maxWidth == 0) {
|
|
@@ -284,17 +331,17 @@ internal class HostView(context: Context, appContext: AppContext) :
|
|
|
284
331
|
val height = size.height.toDp().value
|
|
285
332
|
|
|
286
333
|
if (matchContentsHorizontal == true || matchContentsVertical == true) {
|
|
287
|
-
val styleWidth = if (matchContentsHorizontal == true
|
|
288
|
-
width
|
|
334
|
+
val styleWidth = if (matchContentsHorizontal == true) {
|
|
335
|
+
percentageBaseWidthDp ?: width.takeIf { it > 0 }?.toDouble()
|
|
289
336
|
} else {
|
|
290
337
|
null
|
|
291
338
|
}
|
|
292
|
-
val styleHeight = if (matchContentsVertical == true
|
|
293
|
-
height
|
|
339
|
+
val styleHeight = if (matchContentsVertical == true) {
|
|
340
|
+
percentageBaseHeightDp ?: height.takeIf { it > 0 }?.toDouble()
|
|
294
341
|
} else {
|
|
295
342
|
null
|
|
296
343
|
}
|
|
297
|
-
shadowNodeProxy.setStyleSize(styleWidth
|
|
344
|
+
shadowNodeProxy.setStyleSize(styleWidth, styleHeight)
|
|
298
345
|
}
|
|
299
346
|
|
|
300
347
|
// `onSizeChanged` runs inside the Compose measure pass. Emitting the event here reaches
|
|
@@ -34,8 +34,7 @@ fun FunctionalComposableScope.MaskViewContent(props: MaskViewProps) {
|
|
|
34
34
|
drawLayer(maskLayer)
|
|
35
35
|
}
|
|
36
36
|
) {
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Composed first so the children stay on top and receive touches.
|
|
39
38
|
if (maskSlotView != null) {
|
|
40
39
|
Box(
|
|
41
40
|
modifier = Modifier
|
|
@@ -52,5 +51,7 @@ fun FunctionalComposableScope.MaskViewContent(props: MaskViewProps) {
|
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
}
|
|
54
|
+
|
|
55
|
+
Children(UIComposableScope(), filter = { !isSlotView(it) })
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -323,7 +323,8 @@ internal enum class SemanticRoleType(val value: String) : Enumerable {
|
|
|
323
323
|
@OptimizedRecord
|
|
324
324
|
internal data class ToggleableParams(
|
|
325
325
|
@Field val value: Boolean = false,
|
|
326
|
-
@Field val role: SemanticRoleType? = null
|
|
326
|
+
@Field val role: SemanticRoleType? = null,
|
|
327
|
+
@Field val enabled: Boolean = true
|
|
327
328
|
) : Record
|
|
328
329
|
|
|
329
330
|
internal enum class MenuAnchorType(val value: String) : Enumerable {
|
|
@@ -505,6 +506,11 @@ object ModifierRegistry {
|
|
|
505
506
|
Modifier.height(params.height.dp)
|
|
506
507
|
}
|
|
507
508
|
|
|
509
|
+
register("universalLayout") { map, _, appContext, _ ->
|
|
510
|
+
val params = recordFromMap<UniversalLayoutParams>(map, appContext)
|
|
511
|
+
UniversalLayoutElement(params.toDimensions())
|
|
512
|
+
}
|
|
513
|
+
|
|
508
514
|
register("defaultMinSize") { map, _, appContext, _ ->
|
|
509
515
|
val params = recordFromMap<DefaultMinSizeParams>(map, appContext)
|
|
510
516
|
Modifier.defaultMinSize(
|
|
@@ -673,22 +679,45 @@ object ModifierRegistry {
|
|
|
673
679
|
// Scope-dependent modifiers
|
|
674
680
|
register("weight") { map, scope, appContext, _ ->
|
|
675
681
|
val params = recordFromMap<WeightParams>(map, appContext)
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
682
|
+
val weight = params.weight.takeIf { it.isFinite() && it > 0f }
|
|
683
|
+
// Prefer row, column, or box scope.
|
|
684
|
+
// Those parents ignore universal parent data, and Box has no weight.
|
|
685
|
+
when {
|
|
686
|
+
scope?.rowScope != null || scope?.columnScope != null ->
|
|
687
|
+
scope?.rowScope?.run {
|
|
688
|
+
weight?.let { Modifier.weight(it) }
|
|
689
|
+
} ?: scope?.columnScope?.run {
|
|
690
|
+
weight?.let { Modifier.weight(it) }
|
|
691
|
+
} ?: Modifier
|
|
692
|
+
scope?.boxScope != null -> Modifier
|
|
693
|
+
LocalUniversalStackAxis.current == UniversalStackAxis.Horizontal ||
|
|
694
|
+
LocalUniversalStackAxis.current == UniversalStackAxis.Vertical ->
|
|
695
|
+
weight?.let { UniversalWeightElement(it) } ?: Modifier
|
|
696
|
+
else -> Modifier
|
|
697
|
+
}
|
|
681
698
|
}
|
|
682
699
|
|
|
683
700
|
register("align") { map, scope, appContext, _ ->
|
|
684
701
|
val params = recordFromMap<AlignParams>(map, appContext)
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
702
|
+
when {
|
|
703
|
+
scope?.boxScope != null ->
|
|
704
|
+
scope?.boxScope?.run {
|
|
705
|
+
params.alignment?.toAlignment()?.let { alignment -> Modifier.align(alignment) }
|
|
706
|
+
} ?: Modifier
|
|
707
|
+
scope?.rowScope != null ->
|
|
708
|
+
scope?.rowScope?.run {
|
|
709
|
+
params.alignment?.toVerticalAlignment()?.let { alignment -> Modifier.align(alignment) }
|
|
710
|
+
} ?: Modifier
|
|
711
|
+
scope?.columnScope != null ->
|
|
712
|
+
scope?.columnScope?.run {
|
|
713
|
+
params.alignment?.toHorizontalAlignment()?.let { alignment -> Modifier.align(alignment) }
|
|
714
|
+
} ?: Modifier
|
|
715
|
+
LocalUniversalStackAxis.current == UniversalStackAxis.Horizontal ->
|
|
716
|
+
UniversalAlignElement(vertical = params.alignment?.toVerticalAlignment())
|
|
717
|
+
LocalUniversalStackAxis.current == UniversalStackAxis.Vertical ->
|
|
718
|
+
UniversalAlignElement(horizontal = params.alignment?.toHorizontalAlignment())
|
|
719
|
+
else -> Modifier
|
|
720
|
+
}
|
|
692
721
|
}
|
|
693
722
|
|
|
694
723
|
register("matchParentSize") { _, scope, _, _ ->
|
|
@@ -831,6 +860,7 @@ object ModifierRegistry {
|
|
|
831
860
|
}
|
|
832
861
|
Modifier.toggleable(
|
|
833
862
|
value = params.value,
|
|
863
|
+
enabled = params.enabled,
|
|
834
864
|
role = role,
|
|
835
865
|
onValueChange = { eventDispatcher("toggleable", emptyMap()) }
|
|
836
866
|
)
|
|
@@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.wrapContentSize
|
|
|
20
20
|
import androidx.compose.foundation.layout.wrapContentWidth
|
|
21
21
|
import androidx.compose.runtime.Composable
|
|
22
22
|
import androidx.compose.runtime.MutableState
|
|
23
|
+
import androidx.compose.runtime.key
|
|
23
24
|
import androidx.compose.runtime.mutableStateOf
|
|
24
25
|
import androidx.compose.ui.Alignment
|
|
25
26
|
import androidx.compose.ui.Modifier
|
|
@@ -204,13 +205,16 @@ internal class RNHostView(context: Context, appContext: AppContext) :
|
|
|
204
205
|
.then(sizingModifier)
|
|
205
206
|
.then(publishContentOriginModifier())
|
|
206
207
|
|
|
207
|
-
AndroidView
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
208
|
+
// `addView` creates a new wrapper for each mounted child, and `AndroidView` only calls `factory` once.
|
|
209
|
+
key(wrapper) {
|
|
210
|
+
AndroidView(
|
|
211
|
+
factory = {
|
|
212
|
+
detachForReuse(wrapper)
|
|
213
|
+
wrapper
|
|
214
|
+
},
|
|
215
|
+
modifier = modifiers
|
|
216
|
+
)
|
|
217
|
+
}
|
|
214
218
|
}
|
|
215
219
|
}
|
|
216
220
|
|
|
@@ -41,6 +41,7 @@ data class SwitchColors(
|
|
|
41
41
|
data class SwitchProps(
|
|
42
42
|
val value: Boolean = false,
|
|
43
43
|
val enabled: Boolean = true,
|
|
44
|
+
val nativeClickable: Boolean = true,
|
|
44
45
|
val colors: SwitchColors = SwitchColors(),
|
|
45
46
|
val modifiers: ModifierList = emptyList()
|
|
46
47
|
) : ComposeProps
|
|
@@ -54,7 +55,11 @@ fun FunctionalComposableScope.SwitchContent(
|
|
|
54
55
|
|
|
55
56
|
Switch(
|
|
56
57
|
checked = props.value,
|
|
57
|
-
onCheckedChange =
|
|
58
|
+
onCheckedChange = if (props.nativeClickable) {
|
|
59
|
+
onCheckedChange
|
|
60
|
+
} else {
|
|
61
|
+
null
|
|
62
|
+
},
|
|
58
63
|
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher),
|
|
59
64
|
enabled = props.enabled,
|
|
60
65
|
thumbContent = thumbContentSlotView?.let {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@file:OptIn(ExperimentalMaterial3Api::class)
|
|
2
|
+
|
|
3
|
+
package expo.modules.ui
|
|
4
|
+
|
|
5
|
+
import android.graphics.Color
|
|
6
|
+
import androidx.compose.foundation.layout.WindowInsets
|
|
7
|
+
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
8
|
+
import androidx.compose.material3.TopAppBar
|
|
9
|
+
import androidx.compose.material3.TopAppBarDefaults
|
|
10
|
+
import androidx.compose.runtime.Composable
|
|
11
|
+
import androidx.compose.ui.platform.LocalLayoutDirection
|
|
12
|
+
import expo.modules.kotlin.records.Field
|
|
13
|
+
import expo.modules.kotlin.records.Record
|
|
14
|
+
import expo.modules.kotlin.types.OptimizedRecord
|
|
15
|
+
import expo.modules.kotlin.views.ComposeProps
|
|
16
|
+
import expo.modules.kotlin.views.FunctionalComposableScope
|
|
17
|
+
import expo.modules.kotlin.views.OptimizedComposeProps
|
|
18
|
+
|
|
19
|
+
@OptimizedRecord
|
|
20
|
+
class TopAppBarColors : Record {
|
|
21
|
+
@Field val containerColor: Color? = null
|
|
22
|
+
|
|
23
|
+
@Field val navigationIconContentColor: Color? = null
|
|
24
|
+
|
|
25
|
+
@Field val titleContentColor: Color? = null
|
|
26
|
+
|
|
27
|
+
@Field val actionIconContentColor: Color? = null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@OptimizedComposeProps
|
|
31
|
+
data class TopAppBarProps(
|
|
32
|
+
val colors: TopAppBarColors = TopAppBarColors(),
|
|
33
|
+
val windowInsets: PaddingValuesRecord? = null,
|
|
34
|
+
val modifiers: ModifierList = emptyList()
|
|
35
|
+
) : ComposeProps
|
|
36
|
+
|
|
37
|
+
@Composable
|
|
38
|
+
fun FunctionalComposableScope.TopAppBarContent(props: TopAppBarProps) {
|
|
39
|
+
val layoutDirection = LocalLayoutDirection.current
|
|
40
|
+
val windowInsets = props.windowInsets?.toPaddingValues()?.let {
|
|
41
|
+
WindowInsets(
|
|
42
|
+
left = it.calculateLeftPadding(layoutDirection),
|
|
43
|
+
top = it.calculateTopPadding(),
|
|
44
|
+
right = it.calculateRightPadding(layoutDirection),
|
|
45
|
+
bottom = it.calculateBottomPadding()
|
|
46
|
+
)
|
|
47
|
+
} ?: TopAppBarDefaults.windowInsets
|
|
48
|
+
|
|
49
|
+
TopAppBar(
|
|
50
|
+
title = { Children(UIComposableScope(), filter = { isSlotWithName(it, "title") }) },
|
|
51
|
+
navigationIcon = { Children(UIComposableScope(), filter = { isSlotWithName(it, "navigationIcon") }) },
|
|
52
|
+
actions = { Children(UIComposableScope(rowScope = this), filter = { isSlotWithName(it, "actions") }) },
|
|
53
|
+
windowInsets = windowInsets,
|
|
54
|
+
colors = TopAppBarDefaults.topAppBarColors(
|
|
55
|
+
containerColor = props.colors.containerColor.compose,
|
|
56
|
+
navigationIconContentColor = props.colors.navigationIconContentColor.compose,
|
|
57
|
+
titleContentColor = props.colors.titleContentColor.compose,
|
|
58
|
+
actionIconContentColor = props.colors.actionIconContentColor.compose
|
|
59
|
+
),
|
|
60
|
+
modifier = ModifierRegistry.applyModifiers(props.modifiers, appContext, composableScope, globalEventDispatcher)
|
|
61
|
+
)
|
|
62
|
+
}
|