expo-android-glass-view 0.1.2 → 0.1.4

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 (71) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +154 -67
  3. package/android/src/main/java/expo/modules/androidglassview/ExpoAndroidGlassViewModule.kt +1 -1
  4. package/android/src/main/java/expo/modules/androidglassview/GlassHostView.kt +22 -0
  5. package/package.json +1 -1
  6. package/src/AndroidGlassComponents.types.ts +1 -1
  7. package/tsconfig.json +20 -5
  8. package/build/AndroidGlassBottomTabs.android.d.ts +0 -4
  9. package/build/AndroidGlassBottomTabs.android.d.ts.map +0 -1
  10. package/build/AndroidGlassBottomTabs.android.js +0 -51
  11. package/build/AndroidGlassBottomTabs.android.js.map +0 -1
  12. package/build/AndroidGlassBottomTabs.d.ts +0 -5
  13. package/build/AndroidGlassBottomTabs.d.ts.map +0 -1
  14. package/build/AndroidGlassBottomTabs.js +0 -34
  15. package/build/AndroidGlassBottomTabs.js.map +0 -1
  16. package/build/AndroidGlassButton.android.d.ts +0 -4
  17. package/build/AndroidGlassButton.android.d.ts.map +0 -1
  18. package/build/AndroidGlassButton.android.js +0 -32
  19. package/build/AndroidGlassButton.android.js.map +0 -1
  20. package/build/AndroidGlassButton.d.ts +0 -5
  21. package/build/AndroidGlassButton.d.ts.map +0 -1
  22. package/build/AndroidGlassButton.js +0 -38
  23. package/build/AndroidGlassButton.js.map +0 -1
  24. package/build/AndroidGlassComponents.types.d.ts +0 -72
  25. package/build/AndroidGlassComponents.types.d.ts.map +0 -1
  26. package/build/AndroidGlassComponents.types.js +0 -2
  27. package/build/AndroidGlassComponents.types.js.map +0 -1
  28. package/build/AndroidGlassSlider.android.d.ts +0 -4
  29. package/build/AndroidGlassSlider.android.d.ts.map +0 -1
  30. package/build/AndroidGlassSlider.android.js +0 -27
  31. package/build/AndroidGlassSlider.android.js.map +0 -1
  32. package/build/AndroidGlassSlider.d.ts +0 -5
  33. package/build/AndroidGlassSlider.d.ts.map +0 -1
  34. package/build/AndroidGlassSlider.js +0 -47
  35. package/build/AndroidGlassSlider.js.map +0 -1
  36. package/build/AndroidGlassTab.d.ts +0 -9
  37. package/build/AndroidGlassTab.d.ts.map +0 -1
  38. package/build/AndroidGlassTab.js +0 -22
  39. package/build/AndroidGlassTab.js.map +0 -1
  40. package/build/AndroidGlassToggle.android.d.ts +0 -4
  41. package/build/AndroidGlassToggle.android.d.ts.map +0 -1
  42. package/build/AndroidGlassToggle.android.js +0 -27
  43. package/build/AndroidGlassToggle.android.js.map +0 -1
  44. package/build/AndroidGlassToggle.d.ts +0 -5
  45. package/build/AndroidGlassToggle.d.ts.map +0 -1
  46. package/build/AndroidGlassToggle.js +0 -7
  47. package/build/AndroidGlassToggle.js.map +0 -1
  48. package/build/AndroidGlassView.android.d.ts +0 -4
  49. package/build/AndroidGlassView.android.d.ts.map +0 -1
  50. package/build/AndroidGlassView.android.js +0 -10
  51. package/build/AndroidGlassView.android.js.map +0 -1
  52. package/build/AndroidGlassView.d.ts +0 -8
  53. package/build/AndroidGlassView.d.ts.map +0 -1
  54. package/build/AndroidGlassView.js +0 -18
  55. package/build/AndroidGlassView.js.map +0 -1
  56. package/build/AndroidGlassView.types.d.ts +0 -34
  57. package/build/AndroidGlassView.types.d.ts.map +0 -1
  58. package/build/AndroidGlassView.types.js +0 -2
  59. package/build/AndroidGlassView.types.js.map +0 -1
  60. package/build/MinimizeOnScroll.d.ts +0 -41
  61. package/build/MinimizeOnScroll.d.ts.map +0 -1
  62. package/build/MinimizeOnScroll.js +0 -76
  63. package/build/MinimizeOnScroll.js.map +0 -1
  64. package/build/index.d.ts +0 -10
  65. package/build/index.d.ts.map +0 -1
  66. package/build/index.js +0 -12
  67. package/build/index.js.map +0 -1
  68. package/build/utils.d.ts +0 -5
  69. package/build/utils.d.ts.map +0 -1
  70. package/build/utils.js +0 -9
  71. package/build/utils.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.3 — 2026-09-11
4
+
5
+ - Fix a crash when navigating to or from a screen that has a glass view (Expo Router and React
6
+ Navigation on react-native-screens): `IllegalStateException: Cannot locate windowRecomposer … is
7
+ not attached to a window`. React Native measures views that are not attached to the window —
8
+ a pushed screen or a tab opened for the first time, before react-native-screens attaches it, or
9
+ a screen it has detached — and measuring the glass layer there made Compose look for the
10
+ window. The glass layer is now skipped while detached and sized when it attaches.
11
+ - `captureRevision` is now 3.
12
+
3
13
  ## 0.1.2 — 2026-09-10
4
14
 
5
15
  - Fix a crash when a glass view sits inside a react-native-screens stack (Expo Router and React
package/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # expo-android-glass-view
1
+ <p align="center">
2
+ <img src=".github/assets/hero.png" alt="Liquid Glass — expo-android-glass-view" width="1040" />
3
+ </p>
4
+
5
+ #
2
6
 
3
7
  Liquid Glass for React Native on **Android**: real refraction, blur, vibrancy and rim
4
8
  highlights behind any React content, rendered with Jetpack Compose — plus ready-made glass
@@ -30,12 +34,12 @@ the same window, and keeps up with scrolling lists, animations and layout change
30
34
 
31
35
  ## Platforms
32
36
 
33
- | Platform | Result |
34
- | --- | --- |
35
- | Android 13+ (API 33) | Full effect: refraction, chromatic aberration, blur, vibrancy |
37
+ | Platform | Result |
38
+ | ---------------------- | ------------------------------------------------------------- |
39
+ | Android 13+ (API 33) | Full effect: refraction, chromatic aberration, blur, vibrancy |
36
40
  | Android 12 (API 31–32) | Blur and vibrancy, no refraction (needs AGSL runtime shaders) |
37
- | Android 11 and older | Plain translucent surface (`fallbackColor`) |
38
- | iOS, web | Same components, plain fallbacks with the same API — no crash |
41
+ | Android 11 and older | Plain translucent surface (`fallbackColor`) |
42
+ | iOS, web | Same components, plain fallbacks with the same API — no crash |
39
43
 
40
44
  Requires a development build (it is a native module, so it does not run in Expo Go) and the
41
45
  React Native New Architecture. Built against Expo SDK 57 / React Native 0.86.
@@ -59,22 +63,24 @@ A container: children render on top of the glass and stay fully interactive.
59
63
  </AndroidGlassView>
60
64
  ```
61
65
 
66
+ <img src=".github/assets/glasses.gif" alt="AndroidGlassView with different props: default, frosted, lens, prism, tint, no shadow" width="480" />
67
+
62
68
  Accepts every `View` prop plus:
63
69
 
64
- | Prop | Type | Default | Description |
65
- | --- | --- | --- | --- |
66
- | `cornerRadius` | `number` | `style.borderRadius`, else `24` | Corner radius of the glass shape in dp. Use a large value (e.g. `999`) for a capsule. |
67
- | `blurRadius` | `number` | `2` | Backdrop blur in dp. `0` disables it. |
68
- | `refractionHeight` | `number` | `12` | Width of the refracting rim in dp. `0` disables refraction. |
69
- | `refractionAmount` | `number` | `24` | How far content is bent at the rim, in dp. |
70
- | `chromaticAberration` | `boolean` | `false` | Split the refraction per colour channel (prism fringe). |
71
- | `depthEffect` | `boolean` | `false` | Stronger, depth-like bending towards the rim. |
72
- | `vibrancy` | `boolean` | `true` | Boost the saturation of what is behind the glass. |
73
- | `highlight` | `boolean` | `true` | Specular highlight along the rim. |
74
- | `shadow` | `boolean` | `true` | Soft drop shadow around the shape. |
75
- | `tintColor` | `ColorValue` | — | Colour tint mixed into the glass. |
76
- | `surfaceColor` | `ColorValue` | — | Flat colour painted over the glass, on top of the refraction. |
77
- | `fallbackColor` | `ColorValue` | `rgba(255,255,255,0.7)` | Surface used where the effect cannot run (see *Platforms*). |
70
+ | Prop | Type | Default | Description |
71
+ | --------------------- | ------------ | ------------------------------- | ------------------------------------------------------------------------------------- |
72
+ | `cornerRadius` | `number` | `style.borderRadius`, else `24` | Corner radius of the glass shape in dp. Use a large value (e.g. `999`) for a capsule. |
73
+ | `blurRadius` | `number` | `2` | Backdrop blur in dp. `0` disables it. |
74
+ | `refractionHeight` | `number` | `12` | Width of the refracting rim in dp. `0` disables refraction. |
75
+ | `refractionAmount` | `number` | `24` | How far content is bent at the rim, in dp. |
76
+ | `chromaticAberration` | `boolean` | `false` | Split the refraction per colour channel (prism fringe). |
77
+ | `depthEffect` | `boolean` | `false` | Stronger, depth-like bending towards the rim. |
78
+ | `vibrancy` | `boolean` | `true` | Boost the saturation of what is behind the glass. |
79
+ | `highlight` | `boolean` | `true` | Specular highlight along the rim. |
80
+ | `shadow` | `boolean` | `true` | Soft drop shadow around the shape. |
81
+ | `tintColor` | `ColorValue` | — | Colour tint mixed into the glass. |
82
+ | `surfaceColor` | `ColorValue` | — | Flat colour painted over the glass, on top of the refraction. |
83
+ | `fallbackColor` | `ColorValue` | `rgba(255,255,255,0.7)` | Surface used where the effect cannot run (see _Platforms_). |
78
84
 
79
85
  Don't set `backgroundColor` on a glass view — it would paint over the effect. Use `tintColor`
80
86
  or `surfaceColor` instead.
@@ -84,6 +90,8 @@ or `surfaceColor` instead.
84
90
  Kyant's liquid button: while pressed, the glass swells, stretches towards the finger and a
85
91
  highlight follows it.
86
92
 
93
+ <img src=".github/assets/buttons.gif" alt="AndroidGlassButton" width="480" />
94
+
87
95
  ```tsx
88
96
  <AndroidGlassButton title="Save" onPress={save} />
89
97
  <AndroidGlassButton title="Continue" tintColor="#0088FF" onPress={next} />
@@ -95,29 +103,31 @@ highlight follows it.
95
103
 
96
104
  Takes every `AndroidGlassView` prop (`cornerRadius` defaults to a capsule) plus:
97
105
 
98
- | Prop | Type | Default | Description |
99
- | --- | --- | --- | --- |
100
- | `onPress` | `() => void` | — | Called on tap. |
101
- | `title` | `string` | — | Convenience label (15 sp; white on a tinted button). |
102
- | `titleStyle` | `TextStyle` | — | Style for `title`. |
103
- | `interactive` | `boolean` | `true` | Press and drag deformation. |
106
+ | Prop | Type | Default | Description |
107
+ | ------------- | ------------ | ------- | ---------------------------------------------------- |
108
+ | `onPress` | `() => void` | — | Called on tap. |
109
+ | `title` | `string` | — | Convenience label (15 sp; white on a tinted button). |
110
+ | `titleStyle` | `TextStyle` | — | Style for `title`. |
111
+ | `interactive` | `boolean` | `true` | Press and drag deformation. |
104
112
 
105
113
  The default size is 48 dp high with 16 dp horizontal padding; override it with `style`. The
106
- children are drawn *inside* the glass (clipped to it, deformed with it), so they are decorative:
114
+ children are drawn _inside_ the glass (clipped to it, deformed with it), so they are decorative:
107
115
  don't put interactive elements in a button.
108
116
 
109
117
  ## `AndroidGlassToggle`
110
118
 
119
+ <img src=".github/assets/toggles.gif" alt="AndroidGlassToggle" width="480" />
120
+
111
121
  ```tsx
112
122
  <AndroidGlassToggle value={enabled} onValueChange={setEnabled} />
113
123
  ```
114
124
 
115
- | Prop | Type | Default | Description |
116
- | --- | --- | --- | --- |
117
- | `value` | `boolean` | `false` | |
118
- | `onValueChange` | `(value: boolean) => void` | — | Called on tap or when the thumb is dropped on the other side. |
119
- | `accentColor` | `ColorValue` | iOS green | Track colour when on. |
120
- | `trackColor` | `ColorValue` | translucent grey | Track colour when off. |
125
+ | Prop | Type | Default | Description |
126
+ | --------------- | -------------------------- | ---------------- | ------------------------------------------------------------- |
127
+ | `value` | `boolean` | `false` | |
128
+ | `onValueChange` | `(value: boolean) => void` | — | Called on tap or when the thumb is dropped on the other side. |
129
+ | `accentColor` | `ColorValue` | iOS green | Track colour when on. |
130
+ | `trackColor` | `ColorValue` | translucent grey | Track colour when off. |
121
131
 
122
132
  The track is 64 × 28 dp; the thumb turns into refracting glass and grows past it while dragged.
123
133
 
@@ -127,18 +137,20 @@ new value, the switch returns to `value`.
127
137
 
128
138
  ## `AndroidGlassSlider`
129
139
 
140
+ <img src=".github/assets/sliders.gif" alt="AndroidGlassSlider" width="480" />
141
+
130
142
  ```tsx
131
143
  <AndroidGlassSlider value={volume} maximumValue={100} onValueChange={setVolume} />
132
144
  ```
133
145
 
134
- | Prop | Type | Default | Description |
135
- | --- | --- | --- | --- |
136
- | `value` | `number` | `0` | |
137
- | `minimumValue` / `maximumValue` | `number` | `0` / `1` | |
138
- | `onValueChange` | `(value: number) => void` | — | Called continuously while dragging. |
139
- | `onSlidingComplete` | `(value: number) => void` | — | Called when the finger is lifted, or after a tap on the track. |
140
- | `accentColor` | `ColorValue` | system blue | Filled part of the track. |
141
- | `trackColor` | `ColorValue` | translucent grey | Unfilled part of the track. |
146
+ | Prop | Type | Default | Description |
147
+ | ------------------------------- | ------------------------- | ---------------- | -------------------------------------------------------------- |
148
+ | `value` | `number` | `0` | |
149
+ | `minimumValue` / `maximumValue` | `number` | `0` / `1` | |
150
+ | `onValueChange` | `(value: number) => void` | — | Called continuously while dragging. |
151
+ | `onSlidingComplete` | `(value: number) => void` | — | Called when the finger is lifted, or after a tap on the track. |
152
+ | `accentColor` | `ColorValue` | system blue | Filled part of the track. |
153
+ | `trackColor` | `ColorValue` | translucent grey | Unfilled part of the track. |
142
154
 
143
155
  It stretches to the width of its parent and is 36 dp high by default.
144
156
 
@@ -153,6 +165,8 @@ Kyant's iOS 26 style tab bar: a glass capsule with a liquid selection droplet yo
153
165
  between tabs. Under the droplet the tab content takes the accent colour and is magnified while
154
166
  pressed.
155
167
 
168
+ <img src=".github/assets/tabbar.gif" alt="AndroidGlassBottomTabs" width="480" />
169
+
156
170
  ```tsx
157
171
  <AndroidGlassBottomTabs
158
172
  selectedIndex={tab}
@@ -164,14 +178,14 @@ pressed.
164
178
  </AndroidGlassBottomTabs>
165
179
  ```
166
180
 
167
- | Prop | Type | Default | Description |
168
- | --- | --- | --- | --- |
169
- | `selectedIndex` | `number` | `0` | |
170
- | `onTabSelected` | `(index: number) => void` | — | Called on tap, or when the droplet is dropped on a tab. |
171
- | `minimized` | `boolean` | `false` | Minimized look: shorter and narrower, labels faded out. Animated. See *Minimize on scroll*. |
172
- | `onMinimizedChange` | `(minimized: boolean) => void` | — | Called with `false` when the user expands the minimized bar by touching it. |
173
- | `accentColor` | `ColorValue` | system blue | Colour of the selected tab's content. |
174
- | `containerColor` | `ColorValue` | translucent white | Colour of the glass bar. |
181
+ | Prop | Type | Default | Description |
182
+ | ------------------- | ------------------------------ | ----------------- | ------------------------------------------------------------------------------------------- |
183
+ | `selectedIndex` | `number` | `0` | |
184
+ | `onTabSelected` | `(index: number) => void` | — | Called on tap, or when the droplet is dropped on a tab. |
185
+ | `minimized` | `boolean` | `false` | Minimized look: shorter and narrower, labels faded out. Animated. See _Minimize on scroll_. |
186
+ | `onMinimizedChange` | `(minimized: boolean) => void` | — | Called with `false` when the user expands the minimized bar by touching it. |
187
+ | `accentColor` | `ColorValue` | system blue | Colour of the selected tab's content. |
188
+ | `containerColor` | `ColorValue` | translucent white | Colour of the glass bar. |
175
189
 
176
190
  Each child is one tab (equal widths). `AndroidGlassTab` is an icon over a 12 sp label, but any
177
191
  view works — as with buttons, the tabs are drawn inside the glass, so keep them decorative. The
@@ -184,8 +198,8 @@ droplet returns to `selectedIndex`.
184
198
 
185
199
  ### Minimize on scroll
186
200
 
187
- Like iOS 26 tab bars, the bar can shrink while the user scrolls down a list, and come back when
188
- they scroll up, get back to the top or touch it. It gets shorter and narrower; every tab keeps its
201
+ Added by this package, on top of Kyant's tab bar: the bar can shrink while the user scrolls
202
+ down a list, and come back when they scroll up, get back to the top or touch it. It gets shorter and narrower; every tab keeps its
189
203
  first child (the icon) while the rest (the label) fades out.
190
204
 
191
205
  Wrap the bar and the screens in `MinimizeOnScrollProvider`, and give each list the handler from
@@ -237,7 +251,8 @@ import {
237
251
  function GlassTabBar({ state, descriptors, navigation }: BottomTabBarProps) {
238
252
  // Routes hidden with `href: null` reach a custom bar as `display: 'none'`.
239
253
  const routes = state.routes.filter(
240
- (route) => StyleSheet.flatten(descriptors[route.key].options.tabBarItemStyle)?.display !== 'none'
254
+ (route) =>
255
+ StyleSheet.flatten(descriptors[route.key].options.tabBarItemStyle)?.display !== 'none'
241
256
  );
242
257
  const focusedKey = state.routes[state.index].key;
243
258
  return (
@@ -245,7 +260,11 @@ function GlassTabBar({ state, descriptors, navigation }: BottomTabBarProps) {
245
260
  selectedIndex={routes.findIndex((route) => route.key === focusedKey)}
246
261
  onTabSelected={(index) => {
247
262
  const route = routes[index];
248
- const event = navigation.emit({ type: 'tabPress', target: route.key, canPreventDefault: true });
263
+ const event = navigation.emit({
264
+ type: 'tabPress',
265
+ target: route.key,
266
+ canPreventDefault: true,
267
+ });
249
268
  if (!event.defaultPrevented) navigation.navigate(route.name, route.params);
250
269
  }}
251
270
  style={{ position: 'absolute', left: 24, right: 24, bottom: 32 }}>
@@ -298,20 +317,88 @@ are told a native gesture started. Vertical drags still scroll.
298
317
 
299
318
  ## How it works
300
319
 
301
- Each glass view is a React Native view whose first child is a Compose view drawing Kyant's
302
- `drawBackdrop` modifier. Its backdrop is not a Compose layer but the Android view tree of the
303
- window — i.e. your React Native screen:
304
-
305
- 1. Every container on the path from the window root to a glass view is drawn with the public
306
- `View.draw()`, with glass views (and branches containing them) hidden for that call.
307
- 2. Every other subtree is recorded as a reference to its RenderNode, so when a list scrolls or a
308
- view animates, the glass picks it up without re-sampling.
309
- 3. Glass views don't sample other glass views, except their own ancestors: a toggle on a glass
310
- card sees the card. This rules out RenderNode cycles (glass A → glass B → glass A).
311
- 4. The capture is recorded once into a RenderNode with its own GPU layer, and only recorded again
312
- when the glass moves, something scrolls or glass views come and go. Every glass layer of a view
313
- (the tab bar has three) samples that same texture, so pressing or dragging only re-runs the
314
- glass effects, not the capture.
320
+ In short: every glass view takes a live snapshot of what is drawn behind it, runs it through a
321
+ GPU lens (blur, refraction, vibrancy) and draws the result in its own shape.
322
+
323
+ ### A Compose layer inside a React Native view
324
+
325
+ Each glass component is a React Native view (`GlassHostView`) whose first child is a Jetpack
326
+ Compose view drawing Kyant's `drawBackdrop` modifier. Your React children are regular React
327
+ Native views on top of that layer — except in `AndroidGlassButton`, where they are drawn _inside_
328
+ the glass so they stretch and swell with it.
329
+
330
+ ### Seeing the React Native screen behind it
331
+
332
+ Kyant's library can only see Compose content behind a glass. Here the backdrop is the Android
333
+ view tree of the window — your React Native screen — captured with an approach adapted from
334
+ [QWEA0/Liquid-Glass-Android](https://github.com/QWEA0/Liquid-Glass-Android):
335
+
336
+ 1. The glass records the area of the window around itself (plus a 32 dp margin for blur and for
337
+ glass that grows while pressed) into a `RenderNode`.
338
+ 2. Its own ancestors are being drawn at that very moment, and calling their `draw()` again would
339
+ crash, so their background and children are drawn one by one instead, in their real drawing
340
+ order (`zIndex` included).
341
+ 3. Every other subtree is recorded as a _reference_ to its RenderNode rather than as pixels, so
342
+ when content behind the glass animates, the glass shows it without capturing again.
343
+ 4. Other glass views are left out of the capture, except the glass's own ancestors: a toggle on
344
+ a glass card sees the card. This rules out cycles (glass A → glass B → glass A).
345
+
346
+ ### The effects
347
+
348
+ The capture goes through Kyant's effect chain on the GPU: blur (`RenderEffect`, Android 12+),
349
+ refraction at the rim (an AGSL runtime shader, Android 13+) with optional chromatic aberration,
350
+ vibrancy, a rim highlight and a drop shadow. Where these APIs are missing, the glass falls back
351
+ to a flat `fallbackColor` surface.
352
+
353
+ ### When it captures again
354
+
355
+ The capture is cached in one RenderNode with its own GPU layer, and every glass layer of a view
356
+ (the tab bar has three) samples that same texture. It is recorded again only when:
357
+
358
+ - the glass moves on screen (layout, transform, dragging),
359
+ - a parent scrolls,
360
+ - a glass view is added or removed.
361
+
362
+ A glass view that is off screen waits until it is visible again. Pressing or dragging a glass
363
+ control only re-runs the GPU effects, not the capture.
364
+
365
+ ### Controlled props
366
+
367
+ Toggles, sliders and the tab bar are dragged natively. So that a late `value` from JS never
368
+ pulls the thumb back, a prop only wins once JS has handled every event the control sent — the
369
+ handshake React Native's `TextInput` uses.
370
+
371
+ ### Minimize on scroll
372
+
373
+ JS decides the direction (`useMinimizeOnScrollHandler`) and sends the bar a single boolean; the
374
+ shrinking itself is animated natively in Compose. The provider shares that state between every
375
+ screen.
376
+
377
+ ## Performance
378
+
379
+ The glass costs nothing while nothing moves. The cost comes when many glass views have to be
380
+ redrawn in the same frame: every one of them runs its blur and refraction on the GPU.
381
+
382
+ Measured with `adb shell dumpsys gfxinfo` in the example app on a mid-range phone: Xiaomi
383
+ 24117RN76E, MediaTek Helio G99, Android 16, 120 Hz. The app was a debuggable development build.
384
+ That mostly slows the UI thread; the glass effects run on Android's RenderThread and GPU,
385
+ which a release build does not speed up much.
386
+
387
+ | Screen | Glass views visible | Result |
388
+ | -------------------------------------------------------------------------- | ------------------- | --------------------------------------------------------------------------------- |
389
+ | Static screen, nothing moving | 2 | 0 frames rendered while idle |
390
+ | Scrolling a list under a glass header, a glass button and the tab bar | 3 | 94% of frames on time |
391
+ | 6 glass tiles over an animated backdrop, plus glass panels and controls | 15+ | about 20–24 fps; the RenderThread spends about 40 ms per frame issuing GPU work |
392
+
393
+ In practice:
394
+
395
+ - A glass header, a tab bar and a few glass controls on a scrolling screen stay smooth.
396
+ - Many glass views redrawing at once — over an animation, or all scrolling together — will
397
+ drop frames on mid-range GPUs. Keep those to a handful.
398
+ - Don't put a glass view inside every item of a long list: each visible item captures and
399
+ redraws on every scroll frame.
400
+ - Glass views scrolled out of view don't capture again until they are visible.
401
+ - On Android 11 and older the glass is a flat surface and costs nothing extra.
315
402
 
316
403
  ## Limitations
317
404
 
@@ -13,7 +13,7 @@ class ExpoAndroidGlassViewModule : Module() {
13
13
  // Bumped when the backdrop capture changes in a way JS may need to know about.
14
14
  // 2: ancestors of a sampling glass view are never drawn again through their own draw()
15
15
  // (0.1.1 crashed inside react-native-screens stacks).
16
- Constant("captureRevision") { 2 }
16
+ Constant("captureRevision") { 3 }
17
17
 
18
18
  View(AndroidGlassView::class) {
19
19
  Name("AndroidGlassView")
@@ -120,6 +120,12 @@ abstract class GlassHostView(context: Context, appContext: AppContext) : ExpoVie
120
120
  clipToPadding = false
121
121
  composeView.clipChildren = false
122
122
  super.addView(composeView, 0, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT))
123
+ // The Compose layer is not sized while it is detached (see onMeasure); size it on attach.
124
+ // Listeners run after the view's own onAttachedToWindow, so it is attached by then.
125
+ composeView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
126
+ override fun onViewAttachedToWindow(v: View) = layoutComposeLayer()
127
+ override fun onViewDetachedFromWindow(v: View) = Unit
128
+ })
123
129
  }
124
130
 
125
131
  @Composable
@@ -199,6 +205,12 @@ abstract class GlassHostView(context: Context, appContext: AppContext) : ExpoVie
199
205
  val width = MeasureSpec.getSize(widthMeasureSpec)
200
206
  val height = MeasureSpec.getSize(heightMeasureSpec)
201
207
  setMeasuredDimension(width, height)
208
+ // ComposeView creates its composition on its first measure, and that needs the window's
209
+ // recomposer: measured off-window it throws "Cannot locate windowRecomposer". Fabric does
210
+ // measure off-window views — a screen react-native-screens has not attached yet (a pushed
211
+ // screen, a tab opened for the first time) or has detached — so skip the Compose layer until
212
+ // it is attached. The attach listener in init sizes it then.
213
+ if (!composeView.isAttachedToWindow) return
202
214
  composeView.measure(
203
215
  MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
204
216
  MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
@@ -207,9 +219,19 @@ abstract class GlassHostView(context: Context, appContext: AppContext) : ExpoVie
207
219
 
208
220
  override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
209
221
  // React Native lays out the React children; only the glass layer is ours.
222
+ if (!composeView.isAttachedToWindow) return
210
223
  composeView.layout(0, 0, right - left, bottom - top)
211
224
  }
212
225
 
226
+ /** Sizes the Compose layer to this view outside a layout pass (see [onMeasure]). */
227
+ private fun layoutComposeLayer() {
228
+ composeView.measure(
229
+ MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
230
+ MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
231
+ )
232
+ composeView.layout(0, 0, width, height)
233
+ }
234
+
213
235
  override fun requestLayout() {
214
236
  super.requestLayout()
215
237
  // React Native does not run Android layout passes, so honour the Compose layer's
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-android-glass-view",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
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",
@@ -51,7 +51,7 @@ export type AndroidGlassBottomTabsProps = ViewProps & {
51
51
  /** Called when the user taps a tab or drops the droplet on one. */
52
52
  onTabSelected?: (index: number) => void;
53
53
  /**
54
- * Minimizes the bar, like iOS 26 tab bars on scroll: it gets shorter and narrower, each tab keeps
54
+ * Minimizes the bar (an addition of this package): it gets shorter and narrower, each tab keeps
55
55
  * only its first child (the icon) and the rest (the label) fades out. Animated natively. Inside a
56
56
  * `MinimizeOnScrollProvider`, leave it out: the bar follows the provider. Android only.
57
57
  */
package/tsconfig.json CHANGED
@@ -1,8 +1,17 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "lib": ["dom", "DOM.Iterable", "esnext"],
4
- "types": ["jest"],
5
- "typeRoots": ["./ts-declarations", "./node_modules/@types"],
3
+ "lib": [
4
+ "dom",
5
+ "DOM.Iterable",
6
+ "esnext"
7
+ ],
8
+ "types": [
9
+ "jest"
10
+ ],
11
+ "typeRoots": [
12
+ "./ts-declarations",
13
+ "./node_modules/@types"
14
+ ],
6
15
  "jsx": "react-native",
7
16
  "target": "esnext",
8
17
  "moduleResolution": "bundler",
@@ -23,6 +32,12 @@
23
32
  "rootDir": "./src",
24
33
  "outDir": "./build"
25
34
  },
26
- "include": ["./src"],
27
- "exclude": ["**/__mocks__/*", "**/__tests__/*"]
35
+ "include": [
36
+ "./src"
37
+ ],
38
+ "exclude": [
39
+ "**/__mocks__/*",
40
+ "**/__tests__/*"
41
+ ],
42
+ "extends": "expo/tsconfig.base"
28
43
  }
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import type { AndroidGlassBottomTabsProps } from './AndroidGlassComponents.types';
3
- export default function AndroidGlassBottomTabs({ selectedIndex, onTabSelected, minimized, onMinimizedChange, accentColor, containerColor, children, style, ...rest }: AndroidGlassBottomTabsProps): React.JSX.Element;
4
- //# sourceMappingURL=AndroidGlassBottomTabs.android.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AndroidGlassBottomTabs.android.d.ts","sourceRoot":"","sources":["../src/AndroidGlassBottomTabs.android.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAuBlF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,aAAa,EACb,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,qBAgD7B"}
@@ -1,51 +0,0 @@
1
- import { requireNativeView } from 'expo';
2
- import * as React from 'react';
3
- import { StyleSheet, View } from 'react-native';
4
- import { MinimizedStateContext } from './MinimizeOnScroll';
5
- import { toNativeColor } from './utils';
6
- const NativeAndroidGlassBottomTabs = requireNativeView('ExpoAndroidGlassView', 'AndroidGlassBottomTabs');
7
- export default function AndroidGlassBottomTabs({ selectedIndex, onTabSelected, minimized, onMinimizedChange, accentColor, containerColor, children, style, ...rest }) {
8
- const tabs = React.Children.toArray(children).filter(React.isValidElement);
9
- // Without a `selectedIndex` prop, the bar keeps the user's selection.
10
- const [ownIndex, setOwnIndex] = React.useState(0);
11
- // Sent back with `selectedIndex`, so the native side can tell a stale index (JS still catching
12
- // up with earlier selections) from a current one.
13
- const [eventCount, setEventCount] = React.useState(0);
14
- const selected = selectedIndex ?? ownIndex;
15
- // Inside a MinimizeOnScrollProvider, the bar follows the shared state unless `minimized` is given.
16
- const shared = React.useContext(MinimizedStateContext);
17
- const followsProvider = minimized === undefined;
18
- return (<NativeAndroidGlassBottomTabs accessibilityRole="tablist" {...rest} style={[styles.bar, style]} selectedIndex={selected} tabsCount={tabs.length} mostRecentEventCount={eventCount} minimized={minimized ?? shared?.minimized ?? false} accentColor={toNativeColor(accentColor)} containerColor={toNativeColor(containerColor)} onTabSelected={(event) => {
19
- const { index, eventCount: count } = event.nativeEvent;
20
- setEventCount((current) => Math.max(current, count));
21
- setOwnIndex(index);
22
- onTabSelected?.(index);
23
- }} onMinimizedChange={(event) => {
24
- const value = event.nativeEvent.minimized;
25
- if (followsProvider)
26
- shared?.setMinimized(value);
27
- onMinimizedChange?.(value);
28
- }}>
29
- {tabs.map((tab, index) => (
30
- // The native bar handles taps and drags, and draws these views itself (inside the glass
31
- // and, tinted, under the droplet), so they must stay real views and not take touches.
32
- <View key={tab.key ?? index} collapsable={false} pointerEvents="none" accessibilityRole="tab" accessibilityState={{ selected: index === selected }} style={styles.tab}>
33
- {tab}
34
- </View>))}
35
- </NativeAndroidGlassBottomTabs>);
36
- }
37
- const styles = StyleSheet.create({
38
- // 4 dp side padding keeps the tabs aligned with the droplet: (width - 8 dp) / count each.
39
- bar: {
40
- height: 64,
41
- flexDirection: 'row',
42
- paddingHorizontal: 4,
43
- },
44
- tab: {
45
- flex: 1,
46
- alignItems: 'center',
47
- justifyContent: 'center',
48
- gap: 2,
49
- },
50
- });
51
- //# sourceMappingURL=AndroidGlassBottomTabs.android.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AndroidGlassBottomTabs.android.js","sourceRoot":"","sources":["../src/AndroidGlassBottomTabs.android.tsx"],"names":[],"mappings":"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","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nimport type { AndroidGlassBottomTabsProps } from './AndroidGlassComponents.types';\nimport { MinimizedStateContext } from './MinimizeOnScroll';\nimport { type NativeColor, toNativeColor } from './utils';\n\ntype IndexEvent = { nativeEvent: { index: number; eventCount: number } };\ntype MinimizedEvent = { nativeEvent: { minimized: boolean } };\n\ntype NativeAndroidGlassBottomTabsProps = Omit<\n AndroidGlassBottomTabsProps,\n 'onTabSelected' | 'onMinimizedChange' | 'accentColor' | 'containerColor'\n> & {\n tabsCount: number;\n /** Count of the last selection event handled here (see ControlledProp on the native side). */\n mostRecentEventCount: number;\n onTabSelected: (event: IndexEvent) => void;\n onMinimizedChange: (event: MinimizedEvent) => void;\n accentColor?: NativeColor;\n containerColor?: NativeColor;\n};\n\nconst NativeAndroidGlassBottomTabs: React.ComponentType<NativeAndroidGlassBottomTabsProps> =\n requireNativeView('ExpoAndroidGlassView', 'AndroidGlassBottomTabs');\n\nexport default function AndroidGlassBottomTabs({\n selectedIndex,\n onTabSelected,\n minimized,\n onMinimizedChange,\n accentColor,\n containerColor,\n children,\n style,\n ...rest\n}: AndroidGlassBottomTabsProps) {\n const tabs = React.Children.toArray(children).filter(React.isValidElement);\n // Without a `selectedIndex` prop, the bar keeps the user's selection.\n const [ownIndex, setOwnIndex] = React.useState(0);\n // Sent back with `selectedIndex`, so the native side can tell a stale index (JS still catching\n // up with earlier selections) from a current one.\n const [eventCount, setEventCount] = React.useState(0);\n const selected = selectedIndex ?? ownIndex;\n // Inside a MinimizeOnScrollProvider, the bar follows the shared state unless `minimized` is given.\n const shared = React.useContext(MinimizedStateContext);\n const followsProvider = minimized === undefined;\n return (\n <NativeAndroidGlassBottomTabs\n accessibilityRole=\"tablist\"\n {...rest}\n style={[styles.bar, style]}\n selectedIndex={selected}\n tabsCount={tabs.length}\n mostRecentEventCount={eventCount}\n minimized={minimized ?? shared?.minimized ?? false}\n accentColor={toNativeColor(accentColor)}\n containerColor={toNativeColor(containerColor)}\n onTabSelected={(event) => {\n const { index, eventCount: count } = event.nativeEvent;\n setEventCount((current) => Math.max(current, count));\n setOwnIndex(index);\n onTabSelected?.(index);\n }}\n onMinimizedChange={(event) => {\n const value = event.nativeEvent.minimized;\n if (followsProvider) shared?.setMinimized(value);\n onMinimizedChange?.(value);\n }}>\n {tabs.map((tab, index) => (\n // The native bar handles taps and drags, and draws these views itself (inside the glass\n // and, tinted, under the droplet), so they must stay real views and not take touches.\n <View\n key={tab.key ?? index}\n collapsable={false}\n pointerEvents=\"none\"\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: index === selected }}\n style={styles.tab}>\n {tab}\n </View>\n ))}\n </NativeAndroidGlassBottomTabs>\n );\n}\n\nconst styles = StyleSheet.create({\n // 4 dp side padding keeps the tabs aligned with the droplet: (width - 8 dp) / count each.\n bar: {\n height: 64,\n flexDirection: 'row',\n paddingHorizontal: 4,\n },\n tab: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 2,\n },\n});\n"]}
@@ -1,5 +0,0 @@
1
- import * as React from 'react';
2
- import type { AndroidGlassBottomTabsProps } from './AndroidGlassComponents.types';
3
- /** iOS and web fallback: a plain tab bar with the same API (it does not minimize). */
4
- export default function AndroidGlassBottomTabs({ selectedIndex, onTabSelected, minimized: _minimized, onMinimizedChange: _onMinimizedChange, accentColor: _accentColor, containerColor, children, style, ...rest }: AndroidGlassBottomTabsProps): React.JSX.Element;
5
- //# sourceMappingURL=AndroidGlassBottomTabs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AndroidGlassBottomTabs.d.ts","sourceRoot":"","sources":["../src/AndroidGlassBottomTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAC;AAElF,sFAAsF;AACtF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,aAAiB,EACjB,aAAa,EACb,SAAS,EAAE,UAAU,EACrB,iBAAiB,EAAE,kBAAkB,EACrC,WAAW,EAAE,YAAY,EACzB,cAAc,EACd,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,qBAuB7B"}
@@ -1,34 +0,0 @@
1
- import * as React from 'react';
2
- import { Pressable, StyleSheet, View } from 'react-native';
3
- /** iOS and web fallback: a plain tab bar with the same API (it does not minimize). */
4
- export default function AndroidGlassBottomTabs({ selectedIndex = 0, onTabSelected, minimized: _minimized, onMinimizedChange: _onMinimizedChange, accentColor: _accentColor, containerColor, children, style, ...rest }) {
5
- const tabs = React.Children.toArray(children).filter(React.isValidElement);
6
- return (<View accessibilityRole="tablist" {...rest} style={[
7
- styles.bar,
8
- { backgroundColor: containerColor ?? 'rgba(250, 250, 250, 0.9)' },
9
- style,
10
- ]}>
11
- {tabs.map((tab, index) => (<Pressable key={tab.key ?? index} accessibilityRole="tab" accessibilityState={{ selected: index === selectedIndex }} onPress={() => onTabSelected?.(index)} style={[styles.tab, index === selectedIndex && styles.selected]}>
12
- {tab}
13
- </Pressable>))}
14
- </View>);
15
- }
16
- const styles = StyleSheet.create({
17
- bar: {
18
- height: 64,
19
- flexDirection: 'row',
20
- padding: 4,
21
- borderRadius: 32,
22
- },
23
- tab: {
24
- flex: 1,
25
- alignItems: 'center',
26
- justifyContent: 'center',
27
- gap: 2,
28
- borderRadius: 28,
29
- },
30
- selected: {
31
- backgroundColor: 'rgba(0, 0, 0, 0.08)',
32
- },
33
- });
34
- //# sourceMappingURL=AndroidGlassBottomTabs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AndroidGlassBottomTabs.js","sourceRoot":"","sources":["../src/AndroidGlassBottomTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAI3D,sFAAsF;AACtF,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,aAAa,GAAG,CAAC,EACjB,aAAa,EACb,SAAS,EAAE,UAAU,EACrB,iBAAiB,EAAE,kBAAkB,EACrC,WAAW,EAAE,YAAY,EACzB,cAAc,EACd,QAAQ,EACR,KAAK,EACL,GAAG,IAAI,EACqB;IAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC3E,OAAO,CACL,CAAC,IAAI,CACH,iBAAiB,CAAC,SAAS,CAC3B,IAAI,IAAI,CAAC,CACT,KAAK,CAAC,CAAC;YACL,MAAM,CAAC,GAAG;YACV,EAAE,eAAe,EAAE,cAAc,IAAI,0BAA0B,EAAE;YACjE,KAAK;SACN,CAAC,CACF;MAAA,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CACxB,CAAC,SAAS,CACR,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,CACtB,iBAAiB,CAAC,KAAK,CACvB,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,KAAK,aAAa,EAAE,CAAC,CAC1D,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC,CACtC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,KAAK,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAChE;UAAA,CAAC,GAAG,CACN;QAAA,EAAE,SAAS,CAAC,CACb,CAAC,CACJ;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,GAAG,EAAE;QACH,MAAM,EAAE,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,EAAE;KACjB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,EAAE,CAAC;QACN,YAAY,EAAE,EAAE;KACjB;IACD,QAAQ,EAAE;QACR,eAAe,EAAE,qBAAqB;KACvC;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { Pressable, StyleSheet, View } from 'react-native';\n\nimport type { AndroidGlassBottomTabsProps } from './AndroidGlassComponents.types';\n\n/** iOS and web fallback: a plain tab bar with the same API (it does not minimize). */\nexport default function AndroidGlassBottomTabs({\n selectedIndex = 0,\n onTabSelected,\n minimized: _minimized,\n onMinimizedChange: _onMinimizedChange,\n accentColor: _accentColor,\n containerColor,\n children,\n style,\n ...rest\n}: AndroidGlassBottomTabsProps) {\n const tabs = React.Children.toArray(children).filter(React.isValidElement);\n return (\n <View\n accessibilityRole=\"tablist\"\n {...rest}\n style={[\n styles.bar,\n { backgroundColor: containerColor ?? 'rgba(250, 250, 250, 0.9)' },\n style,\n ]}>\n {tabs.map((tab, index) => (\n <Pressable\n key={tab.key ?? index}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: index === selectedIndex }}\n onPress={() => onTabSelected?.(index)}\n style={[styles.tab, index === selectedIndex && styles.selected]}>\n {tab}\n </Pressable>\n ))}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n bar: {\n height: 64,\n flexDirection: 'row',\n padding: 4,\n borderRadius: 32,\n },\n tab: {\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n gap: 2,\n borderRadius: 28,\n },\n selected: {\n backgroundColor: 'rgba(0, 0, 0, 0.08)',\n },\n});\n"]}
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import type { AndroidGlassButtonProps } from './AndroidGlassComponents.types';
3
- export default function AndroidGlassButton({ onPress, title, titleStyle, cornerRadius, tintColor, surfaceColor, fallbackColor, style, children, ...rest }: AndroidGlassButtonProps): React.JSX.Element;
4
- //# sourceMappingURL=AndroidGlassButton.android.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AndroidGlassButton.android.d.ts","sourceRoot":"","sources":["../src/AndroidGlassButton.android.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAgB9E,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,OAAO,EACP,KAAK,EACL,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,aAAa,EACb,KAAK,EACL,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,uBAAuB,qBAoBzB"}