@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
|
@@ -8,12 +8,108 @@
|
|
|
8
8
|
* functional props (for example `onPress`, `onAppear`, `disabled`) must not
|
|
9
9
|
* go through this filter, or a user modifier of the same type would silently
|
|
10
10
|
* disable the prop.
|
|
11
|
-
*/ export function omitUserOverridden(derived, userModifiers) {
|
|
11
|
+
*/ export function omitUserOverridden(derived, userModifiers, preservedTypes) {
|
|
12
12
|
if (!userModifiers?.length) {
|
|
13
13
|
return derived;
|
|
14
14
|
}
|
|
15
15
|
const userTypes = new Set(userModifiers.map((modifier)=>modifier.$type));
|
|
16
|
-
return derived.filter((modifier)
|
|
16
|
+
return derived.filter((modifier)=>preservedTypes?.has(modifier.$type) || !userTypes.has(modifier.$type));
|
|
17
|
+
}
|
|
18
|
+
const PERCENTAGE_PATTERN = /^(?:\d+(?:\.\d+)?|\.\d+)%$/;
|
|
19
|
+
const warnedInvalidDimensions = new Set();
|
|
20
|
+
function warnInvalidDimension(componentName, axis, value) {
|
|
21
|
+
if (!__DEV__) return;
|
|
22
|
+
const warningKey = `${componentName}:${axis}`;
|
|
23
|
+
if (warnedInvalidDimensions.has(warningKey)) return;
|
|
24
|
+
warnedInvalidDimensions.add(warningKey);
|
|
25
|
+
console.warn(`[Expo UI] Ignoring invalid ${axis} on ${componentName}: ${String(value)}. ` + 'Expected a finite, non-negative number or percentage.');
|
|
26
|
+
}
|
|
27
|
+
function serializeDimension(value, componentName, axis) {
|
|
28
|
+
if (value == null) return {};
|
|
29
|
+
if (typeof value === 'number') {
|
|
30
|
+
if (Number.isFinite(value) && value >= 0) return {
|
|
31
|
+
points: value
|
|
32
|
+
};
|
|
33
|
+
warnInvalidDimension(componentName, axis, value);
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
if (typeof value === 'string' && PERCENTAGE_PATTERN.test(value)) {
|
|
37
|
+
const percentage = Number(value.slice(0, -1));
|
|
38
|
+
if (Number.isFinite(percentage) && percentage >= 0) {
|
|
39
|
+
return {
|
|
40
|
+
fraction: percentage / 100
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
warnInvalidDimension(componentName, axis, value);
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
export function serializeUniversalDimensions(style, componentName = 'universal component') {
|
|
48
|
+
const width = serializeDimension(style?.width, componentName, 'width');
|
|
49
|
+
const height = serializeDimension(style?.height, componentName, 'height');
|
|
50
|
+
return {
|
|
51
|
+
widthPoints: width.points,
|
|
52
|
+
widthFraction: width.fraction,
|
|
53
|
+
heightPoints: height.points,
|
|
54
|
+
heightFraction: height.fraction
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Which axes a user modifier already owns.
|
|
59
|
+
* `weight` applies to the parent's main axis, so the cross axis still comes from `style`.
|
|
60
|
+
* `defaultMinSize` only applies when the incoming constraint is 0, so it does not replace a size.
|
|
61
|
+
* A `frame` owns an axis only when it sets `width` or `height`.
|
|
62
|
+
* A minimum or maximum limits that size.
|
|
63
|
+
*/ export function getUserSizingOverrides(userModifiers, platform) {
|
|
64
|
+
let width = false;
|
|
65
|
+
let height = false;
|
|
66
|
+
for (const modifier of userModifiers ?? []){
|
|
67
|
+
if (platform === 'android') {
|
|
68
|
+
if (modifier.$type === 'size' || modifier.$type === 'fillMaxSize') {
|
|
69
|
+
width = true;
|
|
70
|
+
height = true;
|
|
71
|
+
} else if (modifier.$type === 'width' || modifier.$type === 'fillMaxWidth' || modifier.$type === 'wrapContentWidth') {
|
|
72
|
+
width = true;
|
|
73
|
+
} else if (modifier.$type === 'height' || modifier.$type === 'fillMaxHeight' || modifier.$type === 'wrapContentHeight') {
|
|
74
|
+
height = true;
|
|
75
|
+
}
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (modifier.$type === 'frame') {
|
|
79
|
+
width ||= modifier.width != null;
|
|
80
|
+
height ||= modifier.height != null;
|
|
81
|
+
} else if (modifier.$type === 'containerRelativeFrame') {
|
|
82
|
+
width ||= modifier.axes === 'horizontal' || modifier.axes === 'both';
|
|
83
|
+
height ||= modifier.axes === 'vertical' || modifier.axes === 'both';
|
|
84
|
+
} else if (modifier.$type === 'fixedSize') {
|
|
85
|
+
const hasExplicitAxis = modifier.horizontal != null || modifier.vertical != null;
|
|
86
|
+
width ||= hasExplicitAxis ? modifier.horizontal === true : true;
|
|
87
|
+
height ||= hasExplicitAxis ? modifier.vertical === true : true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
width,
|
|
92
|
+
height
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function omitUserOverriddenDimensions(dimensions, userModifiers, platform) {
|
|
96
|
+
const overrides = getUserSizingOverrides(userModifiers, platform);
|
|
97
|
+
return {
|
|
98
|
+
widthPoints: overrides.width ? undefined : dimensions.widthPoints,
|
|
99
|
+
widthFraction: overrides.width ? undefined : dimensions.widthFraction,
|
|
100
|
+
heightPoints: overrides.height ? undefined : dimensions.heightPoints,
|
|
101
|
+
heightFraction: overrides.height ? undefined : dimensions.heightFraction
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
export function createUniversalLayoutModifier(dimensions) {
|
|
105
|
+
const hasDimension = Object.values(dimensions).some((value)=>value != null);
|
|
106
|
+
return hasDimension ? {
|
|
107
|
+
$type: 'universalLayout',
|
|
108
|
+
...dimensions
|
|
109
|
+
} : undefined;
|
|
110
|
+
}
|
|
111
|
+
export function resetUniversalDimensionWarningsForTests() {
|
|
112
|
+
warnedInvalidDimensions.clear();
|
|
17
113
|
}
|
|
18
114
|
|
|
19
115
|
//# sourceMappingURL=modifierUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/modifierUtils.ts"],"sourcesContent":[null],"names":["omitUserOverridden","derived","userModifiers","length","userTypes","Set","map","modifier","$type","filter","has"],"mappings":"AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASA,mBACdC,OAAY,EACZC,aAAyC;
|
|
1
|
+
{"version":3,"sources":["universal/modifierUtils.ts"],"sourcesContent":[null],"names":["omitUserOverridden","derived","userModifiers","preservedTypes","length","userTypes","Set","map","modifier","$type","filter","has","PERCENTAGE_PATTERN","warnedInvalidDimensions","warnInvalidDimension","componentName","axis","value","__DEV__","warningKey","add","console","warn","String","serializeDimension","Number","isFinite","points","test","percentage","slice","fraction","serializeUniversalDimensions","style","width","height","widthPoints","widthFraction","heightPoints","heightFraction","getUserSizingOverrides","platform","axes","hasExplicitAxis","horizontal","vertical","omitUserOverriddenDimensions","dimensions","overrides","undefined","createUniversalLayoutModifier","hasDimension","Object","values","some","resetUniversalDimensionWarningsForTests","clear"],"mappings":"AAEA;;;;;;;;;;CAUC,GACD,OAAO,SAASA,mBACdC,OAAY,EACZC,aAAyC,EACzCC,cAAoC;IAEpC,IAAI,CAACD,eAAeE,QAAQ;QAC1B,OAAOH;IACT;IACA,MAAMI,YAAY,IAAIC,IAAIJ,cAAcK,GAAG,CAAC,CAACC,WAAaA,SAASC,KAAK;IACxE,OAAOR,QAAQS,MAAM,CACnB,CAACF,WAAaL,gBAAgBQ,IAAIH,SAASC,KAAK,KAAK,CAACJ,UAAUM,GAAG,CAACH,SAASC,KAAK;AAEtF;AAyBA,MAAMG,qBAAqB;AAC3B,MAAMC,0BAA0B,IAAIP;AAEpC,SAASQ,qBAAqBC,aAAqB,EAAEC,IAAmB,EAAEC,KAAc;IACtF,IAAI,CAACC,SAAS;IAEd,MAAMC,aAAa,GAAGJ,cAAc,CAAC,EAAEC,MAAM;IAC7C,IAAIH,wBAAwBF,GAAG,CAACQ,aAAa;IAC7CN,wBAAwBO,GAAG,CAACD;IAE5BE,QAAQC,IAAI,CACV,CAAC,2BAA2B,EAAEN,KAAK,IAA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ACxE,OAAOkC,eAAe;QAAE1C,OAAO;QAAmB,GAAGsC,UAAU;IAAC,IAAIE;AACtE;AAEA,OAAO,SAASM;IACd1C,wBAAwB2C,KAAK;AAC/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { UniversalStyle } from './types';
|
|
2
|
+
export type StackAxis = 'horizontal' | 'vertical';
|
|
3
|
+
/**
|
|
4
|
+
* Main axis of the nearest universal `Row` or `Column` on web.
|
|
5
|
+
* A plain view lays its children out vertically, so that is the default.
|
|
6
|
+
*/
|
|
7
|
+
export declare const StackAxisContext: import("react").Context<StackAxis>;
|
|
8
|
+
/** The size `style` sets on the parent's cross axis, if any. */
|
|
9
|
+
export declare function useCrossAxisSize(style: UniversalStyle | undefined): import("./modifierUtils").UniversalDimension | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Main axis of the nearest universal `Row` or `Column` on web.
|
|
4
|
+
* A plain view lays its children out vertically, so that is the default.
|
|
5
|
+
*/ export const StackAxisContext = createContext('vertical');
|
|
6
|
+
/** The size `style` sets on the parent's cross axis, if any. */ export function useCrossAxisSize(style) {
|
|
7
|
+
const parentAxis = useContext(StackAxisContext);
|
|
8
|
+
return parentAxis === 'horizontal' ? style?.height : style?.width;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=stackAxis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["universal/stackAxis.ts"],"sourcesContent":[null],"names":["createContext","useContext","StackAxisContext","useCrossAxisSize","style","parentAxis","height","width"],"mappings":"AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,QAAQ;AAMlD;;;CAGC,GACD,OAAO,MAAMC,mBAAmBF,cAAyB,YAAY;AAErE,8DAA8D,GAC9D,OAAO,SAASG,iBAAiBC,KAAiC;IAChE,MAAMC,aAAaJ,WAAWC;IAC9B,OAAOG,eAAe,eAAeD,OAAOE,SAASF,OAAOG;AAC9D"}
|
|
@@ -6,10 +6,14 @@ import type { UniversalBaseProps, UniversalStyle } from './types';
|
|
|
6
6
|
*
|
|
7
7
|
* Compose modifiers apply outside-in (left to right). To match React Native's
|
|
8
8
|
* box model where background includes the padding area and border is outermost:
|
|
9
|
-
*
|
|
9
|
+
* universal layout → fixed size → border → clip → background → padding → opacity
|
|
10
10
|
* → events → behavior → user escape-hatch
|
|
11
11
|
*
|
|
12
|
+
* Fixed sizes become `size`, `width`, or `height`.
|
|
13
|
+
* Percentages stay on `universalLayout` so the parent stack can resolve them.
|
|
12
14
|
* Style-derived modifiers yield to user-supplied modifiers of the same
|
|
13
15
|
* `$type`, so the escape hatch can override anything derived from props.
|
|
14
16
|
*/
|
|
15
|
-
export declare function transformToModifiers(style: UniversalStyle | undefined, props: Pick<UniversalBaseProps, 'onPress' | 'disabled' | 'hidden' | 'testID'>, extraModifiers?: ModifierConfig[]
|
|
17
|
+
export declare function transformToModifiers(style: UniversalStyle | undefined, props: Pick<UniversalBaseProps, 'onPress' | 'disabled' | 'hidden' | 'testID'>, extraModifiers?: ModifierConfig[], options?: {
|
|
18
|
+
componentName?: string;
|
|
19
|
+
}): ModifierConfig[];
|
|
@@ -1,27 +1,34 @@
|
|
|
1
1
|
import { alpha, background, border, clickable, clip, height, padding, paddingAll, Shapes, size, testID as testIDModifier, width } from '@expo/ui/jetpack-compose/modifiers';
|
|
2
|
-
import { omitUserOverridden } from './modifierUtils';
|
|
2
|
+
import { createUniversalLayoutModifier, omitUserOverridden, omitUserOverriddenDimensions, serializeUniversalDimensions } from './modifierUtils';
|
|
3
3
|
/**
|
|
4
4
|
* Converts universal style/event/lifecycle/behavior props into a Jetpack
|
|
5
5
|
* Compose modifier array.
|
|
6
6
|
*
|
|
7
7
|
* Compose modifiers apply outside-in (left to right). To match React Native's
|
|
8
8
|
* box model where background includes the padding area and border is outermost:
|
|
9
|
-
*
|
|
9
|
+
* universal layout → fixed size → border → clip → background → padding → opacity
|
|
10
10
|
* → events → behavior → user escape-hatch
|
|
11
11
|
*
|
|
12
|
+
* Fixed sizes become `size`, `width`, or `height`.
|
|
13
|
+
* Percentages stay on `universalLayout` so the parent stack can resolve them.
|
|
12
14
|
* Style-derived modifiers yield to user-supplied modifiers of the same
|
|
13
15
|
* `$type`, so the escape hatch can override anything derived from props.
|
|
14
|
-
*/ export function transformToModifiers(style, props, extraModifiers) {
|
|
16
|
+
*/ export function transformToModifiers(style, props, extraModifiers, options) {
|
|
15
17
|
let mods = [];
|
|
18
|
+
const dimensions = omitUserOverriddenDimensions(serializeUniversalDimensions(style, options?.componentName), extraModifiers, 'android');
|
|
19
|
+
const fixedWidth = dimensions.widthPoints;
|
|
20
|
+
const fixedHeight = dimensions.heightPoints;
|
|
21
|
+
const universalLayoutModifier = createUniversalLayoutModifier(dimensions);
|
|
22
|
+
if (universalLayoutModifier) mods.push(universalLayoutModifier);
|
|
23
|
+
// Fixed sizing is applied directly. Percentages remain as parent data for
|
|
24
|
+
// the owning universal layout to resolve against its content box.
|
|
25
|
+
if (fixedWidth != null && fixedHeight != null) {
|
|
26
|
+
mods.push(size(fixedWidth, fixedHeight));
|
|
27
|
+
} else {
|
|
28
|
+
if (fixedWidth != null) mods.push(width(fixedWidth));
|
|
29
|
+
if (fixedHeight != null) mods.push(height(fixedHeight));
|
|
30
|
+
}
|
|
16
31
|
if (style) {
|
|
17
|
-
// Sizing (outermost)
|
|
18
|
-
if (style.width != null && style.height != null) {
|
|
19
|
-
mods.push(size(style.width, style.height));
|
|
20
|
-
} else if (style.width != null) {
|
|
21
|
-
mods.push(width(style.width));
|
|
22
|
-
} else if (style.height != null) {
|
|
23
|
-
mods.push(height(style.height));
|
|
24
|
-
}
|
|
25
32
|
// Border + background + borderRadius handling.
|
|
26
33
|
// Compose's border() doesn't accept a shape, so when borderRadius is set
|
|
27
34
|
// alongside border, we simulate a rounded border using layered backgrounds:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/transformStyle.android.ts"],"sourcesContent":[null],"names":["alpha","background","border","clickable","clip","height","padding","paddingAll","Shapes","size","testID","testIDModifier","width","omitUserOverridden","transformToModifiers","style","props","extraModifiers","mods","push","hasBorder","borderWidth","borderColor","hasRadius","borderRadius","radius","bw","RoundedCorner","String","Math","max","backgroundColor","all","top","paddingTop","paddingVertical","bottom","paddingBottom","start","paddingLeft","paddingHorizontal","end","paddingRight","opacity","onPress","hidden"],"mappings":"AAAA,SACEA,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,UAAU,EACVC,MAAM,EACNC,IAAI,EACJC,UAAUC,cAAc,EACxBC,KAAK,QAEA,qCAAqC;AAE5C,
|
|
1
|
+
{"version":3,"sources":["universal/transformStyle.android.ts"],"sourcesContent":[null],"names":["alpha","background","border","clickable","clip","height","padding","paddingAll","Shapes","size","testID","testIDModifier","width","createUniversalLayoutModifier","omitUserOverridden","omitUserOverriddenDimensions","serializeUniversalDimensions","transformToModifiers","style","props","extraModifiers","options","mods","dimensions","componentName","fixedWidth","widthPoints","fixedHeight","heightPoints","universalLayoutModifier","push","hasBorder","borderWidth","borderColor","hasRadius","borderRadius","radius","bw","RoundedCorner","String","Math","max","backgroundColor","all","top","paddingTop","paddingVertical","bottom","paddingBottom","start","paddingLeft","paddingHorizontal","end","paddingRight","opacity","onPress","hidden"],"mappings":"AAAA,SACEA,KAAK,EACLC,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,UAAU,EACVC,MAAM,EACNC,IAAI,EACJC,UAAUC,cAAc,EACxBC,KAAK,QAEA,qCAAqC;AAE5C,SACEC,6BAA6B,EAC7BC,kBAAkB,EAClBC,4BAA4B,EAC5BC,4BAA4B,QACvB,kBAAkB;AAGzB;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,qBACdC,KAAiC,EACjCC,KAA6E,EAC7EC,cAAiC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,MAAM,EAAEY,KAAKQ,IAAI,CAACnB,eAAeQ,MAAMT,MAAM;IACvD,wFAAwF;IAExF,mDAAmD;IACnD,IAAIU,gBAAgBE,KAAKQ,IAAI,IAAIV;IAEjC,OAAOE;AACT"}
|
|
@@ -7,13 +7,17 @@ import type { UniversalBaseProps, UniversalStyle } from './types';
|
|
|
7
7
|
*
|
|
8
8
|
* SwiftUI modifiers apply inside-out (each modifier wraps the previous).
|
|
9
9
|
* To match React Native's box model (background fills the full box):
|
|
10
|
-
* padding →
|
|
10
|
+
* padding → fixed frame → universal layout → background → border → clip → opacity
|
|
11
11
|
* → events → lifecycle → behavior → user escape-hatch
|
|
12
12
|
*
|
|
13
|
+
* Fixed sizes become a `frame`.
|
|
14
|
+
* Percentages stay on `universalLayout` so the parent stack can resolve them.
|
|
13
15
|
* Style-derived modifiers yield to user-supplied modifiers of the same
|
|
14
16
|
* `$type`, so the escape hatch can override anything derived from props.
|
|
15
17
|
*/
|
|
16
18
|
export declare function transformToModifiers(style: UniversalStyle | undefined, props: Pick<UniversalBaseProps, 'onPress' | 'onAppear' | 'onDisappear' | 'disabled' | 'hidden' | 'testID'>, extraModifiers?: ModifierConfig[], options?: {
|
|
19
|
+
/** Component name included in invalid-dimension development warnings. */
|
|
20
|
+
componentName?: string;
|
|
17
21
|
/** Alignment for the frame modifier (used by Column/Row). */
|
|
18
22
|
frameAlignment?: Parameters<typeof frame>[0]['alignment'];
|
|
19
23
|
/** Text-styling props for text-rendering components. */
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { background, border, clipShape, contentShape, disabled as disabledMod, font, foregroundStyle, frame, hidden as hiddenMod, kerning, lineSpacing, multilineTextAlignment, onAppear, onDisappear, onTapGesture, opacity, padding, shapes } from '@expo/ui/swift-ui/modifiers';
|
|
2
|
-
import { omitUserOverridden } from './modifierUtils';
|
|
2
|
+
import { createUniversalLayoutModifier, omitUserOverridden, omitUserOverriddenDimensions, serializeUniversalDimensions } from './modifierUtils';
|
|
3
|
+
// A user frame owns only the axes it sets. Keep a derived frame that still
|
|
4
|
+
// owns the other axis, and keep the layout value the parent stack reads.
|
|
5
|
+
const preservedSizingTypes = new Set([
|
|
6
|
+
'frame',
|
|
7
|
+
'universalLayout'
|
|
8
|
+
]);
|
|
3
9
|
const FONT_WEIGHT_MAP = {
|
|
4
10
|
'100': 'ultraLight',
|
|
5
11
|
'200': 'thin',
|
|
@@ -19,13 +25,18 @@ const FONT_WEIGHT_MAP = {
|
|
|
19
25
|
*
|
|
20
26
|
* SwiftUI modifiers apply inside-out (each modifier wraps the previous).
|
|
21
27
|
* To match React Native's box model (background fills the full box):
|
|
22
|
-
* padding →
|
|
28
|
+
* padding → fixed frame → universal layout → background → border → clip → opacity
|
|
23
29
|
* → events → lifecycle → behavior → user escape-hatch
|
|
24
30
|
*
|
|
31
|
+
* Fixed sizes become a `frame`.
|
|
32
|
+
* Percentages stay on `universalLayout` so the parent stack can resolve them.
|
|
25
33
|
* Style-derived modifiers yield to user-supplied modifiers of the same
|
|
26
34
|
* `$type`, so the escape hatch can override anything derived from props.
|
|
27
35
|
*/ export function transformToModifiers(style, props, extraModifiers, options) {
|
|
28
36
|
let mods = [];
|
|
37
|
+
const dimensions = omitUserOverriddenDimensions(serializeUniversalDimensions(style, options?.componentName), extraModifiers, 'ios');
|
|
38
|
+
const fixedWidth = dimensions.widthPoints;
|
|
39
|
+
const fixedHeight = dimensions.heightPoints;
|
|
29
40
|
// Text styling (innermost — applies to text content before container modifiers)
|
|
30
41
|
const textStyle = options?.textStyle;
|
|
31
42
|
if (textStyle) {
|
|
@@ -62,14 +73,19 @@ const FONT_WEIGHT_MAP = {
|
|
|
62
73
|
trailing: style.paddingRight
|
|
63
74
|
}));
|
|
64
75
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
}
|
|
77
|
+
// Fixed sizing is applied directly. Percentages remain as layout values for
|
|
78
|
+
// the owning universal layout to resolve against its content box.
|
|
79
|
+
if (fixedWidth != null || fixedHeight != null) {
|
|
80
|
+
mods.push(frame({
|
|
81
|
+
width: fixedWidth,
|
|
82
|
+
height: fixedHeight,
|
|
83
|
+
alignment: options?.frameAlignment
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
const universalLayoutModifier = createUniversalLayoutModifier(dimensions);
|
|
87
|
+
if (universalLayoutModifier) mods.push(universalLayoutModifier);
|
|
88
|
+
if (style) {
|
|
73
89
|
// Background (fills the frame area including padding)
|
|
74
90
|
if (style.backgroundColor) {
|
|
75
91
|
mods.push(background(style.backgroundColor));
|
|
@@ -92,7 +108,9 @@ const FONT_WEIGHT_MAP = {
|
|
|
92
108
|
}
|
|
93
109
|
// A user-supplied modifier replaces any style-derived modifier of the same
|
|
94
110
|
// type. The event, lifecycle, and behavior modifiers below are never dropped.
|
|
95
|
-
|
|
111
|
+
// Axis-aware sizing precedence has already removed only the dimensions set
|
|
112
|
+
// by a user frame. Preserve any derived frame that still owns the other axis.
|
|
113
|
+
mods = omitUserOverridden(mods, extraModifiers, preservedSizingTypes);
|
|
96
114
|
// Events. SwiftUI only hit-tests drawn content, so the `contentShape` lets
|
|
97
115
|
// taps on empty space (for example a `Spacer` in a `Row`) reach `onPress`.
|
|
98
116
|
if (props.onPress) mods.push(contentShape(shapes.rectangle()), onTapGesture(props.onPress));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/transformStyle.ios.ts"],"sourcesContent":[null],"names":["background","border","clipShape","contentShape","disabled","disabledMod","font","foregroundStyle","frame","hidden","hiddenMod","kerning","lineSpacing","multilineTextAlignment","onAppear","onDisappear","onTapGesture","opacity","padding","shapes","omitUserOverridden","FONT_WEIGHT_MAP","normal","bold","transformToModifiers","style","props","extraModifiers","options","mods","textStyle","fontFamily","fontSize","fontWeight","push","family","size","weight","undefined","color","letterSpacing","lineHeight","baseFontSize","Math","max","textAlign","hasPadding","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","all","horizontal","vertical","top","bottom","leading","trailing","width","height","alignment","frameAlignment","backgroundColor","borderWidth","borderColor","content","borderRadius","onPress","rectangle"],"mappings":"AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,YAAYC,WAAW,EACvBC,IAAI,EACJC,eAAe,EACfC,KAAK,EACLC,UAAUC,SAAS,EACnBC,OAAO,EACPC,WAAW,EACXC,sBAAsB,EACtBC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,OAAO,EACPC,MAAM,QAED,8BAA8B;AAGrC,
|
|
1
|
+
{"version":3,"sources":["universal/transformStyle.ios.ts"],"sourcesContent":[null],"names":["background","border","clipShape","contentShape","disabled","disabledMod","font","foregroundStyle","frame","hidden","hiddenMod","kerning","lineSpacing","multilineTextAlignment","onAppear","onDisappear","onTapGesture","opacity","padding","shapes","createUniversalLayoutModifier","omitUserOverridden","omitUserOverriddenDimensions","serializeUniversalDimensions","preservedSizingTypes","Set","FONT_WEIGHT_MAP","normal","bold","transformToModifiers","style","props","extraModifiers","options","mods","dimensions","componentName","fixedWidth","widthPoints","fixedHeight","heightPoints","textStyle","fontFamily","fontSize","fontWeight","push","family","size","weight","undefined","color","letterSpacing","lineHeight","baseFontSize","Math","max","textAlign","hasPadding","paddingHorizontal","paddingVertical","paddingTop","paddingBottom","paddingLeft","paddingRight","all","horizontal","vertical","top","bottom","leading","trailing","width","height","alignment","frameAlignment","universalLayoutModifier","backgroundColor","borderWidth","borderColor","content","borderRadius","onPress","rectangle"],"mappings":"AAAA,SACEA,UAAU,EACVC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,YAAYC,WAAW,EACvBC,IAAI,EACJC,eAAe,EACfC,KAAK,EACLC,UAAUC,SAAS,EACnBC,OAAO,EACPC,WAAW,EACXC,sBAAsB,EACtBC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,EACPC,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8C,eAAe;QAC5C;QAEA,iEAAiE;QACjE,IAAI9C,MAAM+C,WAAW,IAAI,QAAQ/C,MAAMgD,WAAW,IAAI,MAAM;YAC1D5C,KAAKW,IAAI,CAAC5C,OAAO;gBAAE8E,SAASjD,MAAMgD,WAAW;gBAAEP,OAAOzC,MAAM+C,WAAW;YAAC;QAC1E;QAEA,2DAA2D;QAC3D,IAAI/C,MAAMkD,YAAY,IAAI,MAAM;YAC9B9C,KAAKW,IAAI,CAAC3C,UAAU,oBAAoB4B,MAAMkD,YAAY;QAC5D;QAEA,UAAU;QACV,IAAIlD,MAAMb,OAAO,IAAI,MAAM;YACzBiB,KAAKW,IAAI,CAAC5B,QAAQa,MAAMb,OAAO;QACjC;IACF;IAEA,2EAA2E;IAC3E,8EAA8E;IAC9E,2EAA2E;IAC3E,8EAA8E;IAC9EiB,OAAOb,mBAAmBa,MAAMF,gBAAgBR;IAEhD,2EAA2E;IAC3E,2EAA2E;IAC3E,IAAIO,MAAMkD,OAAO,EAAE/C,KAAKW,IAAI,CAAC1C,aAAagB,OAAO+D,SAAS,KAAKlE,aAAae,MAAMkD,OAAO;IAEzF,YAAY;IACZ,IAAIlD,MAAMjB,QAAQ,EAAEoB,KAAKW,IAAI,CAAC/B,SAASiB,MAAMjB,QAAQ;IACrD,IAAIiB,MAAMhB,WAAW,EAAEmB,KAAKW,IAAI,CAAC9B,YAAYgB,MAAMhB,WAAW;IAE9D,WAAW;IACX,IAAIgB,MAAM3B,QAAQ,EAAE8B,KAAKW,IAAI,CAACxC,YAAY;IAC1C,IAAI0B,MAAMtB,MAAM,EAAEyB,KAAKW,IAAI,CAACnC,UAAU;IAEtC,mDAAmD;IACnD,IAAIsB,gBAAgBE,KAAKW,IAAI,IAAIb;IAEjC,OAAOE;AACT"}
|
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
import type { ViewStyle } from 'react-native';
|
|
2
2
|
import type { ModifierConfig } from '../types';
|
|
3
|
+
import type { UniversalDimension } from './modifierUtils';
|
|
4
|
+
export type { UniversalDimension } from './modifierUtils';
|
|
3
5
|
/**
|
|
4
6
|
* Subset of React Native `ViewStyle` that maps cleanly to both SwiftUI modifiers
|
|
5
7
|
* and Jetpack Compose modifiers. On web, passes through to React Native StyleSheet.
|
|
8
|
+
*
|
|
9
|
+
* `width` and `height` also accept a percentage of the parent, such as `'50%'`.
|
|
10
|
+
* On Android and iOS, a percentage resolves when the parent is a universal `Row`, `Column`,
|
|
11
|
+
* or `Host` with a size on that axis.
|
|
12
|
+
* A universal `ScrollView` resolves the cross axis only.
|
|
13
|
+
* The scroll axis stays unbounded.
|
|
14
|
+
* On web, the value is passed through to the view style.
|
|
15
|
+
* A Jetpack Compose `Row` or `Column`, or a SwiftUI stack, does not resolve it.
|
|
6
16
|
* @docsInline
|
|
7
17
|
*/
|
|
8
|
-
export type UniversalStyle = Pick<ViewStyle, 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'opacity'
|
|
18
|
+
export type UniversalStyle = Pick<ViewStyle, 'padding' | 'paddingHorizontal' | 'paddingVertical' | 'paddingTop' | 'paddingBottom' | 'paddingLeft' | 'paddingRight' | 'backgroundColor' | 'borderRadius' | 'borderWidth' | 'borderColor' | 'opacity'> & {
|
|
19
|
+
/**
|
|
20
|
+
* Fixed size in density-independent pixels, or a percentage of the parent's content width.
|
|
21
|
+
* On Android and iOS, percentages resolve when the parent is a universal `Row`, `Column`,
|
|
22
|
+
* `ScrollView`, or `Host` with a defined width.
|
|
23
|
+
* A horizontal `ScrollView` leaves width unbounded.
|
|
24
|
+
*/
|
|
25
|
+
width?: UniversalDimension;
|
|
26
|
+
/**
|
|
27
|
+
* Fixed size in density-independent pixels, or a percentage of the parent's content height.
|
|
28
|
+
* On Android and iOS, percentages resolve when the parent is a universal `Row`, `Column`,
|
|
29
|
+
* `ScrollView`, or `Host` with a defined height.
|
|
30
|
+
* A vertical `ScrollView` leaves height unbounded.
|
|
31
|
+
*/
|
|
32
|
+
height?: UniversalDimension;
|
|
33
|
+
};
|
|
9
34
|
/**
|
|
10
35
|
* Base props inherited by all universal components.
|
|
11
36
|
* @docsInline
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/types.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["universal/types.ts"],"sourcesContent":[null],"names":[],"mappings":"AA0IA;;;;;;;;;CASC,GACD,WAeE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["universal/webUtils.ts"],"sourcesContent":[null],"names":["processColor","unstable_createElement","createWebComponent","type","props","css","strings","values","reduce","acc","s","i","length","String","replace","trim","lightVariables","darkVariables","colors","background","foreground","red","primary","gray","durations","fast","base","slow","easings","standard","shadows","button","focus","input","globalCss","DEFAULT_PRIMARY_COLOR","srgbToLinear","c","Math","pow","linearToSrgb","hexToLch","hex","raw","body","Array","from","join","r","Number","parseInt","slice","g","b","l","cbrt","m","L","labA","labB","sqrt","atan2","lchToHex","chroma","hue","a","cos","sin","l_","m_","s_","bl","cl","max","min","round","map","x","toString","padStart","PRIMARY_STOPS","step","cMul","colorValueToHex","color","argb","generatePrimaryColorScale","C","H","scale","tgtL","newL","newC"],"mappings":"AACA,SACEA,YAAY,EACZC,sBAAsB,QAMjB,eAAe;AAetB,OAAO,MAAMC,qBACX,CAAwBC,OACxB,CAACC,QACCH,uBAAuBE,MAAMC,OAAO;AAExC,OAAO,MAAMC,MAAM,CAACC,SAA+B,GAAGC,SACpDD,QACGE,MAAM,CAAC,CAACC,KAAKC,GAAGC,IAAMF,MAAMC,IAAKC,CAAAA,IAAIJ,OAAOK,MAAM,GAAGC,OAAON,MAAM,CAACI,EAAE,IAAI,EAAC,GAAI,IAC9EG,OAAO,CAAC,QAAQ,KAChBC,IAAI,GAAG;AAEZ,MAAMC,iBAAiBX,GAAG,CAAC;;;;;;;;;;;;;;;;;AAiB3B,CAAC;AAED,MAAMY,gBAAgBZ,GAAG,CAAC;;;;;;;;;;;;;;;;;AAiB1B,CAAC;AAED,OAAO,MAAMa,SAAS;IACpBC,YAAY;IACZC,YAAY;IAEZC,KAAK;IAELC,SAAS;QACPF,YAAY;QACZ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;IACP;IAEAG,MAAM;QACJ,IAAI;QACJ,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;QACL,KAAK;IACP;AACF,EAAE;AAEF,OAAO,MAAMC,YAAY;IACvBC,MAAM;IACNC,MAAM;IACNC,MAAM;AACR,EAAE;AAEF,OAAO,MAAMC,UAAU;IACrBC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,UAAU;IACrBC,QAAQ;IACRC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,YAAY7B,GAAG,CAAC;;IAEzB,EAAEW,eAAe;;;;;MAKf,EAAEC,cAAc;;;;;IAKlB,
|
|
1
|
+
{"version":3,"sources":["universal/webUtils.ts"],"sourcesContent":[null],"names":["processColor","unstable_createElement","createWebComponent","type","props","css","strings","values","reduce","acc","s","i","length","String","replace","trim","lightVariables","darkVariables","colors","background","foreground","red","primary","gray","durations","fast","base","slow","easings","standard","shadows","button","focus","input","globalCss","DEFAULT_PRIMARY_COLOR","srgbToLinear","c","Math","pow","linearToSrgb","hexToLch","hex","raw","body","Array","from","join","r","Number","parseInt","slice","g","b","l","cbrt","m","L","labA","labB","sqrt","atan2","lchToHex","chroma","hue","a","cos","sin","l_","m_","s_","bl","cl","max","min","round","map","x","toString","padStart","PRIMARY_STOPS","step","cMul","colorValueToHex","color","argb","generatePrimaryColorScale","C","H","scale","tgtL","newL","newC"],"mappings":"AACA,SACEA,YAAY,EACZC,sBAAsB,Q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
71
|
@ViewBuilder
|
|
72
72
|
private func contentChildren() -> some View {
|
|
73
|
-
ForEach(props.children?.
|
|
73
|
+
ForEach(props.children?.withoutSlots() ?? [], id: \.id) { child in
|
|
74
74
|
let view: any View = child.childView
|
|
75
75
|
AnyView(view)
|
|
76
76
|
}
|
|
@@ -93,6 +93,15 @@ struct BottomSheetView: ExpoSwiftUI.View {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
@ViewBuilder
|
|
97
|
+
private var presentedContent: some View {
|
|
98
|
+
if let background = props.children?.slot("presentationBackground") {
|
|
99
|
+
sheetContent.presentationBackground { background }
|
|
100
|
+
} else {
|
|
101
|
+
sheetContent
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
96
105
|
@ViewBuilder
|
|
97
106
|
private var anchor: some View {
|
|
98
107
|
if let anchorView = props.children?.slot("anchor") {
|
|
@@ -107,7 +116,7 @@ struct BottomSheetView: ExpoSwiftUI.View {
|
|
|
107
116
|
.sheet(isPresented: $isPresented, onDismiss: {
|
|
108
117
|
props.onDismiss()
|
|
109
118
|
}) {
|
|
110
|
-
|
|
119
|
+
presentedContent
|
|
111
120
|
}
|
|
112
121
|
.onChange(of: isPresented, perform: { newIsPresented in
|
|
113
122
|
if props.isPresented == newIsPresented {
|