expo-android-glass-view 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +45 -25
  2. package/README.md +222 -45
  3. package/android/build.gradle +2 -5
  4. package/android/src/main/java/expo/modules/androidglassview/AndroidGlassBottomTabs.kt +3 -0
  5. package/android/src/main/java/expo/modules/androidglassview/AndroidGlassMenuPanel.kt +414 -0
  6. package/android/src/main/java/expo/modules/androidglassview/AndroidGlassView.kt +1 -1
  7. package/android/src/main/java/expo/modules/androidglassview/ExpoAndroidGlassViewModule.kt +77 -11
  8. package/android/src/main/java/expo/modules/androidglassview/GlassHostView.kt +17 -11
  9. package/android/src/main/java/expo/modules/androidglassview/GlassSurface.kt +68 -24
  10. package/android/src/main/java/expo/modules/androidglassview/MenuDropShape.kt +51 -0
  11. package/android/src/main/java/expo/modules/androidglassview/MenuIcons.kt +58 -0
  12. package/android/src/main/java/expo/modules/androidglassview/MenuLens.kt +36 -0
  13. package/android/src/main/java/expo/modules/androidglassview/MenuMotion.kt +72 -0
  14. package/android/src/main/java/expo/modules/androidglassview/ViewBackdrop.kt +0 -8
  15. package/android/src/main/java/expo/modules/androidglassview/backdrop/DrawBackdropModifier.kt +21 -9
  16. package/android/src/main/java/expo/modules/androidglassview/backdrop/effects/LinearBlur.kt +47 -0
  17. package/android/src/main/java/expo/modules/androidglassview/backdrop/highlight/HighlightModifier.kt +24 -46
  18. package/android/src/main/java/expo/modules/androidglassview/backdrop/shadow/InnerShadowModifier.kt +12 -33
  19. package/android/src/main/java/expo/modules/androidglassview/backdrop/shadow/ShadowModifier.kt +16 -42
  20. package/android/src/main/java/expo/modules/androidglassview/capture/ViewBackdropCapture.kt +9 -227
  21. package/android/src/main/java/expo/modules/androidglassview/components/LiquidBottomTabs.kt +23 -28
  22. package/android/src/main/java/expo/modules/androidglassview/components/LiquidButton.kt +2 -2
  23. package/build/AndroidGlassBottomTabs.android.d.ts +1 -1
  24. package/build/AndroidGlassBottomTabs.android.d.ts.map +1 -1
  25. package/build/AndroidGlassBottomTabs.android.js +6 -2
  26. package/build/AndroidGlassBottomTabs.android.js.map +1 -1
  27. package/build/AndroidGlassBottomTabs.d.ts +1 -1
  28. package/build/AndroidGlassBottomTabs.d.ts.map +1 -1
  29. package/build/AndroidGlassBottomTabs.js +16 -3
  30. package/build/AndroidGlassBottomTabs.js.map +1 -1
  31. package/build/AndroidGlassButton.android.d.ts +1 -1
  32. package/build/AndroidGlassButton.android.d.ts.map +1 -1
  33. package/build/AndroidGlassButton.android.js +7 -3
  34. package/build/AndroidGlassButton.android.js.map +1 -1
  35. package/build/AndroidGlassButton.d.ts +1 -1
  36. package/build/AndroidGlassButton.d.ts.map +1 -1
  37. package/build/AndroidGlassButton.js +10 -3
  38. package/build/AndroidGlassButton.js.map +1 -1
  39. package/build/AndroidGlassComponents.types.d.ts +10 -3
  40. package/build/AndroidGlassComponents.types.d.ts.map +1 -1
  41. package/build/AndroidGlassComponents.types.js.map +1 -1
  42. package/build/AndroidGlassMenu.d.ts +9 -0
  43. package/build/AndroidGlassMenu.d.ts.map +1 -0
  44. package/build/AndroidGlassMenu.js +186 -0
  45. package/build/AndroidGlassMenu.js.map +1 -0
  46. package/build/AndroidGlassMenu.types.d.ts +70 -0
  47. package/build/AndroidGlassMenu.types.d.ts.map +1 -0
  48. package/build/AndroidGlassMenu.types.js +2 -0
  49. package/build/AndroidGlassMenu.types.js.map +1 -0
  50. package/build/AndroidGlassView.d.ts +1 -1
  51. package/build/AndroidGlassView.d.ts.map +1 -1
  52. package/build/AndroidGlassView.js +2 -2
  53. package/build/AndroidGlassView.js.map +1 -1
  54. package/build/AndroidGlassView.types.d.ts +11 -4
  55. package/build/AndroidGlassView.types.d.ts.map +1 -1
  56. package/build/AndroidGlassView.types.js.map +1 -1
  57. package/build/GlassMenuPanel.android.d.ts +3 -0
  58. package/build/GlassMenuPanel.android.d.ts.map +1 -0
  59. package/build/GlassMenuPanel.android.js +20 -0
  60. package/build/GlassMenuPanel.android.js.map +1 -0
  61. package/build/GlassMenuPanel.d.ts +3 -0
  62. package/build/GlassMenuPanel.d.ts.map +1 -0
  63. package/build/GlassMenuPanel.js +71 -0
  64. package/build/GlassMenuPanel.js.map +1 -0
  65. package/build/index.d.ts +2 -0
  66. package/build/index.d.ts.map +1 -1
  67. package/build/index.js +1 -0
  68. package/build/index.js.map +1 -1
  69. package/build/menuLayout.d.ts +19 -0
  70. package/build/menuLayout.d.ts.map +1 -0
  71. package/build/menuLayout.js +28 -0
  72. package/build/menuLayout.js.map +1 -0
  73. package/internal/jest-unit.config.cjs +10 -0
  74. package/package.json +4 -3
  75. package/src/AndroidGlassBottomTabs.android.tsx +22 -2
  76. package/src/AndroidGlassBottomTabs.tsx +31 -2
  77. package/src/AndroidGlassButton.android.tsx +8 -1
  78. package/src/AndroidGlassButton.tsx +13 -2
  79. package/src/AndroidGlassComponents.types.ts +10 -3
  80. package/src/AndroidGlassMenu.tsx +272 -0
  81. package/src/AndroidGlassMenu.types.ts +78 -0
  82. package/src/AndroidGlassView.tsx +3 -1
  83. package/src/AndroidGlassView.types.ts +12 -4
  84. package/src/GlassMenuPanel.android.tsx +61 -0
  85. package/src/GlassMenuPanel.tsx +105 -0
  86. package/src/index.ts +2 -0
  87. package/src/menuLayout.ts +59 -0
  88. package/tsconfig.json +6 -21
package/CHANGELOG.md CHANGED
@@ -1,41 +1,61 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.7 — 2026-09-13
3
+ ## 0.1.10 — 2026-09-15
4
4
 
5
- - Fix: refresh glass backdrops when navigation replaces children in an inline-drawn container,
6
- or changes their visibility or drawing order. Tab bars no longer keep references to detached
7
- screens. Manually applied transforms and alpha are tracked too, including drawer movement.
8
- All glass components share this fix; referenced lists still scroll without re-capturing.
9
- - `captureRevision` is now 4. Consumer apps need a native rebuild to receive this fix.
5
+ ### Added
10
6
 
11
- ## 0.1.6 — 2026-09-12
7
+ - Optional `blurGradient="top-to-bottom"` on View, Button and BottomTabs: a spatial Gaussian
8
+ blur that decreases linearly to zero at the bottom on Android 13+. Omission keeps uniform
9
+ blur; Android 12 falls back to uniform blur and older platforms retain plain surfaces.
12
10
 
13
- - Fix: 0.1.4 and 0.1.5 were published without their compiled JavaScript (`build/`), so Metro
14
- failed with `Unable to resolve "expo-android-glass-view"`. The native code is the same as in
15
- 0.1.5: an app whose native build already has 0.1.5 only needs the new JavaScript, no rebuild.
16
- - `prepare` now fails when TypeScript emits nothing, so a package without its JavaScript can't be
17
- published again.
11
+ - `AndroidGlassMenu` and `AndroidGlassMenuProvider`: anchored, same-window glass menus with
12
+ nested items, checkmarks, icons, separators, disabled/destructive actions and actions that
13
+ keep the menu open. Includes safe-area positioning, overlap/below placement, Android Back
14
+ handling, long-menu scrolling and plain iOS/web fallbacks.
15
+ - Custom interactive React menu content through `children` and optional `contentHeight`.
16
+ Children replace native rows, scroll within the panel and follow the opening/closing morph.
17
+ - Optional `theme="light" | "dark"` on View, Button, Menu and BottomTabs, with light/dark
18
+ material responses tuned against iOS references. Button, Menu and BottomTabs default to light.
19
+ - Optional BottomTabs glass props: `cornerRadius`, `blurRadius`, `refractionHeight`,
20
+ `refractionAmount`, `chromaticAberration`, `depthEffect`, `vibrancy`, `highlight`, `shadow`,
21
+ `tintColor`, `surfaceColor` and `fallbackColor`. They configure the bar surface; the selection
22
+ droplet keeps its own optics. Removing overrides restores the defaults.
23
+ - Optional BottomTabs `opacity` prop (0–1), affecting the entire bar including icons and labels.
24
+ When supplied it overrides `style.opacity`; existing styles continue to work when omitted.
18
25
 
19
- ## 0.1.5 — 2026-09-12
26
+ ### Changed
20
27
 
21
- - Performance: a glass view's capture leaves out everything that cannot reach it. Before, an
22
- animation anywhere on screen made every glass view re-render its blur and refraction on every
23
- frame; now only the glass views it can be seen through do. On a screen with 17 glass views over
24
- an animated backdrop (Helio G99, release build) this took the frame rate from about 20 to about
25
- 70 fps. A left-out view that moves, resizes or scrolls triggers a new capture.
28
+ - Menu opening/closing morphs, finger-following deformation and release springs, animated
29
+ row-snapped highlights, and submenu headers that animate into position. The backdrop stays
30
+ anchored to screen coordinates throughout the morph.
31
+ - Button convenience labels follow the selected theme. Custom React text remains caller-styled.
26
32
 
27
- - Performance: scrolling no longer re-captures every glass view in the window. A glass view
28
- captures again only when a container whose scroll offset its capture baked in has scrolled;
29
- lists it merely references (e.g. a screen's list under a tab bar) scroll live for free.
30
- - Performance: the drop shadow, inner shadow and rim highlight are only re-recorded when their
31
- shape or parameters change (not when they fade, and not on every redraw), and are skipped at
32
- zero alpha.
33
+ ### Fixed
34
+
35
+ - Opening or closing a menu no longer rebuilds the provider's native content wrapper, which
36
+ could leave the menu and tab bar sampling an empty backdrop until the next scroll.
37
+ - Dark menu appearance now applies to the native background as well as its text.
38
+ - Menu highlights stay on selectable rows instead of appearing in gaps or panel padding.
39
+ - Touches and scrolling inside custom React menu content no longer dismiss the panel.
40
+
41
+ ### Compatibility
42
+
43
+ - GlassView without `theme` retains its original untinted material: blur 2 dp, refraction
44
+ height/amount 12/24 dp and vibrancy enabled. Explicit themes use 9 dp, 2/3 dp and vibrancy off.
45
+ - Toggle and Slider do not receive a theme prop and keep their existing appearance.
46
+ - Rebuild the native application to use the new menu and BottomTabs props; a JS-only update
47
+ does not add these native capabilities.
48
+
49
+ ## 0.1.9 — 2026-09-14
50
+
51
+ - Republish the 0.1.3 implementation with the updated README and npm-compatible demo image URLs.
52
+ - No runtime changes from 0.1.3; supersedes the 0.1.4–0.1.8 publications.
33
53
 
34
54
  ## 0.1.3 — 2026-09-11
35
55
 
36
56
  - Fix a crash when navigating to or from a screen that has a glass view (Expo Router and React
37
57
  Navigation on react-native-screens): `IllegalStateException: Cannot locate windowRecomposer … is
38
- not attached to a window`. React Native measures views that are not attached to the window —
58
+ not attached to a window`. React Native measures views that are not attached to the window —
39
59
  a pushed screen or a tab opened for the first time, before react-native-screens attaches it, or
40
60
  a screen it has detached — and measuring the glass layer there made Compose look for the
41
61
  window. The glass layer is now skipped while detached and sized when it attaches.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  <p align="center">
2
- <img src=".github/assets/hero.png" alt="Liquid Glass — expo-android-glass-view" width="1040" />
2
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/5a563ac/.github/assets/hero.png" alt="Liquid Glass — expo-android-glass-view" width="1040" />
3
3
  </p>
4
4
 
5
- #
5
+ # expo-android-glass-view
6
6
 
7
7
  Liquid Glass for React Native on **Android**: real refraction, blur, vibrancy and rim
8
8
  highlights behind any React content, rendered with Jetpack Compose — plus ready-made glass
9
- buttons, toggles, sliders and a bottom tab bar.
9
+ buttons, toggles, sliders, a bottom tab bar and anchored menus.
10
10
 
11
11
  The glass effects and the components come from
12
12
  [Kyant0/AndroidLiquidGlass](https://github.com/Kyant0/AndroidLiquidGlass). The part that lets
@@ -27,14 +27,21 @@ import {
27
27
  AndroidGlassSlider,
28
28
  AndroidGlassBottomTabs,
29
29
  AndroidGlassTab,
30
+ AndroidGlassMenu,
31
+ AndroidGlassMenuProvider,
30
32
  MinimizeOnScrollProvider,
31
33
  useMinimizeOnScrollHandler,
32
34
  useMinimizeOnScroll,
33
35
  } from 'expo-android-glass-view';
34
36
  ```
35
37
 
36
- No wrapper or provider is needed: every glass component samples whatever is drawn behind it in
37
- the same window, and keeps up with scrolling lists, animations and layout changes.
38
+ Glass components sample what is drawn behind them in the same window, keeping up with
39
+ scrolling lists, animations and layout changes. View, Button, Toggle, Slider and BottomTabs
40
+ need no provider. Menus require `AndroidGlassMenuProvider` above the navigator.
41
+
42
+ Version **0.1.10** adds anchored menus with custom React content, optional light/dark materials,
43
+ and configurable tab bar glass effects.
44
+ See [CHANGELOG.md](./CHANGELOG.md) for the release notes.
38
45
 
39
46
  ## Platforms
40
47
 
@@ -57,6 +64,9 @@ npx expo run:android
57
64
 
58
65
  For bare React Native apps, [install Expo Modules](https://docs.expo.dev/bare/installing-expo-modules/) first.
59
66
 
67
+ When upgrading to 0.1.10, rebuild your native app or development client. The new menu and
68
+ BottomTabs props require the matching native binary; updating JavaScript alone is insufficient.
69
+
60
70
  ## `AndroidGlassView`
61
71
 
62
72
  A container: children render on top of the glass and stay fully interactive.
@@ -67,24 +77,26 @@ A container: children render on top of the glass and stay fully interactive.
67
77
  </AndroidGlassView>
68
78
  ```
69
79
 
70
- <img src=".github/assets/glasses.gif" alt="AndroidGlassView with different props: default, frosted, lens, prism, tint, no shadow" width="480" />
80
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/5a563ac/.github/assets/glasses.gif" alt="AndroidGlassView with different props: default, frosted, lens, prism, tint, no shadow" width="480" />
71
81
 
72
82
  Accepts every `View` prop plus:
73
83
 
74
- | Prop | Type | Default | Description |
75
- | --------------------- | ------------ | ------------------------------- | ------------------------------------------------------------------------------------- |
76
- | `cornerRadius` | `number` | `style.borderRadius`, else `24` | Corner radius of the glass shape in dp. Use a large value (e.g. `999`) for a capsule. |
77
- | `blurRadius` | `number` | `2` | Backdrop blur in dp. `0` disables it. |
78
- | `refractionHeight` | `number` | `12` | Width of the refracting rim in dp. `0` disables refraction. |
79
- | `refractionAmount` | `number` | `24` | How far content is bent at the rim, in dp. |
80
- | `chromaticAberration` | `boolean` | `false` | Split the refraction per colour channel (prism fringe). |
81
- | `depthEffect` | `boolean` | `false` | Stronger, depth-like bending towards the rim. |
82
- | `vibrancy` | `boolean` | `true` | Boost the saturation of what is behind the glass. |
83
- | `highlight` | `boolean` | `true` | Specular highlight along the rim. |
84
- | `shadow` | `boolean` | `true` | Soft drop shadow around the shape. |
85
- | `tintColor` | `ColorValue` | — | Colour tint mixed into the glass. |
86
- | `surfaceColor` | `ColorValue` | — | Flat colour painted over the glass, on top of the refraction. |
87
- | `fallbackColor` | `ColorValue` | `rgba(255,255,255,0.7)` | Surface used where the effect cannot run (see _Platforms_). |
84
+ | Prop | Type | Default | Description |
85
+ | --------------------- | ------------------- | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
86
+ | `theme` | `"light" \| "dark"` | omitted | Optional appearance; omission preserves the original untinted glass. |
87
+ | `cornerRadius` | `number` | `style.borderRadius`, else `24` | Corner radius of the glass shape in dp. Use a large value (e.g. `999`) for a capsule. |
88
+ | `blurRadius` | `number` | `2` unthemed / `9` themed | Backdrop blur in dp. `0` disables it. |
89
+ | `blurGradient` | `"top-to-bottom"` | omitted | Android 13+: blur decreases linearly from `blurRadius` at the top to zero at the bottom. Omit for uniform blur; Android 12 uses uniform blur. |
90
+ | `refractionHeight` | `number` | `12` unthemed / `2` themed | Width of the refracting rim in dp. `0` disables refraction. |
91
+ | `refractionAmount` | `number` | `24` unthemed / `3` themed | How far content is bent at the rim, in dp. |
92
+ | `chromaticAberration` | `boolean` | `false` | Split the refraction per colour channel (prism fringe). |
93
+ | `depthEffect` | `boolean` | `false` | Stronger, depth-like bending towards the rim. |
94
+ | `vibrancy` | `boolean` | `true` unthemed / `false` themed | Boost the saturation of what is behind the glass. |
95
+ | `highlight` | `boolean` | `true` | Specular highlight along the rim. |
96
+ | `shadow` | `boolean` | `true` | Soft drop shadow around the shape. |
97
+ | `tintColor` | `ColorValue` | — | Colour tint mixed into the glass. |
98
+ | `surfaceColor` | `ColorValue` | — | Flat colour painted over the glass, on top of the refraction. |
99
+ | `fallbackColor` | `ColorValue` | `#242b33` dark / `rgba(255,255,255,0.7)` otherwise | Surface used where the effect cannot run (see _Platforms_). |
88
100
 
89
101
  Don't set `backgroundColor` on a glass view — it would paint over the effect. Use `tintColor`
90
102
  or `surfaceColor` instead.
@@ -94,7 +106,7 @@ or `surfaceColor` instead.
94
106
  Kyant's liquid button: while pressed, the glass swells, stretches towards the finger and a
95
107
  highlight follows it.
96
108
 
97
- <img src=".github/assets/buttons.gif" alt="AndroidGlassButton" width="480" />
109
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/5a563ac/.github/assets/buttons.gif" alt="AndroidGlassButton" width="480" />
98
110
 
99
111
  ```tsx
100
112
  <AndroidGlassButton title="Save" onPress={save} />
@@ -105,14 +117,14 @@ highlight follows it.
105
117
  </AndroidGlassButton>
106
118
  ```
107
119
 
108
- Takes every `AndroidGlassView` prop (`cornerRadius` defaults to a capsule) plus:
120
+ Takes every `AndroidGlassView` prop, with `theme="light"` and a capsule corner radius by default, plus:
109
121
 
110
- | Prop | Type | Default | Description |
111
- | ------------- | ------------ | ------- | ---------------------------------------------------- |
112
- | `onPress` | `() => void` | — | Called on tap. |
113
- | `title` | `string` | — | Convenience label (15 sp; white on a tinted button). |
114
- | `titleStyle` | `TextStyle` | — | Style for `title`. |
115
- | `interactive` | `boolean` | `true` | Press and drag deformation. |
122
+ | Prop | Type | Default | Description |
123
+ | ------------- | ------------ | ------- | ----------------------------------------------------------- |
124
+ | `onPress` | `() => void` | — | Called on tap. |
125
+ | `title` | `string` | — | Convenience label (15 sp; white with dark theme or a tint). |
126
+ | `titleStyle` | `TextStyle` | — | Style for `title`. |
127
+ | `interactive` | `boolean` | `true` | Press and drag deformation. |
116
128
 
117
129
  The default size is 48 dp high with 16 dp horizontal padding; override it with `style`. The
118
130
  children are drawn _inside_ the glass (clipped to it, deformed with it), so they are decorative:
@@ -120,7 +132,7 @@ don't put interactive elements in a button.
120
132
 
121
133
  ## `AndroidGlassToggle`
122
134
 
123
- <img src=".github/assets/toggles.gif" alt="AndroidGlassToggle" width="480" />
135
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/5a563ac/.github/assets/toggles.gif" alt="AndroidGlassToggle" width="480" />
124
136
 
125
137
  ```tsx
126
138
  <AndroidGlassToggle value={enabled} onValueChange={setEnabled} />
@@ -141,7 +153,7 @@ new value, the switch returns to `value`.
141
153
 
142
154
  ## `AndroidGlassSlider`
143
155
 
144
- <img src=".github/assets/sliders.gif" alt="AndroidGlassSlider" width="480" />
156
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/5a563ac/.github/assets/sliders.gif" alt="AndroidGlassSlider" width="480" />
145
157
 
146
158
  ```tsx
147
159
  <AndroidGlassSlider value={volume} maximumValue={100} onValueChange={setVolume} />
@@ -169,7 +181,32 @@ Kyant's iOS 26 style tab bar: a glass capsule with a liquid selection droplet yo
169
181
  between tabs. Under the droplet the tab content takes the accent colour and is magnified while
170
182
  pressed.
171
183
 
172
- <img src=".github/assets/tabbar.gif" alt="AndroidGlassBottomTabs" width="480" />
184
+ All glass surface options are optional: `cornerRadius`, `blurRadius`, `blurGradient`, `refractionHeight`,
185
+ `refractionAmount`, `chromaticAberration`, `depthEffect`, `vibrancy`, `highlight`,
186
+ `shadow`, `tintColor`, `surfaceColor`, and `fallbackColor`. Omitted options preserve
187
+ existing theme defaults and the capsule shape. Removing an override restores its default.
188
+ These options affect the bar surface; the selection droplet retains its own optics.
189
+ `containerColor` is painted above tint/surface colours. On iOS/web, optical effects are
190
+ unavailable; the fallback uses the supplied colours and corner radius.
191
+
192
+ `opacity` (0–1) fades the entire bar including icons and labels. It overrides
193
+ `style.opacity` only when supplied; otherwise the style works as before.
194
+
195
+ ```tsx
196
+ <AndroidGlassBottomTabs
197
+ theme="dark"
198
+ opacity={0.85}
199
+ blurRadius={16}
200
+ refractionHeight={8}
201
+ refractionAmount={12}
202
+ chromaticAberration
203
+ shadow={false}>
204
+ <AndroidGlassTab label="Home" />
205
+ <AndroidGlassTab label="Search" />
206
+ </AndroidGlassBottomTabs>
207
+ ```
208
+
209
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/5a563ac/.github/assets/tabbar.gif" alt="AndroidGlassBottomTabs" width="480" />
173
210
 
174
211
  ```tsx
175
212
  <AndroidGlassBottomTabs
@@ -182,14 +219,17 @@ pressed.
182
219
  </AndroidGlassBottomTabs>
183
220
  ```
184
221
 
185
- | Prop | Type | Default | Description |
186
- | ------------------- | ------------------------------ | ----------------- | ------------------------------------------------------------------------------------------- |
187
- | `selectedIndex` | `number` | `0` | |
188
- | `onTabSelected` | `(index: number) => void` | — | Called on tap, or when the droplet is dropped on a tab. |
189
- | `minimized` | `boolean` | `false` | Minimized look: shorter and narrower, labels faded out. Animated. See _Minimize on scroll_. |
190
- | `onMinimizedChange` | `(minimized: boolean) => void` | — | Called with `false` when the user expands the minimized bar by touching it. |
191
- | `accentColor` | `ColorValue` | system blue | Colour of the selected tab's content. |
192
- | `containerColor` | `ColorValue` | translucent white | Colour of the glass bar. |
222
+ | Prop | Type | Default | Description |
223
+ | ------------------- | ------------------------------ | ------------------------- | ------------------------------------------------------------------------------------------- |
224
+ | `theme` | `"light" \| "dark"` | `"light"` | Glass appearance, independent of the system. |
225
+ | `opacity` | `number` | `style.opacity`, else `1` | Whole bar opacity, including icons and labels; clamped to 0–1. |
226
+ | `cornerRadius` | `number` | capsule | Explicit bar radius in dp. |
227
+ | `selectedIndex` | `number` | `0` | |
228
+ | `onTabSelected` | `(index: number) => void` | — | Called on tap, or when the droplet is dropped on a tab. |
229
+ | `minimized` | `boolean` | `false` | Minimized look: shorter and narrower, labels faded out. Animated. See _Minimize on scroll_. |
230
+ | `onMinimizedChange` | `(minimized: boolean) => void` | — | Called with `false` when the user expands the minimized bar by touching it. |
231
+ | `accentColor` | `ColorValue` | system blue | Colour of the selected tab's content. |
232
+ | `containerColor` | `ColorValue` | theme material | Colour of the glass bar. |
193
233
 
194
234
  Each child is one tab (equal widths). `AndroidGlassTab` is an icon over a 12 sp label, but any
195
235
  view works — as with buttons, the tabs are drawn inside the glass, so keep them decorative. The
@@ -299,10 +339,130 @@ export default function TabLayout() {
299
339
  The bar floats over the screens, so give their content some bottom padding. With React
300
340
  Navigation, the same component works as `createBottomTabNavigator`'s `tabBar`.
301
341
 
342
+ ## `AndroidGlassMenu`
343
+
344
+ <img src="https://raw.githubusercontent.com/kagantemizkan/expo-android-glass-view/main/.github/assets/menu.gif" alt="AndroidGlassMenu: opening, row highlight transitions and nested menus in dark mode" width="480" />
345
+
346
+ An anchored glass action menu with independent position, size and corner motion,
347
+ refracted labels, a selection pill that snaps to rows, checkmarks, separators and
348
+ disabled/destructive actions. The backdrop stays in screen coordinates while the
349
+ surface grows. Its surface stretches and moves toward the finger, then springs
350
+ back on release. The selection pill springs between row-aligned positions and
351
+ adapts to each row's height. It disappears when the finger is over separators,
352
+ headings, disabled rows or the panel's padding.
353
+ The menu renders in the same window as the screen, through a provider above the
354
+ navigator. It does not use React Native `Modal`.
355
+
356
+ ```tsx
357
+ import { useRef, useState } from 'react';
358
+ import { View } from 'react-native';
359
+ import {
360
+ AndroidGlassButton,
361
+ AndroidGlassMenu,
362
+ AndroidGlassMenuProvider,
363
+ } from 'expo-android-glass-view';
364
+
365
+ // At your application root:
366
+ // <AndroidGlassMenuProvider><YourNavigator /></AndroidGlassMenuProvider>
367
+
368
+ function SortMenu() {
369
+ const anchorRef = useRef<View>(null);
370
+ const [visible, setVisible] = useState(false);
371
+ const [sort, setSort] = useState('recent');
372
+ return (
373
+ <>
374
+ <View ref={anchorRef} collapsable={false}>
375
+ <AndroidGlassButton title="Sort" onPress={() => setVisible(true)} />
376
+ </View>
377
+ <AndroidGlassMenu
378
+ visible={visible}
379
+ anchorRef={anchorRef}
380
+ items={[
381
+ { id: 'recent', title: 'Most recent', checked: sort === 'recent' },
382
+ { id: 'name', title: 'Name', checked: sort === 'name' },
383
+ ]}
384
+ onSelect={setSort}
385
+ onDismiss={() => setVisible(false)}
386
+ />
387
+ </>
388
+ );
389
+ }
390
+ ```
391
+
392
+ `visible`, `anchorRef` and `onDismiss` are required. For native rows, supply `items` and `onSelect`. Set
393
+ `visible` to false in `onDismiss`, which runs on a dismissing selection or when
394
+ outside press / Android Back closes the root menu. `onSelect` receives the chosen item's unique `id`. Each item supports
395
+ `title`, `checked`, `disabled`, `destructive`, and `separator` (before the row).
396
+
397
+ Optional `width` defaults to 250 dp. `theme` is `light` or `dark` and defaults to
398
+ `light`. Pass safe-area `insets` (`top`, `right`, `bottom`, `left`) if the provider
399
+ covers system bars; omitted edges use 12 dp. Position is measured on opening and
400
+ window-size changes. The default `placement="overlap"` expands over the trigger,
401
+ aligned just beyond its right edge; `placement="below"` opens underneath. Both are
402
+ clamped to the provider bounds and flip above the trigger when needed. Keep the trigger stationary while open.
403
+
404
+ Items can include `children` (another item array). On Android, a front surface grows
405
+ from the selected row and leaves the parent visible behind it. Its header, a tap
406
+ on the parent, an outside press, or Android Back collapses it. There is no extra
407
+ back row on Android. Selecting a leaf calls `onSelect` with its id. Set
408
+ `keepsMenuPresented` on toggles and repeated actions to keep the menu open while
409
+ updating their checked state. `compact` uses a smaller row and `sectionTitle` adds
410
+ a muted heading. `icon` supports grid, heart, adjustments, photo, video, screenshot,
411
+ album, zoom-in, zoom-out, aspect and people glyphs.
412
+
413
+ Use `\n` for a two-line title; those rows receive extra height. If hiding the
414
+ trigger during the morph, keep its layout and ref mounted and restore it in
415
+ `onDismissed`, after the closing animation finishes. `sourceIcon="sort"` retains
416
+ the sort glyph during that transition. Decorative View groups inside a glass
417
+ button should use `pointerEvents="none"`. The provider keeps its last native panel
418
+ hidden and non-interactive after closing so its GPU programs stay ready.
419
+
420
+ Only one menu should be visible per provider. Tall menus reveal rows when dragged
421
+ along their upper/lower edge and support accessibility scrolling with TalkBack.
422
+ Dragging directly from the opening button into the menu is not part of this API. iOS and web use a plain scrollable
423
+ menu with the same selection API. On Android the animation follows system animator
424
+ duration settings.
425
+
426
+ ### Custom React menu content
427
+
428
+ Pass `children` to replace the native action rows with live React content. `contentHeight`
429
+ sets the panel height in dp (default 240, including 16 dp content padding on each edge); it
430
+ is clamped to the available screen space, and overflowing content scrolls. When children
431
+ are present, `items` are ignored and `onSelect` is not used. Dismiss from a custom control by
432
+ setting `visible` to false; outside press and Android Back also dismiss.
433
+
434
+ ```tsx
435
+ <AndroidGlassMenu
436
+ visible={open}
437
+ anchorRef={anchor}
438
+ theme="dark"
439
+ contentHeight={300}
440
+ onDismiss={() => setOpen(false)}>
441
+ <Text style={{ color: 'white' }}>Custom controls</Text>
442
+ <Switch value={enabled} onValueChange={setEnabled} />
443
+ <Pressable onPress={() => setOpen(false)}>
444
+ <Text style={{ color: 'white' }}>Done</Text>
445
+ </Pressable>
446
+ </AndroidGlassMenu>
447
+ ```
448
+
449
+ The native glass retains its opening/closing morph; React children follow its scale, position
450
+ and fade, while retaining native touch responders and accessibility. Custom content does not
451
+ use native row snapping or the native label refraction shader. Style child text for the selected
452
+ theme yourself. Components render in the provider's React context, so place any context providers
453
+ needed by custom children above `AndroidGlassMenuProvider`.
454
+
302
455
  ## Colours and dark mode
303
456
 
304
- Component defaults (accent, track and container colours) follow the system dark mode setting,
305
- like Kyant's samples. Pass the colour props to match your own theme.
457
+ View, Button, Menu and BottomTabs accept optional `theme="light" | "dark"`. Button, Menu and BottomTabs default to `light`. GlassView without a theme keeps its original untinted material; it does not select a theme automatically.
458
+ The material is tuned against the supplied iOS recordings: light has a milky translucent
459
+ colour response, dark retains a subdued charcoal response. View, Button, Menu and the tab
460
+ bar share the resting material; their shapes and interaction animations remain independent.
461
+ Toggle and Slider do not accept a theme prop and are unchanged by the glass appearance setting.
462
+
463
+ View/Button/BottomTabs effect overrides remain supported and survive theme changes. Removing an
464
+ override restores its default. The themed material uses blur 9 dp, refraction 2 / 3 dp and vibrancy off. Unthemed GlassView uses its original blur 2 dp, refraction 12 / 24 dp and vibrancy on. Removing its theme restores that material, including its original highlight and shadow. Button labels follow the appearance; custom child text colours are yours.
465
+ Fallback platforms use plain theme-aware surfaces.
306
466
 
307
467
  ## Gestures
308
468
 
@@ -321,15 +481,15 @@ are told a native gesture started. Vertical drags still scroll.
321
481
 
322
482
  ## How it works
323
483
 
324
- In short: every glass view takes a live snapshot of what is drawn behind it, runs it through a
484
+ Every glass view takes a live snapshot of what is drawn behind it, runs it through a
325
485
  GPU lens (blur, refraction, vibrancy) and draws the result in its own shape.
326
486
 
327
487
  ### A Compose layer inside a React Native view
328
488
 
329
489
  Each glass component is a React Native view (`GlassHostView`) whose first child is a Jetpack
330
490
  Compose view drawing Kyant's `drawBackdrop` modifier. Your React children are regular React
331
- Native views on top of that layer — except in `AndroidGlassButton`, where they are drawn _inside_
332
- the glass so they stretch and swell with it.
491
+ Native views on top of that layer. Button and BottomTabs content is drawn _inside_ the glass
492
+ so it follows their deformation; custom menu children remain interactive React views.
333
493
 
334
494
  ### Seeing the React Native screen behind it
335
495
 
@@ -393,7 +553,8 @@ that glass view then runs its blur and refraction again on the GPU. Changes else
393
553
  screen don't count, because each glass view only captures what can reach it (see _Seeing the
394
554
  React Native screen behind it_).
395
555
 
396
- Measured with `adb shell dumpsys gfxinfo` and `atrace` on a release build, on a mid-range phone:
556
+ Earlier baseline measurements with `adb shell dumpsys gfxinfo` and `atrace` on a release build
557
+ (no new 0.1.10 performance benchmark), on a mid-range phone:
397
558
  Xiaomi 24117RN76E, MediaTek Helio G99, Android 16, 120 Hz.
398
559
 
399
560
  | Screen | Glass views | Result |
@@ -425,6 +586,22 @@ In practice:
425
586
  view tree's drawing and shows up empty behind the glass. `TextureView` content works.
426
587
  - A React Native `Modal` is a separate window, so glass inside it only sees the modal's content.
427
588
 
589
+ ### Android overscroll stretch
590
+
591
+ Repeatedly scrolling past the edge of a list can leave the sampled backdrop shifted inside a
592
+ fixed glass header. This has been reproduced with Android's overscroll stretch effect; the
593
+ header itself stays in place while the image inside the glass drifts.
594
+
595
+ Set `overScrollMode="never"` on the `ScrollView` or `FlatList` behind the glass to avoid this:
596
+
597
+ ```tsx
598
+ <ScrollView overScrollMode="never">{content}</ScrollView>
599
+ ```
600
+
601
+ This disables Android's edge stretch/glow feedback. Normal scrolling and glass effects,
602
+ including `blurGradient`, continue to work. This is a workaround for the backdrop capture
603
+ interaction, not native support for overscroll stretch.
604
+
428
605
  ## Credits and licenses
429
606
 
430
607
  This package is licensed under Apache-2.0. It contains code from
@@ -14,14 +14,13 @@ plugins {
14
14
  apply plugin: 'org.jetbrains.kotlin.plugin.compose'
15
15
 
16
16
  group = 'expo.modules.androidglassview'
17
- version = '0.1.7'
17
+ version = '0.1.0'
18
18
 
19
19
  android {
20
20
  namespace "expo.modules.androidglassview"
21
21
  defaultConfig {
22
22
  versionCode 1
23
- versionName "0.1.7"
24
- testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
23
+ versionName "0.1.0"
25
24
  }
26
25
  buildFeatures {
27
26
  compose true
@@ -37,6 +36,4 @@ dependencies {
37
36
  // Same Compose version as @expo/ui for this Expo SDK, so apps using both resolve one runtime.
38
37
  implementation 'androidx.compose.foundation:foundation-android:1.10.6'
39
38
  implementation 'androidx.compose.ui:ui-android:1.10.6'
40
- androidTestImplementation 'androidx.test:runner:1.6.2'
41
- androidTestImplementation 'androidx.test.ext:junit:1.2.1'
42
39
  }
@@ -28,6 +28,8 @@ import expo.modules.kotlin.viewevent.EventDispatcher
28
28
  class AndroidGlassBottomTabs(context: Context, appContext: AppContext) : GlassHostView(context, appContext) {
29
29
 
30
30
  override val drawsReactChildrenInCompose: Boolean = true
31
+ internal val glassState = GlassState().apply { cornerRadius = 999f }
32
+
31
33
  override val claimsHorizontalDrags: Boolean = true
32
34
 
33
35
  internal var selectedIndex by mutableIntStateOf(0)
@@ -84,6 +86,7 @@ class AndroidGlassBottomTabs(context: Context, appContext: AppContext) : GlassHo
84
86
  }
85
87
  },
86
88
  backdrop = backdrop,
89
+ state = glassState,
87
90
  tabsCount = tabsCount.coerceAtLeast(1),
88
91
  drawTabs = { origin, frame, tint, scale ->
89
92
  // Reading the generation subscribes this draw to changes of the React children.