expo-android-glass-view 1.0.1 → 1.0.2

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2 — 2026-10-18
4
+
5
+ ### Fixed
6
+
7
+ - **1.0.1 crashed on Android when a menu opened or closed** (`UnsupportedOperationException:
8
+ Only CornerBasedShape is supported in lens effects`): it handed the menu's drop-shaped
9
+ silhouette to the glass lens, which only accepts rounded rectangles. The glass is drawn
10
+ exactly as in 1.0.0 again. The drop shadow is now a separate layer behind it, with the
11
+ same position, size, scale and fade, so it stays visible without touching the glass.
12
+ Do not use 1.0.1.
13
+
14
+ ### Compatibility
15
+
16
+ - Rebuild the Android app or development client; this is a native change.
17
+
3
18
  ## 1.0.1 — 2026-10-18
4
19
 
5
20
  ### Fixed
@@ -36,7 +36,9 @@ import expo.modules.androidglassview.backdrop.effects.lens
36
36
  import expo.modules.androidglassview.backdrop.effects.vibrancy
37
37
  import expo.modules.androidglassview.backdrop.highlight.Highlight
38
38
  import expo.modules.androidglassview.backdrop.isRenderEffectSupported
39
+ import expo.modules.androidglassview.backdrop.internal.ShapeProvider
39
40
  import expo.modules.androidglassview.backdrop.shadow.Shadow
41
+ import expo.modules.androidglassview.backdrop.shadow.ShadowElement
40
42
  import expo.modules.kotlin.AppContext
41
43
  import expo.modules.kotlin.viewevent.EventDispatcher
42
44
  import org.json.JSONArray
@@ -334,27 +336,35 @@ class AndroidGlassMenuPanel(context: Context, appContext: AppContext) : GlassHos
334
336
  val localRadius = radius / effectScale
335
337
  val shape = RoundedCornerShape(localRadius.coerceAtLeast(0f).dp)
336
338
  val silhouette = if (neck > .001f) MenuDropShape(localRadius.dp, neck) else shape
337
- Box(Modifier.offset {
339
+ val placement = Modifier.offset {
338
340
  IntOffset(with(density) { (x + width * (1f - stretchX) + dragX * 7f * (1f - verticalPull).coerceAtLeast(0f)).dp.toPx() }.roundToInt(),
339
341
  with(density) { (y + dragY * 8f).dp.toPx() }.roundToInt())
340
342
  }
341
343
  .requiredSize((if(fixedLayer) layoutWidth else width).coerceAtLeast(1f).dp,
342
344
  (if(fixedLayer) layoutHeight else height).coerceAtLeast(1f).dp)
343
- // The backdrop node clips itself to the silhouette. The outer layer only
344
- // scales and fades: it wraps the drop shadow, so clipping it there cut the
345
- // shadow off entirely (shadow/shadowOpacity had no visible effect).
346
- .drawBackdrop(backdrop = backdrop, shape = { silhouette }, clipToShape = true, layerBlock = {
345
+ val dropShadow: () -> Shadow? = {
346
+ if (!shadowEnabled) null else menuGlass.dropShadow.let { base ->
347
+ shadowOpacity?.let { base.copy(color = base.color.copy(alpha = it)) } ?: base
348
+ }
349
+ }
350
+ // The drop shadow is its own layer behind the glass. The glass layer below is
351
+ // clipped to the menu silhouette, so a shadow drawn inside it was cut off and
352
+ // never visible. This layer takes the same position, size, scale and fade, and
353
+ // ShadowNode masks the shape's interior, so only the outside is shaded.
354
+ Box(placement.graphicsLayer {
355
+ transformOrigin = TransformOrigin(0f,0f)
356
+ this.scaleX = surfaceScaleX; this.scaleY = surfaceScaleY
357
+ this.alpha = overallAlpha
358
+ }.then(ShadowElement(ShapeProvider { silhouette }, dropShadow)))
359
+ Box(placement
360
+ .drawBackdrop(backdrop = backdrop, shape = { shape }, clipToShape = false, layerBlock = {
347
361
  transformOrigin = TransformOrigin(0f,0f)
348
362
  this.scaleX = surfaceScaleX; this.scaleY = surfaceScaleY
349
- this.alpha = overallAlpha
363
+ this.alpha = overallAlpha; this.shape = silhouette; clip = true
350
364
  }, effects = {
351
365
  glassEffects(menuGlass, effectScale, material, press)
352
366
  }, highlight = { menuGlass.rim.copy(alpha = menuGlass.rim.alpha + press * .25f) },
353
- shadow = {
354
- if (!shadowEnabled) null else menuGlass.dropShadow.let { base ->
355
- shadowOpacity?.let { base.copy(color = base.color.copy(alpha = it)) } ?: base
356
- }
357
- },
367
+ shadow = null,
358
368
  onDrawSurface = { glassSurface(menuGlass, effectsSupported) }
359
369
  )
360
370
  .then(scrubbing)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-android-glass-view",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Liquid Glass views, buttons, sliders and toggles for React Native on Android (Jetpack Compose, powered by Kyant0/AndroidLiquidGlass)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",