@expo/ui 56.0.8 → 56.0.10
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 +35 -1
- package/CLAUDE.md +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +49 -6
- package/android/src/main/java/expo/modules/ui/HorizontalPagerView.kt +97 -16
- package/android/src/main/java/expo/modules/ui/LoadingView.kt +80 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +31 -3
- package/android/src/main/java/expo/modules/ui/SnackbarView.kt +126 -0
- package/android/src/main/java/expo/modules/ui/colors/MaterialColors.kt +2 -0
- package/android/src/main/java/expo/modules/ui/state/ObservableState.kt +10 -0
- package/assets/keyboard_arrow_down.xml +10 -0
- package/build/State/index.d.ts +6 -0
- package/build/State/index.d.ts.map +1 -0
- package/build/State/useNativeState.d.ts +32 -3
- package/build/State/useNativeState.d.ts.map +1 -1
- package/build/community/bottom-sheet/BottomSheet.ios.d.ts.map +1 -1
- package/build/community/pager-view/PagerView.android.d.ts +7 -0
- package/build/community/pager-view/PagerView.android.d.ts.map +1 -0
- package/build/community/pager-view/PagerView.d.ts +8 -0
- package/build/community/pager-view/PagerView.d.ts.map +1 -0
- package/build/community/pager-view/PagerView.ios.d.ts +15 -0
- package/build/community/pager-view/PagerView.ios.d.ts.map +1 -0
- package/build/community/pager-view/index.d.ts +3 -0
- package/build/community/pager-view/index.d.ts.map +1 -0
- package/build/community/pager-view/types.d.ts +128 -0
- package/build/community/pager-view/types.d.ts.map +1 -0
- package/build/community/segmented-control/vendor/SegmentsSeparators.d.ts.map +1 -1
- package/build/jetpack-compose/HorizontalPager/index.d.ts +27 -0
- package/build/jetpack-compose/HorizontalPager/index.d.ts.map +1 -1
- package/build/jetpack-compose/Host/index.d.ts +1 -0
- package/build/jetpack-compose/Host/index.d.ts.map +1 -1
- package/build/jetpack-compose/LoadingIndicator/index.d.ts +41 -0
- package/build/jetpack-compose/LoadingIndicator/index.d.ts.map +1 -0
- package/build/jetpack-compose/Snackbar/index.d.ts +94 -0
- package/build/jetpack-compose/Snackbar/index.d.ts.map +1 -0
- package/build/jetpack-compose/SyncSwitch/index.d.ts +1 -1
- package/build/jetpack-compose/SyncSwitch/index.d.ts.map +1 -1
- package/build/jetpack-compose/TextField/index.d.ts +1 -1
- package/build/jetpack-compose/TextField/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +3 -2
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +6 -2
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/BottomSheet/index.d.ts +5 -1
- package/build/swift-ui/BottomSheet/index.d.ts.map +1 -1
- package/build/swift-ui/Host/index.d.ts +1 -0
- package/build/swift-ui/Host/index.d.ts.map +1 -1
- package/build/swift-ui/ScrollView/index.d.ts +30 -0
- package/build/swift-ui/ScrollView/index.d.ts.map +1 -1
- package/build/swift-ui/SecureField/index.d.ts +1 -1
- package/build/swift-ui/SecureField/index.d.ts.map +1 -1
- package/build/swift-ui/SyncToggle/index.d.ts +1 -1
- package/build/swift-ui/SyncToggle/index.d.ts.map +1 -1
- package/build/swift-ui/TextField/index.d.ts +1 -1
- package/build/swift-ui/TextField/index.d.ts.map +1 -1
- package/build/swift-ui/index.d.ts +2 -2
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +25 -15
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/scrollObservation.d.ts +52 -0
- package/build/swift-ui/modifiers/scrollObservation.d.ts.map +1 -0
- package/build/swift-ui/modifiers/scrollPosition.d.ts +1 -1
- package/build/swift-ui/modifiers/scrollPosition.d.ts.map +1 -1
- package/build/swift-ui/modifiers/symbolEffect.d.ts +1 -1
- package/build/swift-ui/modifiers/symbolEffect.d.ts.map +1 -1
- package/build/swift-ui/withAnimation.d.ts +26 -0
- package/build/swift-ui/withAnimation.d.ts.map +1 -0
- package/build/universal/BottomSheet/index.android.d.ts +1 -1
- package/build/universal/BottomSheet/index.android.d.ts.map +1 -1
- package/build/universal/BottomSheet/index.d.ts +1 -1
- package/build/universal/BottomSheet/index.d.ts.map +1 -1
- package/build/universal/BottomSheet/index.ios.d.ts +1 -1
- package/build/universal/BottomSheet/index.ios.d.ts.map +1 -1
- package/build/universal/BottomSheet/types.d.ts +27 -0
- package/build/universal/BottomSheet/types.d.ts.map +1 -1
- package/build/universal/Checkbox/index.d.ts.map +1 -1
- package/build/universal/Collapsible/index.android.d.ts +8 -0
- package/build/universal/Collapsible/index.android.d.ts.map +1 -0
- package/build/universal/Collapsible/index.d.ts +8 -0
- package/build/universal/Collapsible/index.d.ts.map +1 -0
- package/build/universal/Collapsible/index.ios.d.ts +7 -0
- package/build/universal/Collapsible/index.ios.d.ts.map +1 -0
- package/build/universal/Collapsible/types.d.ts +23 -0
- package/build/universal/Collapsible/types.d.ts.map +1 -0
- package/build/universal/Column/index.d.ts.map +1 -1
- package/build/universal/Host/index.d.ts +5 -18
- package/build/universal/Host/index.d.ts.map +1 -1
- package/build/universal/Host/types.d.ts +72 -0
- package/build/universal/Host/types.d.ts.map +1 -0
- package/build/universal/List/index.android.d.ts +9 -0
- package/build/universal/List/index.android.d.ts.map +1 -0
- package/build/universal/List/index.d.ts +8 -0
- package/build/universal/List/index.d.ts.map +1 -0
- package/build/universal/List/index.ios.d.ts +8 -0
- package/build/universal/List/index.ios.d.ts.map +1 -0
- package/build/universal/List/types.d.ts +26 -0
- package/build/universal/List/types.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.android.d.ts +8 -0
- package/build/universal/ListItem/ListItem.android.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.d.ts +9 -0
- package/build/universal/ListItem/ListItem.d.ts.map +1 -0
- package/build/universal/ListItem/ListItem.ios.d.ts +8 -0
- package/build/universal/ListItem/ListItem.ios.d.ts.map +1 -0
- package/build/universal/ListItem/ListItemSlots.d.ts +21 -0
- package/build/universal/ListItem/ListItemSlots.d.ts.map +1 -0
- package/build/universal/ListItem/index.d.ts +10 -0
- package/build/universal/ListItem/index.d.ts.map +1 -0
- package/build/universal/ListItem/types.d.ts +59 -0
- package/build/universal/ListItem/types.d.ts.map +1 -0
- package/build/universal/Picker/Picker.android.d.ts +9 -0
- package/build/universal/Picker/Picker.android.d.ts.map +1 -0
- package/build/universal/Picker/Picker.d.ts +8 -0
- package/build/universal/Picker/Picker.d.ts.map +1 -0
- package/build/universal/Picker/Picker.ios.d.ts +9 -0
- package/build/universal/Picker/Picker.ios.d.ts.map +1 -0
- package/build/universal/Picker/PickerItem.d.ts +9 -0
- package/build/universal/Picker/PickerItem.d.ts.map +1 -0
- package/build/universal/Picker/index.d.ts +8 -0
- package/build/universal/Picker/index.d.ts.map +1 -0
- package/build/universal/Picker/types.d.ts +69 -0
- package/build/universal/Picker/types.d.ts.map +1 -0
- package/build/universal/RNHostView/index.android.d.ts +7 -0
- package/build/universal/RNHostView/index.android.d.ts.map +1 -0
- package/build/universal/RNHostView/index.d.ts +7 -0
- package/build/universal/RNHostView/index.d.ts.map +1 -0
- package/build/universal/RNHostView/index.ios.d.ts +7 -0
- package/build/universal/RNHostView/index.ios.d.ts.map +1 -0
- package/build/universal/RNHostView/types.d.ts +23 -0
- package/build/universal/RNHostView/types.d.ts.map +1 -0
- package/build/universal/Switch/index.d.ts.map +1 -1
- package/build/universal/TextInput/index.d.ts.map +1 -1
- package/build/universal/index.d.ts +5 -0
- package/build/universal/index.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/BottomSheetView.swift +4 -1
- package/ios/ExpoUIModule.swift +47 -4
- package/ios/HostView.swift +21 -18
- package/ios/Modifiers/AnimationConfig.swift +109 -0
- package/ios/Modifiers/FontModifier.swift +72 -20
- package/ios/Modifiers/ScrollObservationModifiers.swift +107 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +9 -112
- package/ios/State/ObservableState.swift +12 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8-sources.jar → 56.0.10/expo.modules.ui-56.0.10-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8.module → 56.0.10/expo.modules.ui-56.0.10.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{56.0.8/expo.modules.ui-56.0.8.pom → 56.0.10/expo.modules.ui-56.0.10.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.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 +7 -3
- package/src/State/index.ts +10 -0
- package/src/State/useNativeState.ts +71 -3
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +0 -17
- package/src/community/pager-view/PagerView.android.tsx +223 -0
- package/src/community/pager-view/PagerView.ios.tsx +267 -0
- package/src/community/pager-view/PagerView.tsx +14 -0
- package/src/community/pager-view/index.tsx +13 -0
- package/src/community/pager-view/types.tsx +137 -0
- package/src/community/picker/Picker.android.tsx +1 -1
- package/src/community/segmented-control/vendor/SegmentsSeparators.tsx +3 -6
- package/src/jetpack-compose/HorizontalPager/index.tsx +89 -18
- package/src/jetpack-compose/Host/index.tsx +1 -0
- package/src/jetpack-compose/LoadingIndicator/index.tsx +91 -0
- package/src/jetpack-compose/Snackbar/index.tsx +135 -0
- package/src/jetpack-compose/SyncSwitch/index.tsx +1 -3
- package/src/jetpack-compose/TextField/index.tsx +1 -4
- package/src/jetpack-compose/index.ts +3 -2
- package/src/jetpack-compose/modifiers/index.ts +5 -2
- package/src/swift-ui/BottomSheet/index.tsx +32 -15
- package/src/swift-ui/Host/index.tsx +1 -0
- package/src/swift-ui/ScrollView/index.tsx +33 -0
- package/src/swift-ui/SecureField/index.tsx +1 -4
- package/src/swift-ui/SyncToggle/index.tsx +1 -3
- package/src/swift-ui/TextField/index.tsx +1 -4
- package/src/swift-ui/index.tsx +2 -3
- package/src/swift-ui/modifiers/index.ts +37 -14
- package/src/swift-ui/modifiers/scrollObservation.ts +80 -0
- package/src/swift-ui/modifiers/scrollPosition.ts +1 -2
- package/src/swift-ui/modifiers/symbolEffect.ts +1 -2
- package/src/swift-ui/withAnimation.ts +71 -0
- package/src/ts-declarations/react-native-web.d.ts +7 -0
- package/src/universal/BottomSheet/index.android.tsx +58 -11
- package/src/universal/BottomSheet/index.ios.tsx +40 -20
- package/src/universal/BottomSheet/index.tsx +49 -4
- package/src/universal/BottomSheet/types.ts +25 -0
- package/src/universal/Checkbox/index.tsx +14 -2
- package/src/universal/Collapsible/index.android.tsx +72 -0
- package/src/universal/Collapsible/index.ios.tsx +16 -0
- package/src/universal/Collapsible/index.tsx +71 -0
- package/src/universal/Collapsible/types.ts +25 -0
- package/src/universal/Column/index.tsx +3 -1
- package/src/universal/Host/index.tsx +9 -10
- package/src/universal/Host/types.ts +70 -0
- package/src/universal/List/index.android.tsx +44 -0
- package/src/universal/List/index.ios.tsx +19 -0
- package/src/universal/List/index.tsx +26 -0
- package/src/universal/List/types.ts +28 -0
- package/src/universal/ListItem/ListItem.android.tsx +52 -0
- package/src/universal/ListItem/ListItem.ios.tsx +58 -0
- package/src/universal/ListItem/ListItem.tsx +77 -0
- package/src/universal/ListItem/ListItemSlots.tsx +66 -0
- package/src/universal/ListItem/index.ts +15 -0
- package/src/universal/ListItem/types.ts +67 -0
- package/src/universal/Picker/Picker.android.tsx +69 -0
- package/src/universal/Picker/Picker.ios.tsx +45 -0
- package/src/universal/Picker/Picker.tsx +52 -0
- package/src/universal/Picker/PickerItem.tsx +27 -0
- package/src/universal/Picker/index.ts +11 -0
- package/src/universal/Picker/types.ts +79 -0
- package/src/universal/RNHostView/index.android.tsx +33 -0
- package/src/universal/RNHostView/index.ios.tsx +12 -0
- package/src/universal/RNHostView/index.tsx +39 -0
- package/src/universal/RNHostView/types.ts +25 -0
- package/src/universal/Switch/index.tsx +7 -2
- package/src/universal/TextInput/index.tsx +12 -2
- package/src/universal/index.ts +5 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.8/expo.modules.ui-56.0.8.pom.sha512 +0 -1
- package/src/community/bottom-sheet/CLAUDE.md +0 -55
|
@@ -13,7 +13,18 @@ import SwiftUI
|
|
|
13
13
|
* Toggle(label, isOn: state.binding(false))
|
|
14
14
|
*/
|
|
15
15
|
internal class ObservableState: SharedObject, ObservableObject {
|
|
16
|
-
|
|
16
|
+
var onChange: WorkletCallback?
|
|
17
|
+
private var isNotifying = false
|
|
18
|
+
|
|
19
|
+
@Published var value: Any? {
|
|
20
|
+
didSet {
|
|
21
|
+
// Skip re-invoking onChange if state.value was written from inside onChange.
|
|
22
|
+
guard !isNotifying else { return }
|
|
23
|
+
isNotifying = true
|
|
24
|
+
defer { isNotifying = false }
|
|
25
|
+
onChange?.invoke(arguments: [value ?? NSNull()])
|
|
26
|
+
}
|
|
27
|
+
}
|
|
17
28
|
|
|
18
29
|
init(value: Any?) {
|
|
19
30
|
self.value = value
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3c31f1e06290c7a6bd79ca48f3891a26
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
641e106db443c60a45679ceeb012d91ec9a8f92f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
d6ac0beac572ce308b1132edea5636af62174f38717a944fe96c577764fe15d0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
767b2296610e6f8c7a584cc65177bb80da1d6ac06ca34fab03e1ecc261103e45b6ea3cc85df9b91d984dcfa8707392dc9353135245a7b88c25d7416498c9d57b
|
|
Binary file
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fc36f9fce95048c28a4acc8b50509b30
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
750d3c439cf2196017543dbf4c28e442c895c557
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ed094af4f078c995d22d917c31585c648c1183e1da60401608f75e3ad29bf052
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.aar.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b5c54535d0b6873bef37012f7f7e42c19624a7db690cac6b557fa7133c58d7bf2254857248138d5bed3283045f0cbf73312aa4b55842b1d7e550f6a7dc45bad9
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "expo.modules.ui",
|
|
5
5
|
"module": "expo.modules.ui",
|
|
6
|
-
"version": "56.0.
|
|
6
|
+
"version": "56.0.10",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.ui-56.0.
|
|
28
|
-
"url": "expo.modules.ui-56.0.
|
|
29
|
-
"size":
|
|
30
|
-
"sha512": "
|
|
31
|
-
"sha256": "
|
|
32
|
-
"sha1": "
|
|
33
|
-
"md5": "
|
|
27
|
+
"name": "expo.modules.ui-56.0.10.aar",
|
|
28
|
+
"url": "expo.modules.ui-56.0.10.aar",
|
|
29
|
+
"size": 1836627,
|
|
30
|
+
"sha512": "b5c54535d0b6873bef37012f7f7e42c19624a7db690cac6b557fa7133c58d7bf2254857248138d5bed3283045f0cbf73312aa4b55842b1d7e550f6a7dc45bad9",
|
|
31
|
+
"sha256": "ed094af4f078c995d22d917c31585c648c1183e1da60401608f75e3ad29bf052",
|
|
32
|
+
"sha1": "750d3c439cf2196017543dbf4c28e442c895c557",
|
|
33
|
+
"md5": "fc36f9fce95048c28a4acc8b50509b30"
|
|
34
34
|
}
|
|
35
35
|
]
|
|
36
36
|
},
|
|
@@ -141,13 +141,13 @@
|
|
|
141
141
|
],
|
|
142
142
|
"files": [
|
|
143
143
|
{
|
|
144
|
-
"name": "expo.modules.ui-56.0.
|
|
145
|
-
"url": "expo.modules.ui-56.0.
|
|
146
|
-
"size":
|
|
147
|
-
"sha512": "
|
|
148
|
-
"sha256": "
|
|
149
|
-
"sha1": "
|
|
150
|
-
"md5": "
|
|
144
|
+
"name": "expo.modules.ui-56.0.10.aar",
|
|
145
|
+
"url": "expo.modules.ui-56.0.10.aar",
|
|
146
|
+
"size": 1836627,
|
|
147
|
+
"sha512": "b5c54535d0b6873bef37012f7f7e42c19624a7db690cac6b557fa7133c58d7bf2254857248138d5bed3283045f0cbf73312aa4b55842b1d7e550f6a7dc45bad9",
|
|
148
|
+
"sha256": "ed094af4f078c995d22d917c31585c648c1183e1da60401608f75e3ad29bf052",
|
|
149
|
+
"sha1": "750d3c439cf2196017543dbf4c28e442c895c557",
|
|
150
|
+
"md5": "fc36f9fce95048c28a4acc8b50509b30"
|
|
151
151
|
}
|
|
152
152
|
]
|
|
153
153
|
},
|
|
@@ -161,13 +161,13 @@
|
|
|
161
161
|
},
|
|
162
162
|
"files": [
|
|
163
163
|
{
|
|
164
|
-
"name": "expo.modules.ui-56.0.
|
|
165
|
-
"url": "expo.modules.ui-56.0.
|
|
166
|
-
"size":
|
|
167
|
-
"sha512": "
|
|
168
|
-
"sha256": "
|
|
169
|
-
"sha1": "
|
|
170
|
-
"md5": "
|
|
164
|
+
"name": "expo.modules.ui-56.0.10-sources.jar",
|
|
165
|
+
"url": "expo.modules.ui-56.0.10-sources.jar",
|
|
166
|
+
"size": 87285,
|
|
167
|
+
"sha512": "767b2296610e6f8c7a584cc65177bb80da1d6ac06ca34fab03e1ecc261103e45b6ea3cc85df9b91d984dcfa8707392dc9353135245a7b88c25d7416498c9d57b",
|
|
168
|
+
"sha256": "d6ac0beac572ce308b1132edea5636af62174f38717a944fe96c577764fe15d0",
|
|
169
|
+
"sha1": "641e106db443c60a45679ceeb012d91ec9a8f92f",
|
|
170
|
+
"md5": "3c31f1e06290c7a6bd79ca48f3891a26"
|
|
171
171
|
}
|
|
172
172
|
]
|
|
173
173
|
}
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b55341163a3ae06e2fefc06835b1393a
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.module.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b71c8eb0f34676f0c8f7a76488b7421f707ad21f
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
198b4ed7e41e942baee4eaa991399610ea101fde8bce73d83566ebf7df75055e
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4c42d995a74d8cabb4544a4980d91172391b55b23e59b31b52a3fdf0680dd86bc043f34e07051b8a1a2f7255b45b00ff86095cd42b8119fda709138805ca33cc
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<modelVersion>4.0.0</modelVersion>
|
|
10
10
|
<groupId>expo.modules.ui</groupId>
|
|
11
11
|
<artifactId>expo.modules.ui</artifactId>
|
|
12
|
-
<version>56.0.
|
|
12
|
+
<version>56.0.10</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.ui</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.md5
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ad29a351aaea28c246a456f3ed5fbcaa
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha1
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
b08134844384a6967513a2042a845a9293bbce8d
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha256
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fb9ffc15a2534764d7862228b4b481c4735c3bed15bf9ca8c7c911e7c5d02a39
|
package/local-maven-repo/expo/modules/ui/expo.modules.ui/56.0.10/expo.modules.ui-56.0.10.pom.sha512
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
e454207a2d765563864f1b57c3c597433df193a6cecf46c9a56f9acee6f88e028cf6d68505926f8e6ab2a1a95cf5664d608ca93c570e763fa81d1366013b2b12
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>expo.modules.ui</groupId>
|
|
4
4
|
<artifactId>expo.modules.ui</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>56.0.
|
|
7
|
-
<release>56.0.
|
|
6
|
+
<latest>56.0.10</latest>
|
|
7
|
+
<release>56.0.10</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>56.0.
|
|
9
|
+
<version>56.0.10</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20260520215036</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1c8319dbe2c319d05f3defce9dfca28f
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3f9e1260d005ec3203affdfa84145f38f93036a4
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
194c899143ea1ebba6113856a373494144b8bb9307db4eeaeda9003c40bc1f50
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
d0e985d2f7d710a0b5c6b30cead38097e0174bd188c39296b33348f5749fa1b7351d08e4b823d12af2a708a0e1c69f7032a6e678c89d79dd3d9c0ff837cfbf36
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/ui",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.10",
|
|
4
4
|
"description": "A collection of UI components",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.fx.js"
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
"types": "./build/community/menu/index.d.ts",
|
|
56
56
|
"default": "./src/community/menu/index.tsx"
|
|
57
57
|
},
|
|
58
|
+
"./community/pager-view": {
|
|
59
|
+
"types": "./build/community/pager-view/index.d.ts",
|
|
60
|
+
"default": "./src/community/pager-view/index.tsx"
|
|
61
|
+
},
|
|
58
62
|
"./babel-plugin": {
|
|
59
63
|
"types": "./plugin/babel-plugin.d.ts",
|
|
60
64
|
"default": "./plugin/babel-plugin.js"
|
|
@@ -91,7 +95,7 @@
|
|
|
91
95
|
"@types/react": "~19.2.0",
|
|
92
96
|
"react-native-reanimated": "4.3.1",
|
|
93
97
|
"react-native-worklets": "0.8.3",
|
|
94
|
-
"expo": "56.0.0
|
|
98
|
+
"expo": "56.0.0",
|
|
95
99
|
"expo-module-scripts": "56.0.2"
|
|
96
100
|
},
|
|
97
101
|
"jest": {
|
|
@@ -120,7 +124,7 @@
|
|
|
120
124
|
"optional": true
|
|
121
125
|
}
|
|
122
126
|
},
|
|
123
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "c4c9867a0bcbb188e55ecaec4998e38d33108a5d",
|
|
124
128
|
"scripts": {
|
|
125
129
|
"build": "expo-module build",
|
|
126
130
|
"clean": "expo-module clean",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Side-effect: installs the iOS UI worklet runtime and SharedObject
|
|
2
|
+
// support in the worklet runtime. Routed through this barrel so the
|
|
3
|
+
// installation happens exactly once per the bundler's module cache,
|
|
4
|
+
// regardless of which entry consumers import from.
|
|
5
|
+
import './index.fx';
|
|
6
|
+
|
|
7
|
+
export { useNativeState, type ObservableState } from './useNativeState';
|
|
8
|
+
export { useWorkletProp } from './useWorkletProp';
|
|
9
|
+
export { worklets } from './optionalWorklets';
|
|
10
|
+
export { getStateId } from './utils';
|
|
@@ -12,11 +12,39 @@ const ExpoUI = requireNativeModule('ExpoUI');
|
|
|
12
12
|
*/
|
|
13
13
|
export type ObservableState<T> = SharedObject & {
|
|
14
14
|
/**
|
|
15
|
-
* The current value.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The current value.
|
|
16
|
+
*
|
|
17
|
+
* Writes from a UI worklet are synchronous and immediately readable. Writes
|
|
18
|
+
* from the JS thread are scheduled to the UI thread asynchronously, the new value is not readable until the update has been
|
|
19
|
+
* applied. Prefer writing from a worklet when you need synchronous updates
|
|
18
20
|
*/
|
|
19
21
|
value: T;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A single listener invoked on the native UI runtime whenever the value changes
|
|
25
|
+
* (after iOS `didSet` and Android's setter). Assigning replaces the previous
|
|
26
|
+
* listener; assign `null` to clear. The initial value does not fire `onChange`.
|
|
27
|
+
*
|
|
28
|
+
* The callback must be a worklet so it can run synchronously on the UI thread.
|
|
29
|
+
* Attach it inside `useEffect` and clear it in the cleanup so the listener
|
|
30
|
+
* lifecycle matches the component lifecycle.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const state = useNativeState(0);
|
|
35
|
+
*
|
|
36
|
+
* useEffect(() => {
|
|
37
|
+
* state.onChange = (value) => {
|
|
38
|
+
* 'worklet';
|
|
39
|
+
* console.log('changed to', value);
|
|
40
|
+
* };
|
|
41
|
+
* return () => {
|
|
42
|
+
* state.onChange = null;
|
|
43
|
+
* };
|
|
44
|
+
* }, []);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
onChange: { listener(value: T): void }['listener'] | null;
|
|
20
48
|
};
|
|
21
49
|
|
|
22
50
|
/**
|
|
@@ -28,6 +56,7 @@ export function useNativeState<T>(initialValue: T): ObservableState<T> {
|
|
|
28
56
|
return useReleasingSharedObject(() => {
|
|
29
57
|
const state = new ExpoUI.ObservableState({ value: initialValueRef.current });
|
|
30
58
|
defineValueProperty(state);
|
|
59
|
+
defineOnChangeProperty(state);
|
|
31
60
|
return state;
|
|
32
61
|
}, []) as ObservableState<T>;
|
|
33
62
|
}
|
|
@@ -35,6 +64,7 @@ export function useNativeState<T>(initialValue: T): ObservableState<T> {
|
|
|
35
64
|
type NativeObservableState = {
|
|
36
65
|
getValue(): unknown;
|
|
37
66
|
setValue(v: { value: unknown }): void;
|
|
67
|
+
setOnChange(callback: object | null): void;
|
|
38
68
|
};
|
|
39
69
|
|
|
40
70
|
/**
|
|
@@ -58,3 +88,41 @@ function defineValueProperty(state: NativeObservableState): void {
|
|
|
58
88
|
},
|
|
59
89
|
});
|
|
60
90
|
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Adds an `onChange` property that wraps the user's worklet function as a
|
|
94
|
+
* `WorkletCallback` SharedObject before handing it to native. The cached
|
|
95
|
+
* function (not the SharedObject) is what the getter returns, so reading
|
|
96
|
+
* `state.onChange` gives back what the user assigned.
|
|
97
|
+
*/
|
|
98
|
+
function defineOnChangeProperty(state: NativeObservableState): void {
|
|
99
|
+
let currentFn: ((value: unknown) => void) | null = null;
|
|
100
|
+
Object.defineProperty(state, 'onChange', {
|
|
101
|
+
get() {
|
|
102
|
+
return currentFn;
|
|
103
|
+
},
|
|
104
|
+
set(fn: ((value: unknown) => void) | null | undefined) {
|
|
105
|
+
if (!fn) {
|
|
106
|
+
currentFn = null;
|
|
107
|
+
state.setOnChange(null);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!worklets) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
"ObservableState.onChange requires the 'react-native-worklets' package, which couldn't be loaded. " +
|
|
113
|
+
'Install react-native-worklets and rebuild the native app, then assign onChange again.'
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (!worklets.isWorkletFunction(fn)) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
'ObservableState.onChange must be a worklet so it can run on the UI runtime when the native value changes. ' +
|
|
119
|
+
"Add the 'worklet' directive as the first statement in your callback: " +
|
|
120
|
+
"state.onChange = (value) => { 'worklet'; ... };"
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
currentFn = fn;
|
|
124
|
+
const callback = new ExpoUI.WorkletCallback(worklets.createSerializable(fn));
|
|
125
|
+
state.setOnChange(callback);
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -84,12 +84,6 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
84
84
|
} = props;
|
|
85
85
|
const { width } = useWindowDimensions();
|
|
86
86
|
|
|
87
|
-
// Two-state pattern for animated close:
|
|
88
|
-
// - isMounted: whether the native sheet tree exists in the React tree
|
|
89
|
-
// - isPresented: passed to native isPresented prop (controls SwiftUI animation)
|
|
90
|
-
// On close: isPresented→false (native animates out) → onIsPresentedChange fires → isMounted→false (unmount)
|
|
91
|
-
// On open: isMounted→true + isPresented→true (mount + native animates in)
|
|
92
|
-
const [isMounted, setIsMounted] = useState(indexProp >= 0);
|
|
93
87
|
const [isPresented, setIsPresented] = useState(indexProp >= 0);
|
|
94
88
|
const [currentIndex, setCurrentIndex] = useState(Math.max(indexProp, 0));
|
|
95
89
|
// Ref mirrors currentIndex for use in handleDetentChange without adding it as a useCallback dep
|
|
@@ -129,7 +123,6 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
129
123
|
fireCloseCallbacks();
|
|
130
124
|
} else if (indexProp >= 0) {
|
|
131
125
|
closedRef.current = false;
|
|
132
|
-
setIsMounted(true);
|
|
133
126
|
setIsPresented(true);
|
|
134
127
|
const clampedIndex = Math.min(indexProp, detents.length - 1);
|
|
135
128
|
setCurrentIndex(clampedIndex);
|
|
@@ -141,7 +134,6 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
141
134
|
(presented: boolean) => {
|
|
142
135
|
if (!presented) {
|
|
143
136
|
setIsPresented(false);
|
|
144
|
-
setIsMounted(false);
|
|
145
137
|
fireCloseCallbacks();
|
|
146
138
|
}
|
|
147
139
|
},
|
|
@@ -169,7 +161,6 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
169
161
|
}
|
|
170
162
|
const clampedIndex = Math.min(Math.max(index, 0), detents.length - 1);
|
|
171
163
|
closedRef.current = false;
|
|
172
|
-
setIsMounted(true);
|
|
173
164
|
setIsPresented(true);
|
|
174
165
|
currentIndexRef.current = clampedIndex;
|
|
175
166
|
setCurrentIndex(clampedIndex);
|
|
@@ -224,14 +215,6 @@ export function BottomSheet(props: BottomSheetProps) {
|
|
|
224
215
|
]
|
|
225
216
|
);
|
|
226
217
|
|
|
227
|
-
if (!isMounted) {
|
|
228
|
-
return (
|
|
229
|
-
<BottomSheetInternalContext.Provider value={internalContextValue}>
|
|
230
|
-
<BottomSheetContext.Provider value={methods}>{null}</BottomSheetContext.Provider>
|
|
231
|
-
</BottomSheetInternalContext.Provider>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
218
|
return (
|
|
236
219
|
<BottomSheetInternalContext.Provider value={internalContextValue}>
|
|
237
220
|
<BottomSheetContext.Provider value={methods}>
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Children,
|
|
3
|
+
isValidElement,
|
|
4
|
+
useEffect,
|
|
5
|
+
useImperativeHandle,
|
|
6
|
+
useMemo,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
type ReactElement,
|
|
10
|
+
} from 'react';
|
|
11
|
+
import { StyleSheet } from 'react-native';
|
|
12
|
+
|
|
13
|
+
import { wrapNativeEvent, type PagerViewProps } from './types';
|
|
14
|
+
import { worklets } from '../../State';
|
|
15
|
+
import { HorizontalPager, type HorizontalPagerHandle } from '../../jetpack-compose/HorizontalPager';
|
|
16
|
+
import { Host } from '../../jetpack-compose/Host';
|
|
17
|
+
import { RNHostView } from '../../jetpack-compose/RNHostView';
|
|
18
|
+
import { type BuiltinShape, Shapes, clip, fillMaxSize } from '../../jetpack-compose/modifiers';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Drop-in replacement for `react-native-pager-view` on Android.
|
|
22
|
+
* Renders a Jetpack Compose `HorizontalPager`.
|
|
23
|
+
*/
|
|
24
|
+
export function PagerView(props: PagerViewProps) {
|
|
25
|
+
const {
|
|
26
|
+
ref,
|
|
27
|
+
initialPage = 0,
|
|
28
|
+
scrollEnabled = true,
|
|
29
|
+
pageMargin,
|
|
30
|
+
offscreenPageLimit,
|
|
31
|
+
layoutDirection,
|
|
32
|
+
onPageScroll,
|
|
33
|
+
onPageScrollStateChanged,
|
|
34
|
+
onPageSelected,
|
|
35
|
+
children,
|
|
36
|
+
style,
|
|
37
|
+
} = props;
|
|
38
|
+
|
|
39
|
+
const pagerRef = useRef<HorizontalPagerHandle>(null);
|
|
40
|
+
const [scrollEnabledState, setScrollEnabledState] = useState(scrollEnabled);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
setScrollEnabledState(scrollEnabled);
|
|
43
|
+
}, [scrollEnabled]);
|
|
44
|
+
|
|
45
|
+
// Synthesize pager-view's `idle | dragging | settling` from Compose's raw
|
|
46
|
+
// signals: `isScrollInProgress` (drag or snap-animation in flight) plus
|
|
47
|
+
// drag interactions (start/stop/cancel).
|
|
48
|
+
const isScrollInProgressRef = useRef(false);
|
|
49
|
+
const isDraggingRef = useRef(false);
|
|
50
|
+
const lastEmittedScrollStateRef = useRef<'idle' | 'dragging' | 'settling' | null>(null);
|
|
51
|
+
const emitPageScrollStateIfChanged = (state: 'idle' | 'dragging' | 'settling') => {
|
|
52
|
+
if (state === lastEmittedScrollStateRef.current) return;
|
|
53
|
+
lastEmittedScrollStateRef.current = state;
|
|
54
|
+
onPageScrollStateChanged?.(wrapNativeEvent({ pageScrollState: state }));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
useImperativeHandle(
|
|
58
|
+
ref,
|
|
59
|
+
() => ({
|
|
60
|
+
setPage: (page: number) => {
|
|
61
|
+
pagerRef.current?.animateScrollToPage(page);
|
|
62
|
+
},
|
|
63
|
+
setPageWithoutAnimation: (page: number) => {
|
|
64
|
+
pagerRef.current?.scrollToPage(page);
|
|
65
|
+
},
|
|
66
|
+
setScrollEnabled: setScrollEnabledState,
|
|
67
|
+
}),
|
|
68
|
+
[]
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const pages = Children.toArray(children)
|
|
72
|
+
.filter((child): child is ReactElement => isValidElement(child))
|
|
73
|
+
.map((child, index) => (
|
|
74
|
+
<RNHostView key={child.key ?? String(index)} modifiers={[fillMaxSize()]}>
|
|
75
|
+
{child}
|
|
76
|
+
</RNHostView>
|
|
77
|
+
));
|
|
78
|
+
|
|
79
|
+
const pageScrollHandler = useMemo(
|
|
80
|
+
() => (onPageScroll ? buildOnPageScrollHandler(onPageScroll) : undefined),
|
|
81
|
+
[onPageScroll]
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
// RN's `borderRadius` on the host View doesn't reliably clip Compose's draw
|
|
85
|
+
// pass — translate it into a Compose `clip` modifier instead.
|
|
86
|
+
const pagerModifiers = [fillMaxSize()];
|
|
87
|
+
const cornerShape = borderRadiusShape(style, layoutDirection === 'rtl');
|
|
88
|
+
if (cornerShape) {
|
|
89
|
+
pagerModifiers.push(clip(cornerShape));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<Host style={style ?? { flex: 1 }}>
|
|
94
|
+
<HorizontalPager
|
|
95
|
+
ref={pagerRef}
|
|
96
|
+
initialPage={initialPage}
|
|
97
|
+
userScrollEnabled={scrollEnabledState}
|
|
98
|
+
reverseLayout={layoutDirection === 'rtl'}
|
|
99
|
+
pageSpacing={pageMargin}
|
|
100
|
+
beyondViewportPageCount={offscreenPageLimit}
|
|
101
|
+
modifiers={pagerModifiers}
|
|
102
|
+
onSettledPageChange={(page) => {
|
|
103
|
+
onPageSelected?.(wrapNativeEvent({ position: page }));
|
|
104
|
+
}}
|
|
105
|
+
onPageScroll={pageScrollHandler}
|
|
106
|
+
onScrollInProgressChange={
|
|
107
|
+
onPageScrollStateChanged
|
|
108
|
+
? (inProgress) => {
|
|
109
|
+
isScrollInProgressRef.current = inProgress;
|
|
110
|
+
if (!inProgress) {
|
|
111
|
+
emitPageScrollStateIfChanged('idle');
|
|
112
|
+
} else if (!isDraggingRef.current) {
|
|
113
|
+
emitPageScrollStateIfChanged('settling');
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
: undefined
|
|
117
|
+
}
|
|
118
|
+
onDragInteraction={
|
|
119
|
+
onPageScrollStateChanged
|
|
120
|
+
? (kind) => {
|
|
121
|
+
if (kind === 'start') {
|
|
122
|
+
isDraggingRef.current = true;
|
|
123
|
+
emitPageScrollStateIfChanged('dragging');
|
|
124
|
+
} else {
|
|
125
|
+
isDraggingRef.current = false;
|
|
126
|
+
emitPageScrollStateIfChanged(isScrollInProgressRef.current ? 'settling' : 'idle');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
: undefined
|
|
130
|
+
}>
|
|
131
|
+
{pages}
|
|
132
|
+
</HorizontalPager>
|
|
133
|
+
</Host>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Compose's `(currentPage, fraction ∈ [-0.5, 0.5))` is anchored to the snapped
|
|
138
|
+
// page; pager-view's `(position, offset ∈ [0, 1))` is anchored to the leading
|
|
139
|
+
// page. Re-anchor negative fractions onto the previous page.
|
|
140
|
+
function composePageToPageScroll(
|
|
141
|
+
currentPage: number,
|
|
142
|
+
currentPageOffsetFraction: number
|
|
143
|
+
): { position: number; offset: number } {
|
|
144
|
+
'worklet';
|
|
145
|
+
if (currentPageOffsetFraction >= 0) {
|
|
146
|
+
return { position: currentPage, offset: currentPageOffsetFraction };
|
|
147
|
+
}
|
|
148
|
+
return { position: currentPage - 1, offset: 1 + currentPageOffsetFraction };
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Mirrors the worklet-ness of the user's callback so the per-frame mapping
|
|
152
|
+
// stays on the UI runtime when the user is also on it.
|
|
153
|
+
function buildOnPageScrollHandler(
|
|
154
|
+
userOnPageScroll: NonNullable<PagerViewProps['onPageScroll']>
|
|
155
|
+
): (currentPage: number, currentPageOffsetFraction: number) => void {
|
|
156
|
+
if (worklets?.isWorkletFunction?.(userOnPageScroll)) {
|
|
157
|
+
return (currentPage, currentPageOffsetFraction) => {
|
|
158
|
+
'worklet';
|
|
159
|
+
userOnPageScroll(
|
|
160
|
+
wrapNativeEvent(composePageToPageScroll(currentPage, currentPageOffsetFraction))
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return (currentPage, currentPageOffsetFraction) => {
|
|
165
|
+
userOnPageScroll(
|
|
166
|
+
wrapNativeEvent(composePageToPageScroll(currentPage, currentPageOffsetFraction))
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Translates RN border-radius style keys to a Compose `RoundedCornerShape`.
|
|
172
|
+
// Physical (`borderTopLeftRadius`) and logical (`borderTopStartRadius`) keys
|
|
173
|
+
// collapse onto Compose's start/end edges, swapped under RTL.
|
|
174
|
+
function borderRadiusShape(style: PagerViewProps['style'], rtl: boolean): BuiltinShape | undefined {
|
|
175
|
+
const flat = StyleSheet.flatten(style) as Record<string, unknown> | undefined;
|
|
176
|
+
if (!flat) return undefined;
|
|
177
|
+
// Compose `RoundedCornerShape` only takes Dp (numeric); RN's string values
|
|
178
|
+
// like `'50%'` are dropped — `__DEV__` warns once so the no-clip isn't silent.
|
|
179
|
+
const num = (key: string): number | undefined => {
|
|
180
|
+
const v = flat[key];
|
|
181
|
+
if (typeof v === 'number') return v > 0 ? v : undefined;
|
|
182
|
+
if (__DEV__ && typeof v === 'string') {
|
|
183
|
+
warnAboutStringBorderRadiusOnce(key, v);
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
};
|
|
187
|
+
const uniform = num('borderRadius');
|
|
188
|
+
const topLeft = num('borderTopLeftRadius');
|
|
189
|
+
const topRight = num('borderTopRightRadius');
|
|
190
|
+
const bottomLeft = num('borderBottomLeftRadius');
|
|
191
|
+
const bottomRight = num('borderBottomRightRadius');
|
|
192
|
+
const topStart = num('borderTopStartRadius') ?? (rtl ? topRight : topLeft);
|
|
193
|
+
const topEnd = num('borderTopEndRadius') ?? (rtl ? topLeft : topRight);
|
|
194
|
+
const bottomStart = num('borderBottomStartRadius') ?? (rtl ? bottomRight : bottomLeft);
|
|
195
|
+
const bottomEnd = num('borderBottomEndRadius') ?? (rtl ? bottomLeft : bottomRight);
|
|
196
|
+
const hasPerCorner =
|
|
197
|
+
topStart != null || topEnd != null || bottomStart != null || bottomEnd != null;
|
|
198
|
+
if (hasPerCorner) {
|
|
199
|
+
const fallback = uniform ?? 0;
|
|
200
|
+
return Shapes.RoundedCorner({
|
|
201
|
+
topStart: topStart ?? fallback,
|
|
202
|
+
topEnd: topEnd ?? fallback,
|
|
203
|
+
bottomStart: bottomStart ?? fallback,
|
|
204
|
+
bottomEnd: bottomEnd ?? fallback,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
if (uniform != null) {
|
|
208
|
+
return Shapes.RoundedCorner(uniform);
|
|
209
|
+
}
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
let didWarnStringBorderRadius = false;
|
|
214
|
+
function warnAboutStringBorderRadiusOnce(key: string, value: string): void {
|
|
215
|
+
if (didWarnStringBorderRadius) return;
|
|
216
|
+
didWarnStringBorderRadius = true;
|
|
217
|
+
console.warn(
|
|
218
|
+
`[expo-ui PagerView] ${key}: ${JSON.stringify(value)} — string border-radius values ` +
|
|
219
|
+
`aren't supported on the Android pager (Jetpack Compose's RoundedCornerShape requires ` +
|
|
220
|
+
`numeric Dp values). The corner radius is being dropped, so the pager won't clip. ` +
|
|
221
|
+
`Use a numeric pixel value, or omit the style key.`
|
|
222
|
+
);
|
|
223
|
+
}
|