@expo/ui 0.2.0-alpha.2 → 0.2.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/android/build.gradle +2 -2
- package/build/swift-ui/modifiers/index.d.ts +12 -1
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.js +4 -0
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/Modifiers/ViewModifierRegistry.swift +67 -6
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.module} +7 -7
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +2 -2
- package/src/swift-ui/modifiers/index.ts +14 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.pom.sha512 +0 -1
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3-sources.jar} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.md5 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3-sources.jar.md5} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha1 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3-sources.jar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha256 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3-sources.jar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2-sources.jar.sha512 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3-sources.jar.sha512} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.aar} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.md5 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.aar.md5} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha1 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.aar.sha1} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha256 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.aar.sha256} +0 -0
- /package/local-maven-repo/expo/modules/ui/expo.modules.ui/{0.2.0-alpha.2/expo.modules.ui-0.2.0-alpha.2.aar.sha512 → 0.2.0-alpha.3/expo.modules.ui-0.2.0-alpha.3.aar.sha512} +0 -0
package/CHANGELOG.md
CHANGED
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 = '0.2.0-alpha.
|
|
15
|
+
version = '0.2.0-alpha.3'
|
|
16
16
|
|
|
17
17
|
android {
|
|
18
18
|
namespace "expo.modules.ui"
|
|
19
19
|
defaultConfig {
|
|
20
20
|
versionCode 1
|
|
21
|
-
versionName "0.2.0-alpha.
|
|
21
|
+
versionName "0.2.0-alpha.3"
|
|
22
22
|
}
|
|
23
23
|
buildFeatures {
|
|
24
24
|
compose true
|
|
@@ -226,11 +226,22 @@ export declare const aspectRatio: (params: {
|
|
|
226
226
|
* @param clipped - Whether to clip content
|
|
227
227
|
*/
|
|
228
228
|
export declare const clipped: (clipped?: boolean) => ModifierConfig;
|
|
229
|
+
/**
|
|
230
|
+
* Applies a glass effect to a view.
|
|
231
|
+
*/
|
|
232
|
+
export declare const glassEffect: (params?: {
|
|
233
|
+
glass?: {
|
|
234
|
+
variant: "regular" | "clear" | "identity";
|
|
235
|
+
interactive?: boolean;
|
|
236
|
+
tint?: string;
|
|
237
|
+
};
|
|
238
|
+
shape?: "circle" | "capsule" | "rectangle" | "ellipse";
|
|
239
|
+
}) => ModifierConfig;
|
|
229
240
|
/**
|
|
230
241
|
* Union type of all built-in modifier return types.
|
|
231
242
|
* This provides type safety for the modifiers array.
|
|
232
243
|
*/
|
|
233
|
-
export type BuiltInModifier = ReturnType<typeof background> | ReturnType<typeof cornerRadius> | ReturnType<typeof shadow> | ReturnType<typeof frame> | ReturnType<typeof padding> | ReturnType<typeof fixedSize> | ReturnType<typeof onTapGesture> | ReturnType<typeof onLongPressGesture> | ReturnType<typeof opacity> | ReturnType<typeof clipShape> | ReturnType<typeof border> | ReturnType<typeof scaleEffect> | ReturnType<typeof rotationEffect> | ReturnType<typeof offset> | ReturnType<typeof foregroundColor> | ReturnType<typeof tint> | ReturnType<typeof hidden> | ReturnType<typeof zIndex> | ReturnType<typeof blur> | ReturnType<typeof brightness> | ReturnType<typeof contrast> | ReturnType<typeof saturation> | ReturnType<typeof hueRotation> | ReturnType<typeof colorInvert> | ReturnType<typeof grayscale> | ReturnType<typeof accessibilityLabel> | ReturnType<typeof accessibilityHint> | ReturnType<typeof accessibilityValue> | ReturnType<typeof layoutPriority> | ReturnType<typeof mask> | ReturnType<typeof overlay> | ReturnType<typeof backgroundOverlay> | ReturnType<typeof aspectRatio> | ReturnType<typeof clipped>;
|
|
244
|
+
export type BuiltInModifier = ReturnType<typeof background> | ReturnType<typeof cornerRadius> | ReturnType<typeof shadow> | ReturnType<typeof frame> | ReturnType<typeof padding> | ReturnType<typeof fixedSize> | ReturnType<typeof onTapGesture> | ReturnType<typeof onLongPressGesture> | ReturnType<typeof opacity> | ReturnType<typeof clipShape> | ReturnType<typeof border> | ReturnType<typeof scaleEffect> | ReturnType<typeof rotationEffect> | ReturnType<typeof offset> | ReturnType<typeof foregroundColor> | ReturnType<typeof tint> | ReturnType<typeof hidden> | ReturnType<typeof zIndex> | ReturnType<typeof blur> | ReturnType<typeof brightness> | ReturnType<typeof contrast> | ReturnType<typeof saturation> | ReturnType<typeof hueRotation> | ReturnType<typeof colorInvert> | ReturnType<typeof grayscale> | ReturnType<typeof accessibilityLabel> | ReturnType<typeof accessibilityHint> | ReturnType<typeof accessibilityValue> | ReturnType<typeof layoutPriority> | ReturnType<typeof mask> | ReturnType<typeof overlay> | ReturnType<typeof backgroundOverlay> | ReturnType<typeof aspectRatio> | ReturnType<typeof clipped> | ReturnType<typeof glassEffect>;
|
|
234
245
|
/**
|
|
235
246
|
* Main ViewModifier type that supports both built-in and 3rd party modifiers.
|
|
236
247
|
* 3rd party modifiers should return ModifierConfig objects with their own type strings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/swift-ui/modifiers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACrC;AAED;;;GAGG;AACH,iBAAS,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,GAAG,cAAc,CAEtF;AAiBD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,mBAA4C,CAAC;AAErF;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,mBAA+C,CAAC;AAE3F;;GAEG;AACH,eAAO,MAAM,MAAM,GAAI,QAAQ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,mBACvD,CAAC;AAEnC;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,QAAQ;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EACN,QAAQ,GACR,SAAS,GACT,UAAU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UAAU,CAAC,OAAO,iBAAiB,CAAC,GACpC,UAAU,CAAC,OAAO,kBAAkB,CAAC,GACrC,UAAU,CAAC,OAAO,cAAc,CAAC,GACjC,UAAU,CAAC,OAAO,IAAI,CAAC,GACvB,UAAU,CAAC,OAAO,OAAO,CAAC,GAC1B,UAAU,CAAC,OAAO,iBAAiB,CAAC,GACpC,UAAU,CAAC,OAAO,WAAW,CAAC,GAC9B,UAAU,CAAC,OAAO,OAAO,CAAC,GAC1B,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,cAAc,CAAC;AAM5D;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,cAEhD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,OAAO,EAAE,KAAG,cAAc,EAEpE,CAAC"}
|
|
@@ -194,6 +194,10 @@ export const aspectRatio = (params) => createModifier('aspectRatio', params);
|
|
|
194
194
|
* @param clipped - Whether to clip content
|
|
195
195
|
*/
|
|
196
196
|
export const clipped = (clipped = true) => createModifier('clipped', { clipped });
|
|
197
|
+
/**
|
|
198
|
+
* Applies a glass effect to a view.
|
|
199
|
+
*/
|
|
200
|
+
export const glassEffect = (params) => createModifier('glassEffect', params);
|
|
197
201
|
// =============================================================================
|
|
198
202
|
// Utility Functions
|
|
199
203
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/swift-ui/modifiers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;GAGG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,SAA8B,EAAE;IACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;;GAEG;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gF;AAEhF;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAA2B,EAAE;IAChE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC;AACxF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAoB,EAAE;IACxE,OAAO,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["/**\n * Core modifier factory and type definitions for SwiftUI view modifiers.\n * This system allows both built-in and 3rd party modifiers to use the same API.\n */\n\n/**\n * Base interface for all view modifiers.\n * All modifiers must have a type field and can include arbitrary parameters.\n */\nexport interface ModifierConfig {\n $type: string;\n [key: string]: any;\n eventListener?: (args: any) => void;\n}\n\n/**\n * Factory function to create modifier configuration objects.\n * This is used internally by all modifier functions.\n */\nfunction createModifier(type: string, params: Record<string, any> = {}): ModifierConfig {\n return { $type: type, ...params };\n}\n\n/**\n * Creates a modifier with an event listener.\n */\nfunction createModifierWithEventListener(\n type: string,\n eventListener: (args: any) => void,\n params: Record<string, any> = {}\n): ModifierConfig {\n return { $type: type, ...params, eventListener };\n}\n\n// =============================================================================\n// Built-in Modifier Functions\n// =============================================================================\n\n/**\n * Sets the background of a view.\n * @param color - The background color (hex string, e.g., '#FF0000')\n */\nexport const background = (color: string) => createModifier('background', { color });\n\n/**\n * Applies corner radius to a view.\n * @param radius - The corner radius value\n */\nexport const cornerRadius = (radius: number) => createModifier('cornerRadius', { radius });\n\n/**\n * Adds a shadow to a view.\n */\nexport const shadow = (params: { radius: number; x?: number; y?: number; color?: string }) =>\n createModifier('shadow', params);\n\n/**\n * Sets the frame properties of a view.\n */\nexport const frame = (params: {\n width?: number;\n height?: number;\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n idealWidth?: number;\n idealHeight?: number;\n alignment?:\n | 'center'\n | 'leading'\n | 'trailing'\n | 'top'\n | 'bottom'\n | 'topLeading'\n | 'topTrailing'\n | 'bottomLeading'\n | 'bottomTrailing';\n}) => createModifier('frame', params);\n\n/**\n * Sets padding on a view.\n * Supports individual edges or shorthand properties.\n */\nexport const padding = (params: {\n top?: number;\n bottom?: number;\n leading?: number;\n trailing?: number;\n horizontal?: number;\n vertical?: number;\n all?: number;\n}) => createModifier('padding', params);\n\n/**\n * Controls fixed size behavior.\n * @param enabled - Whether the view should use its natural size\n */\nexport const fixedSize = (enabled: boolean = true) => createModifier('fixedSize', { enabled });\n\n/**\n * Adds a tap gesture recognizer.\n * @param handler - Function to call when tapped\n */\nexport const onTapGesture = (handler: () => void) =>\n createModifierWithEventListener('onTapGesture', handler);\n\n/**\n * Adds a long press gesture recognizer.\n * @param handler - Function to call when long pressed\n * @param minimumDuration - Minimum duration for long press (default: 0.5s)\n */\nexport const onLongPressGesture = (handler: () => void, minimumDuration?: number) =>\n createModifierWithEventListener('onLongPressGesture', handler, {\n minimumDuration: minimumDuration ?? 0.5,\n });\n\n// Note: Complex gesture modifiers like onDragGesture are not available\n// in the modifier system. Use component-level props instead.\n\n/**\n * Sets the opacity of a view.\n * @param value - Opacity value between 0 and 1\n */\nexport const opacity = (value: number) => createModifier('opacity', { value });\n\n/**\n * Clips the view to a specific shape.\n * @param shape - The clipping shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const clipShape = (\n shape: 'rectangle' | 'circle' | 'roundedRectangle',\n cornerRadius?: number\n) => createModifier('clipShape', { shape, cornerRadius });\n\n/**\n * Adds a border to a view.\n */\nexport const border = (params: { color: string; width?: number }) =>\n createModifier('border', params);\n\n/**\n * Applies scaling transformation.\n * @param scale - Scale factor (1.0 = normal size)\n */\nexport const scaleEffect = (scale: number) => createModifier('scaleEffect', { scale });\n\n/**\n * Applies rotation transformation.\n * @param angle - Rotation angle in degrees\n */\nexport const rotationEffect = (angle: number) => createModifier('rotationEffect', { angle });\n\n/**\n * Applies an offset (translation) to a view.\n */\nexport const offset = (params: { x?: number; y?: number }) => createModifier('offset', params);\n\n/**\n * Sets the foreground color/tint of a view.\n * @param color - The foreground color (hex string)\n */\nexport const foregroundColor = (color: string) => createModifier('foregroundColor', { color });\n\n/**\n * Sets the tint color of a view.\n * @param color - The tint color (hex string)\n */\nexport const tint = (color: string) => createModifier('tint', { color });\n\n/**\n * Hides or shows a view.\n * @param hidden - Whether the view should be hidden\n */\nexport const hidden = (hidden: boolean = true) => createModifier('hidden', { hidden });\n\n/**\n * Sets the z-index (display order) of a view.\n * @param index - The z-index value\n */\nexport const zIndex = (index: number) => createModifier('zIndex', { index });\n\n/**\n * Applies blur to a view.\n * @param radius - The blur radius\n */\nexport const blur = (radius: number) => createModifier('blur', { radius });\n\n/**\n * Adjusts the brightness of a view.\n * @param amount - Brightness adjustment (-1 to 1)\n */\nexport const brightness = (amount: number) => createModifier('brightness', { amount });\n\n/**\n * Adjusts the contrast of a view.\n * @param amount - Contrast multiplier (0 to infinity, 1 = normal)\n */\nexport const contrast = (amount: number) => createModifier('contrast', { amount });\n\n/**\n * Adjusts the saturation of a view.\n * @param amount - Saturation multiplier (0 to infinity, 1 = normal)\n */\nexport const saturation = (amount: number) => createModifier('saturation', { amount });\n\n/**\n * Applies a hue rotation to a view.\n * @param angle - Hue rotation angle in degrees\n */\nexport const hueRotation = (angle: number) => createModifier('hueRotation', { angle });\n\n/**\n * Inverts the colors of a view.\n * @param inverted - Whether to invert colors\n */\nexport const colorInvert = (inverted: boolean = true) =>\n createModifier('colorInvert', { inverted });\n\n/**\n * Makes a view grayscale.\n * @param amount - Grayscale amount (0 to 1)\n */\nexport const grayscale = (amount: number) => createModifier('grayscale', { amount });\n\n/**\n * Sets accessibility label for the view.\n * @param label - The accessibility label\n */\nexport const accessibilityLabel = (label: string) =>\n createModifier('accessibilityLabel', { label });\n\n/**\n * Sets accessibility hint for the view.\n * @param hint - The accessibility hint\n */\nexport const accessibilityHint = (hint: string) => createModifier('accessibilityHint', { hint });\n\n/**\n * Sets accessibility value for the view.\n * @param value - The accessibility value\n */\nexport const accessibilityValue = (value: string) =>\n createModifier('accessibilityValue', { value });\n\n/**\n * Sets layout priority for the view.\n * @param priority - Layout priority value\n */\nexport const layoutPriority = (priority: number) => createModifier('layoutPriority', { priority });\n\n/**\n * Applies a mask to the view.\n * @param shape - The masking shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const mask = (shape: 'rectangle' | 'circle' | 'roundedRectangle', cornerRadius?: number) =>\n createModifier('mask', { shape, cornerRadius });\n\n/**\n * Overlays another view on top.\n * @param color - Overlay color\n * @param alignment - Overlay alignment\n */\nexport const overlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('overlay', params);\n\n/**\n * Adds a background behind the view.\n * @param color - Background color\n * @param alignment - Background alignment\n */\nexport const backgroundOverlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('backgroundOverlay', params);\n\n/**\n * Sets aspect ratio constraint.\n * @param ratio - Width/height aspect ratio\n * @param contentMode - How content fits the aspect ratio\n */\nexport const aspectRatio = (params: { ratio: number; contentMode?: 'fit' | 'fill' }) =>\n createModifier('aspectRatio', params);\n\n/**\n * Clips content to bounds.\n * @param clipped - Whether to clip content\n */\nexport const clipped = (clipped: boolean = true) => createModifier('clipped', { clipped });\n\n// =============================================================================\n// Type Definitions\n// =============================================================================\n\n/**\n * Union type of all built-in modifier return types.\n * This provides type safety for the modifiers array.\n */\nexport type BuiltInModifier =\n | ReturnType<typeof background>\n | ReturnType<typeof cornerRadius>\n | ReturnType<typeof shadow>\n | ReturnType<typeof frame>\n | ReturnType<typeof padding>\n | ReturnType<typeof fixedSize>\n | ReturnType<typeof onTapGesture>\n | ReturnType<typeof onLongPressGesture>\n | ReturnType<typeof opacity>\n | ReturnType<typeof clipShape>\n | ReturnType<typeof border>\n | ReturnType<typeof scaleEffect>\n | ReturnType<typeof rotationEffect>\n | ReturnType<typeof offset>\n | ReturnType<typeof foregroundColor>\n | ReturnType<typeof tint>\n | ReturnType<typeof hidden>\n | ReturnType<typeof zIndex>\n | ReturnType<typeof blur>\n | ReturnType<typeof brightness>\n | ReturnType<typeof contrast>\n | ReturnType<typeof saturation>\n | ReturnType<typeof hueRotation>\n | ReturnType<typeof colorInvert>\n | ReturnType<typeof grayscale>\n | ReturnType<typeof accessibilityLabel>\n | ReturnType<typeof accessibilityHint>\n | ReturnType<typeof accessibilityValue>\n | ReturnType<typeof layoutPriority>\n | ReturnType<typeof mask>\n | ReturnType<typeof overlay>\n | ReturnType<typeof backgroundOverlay>\n | ReturnType<typeof aspectRatio>\n | ReturnType<typeof clipped>;\n\n/**\n * Main ViewModifier type that supports both built-in and 3rd party modifiers.\n * 3rd party modifiers should return ModifierConfig objects with their own type strings.\n */\nexport type ViewModifier = BuiltInModifier | ModifierConfig;\n\n// =============================================================================\n// Utility Functions\n// =============================================================================\n\n/**\n * Creates a custom modifier for 3rd party libraries.\n * This function is exported so 3rd party packages can create their own modifiers.\n *\n * @example\n * ```typescript\n * // In a 3rd party package\n * export const blurEffect = (params: { radius: number; style?: string }) =>\n * createModifier('blurEffect', params);\n * ```\n */\nexport { createModifier };\n\n/**\n * Type guard to check if a value is a valid modifier.\n */\nexport const isModifier = (value: any): value is ModifierConfig => {\n return typeof value === 'object' && value !== null && typeof value.$type === 'string';\n};\n\n/**\n * Filters an array to only include valid modifiers.\n */\nexport const filterModifiers = (modifiers: unknown[]): ModifierConfig[] => {\n return modifiers.filter(isModifier);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/swift-ui/modifiers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;GAGG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,SAA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AC,cAAc,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAE3F;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAO3B,EAAE,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;AAqD5C,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF;;;;;;;;;;GAUG;AACH,OAAO,EAAE,cAAc,EAAE,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAU,EAA2B,EAAE;IAChE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC;AACxF,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAoB,EAAE;IACxE,OAAO,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC,CAAC","sourcesContent":["/**\n * Core modifier factory and type definitions for SwiftUI view modifiers.\n * This system allows both built-in and 3rd party modifiers to use the same API.\n */\n\n/**\n * Base interface for all view modifiers.\n * All modifiers must have a type field and can include arbitrary parameters.\n */\nexport interface ModifierConfig {\n $type: string;\n [key: string]: any;\n eventListener?: (args: any) => void;\n}\n\n/**\n * Factory function to create modifier configuration objects.\n * This is used internally by all modifier functions.\n */\nfunction createModifier(type: string, params: Record<string, any> = {}): ModifierConfig {\n return { $type: type, ...params };\n}\n\n/**\n * Creates a modifier with an event listener.\n */\nfunction createModifierWithEventListener(\n type: string,\n eventListener: (args: any) => void,\n params: Record<string, any> = {}\n): ModifierConfig {\n return { $type: type, ...params, eventListener };\n}\n\n// =============================================================================\n// Built-in Modifier Functions\n// =============================================================================\n\n/**\n * Sets the background of a view.\n * @param color - The background color (hex string, e.g., '#FF0000')\n */\nexport const background = (color: string) => createModifier('background', { color });\n\n/**\n * Applies corner radius to a view.\n * @param radius - The corner radius value\n */\nexport const cornerRadius = (radius: number) => createModifier('cornerRadius', { radius });\n\n/**\n * Adds a shadow to a view.\n */\nexport const shadow = (params: { radius: number; x?: number; y?: number; color?: string }) =>\n createModifier('shadow', params);\n\n/**\n * Sets the frame properties of a view.\n */\nexport const frame = (params: {\n width?: number;\n height?: number;\n minWidth?: number;\n maxWidth?: number;\n minHeight?: number;\n maxHeight?: number;\n idealWidth?: number;\n idealHeight?: number;\n alignment?:\n | 'center'\n | 'leading'\n | 'trailing'\n | 'top'\n | 'bottom'\n | 'topLeading'\n | 'topTrailing'\n | 'bottomLeading'\n | 'bottomTrailing';\n}) => createModifier('frame', params);\n\n/**\n * Sets padding on a view.\n * Supports individual edges or shorthand properties.\n */\nexport const padding = (params: {\n top?: number;\n bottom?: number;\n leading?: number;\n trailing?: number;\n horizontal?: number;\n vertical?: number;\n all?: number;\n}) => createModifier('padding', params);\n\n/**\n * Controls fixed size behavior.\n * @param enabled - Whether the view should use its natural size\n */\nexport const fixedSize = (enabled: boolean = true) => createModifier('fixedSize', { enabled });\n\n/**\n * Adds a tap gesture recognizer.\n * @param handler - Function to call when tapped\n */\nexport const onTapGesture = (handler: () => void) =>\n createModifierWithEventListener('onTapGesture', handler);\n\n/**\n * Adds a long press gesture recognizer.\n * @param handler - Function to call when long pressed\n * @param minimumDuration - Minimum duration for long press (default: 0.5s)\n */\nexport const onLongPressGesture = (handler: () => void, minimumDuration?: number) =>\n createModifierWithEventListener('onLongPressGesture', handler, {\n minimumDuration: minimumDuration ?? 0.5,\n });\n\n// Note: Complex gesture modifiers like onDragGesture are not available\n// in the modifier system. Use component-level props instead.\n\n/**\n * Sets the opacity of a view.\n * @param value - Opacity value between 0 and 1\n */\nexport const opacity = (value: number) => createModifier('opacity', { value });\n\n/**\n * Clips the view to a specific shape.\n * @param shape - The clipping shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const clipShape = (\n shape: 'rectangle' | 'circle' | 'roundedRectangle',\n cornerRadius?: number\n) => createModifier('clipShape', { shape, cornerRadius });\n\n/**\n * Adds a border to a view.\n */\nexport const border = (params: { color: string; width?: number }) =>\n createModifier('border', params);\n\n/**\n * Applies scaling transformation.\n * @param scale - Scale factor (1.0 = normal size)\n */\nexport const scaleEffect = (scale: number) => createModifier('scaleEffect', { scale });\n\n/**\n * Applies rotation transformation.\n * @param angle - Rotation angle in degrees\n */\nexport const rotationEffect = (angle: number) => createModifier('rotationEffect', { angle });\n\n/**\n * Applies an offset (translation) to a view.\n */\nexport const offset = (params: { x?: number; y?: number }) => createModifier('offset', params);\n\n/**\n * Sets the foreground color/tint of a view.\n * @param color - The foreground color (hex string)\n */\nexport const foregroundColor = (color: string) => createModifier('foregroundColor', { color });\n\n/**\n * Sets the tint color of a view.\n * @param color - The tint color (hex string)\n */\nexport const tint = (color: string) => createModifier('tint', { color });\n\n/**\n * Hides or shows a view.\n * @param hidden - Whether the view should be hidden\n */\nexport const hidden = (hidden: boolean = true) => createModifier('hidden', { hidden });\n\n/**\n * Sets the z-index (display order) of a view.\n * @param index - The z-index value\n */\nexport const zIndex = (index: number) => createModifier('zIndex', { index });\n\n/**\n * Applies blur to a view.\n * @param radius - The blur radius\n */\nexport const blur = (radius: number) => createModifier('blur', { radius });\n\n/**\n * Adjusts the brightness of a view.\n * @param amount - Brightness adjustment (-1 to 1)\n */\nexport const brightness = (amount: number) => createModifier('brightness', { amount });\n\n/**\n * Adjusts the contrast of a view.\n * @param amount - Contrast multiplier (0 to infinity, 1 = normal)\n */\nexport const contrast = (amount: number) => createModifier('contrast', { amount });\n\n/**\n * Adjusts the saturation of a view.\n * @param amount - Saturation multiplier (0 to infinity, 1 = normal)\n */\nexport const saturation = (amount: number) => createModifier('saturation', { amount });\n\n/**\n * Applies a hue rotation to a view.\n * @param angle - Hue rotation angle in degrees\n */\nexport const hueRotation = (angle: number) => createModifier('hueRotation', { angle });\n\n/**\n * Inverts the colors of a view.\n * @param inverted - Whether to invert colors\n */\nexport const colorInvert = (inverted: boolean = true) =>\n createModifier('colorInvert', { inverted });\n\n/**\n * Makes a view grayscale.\n * @param amount - Grayscale amount (0 to 1)\n */\nexport const grayscale = (amount: number) => createModifier('grayscale', { amount });\n\n/**\n * Sets accessibility label for the view.\n * @param label - The accessibility label\n */\nexport const accessibilityLabel = (label: string) =>\n createModifier('accessibilityLabel', { label });\n\n/**\n * Sets accessibility hint for the view.\n * @param hint - The accessibility hint\n */\nexport const accessibilityHint = (hint: string) => createModifier('accessibilityHint', { hint });\n\n/**\n * Sets accessibility value for the view.\n * @param value - The accessibility value\n */\nexport const accessibilityValue = (value: string) =>\n createModifier('accessibilityValue', { value });\n\n/**\n * Sets layout priority for the view.\n * @param priority - Layout priority value\n */\nexport const layoutPriority = (priority: number) => createModifier('layoutPriority', { priority });\n\n/**\n * Applies a mask to the view.\n * @param shape - The masking shape\n * @param cornerRadius - Corner radius for rounded rectangle (default: 8)\n */\nexport const mask = (shape: 'rectangle' | 'circle' | 'roundedRectangle', cornerRadius?: number) =>\n createModifier('mask', { shape, cornerRadius });\n\n/**\n * Overlays another view on top.\n * @param color - Overlay color\n * @param alignment - Overlay alignment\n */\nexport const overlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('overlay', params);\n\n/**\n * Adds a background behind the view.\n * @param color - Background color\n * @param alignment - Background alignment\n */\nexport const backgroundOverlay = (params: {\n color?: string;\n alignment?: 'center' | 'top' | 'bottom' | 'leading' | 'trailing';\n}) => createModifier('backgroundOverlay', params);\n\n/**\n * Sets aspect ratio constraint.\n * @param ratio - Width/height aspect ratio\n * @param contentMode - How content fits the aspect ratio\n */\nexport const aspectRatio = (params: { ratio: number; contentMode?: 'fit' | 'fill' }) =>\n createModifier('aspectRatio', params);\n\n/**\n * Clips content to bounds.\n * @param clipped - Whether to clip content\n */\nexport const clipped = (clipped: boolean = true) => createModifier('clipped', { clipped });\n\n/**\n * Applies a glass effect to a view.\n */\nexport const glassEffect = (params?: {\n glass?: {\n variant: 'regular' | 'clear' | 'identity';\n interactive?: boolean;\n tint?: string;\n };\n shape?: 'circle' | 'capsule' | 'rectangle' | 'ellipse';\n}) => createModifier('glassEffect', params);\n\n// =============================================================================\n// Type Definitions\n// =============================================================================\n\n/**\n * Union type of all built-in modifier return types.\n * This provides type safety for the modifiers array.\n */\nexport type BuiltInModifier =\n | ReturnType<typeof background>\n | ReturnType<typeof cornerRadius>\n | ReturnType<typeof shadow>\n | ReturnType<typeof frame>\n | ReturnType<typeof padding>\n | ReturnType<typeof fixedSize>\n | ReturnType<typeof onTapGesture>\n | ReturnType<typeof onLongPressGesture>\n | ReturnType<typeof opacity>\n | ReturnType<typeof clipShape>\n | ReturnType<typeof border>\n | ReturnType<typeof scaleEffect>\n | ReturnType<typeof rotationEffect>\n | ReturnType<typeof offset>\n | ReturnType<typeof foregroundColor>\n | ReturnType<typeof tint>\n | ReturnType<typeof hidden>\n | ReturnType<typeof zIndex>\n | ReturnType<typeof blur>\n | ReturnType<typeof brightness>\n | ReturnType<typeof contrast>\n | ReturnType<typeof saturation>\n | ReturnType<typeof hueRotation>\n | ReturnType<typeof colorInvert>\n | ReturnType<typeof grayscale>\n | ReturnType<typeof accessibilityLabel>\n | ReturnType<typeof accessibilityHint>\n | ReturnType<typeof accessibilityValue>\n | ReturnType<typeof layoutPriority>\n | ReturnType<typeof mask>\n | ReturnType<typeof overlay>\n | ReturnType<typeof backgroundOverlay>\n | ReturnType<typeof aspectRatio>\n | ReturnType<typeof clipped>\n | ReturnType<typeof glassEffect>;\n\n/**\n * Main ViewModifier type that supports both built-in and 3rd party modifiers.\n * 3rd party modifiers should return ModifierConfig objects with their own type strings.\n */\nexport type ViewModifier = BuiltInModifier | ModifierConfig;\n\n// =============================================================================\n// Utility Functions\n// =============================================================================\n\n/**\n * Creates a custom modifier for 3rd party libraries.\n * This function is exported so 3rd party packages can create their own modifiers.\n *\n * @example\n * ```typescript\n * // In a 3rd party package\n * export const blurEffect = (params: { radius: number; style?: string }) =>\n * createModifier('blurEffect', params);\n * ```\n */\nexport { createModifier };\n\n/**\n * Type guard to check if a value is a valid modifier.\n */\nexport const isModifier = (value: any): value is ModifierConfig => {\n return typeof value === 'object' && value !== null && typeof value.$type === 'string';\n};\n\n/**\n * Filters an array to only include valid modifiers.\n */\nexport const filterModifiers = (modifiers: unknown[]): ModifierConfig[] => {\n return modifiers.filter(isModifier);\n};\n"]}
|
package/expo-module.config.json
CHANGED
|
@@ -212,14 +212,15 @@ internal struct ClipShapeModifier: ViewModifier {
|
|
|
212
212
|
let shape: String
|
|
213
213
|
let cornerRadius: CGFloat
|
|
214
214
|
|
|
215
|
+
@ViewBuilder
|
|
215
216
|
func body(content: Content) -> some View {
|
|
216
217
|
switch shape {
|
|
217
218
|
case "circle":
|
|
218
|
-
|
|
219
|
+
content.clipShape(Circle())
|
|
219
220
|
case "roundedRectangle":
|
|
220
|
-
|
|
221
|
+
content.clipShape(RoundedRectangle(cornerRadius: cornerRadius))
|
|
221
222
|
default:
|
|
222
|
-
|
|
223
|
+
content.clipShape(Rectangle())
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
226
|
}
|
|
@@ -322,14 +323,15 @@ internal struct MaskModifier: ViewModifier {
|
|
|
322
323
|
let shape: String
|
|
323
324
|
let cornerRadius: CGFloat
|
|
324
325
|
|
|
326
|
+
@ViewBuilder
|
|
325
327
|
func body(content: Content) -> some View {
|
|
326
328
|
switch shape {
|
|
327
329
|
case "circle":
|
|
328
|
-
|
|
330
|
+
content.mask(Circle())
|
|
329
331
|
case "roundedRectangle":
|
|
330
|
-
|
|
332
|
+
content.mask(RoundedRectangle(cornerRadius: cornerRadius))
|
|
331
333
|
default:
|
|
332
|
-
|
|
334
|
+
content.mask(Rectangle())
|
|
333
335
|
}
|
|
334
336
|
}
|
|
335
337
|
}
|
|
@@ -377,6 +379,50 @@ internal struct AnyViewModifier: ViewModifier {
|
|
|
377
379
|
}
|
|
378
380
|
}
|
|
379
381
|
|
|
382
|
+
internal struct GlassEffectModifier: ViewModifier {
|
|
383
|
+
let glassVariant: String
|
|
384
|
+
let interactive: Bool
|
|
385
|
+
let tint: Color?
|
|
386
|
+
let shape: String
|
|
387
|
+
|
|
388
|
+
@ViewBuilder
|
|
389
|
+
func body(content: Content) -> some View {
|
|
390
|
+
if #available(iOS 26.0, *) {
|
|
391
|
+
#if compiler(>=6.2) // Xcode 26
|
|
392
|
+
let glass = parseGlassVariant(glassVariant)
|
|
393
|
+
switch shape {
|
|
394
|
+
case "capsule":
|
|
395
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Capsule())
|
|
396
|
+
case "circle":
|
|
397
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Circle())
|
|
398
|
+
case "ellipse":
|
|
399
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Ellipse())
|
|
400
|
+
default:
|
|
401
|
+
content.glassEffect(glass.interactive(interactive).tint(tint), in: Rectangle())
|
|
402
|
+
}
|
|
403
|
+
#else
|
|
404
|
+
content
|
|
405
|
+
#endif
|
|
406
|
+
} else {
|
|
407
|
+
content
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
#if compiler(>=6.2) // Xcode 26
|
|
412
|
+
@available(iOS 26.0, *)
|
|
413
|
+
private func parseGlassVariant(_ glassString: String) -> Glass {
|
|
414
|
+
switch glassString {
|
|
415
|
+
case "regular":
|
|
416
|
+
return .regular
|
|
417
|
+
case "clear":
|
|
418
|
+
return .clear
|
|
419
|
+
default:
|
|
420
|
+
return .identity
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
#endif
|
|
424
|
+
}
|
|
425
|
+
|
|
380
426
|
// MARK: - Registry
|
|
381
427
|
|
|
382
428
|
/**
|
|
@@ -660,6 +706,21 @@ extension ViewModifierRegistry {
|
|
|
660
706
|
let alignment = parseAlignment(alignmentString)
|
|
661
707
|
return BackgroundOverlayModifier(color: color, alignment: alignment)
|
|
662
708
|
}
|
|
709
|
+
|
|
710
|
+
register("glassEffect") { params, _ in
|
|
711
|
+
let glassDict = params["glass"] as? [String: Any]
|
|
712
|
+
let glassVariant = glassDict?["variant"] as? String ?? "regular"
|
|
713
|
+
let interactive = glassDict?["interactive"] as? Bool ?? false
|
|
714
|
+
let tintColor = (glassDict?["tint"] as? String).map { Color(hex: $0) }
|
|
715
|
+
let shape = params["shape"] as? String ?? "capsule"
|
|
716
|
+
|
|
717
|
+
return GlassEffectModifier(
|
|
718
|
+
glassVariant: glassVariant,
|
|
719
|
+
interactive: interactive,
|
|
720
|
+
tint: tintColor,
|
|
721
|
+
shape: shape
|
|
722
|
+
)
|
|
723
|
+
}
|
|
663
724
|
}
|
|
664
725
|
}
|
|
665
726
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"component": {
|
|
4
4
|
"group": "expo.modules.ui",
|
|
5
5
|
"module": "expo.modules.ui",
|
|
6
|
-
"version": "0.2.0-alpha.
|
|
6
|
+
"version": "0.2.0-alpha.3",
|
|
7
7
|
"attributes": {
|
|
8
8
|
"org.gradle.status": "release"
|
|
9
9
|
}
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
{
|
|
27
|
-
"name": "expo.modules.ui-0.2.0-alpha.
|
|
28
|
-
"url": "expo.modules.ui-0.2.0-alpha.
|
|
27
|
+
"name": "expo.modules.ui-0.2.0-alpha.3.aar",
|
|
28
|
+
"url": "expo.modules.ui-0.2.0-alpha.3.aar",
|
|
29
29
|
"size": 290997,
|
|
30
30
|
"sha512": "384cd29a311455c4ae4cf149d310dcfe14a19327037155ed2d92caaa560f8dddb508848c5d53f4df052616c6a7ea375f7c71c65005b033059cbb2371347cc41c",
|
|
31
31
|
"sha256": "b1c1a4d274c028b10bac4f977b1cfb740b2b70099a3d5dda908d8672810ad77c",
|
|
@@ -102,8 +102,8 @@
|
|
|
102
102
|
],
|
|
103
103
|
"files": [
|
|
104
104
|
{
|
|
105
|
-
"name": "expo.modules.ui-0.2.0-alpha.
|
|
106
|
-
"url": "expo.modules.ui-0.2.0-alpha.
|
|
105
|
+
"name": "expo.modules.ui-0.2.0-alpha.3.aar",
|
|
106
|
+
"url": "expo.modules.ui-0.2.0-alpha.3.aar",
|
|
107
107
|
"size": 290997,
|
|
108
108
|
"sha512": "384cd29a311455c4ae4cf149d310dcfe14a19327037155ed2d92caaa560f8dddb508848c5d53f4df052616c6a7ea375f7c71c65005b033059cbb2371347cc41c",
|
|
109
109
|
"sha256": "b1c1a4d274c028b10bac4f977b1cfb740b2b70099a3d5dda908d8672810ad77c",
|
|
@@ -122,8 +122,8 @@
|
|
|
122
122
|
},
|
|
123
123
|
"files": [
|
|
124
124
|
{
|
|
125
|
-
"name": "expo.modules.ui-0.2.0-alpha.
|
|
126
|
-
"url": "expo.modules.ui-0.2.0-alpha.
|
|
125
|
+
"name": "expo.modules.ui-0.2.0-alpha.3-sources.jar",
|
|
126
|
+
"url": "expo.modules.ui-0.2.0-alpha.3-sources.jar",
|
|
127
127
|
"size": 18894,
|
|
128
128
|
"sha512": "b6fd029855da3e7ceb97e20cf9dbcbf73f0b81342a24eb9e1988d7d05734fb038080702280129e643d1acab4b1ca0d9d2147d54f64906f6824659640bcc12b46",
|
|
129
129
|
"sha256": "ab99988e09f8bda506deaa7eded3b45bfa56f444c6f55c78d7814cfb6c40918b",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
160a8be1d9b7c16d273c2a94ef82ad73
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f3bf7ecbf4089cada8248bc4e23e0c9373716b30
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
a8f89346d1afa52401402b234e4f77bd524d59cb2e4d407f9b97aa83aaee7766
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
48004666e3327e461cbfec3c00d2167481a58d094b596250bddf17c83c5c89aa770f5f5298a7a5bc2a9334a02de9b9e476fcf8ee438631e62b23063cbb15d084
|
|
@@ -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>0.2.0-alpha.
|
|
12
|
+
<version>0.2.0-alpha.3</version>
|
|
13
13
|
<packaging>aar</packaging>
|
|
14
14
|
<name>expo.modules.ui</name>
|
|
15
15
|
<url>https://github.com/expo/expo</url>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ec14bce67d5450cb6ce1925b8d1edba7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
f9bf22b7e3c23218121b0ec61f26235404599b49
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
7631a8a8ba7f27b847169207fb6a890e66aebc551d997e0a32f8df1a751bacb5
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
607b89f1a509d61b0a34f8978272056cc473d3e3c82180d0a300229f2044dfa7cc41fb8f3e58059dddece34bde1d861a13fc6c6e2e23dce0b1284fd7336e1233
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
<groupId>expo.modules.ui</groupId>
|
|
4
4
|
<artifactId>expo.modules.ui</artifactId>
|
|
5
5
|
<versioning>
|
|
6
|
-
<latest>0.2.0-alpha.
|
|
7
|
-
<release>0.2.0-alpha.
|
|
6
|
+
<latest>0.2.0-alpha.3</latest>
|
|
7
|
+
<release>0.2.0-alpha.3</release>
|
|
8
8
|
<versions>
|
|
9
|
-
<version>0.2.0-alpha.
|
|
9
|
+
<version>0.2.0-alpha.3</version>
|
|
10
10
|
</versions>
|
|
11
|
-
<lastUpdated>
|
|
11
|
+
<lastUpdated>20250818203954</lastUpdated>
|
|
12
12
|
</versioning>
|
|
13
13
|
</metadata>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
b10000438b4098ae66464fe8c9e1579d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
be101bfdb245d831419320a6931cd3ab45b78dff
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
472774cc556f8635ef56b3a381cdba7c8448e55ce4681e972e0551a0d4b7c79d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4eccc3d5410c3bd09bf4fd292c2917017808d938987f2672ba77ff4a2267db256c7693a0281e7f5e0b19b8cd4c8f9dca63e64cefeff1d6abd9aeda9d0bb3f306
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/ui",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.3",
|
|
4
4
|
"description": "A collection of UI components",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "expo-module build",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"react": "*",
|
|
35
35
|
"react-native": "*"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "475cdabd3faad56f0e8c4abcaaf21140c01c094f"
|
|
38
38
|
}
|
|
@@ -292,6 +292,18 @@ export const aspectRatio = (params: { ratio: number; contentMode?: 'fit' | 'fill
|
|
|
292
292
|
*/
|
|
293
293
|
export const clipped = (clipped: boolean = true) => createModifier('clipped', { clipped });
|
|
294
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Applies a glass effect to a view.
|
|
297
|
+
*/
|
|
298
|
+
export const glassEffect = (params?: {
|
|
299
|
+
glass?: {
|
|
300
|
+
variant: 'regular' | 'clear' | 'identity';
|
|
301
|
+
interactive?: boolean;
|
|
302
|
+
tint?: string;
|
|
303
|
+
};
|
|
304
|
+
shape?: 'circle' | 'capsule' | 'rectangle' | 'ellipse';
|
|
305
|
+
}) => createModifier('glassEffect', params);
|
|
306
|
+
|
|
295
307
|
// =============================================================================
|
|
296
308
|
// Type Definitions
|
|
297
309
|
// =============================================================================
|
|
@@ -334,7 +346,8 @@ export type BuiltInModifier =
|
|
|
334
346
|
| ReturnType<typeof overlay>
|
|
335
347
|
| ReturnType<typeof backgroundOverlay>
|
|
336
348
|
| ReturnType<typeof aspectRatio>
|
|
337
|
-
| ReturnType<typeof clipped
|
|
349
|
+
| ReturnType<typeof clipped>
|
|
350
|
+
| ReturnType<typeof glassEffect>;
|
|
338
351
|
|
|
339
352
|
/**
|
|
340
353
|
* Main ViewModifier type that supports both built-in and 3rd party modifiers.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ebd622454b8774b1d8ab9e5e13faef28
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
72cb5c3cd1ca2c656fd9f9c5a82e39e076b998e6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
51b8e44c8de591afb564cca40096f2923a77c03577e8aa204aa187d6dd871aa8
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
acd769c1604cc8b0ef715b2f02991e2a52a6157f5c1c101092bcbb9baadb42ffba7963415b68a9716e0274e12cec59481b8436e795f1e7d9ee11af7b3adfa523
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
732bab5d7fc9465e34d27e82c59951f5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
99c4b297650ecd03d9207c8380a537e1e9fea2fd
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1dfbdb4e571d7f6434abdca55138ea887a886e1c8c6df3ab1bedb0a576f02551
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0b1ca33275c23c58e10e53cfdb637b81b1cc07d9daa34d0def0ec3b2d2e4f3cb92688325ecee2c9d9afb45575d71bdf1faaa65d69dca03140004d5f52bedd7f9
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|