expo-android-glass-view 0.1.5 → 0.1.7
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 +16 -0
- package/README.md +2 -0
- package/android/build.gradle +3 -0
- package/android/src/main/java/expo/modules/androidglassview/ExpoAndroidGlassViewModule.kt +1 -1
- package/android/src/main/java/expo/modules/androidglassview/GlassHostView.kt +2 -2
- package/android/src/main/java/expo/modules/androidglassview/ViewBackdrop.kt +2 -1
- package/android/src/main/java/expo/modules/androidglassview/capture/ViewBackdropCapture.kt +83 -26
- package/build/AndroidGlassBottomTabs.android.d.ts +4 -0
- package/build/AndroidGlassBottomTabs.android.d.ts.map +1 -0
- package/build/AndroidGlassBottomTabs.android.js +51 -0
- package/build/AndroidGlassBottomTabs.android.js.map +1 -0
- package/build/AndroidGlassBottomTabs.d.ts +5 -0
- package/build/AndroidGlassBottomTabs.d.ts.map +1 -0
- package/build/AndroidGlassBottomTabs.js +34 -0
- package/build/AndroidGlassBottomTabs.js.map +1 -0
- package/build/AndroidGlassButton.android.d.ts +4 -0
- package/build/AndroidGlassButton.android.d.ts.map +1 -0
- package/build/AndroidGlassButton.android.js +32 -0
- package/build/AndroidGlassButton.android.js.map +1 -0
- package/build/AndroidGlassButton.d.ts +5 -0
- package/build/AndroidGlassButton.d.ts.map +1 -0
- package/build/AndroidGlassButton.js +38 -0
- package/build/AndroidGlassButton.js.map +1 -0
- package/build/AndroidGlassComponents.types.d.ts +72 -0
- package/build/AndroidGlassComponents.types.d.ts.map +1 -0
- package/build/AndroidGlassComponents.types.js +2 -0
- package/build/AndroidGlassComponents.types.js.map +1 -0
- package/build/AndroidGlassSlider.android.d.ts +4 -0
- package/build/AndroidGlassSlider.android.d.ts.map +1 -0
- package/build/AndroidGlassSlider.android.js +27 -0
- package/build/AndroidGlassSlider.android.js.map +1 -0
- package/build/AndroidGlassSlider.d.ts +5 -0
- package/build/AndroidGlassSlider.d.ts.map +1 -0
- package/build/AndroidGlassSlider.js +47 -0
- package/build/AndroidGlassSlider.js.map +1 -0
- package/build/AndroidGlassTab.d.ts +9 -0
- package/build/AndroidGlassTab.d.ts.map +1 -0
- package/build/AndroidGlassTab.js +22 -0
- package/build/AndroidGlassTab.js.map +1 -0
- package/build/AndroidGlassToggle.android.d.ts +4 -0
- package/build/AndroidGlassToggle.android.d.ts.map +1 -0
- package/build/AndroidGlassToggle.android.js +27 -0
- package/build/AndroidGlassToggle.android.js.map +1 -0
- package/build/AndroidGlassToggle.d.ts +5 -0
- package/build/AndroidGlassToggle.d.ts.map +1 -0
- package/build/AndroidGlassToggle.js +7 -0
- package/build/AndroidGlassToggle.js.map +1 -0
- package/build/AndroidGlassView.android.d.ts +4 -0
- package/build/AndroidGlassView.android.d.ts.map +1 -0
- package/build/AndroidGlassView.android.js +10 -0
- package/build/AndroidGlassView.android.js.map +1 -0
- package/build/AndroidGlassView.d.ts +8 -0
- package/build/AndroidGlassView.d.ts.map +1 -0
- package/build/AndroidGlassView.js +18 -0
- package/build/AndroidGlassView.js.map +1 -0
- package/build/AndroidGlassView.types.d.ts +34 -0
- package/build/AndroidGlassView.types.d.ts.map +1 -0
- package/build/AndroidGlassView.types.js +2 -0
- package/build/AndroidGlassView.types.js.map +1 -0
- package/build/MinimizeOnScroll.d.ts +41 -0
- package/build/MinimizeOnScroll.d.ts.map +1 -0
- package/build/MinimizeOnScroll.js +76 -0
- package/build/MinimizeOnScroll.js.map +1 -0
- package/build/index.d.ts +10 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +12 -0
- package/build/index.js.map +1 -0
- package/build/utils.d.ts +5 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +9 -0
- package/build/utils.js.map +1 -0
- package/package.json +1 -1
- package/tsconfig.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
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.
|
|
10
|
+
|
|
11
|
+
## 0.1.6 — 2026-09-12
|
|
12
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
## 0.1.5 — 2026-09-12
|
|
20
|
+
|
|
5
21
|
- Performance: a glass view's capture leaves out everything that cannot reach it. Before, an
|
|
6
22
|
animation anywhere on screen made every glass view re-render its blur and refraction on every
|
|
7
23
|
frame; now only the glass views it can be seen through do. On a screen with 17 glass views over
|
package/README.md
CHANGED
|
@@ -362,6 +362,8 @@ The capture is cached in one RenderNode with its own GPU layer, and every glass
|
|
|
362
362
|
- a container it draws inline scrolls: one of its own ancestors, one of their direct children,
|
|
363
363
|
or a container that holds other glass views. A list that is simply behind the glass (deeper in
|
|
364
364
|
another branch, with no glass inside) is referenced, so it scrolls live without a new capture,
|
|
365
|
+
- an inline container's direct children change (including screen replacement, visibility and
|
|
366
|
+
drawing order), or a child whose transform is drawn inline moves, resizes or changes alpha,
|
|
365
367
|
- a view it left out because it was too far away moves, resizes or scrolls,
|
|
366
368
|
- a glass view is added or removed.
|
|
367
369
|
|
package/android/build.gradle
CHANGED
|
@@ -21,6 +21,7 @@ android {
|
|
|
21
21
|
defaultConfig {
|
|
22
22
|
versionCode 1
|
|
23
23
|
versionName "0.1.0"
|
|
24
|
+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
|
|
24
25
|
}
|
|
25
26
|
buildFeatures {
|
|
26
27
|
compose true
|
|
@@ -36,4 +37,6 @@ dependencies {
|
|
|
36
37
|
// Same Compose version as @expo/ui for this Expo SDK, so apps using both resolve one runtime.
|
|
37
38
|
implementation 'androidx.compose.foundation:foundation-android:1.10.6'
|
|
38
39
|
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'
|
|
39
42
|
}
|
|
@@ -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") {
|
|
16
|
+
Constant("captureRevision") { 4 }
|
|
17
17
|
|
|
18
18
|
View(AndroidGlassView::class) {
|
|
19
19
|
Name("AndroidGlassView")
|
|
@@ -83,8 +83,8 @@ abstract class GlassHostView(context: Context, appContext: AppContext) : ExpoVie
|
|
|
83
83
|
private var dragClaimed = false
|
|
84
84
|
|
|
85
85
|
// Re-sample when the glass moves on screen (layout, an ancestor scrolling, transforms), when a
|
|
86
|
-
// container the capture drew inline
|
|
87
|
-
//
|
|
86
|
+
// container the capture drew inline changed its children, scroll or baked child transforms,
|
|
87
|
+
// or when a view the capture left out (too far away to be seen through the glass)
|
|
88
88
|
// moved and may now be. A list that is only referenced scrolls live, so scrolling it costs no
|
|
89
89
|
// capture. There is deliberately no global-layout listener: React Native lays out on every
|
|
90
90
|
// state change (e.g. each slider tick updating a label), and re-sampling every glass view each
|
|
@@ -68,7 +68,8 @@ internal class ViewBackdrop(private val host: GlassHostView) : Backdrop {
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* Whether the capture is out of date although the host didn't move: something it drew inline
|
|
71
|
-
* (not by reference)
|
|
71
|
+
* (not by reference) changed its children or baked geometry, or a view it left out moved
|
|
72
|
+
* (see ViewBackdropCapture).
|
|
72
73
|
*/
|
|
73
74
|
fun changedSinceCapture(): Boolean = capture?.changedSinceCapture() ?: false
|
|
74
75
|
|
|
@@ -17,6 +17,7 @@ import android.graphics.RectF
|
|
|
17
17
|
import android.os.Build
|
|
18
18
|
import android.view.View
|
|
19
19
|
import android.view.ViewGroup
|
|
20
|
+
import android.view.animation.Animation
|
|
20
21
|
import androidx.annotation.RequiresApi
|
|
21
22
|
import kotlin.math.max
|
|
22
23
|
|
|
@@ -100,12 +101,16 @@ internal class ViewBackdropCapture {
|
|
|
100
101
|
private var bakedScroll = IntArray(32)
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
|
-
*
|
|
104
|
-
*
|
|
104
|
+
* Child lists dispatched inline, rather than through the group's own RenderNode. A screen
|
|
105
|
+
* replacement can discard a referenced child's display list without moving any views.
|
|
105
106
|
*/
|
|
106
|
-
private val
|
|
107
|
+
private val inlineGroups = ArrayList<InlineGroup>()
|
|
108
|
+
|
|
109
|
+
/** Culled children, and children whose transform/clip/alpha we applied ourselves. */
|
|
110
|
+
private val geometryViews = ArrayList<View>()
|
|
111
|
+
private var geometry = FloatArray(GEOMETRY_FIELDS * 16)
|
|
112
|
+
private var geometryTracksAlpha = BooleanArray(16)
|
|
107
113
|
private val culledSet = HashSet<View>()
|
|
108
|
-
private var culledGeometry = FloatArray(GEOMETRY_FIELDS * 16)
|
|
109
114
|
|
|
110
115
|
/** Margin around a view's bounds that its drawing may still reach (shadows, borders), in px. */
|
|
111
116
|
private var cullPadding = 0f
|
|
@@ -113,24 +118,34 @@ internal class ViewBackdropCapture {
|
|
|
113
118
|
|
|
114
119
|
/**
|
|
115
120
|
* Whether the last capture is out of date although the glass itself didn't move: a view whose
|
|
116
|
-
* scroll offset it baked in
|
|
117
|
-
* (and may now reach the glass).
|
|
121
|
+
* scroll offset or transform it baked in changed, an inline group changed its children, or a
|
|
122
|
+
* view it left out moved (and may now reach the glass). RenderNode subtrees stay live without
|
|
123
|
+
* being traversed here. This check allocates nothing.
|
|
118
124
|
*/
|
|
119
125
|
fun changedSinceCapture(): Boolean {
|
|
120
126
|
for (i in bakedViews.indices) {
|
|
121
127
|
val view = bakedViews[i]
|
|
122
128
|
if (view.scrollX != bakedScroll[i * 2] || view.scrollY != bakedScroll[i * 2 + 1]) return true
|
|
123
129
|
}
|
|
124
|
-
for (i in
|
|
125
|
-
if (!hasGeometry(
|
|
130
|
+
for (i in geometryViews.indices) {
|
|
131
|
+
if (!hasGeometry(geometryViews[i], i)) return true
|
|
132
|
+
}
|
|
133
|
+
for (i in inlineGroups.indices) {
|
|
134
|
+
if (inlineGroups[i].hasChanged()) return true
|
|
126
135
|
}
|
|
127
136
|
return false
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
/** Forgets the views of the last capture (they may belong to a window that is going away). */
|
|
131
140
|
fun clear() {
|
|
141
|
+
expanded.clear()
|
|
142
|
+
excluded.clear()
|
|
143
|
+
selfPath.clear()
|
|
144
|
+
path.clear()
|
|
145
|
+
hidden.clear()
|
|
132
146
|
bakedViews.clear()
|
|
133
|
-
|
|
147
|
+
inlineGroups.clear()
|
|
148
|
+
geometryViews.clear()
|
|
134
149
|
culledSet.clear()
|
|
135
150
|
}
|
|
136
151
|
|
|
@@ -143,13 +158,21 @@ internal class ViewBackdropCapture {
|
|
|
143
158
|
}
|
|
144
159
|
|
|
145
160
|
private fun cull(view: View) {
|
|
146
|
-
val offset = culledViews.size * GEOMETRY_FIELDS
|
|
147
|
-
if (culledGeometry.size < offset + GEOMETRY_FIELDS) {
|
|
148
|
-
culledGeometry = culledGeometry.copyOf(culledGeometry.size * 2)
|
|
149
|
-
}
|
|
150
|
-
culledViews.add(view)
|
|
151
161
|
culledSet.add(view)
|
|
152
|
-
|
|
162
|
+
// A fade outside the capture cannot bring any content into it.
|
|
163
|
+
bakeGeometry(view, trackAlpha = false)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
private fun bakeGeometry(view: View, trackAlpha: Boolean = true) {
|
|
167
|
+
val index = geometryViews.size
|
|
168
|
+
val offset = index * GEOMETRY_FIELDS
|
|
169
|
+
if (geometry.size < offset + GEOMETRY_FIELDS) {
|
|
170
|
+
geometry = geometry.copyOf(geometry.size * 2)
|
|
171
|
+
geometryTracksAlpha = geometryTracksAlpha.copyOf(geometryTracksAlpha.size * 2)
|
|
172
|
+
}
|
|
173
|
+
geometryTracksAlpha[index] = trackAlpha
|
|
174
|
+
geometryViews.add(view)
|
|
175
|
+
val g = geometry
|
|
153
176
|
g[offset] = view.left.toFloat()
|
|
154
177
|
g[offset + 1] = view.top.toFloat()
|
|
155
178
|
g[offset + 2] = view.right.toFloat()
|
|
@@ -164,10 +187,15 @@ internal class ViewBackdropCapture {
|
|
|
164
187
|
g[offset + 11] = view.scrollX.toFloat()
|
|
165
188
|
g[offset + 12] = view.scrollY.toFloat()
|
|
166
189
|
g[offset + 13] = view.z
|
|
190
|
+
g[offset + 14] = view.pivotX
|
|
191
|
+
g[offset + 15] = view.pivotY
|
|
192
|
+
g[offset + 16] = view.alpha
|
|
193
|
+
g[offset + 17] = view.cameraDistance
|
|
167
194
|
}
|
|
168
195
|
|
|
169
|
-
private fun hasGeometry(view: View,
|
|
170
|
-
val
|
|
196
|
+
private fun hasGeometry(view: View, index: Int): Boolean {
|
|
197
|
+
val offset = index * GEOMETRY_FIELDS
|
|
198
|
+
val g = geometry
|
|
171
199
|
return g[offset] == view.left.toFloat() &&
|
|
172
200
|
g[offset + 1] == view.top.toFloat() &&
|
|
173
201
|
g[offset + 2] == view.right.toFloat() &&
|
|
@@ -181,7 +209,11 @@ internal class ViewBackdropCapture {
|
|
|
181
209
|
g[offset + 10] == view.rotationY &&
|
|
182
210
|
g[offset + 11] == view.scrollX.toFloat() &&
|
|
183
211
|
g[offset + 12] == view.scrollY.toFloat() &&
|
|
184
|
-
g[offset + 13] == view.z
|
|
212
|
+
g[offset + 13] == view.z &&
|
|
213
|
+
g[offset + 14] == view.pivotX &&
|
|
214
|
+
g[offset + 15] == view.pivotY &&
|
|
215
|
+
(!geometryTracksAlpha[index] || g[offset + 16] == view.alpha) &&
|
|
216
|
+
g[offset + 17] == view.cameraDistance
|
|
185
217
|
}
|
|
186
218
|
|
|
187
219
|
/**
|
|
@@ -191,12 +223,7 @@ internal class ViewBackdropCapture {
|
|
|
191
223
|
* @param glassViews every glass view; the ones outside [source] are ignored.
|
|
192
224
|
*/
|
|
193
225
|
fun draw(canvas: Canvas, source: View, self: View, glassViews: Collection<View>) {
|
|
194
|
-
|
|
195
|
-
excluded.clear()
|
|
196
|
-
selfPath.clear()
|
|
197
|
-
bakedViews.clear()
|
|
198
|
-
culledViews.clear()
|
|
199
|
-
culledSet.clear()
|
|
226
|
+
clear()
|
|
200
227
|
cullPadding = CULL_PADDING_DP * source.resources.displayMetrics.density
|
|
201
228
|
|
|
202
229
|
var ancestor = self.parent
|
|
@@ -239,6 +266,8 @@ internal class ViewBackdropCapture {
|
|
|
239
266
|
}
|
|
240
267
|
|
|
241
268
|
private fun drawLevel(canvas: Canvas, host: View) {
|
|
269
|
+
// Snapshot before temporarily hiding children; otherwise every pre-draw sees a change.
|
|
270
|
+
if (host is ViewGroup) inlineGroups.add(InlineGroup(host))
|
|
242
271
|
if (host is ViewGroup && host in selfPath) {
|
|
243
272
|
drawAncestor(canvas, host)
|
|
244
273
|
return
|
|
@@ -321,6 +350,7 @@ internal class ViewBackdropCapture {
|
|
|
321
350
|
if (child in expanded) {
|
|
322
351
|
drawLevel(canvas, child)
|
|
323
352
|
} else {
|
|
353
|
+
if (child is ViewGroup) inlineGroups.add(InlineGroup(child))
|
|
324
354
|
bakeScroll(child)
|
|
325
355
|
canvas.translate(-child.scrollX.toFloat(), -child.scrollY.toFloat())
|
|
326
356
|
child.draw(canvas)
|
|
@@ -365,6 +395,7 @@ internal class ViewBackdropCapture {
|
|
|
365
395
|
|
|
366
396
|
/** The child's matrix, clip and alpha, as its parent applies them; the canvas is at its left/top. */
|
|
367
397
|
private fun applyChildTransform(canvas: Canvas, child: View, clipChildren: Boolean) {
|
|
398
|
+
bakeGeometry(child)
|
|
368
399
|
val matrix = child.matrix
|
|
369
400
|
if (!matrix.isIdentity) canvas.concat(matrix)
|
|
370
401
|
if (clipChildren) canvas.clipRect(0f, 0f, child.width.toFloat(), child.height.toFloat())
|
|
@@ -389,11 +420,37 @@ internal class ViewBackdropCapture {
|
|
|
389
420
|
return children
|
|
390
421
|
}
|
|
391
422
|
|
|
423
|
+
/** Only the direct dispatch boundary is frozen; descendants keep their live RenderNodes. */
|
|
424
|
+
private class InlineGroup(private val group: ViewGroup) {
|
|
425
|
+
private val count = group.childCount
|
|
426
|
+
private val children = Array(count) { group.getChildAt(it) }
|
|
427
|
+
private val visibility = IntArray(count) { children[it].visibility }
|
|
428
|
+
private val order = IntArray(count) { group.getChildDrawingOrder(it) }
|
|
429
|
+
private val z = FloatArray(count) { children[it].z }
|
|
430
|
+
private val animations = arrayOfNulls<Animation>(count).also { values ->
|
|
431
|
+
for (i in 0 until count) values[i] = children[i].animation
|
|
432
|
+
}
|
|
433
|
+
private val clipChildren = group.clipChildren
|
|
434
|
+
private val clipToPadding = group.clipToPadding
|
|
435
|
+
|
|
436
|
+
fun hasChanged(): Boolean {
|
|
437
|
+
if (group.childCount != count || group.clipChildren != clipChildren ||
|
|
438
|
+
group.clipToPadding != clipToPadding) return true
|
|
439
|
+
for (i in 0 until count) {
|
|
440
|
+
val child = group.getChildAt(i)
|
|
441
|
+
if (child !== children[i] || child.visibility != visibility[i] ||
|
|
442
|
+
group.getChildDrawingOrder(i) != order[i] || child.z != z[i] ||
|
|
443
|
+
child.animation !== animations[i]) return true
|
|
444
|
+
}
|
|
445
|
+
return false
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
392
449
|
companion object {
|
|
393
450
|
private var depth = 0
|
|
394
451
|
|
|
395
|
-
/** Geometry values stored per culled
|
|
396
|
-
private const val GEOMETRY_FIELDS =
|
|
452
|
+
/** Geometry values stored per culled or manually transformed view. */
|
|
453
|
+
private const val GEOMETRY_FIELDS = 18
|
|
397
454
|
|
|
398
455
|
/** How far outside its bounds a view's drawing is assumed to reach (shadows, borders). */
|
|
399
456
|
private const val CULL_PADDING_DP = 8f
|
|
@@ -0,0 +1,4 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassBottomTabs.android.js","sourceRoot":"","sources":["../src/AndroidGlassBottomTabs.android.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAkB1D,MAAM,4BAA4B,GAChC,iBAAiB,CAAC,sBAAsB,EAAE,wBAAwB,CAAC,CAAC;AAEtE,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,EACqB;IAC5B,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC3E,sEAAsE;IACtE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QA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AAS,CAAC;YAC1C,IAAI,eAAe;gBAAE,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACjD,iBAAiB,EAAE,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC,CAAC,CACF;MAAA,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC;QACxB,wFAAwF;QACxF,sFAAsF;QACtF,CAAC,IAAI,CACH,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,KAAK,CAAC,CACtB,WAAW,CAAC,CAAC,KAAK,CAAC,CACnB,aAAa,CAAC,MAAM,CACpB,iBAAiB,CAAC,KAAK,CACvB,kBAAkB,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,KAAK,QAAQ,EAAE,CAAC,CACrD,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAClB;UAAA,CAAC,GAAG,CACN;QAAA,EAAE,IAAI,CAAC,CACR,CAAC,CACJ;IAAA,EAAE,4BAA4B,CAAC,CAChC,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,0FAA0F;IAC1F,GAAG,EAAE;QACH,MAAM,EAAE,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,iBAAiB,EAAE,CAAC;KACrB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,EAAE,CAAC;KACP;CACF,CAAC,CAAC","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"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassBottomTabs.js","sourceRoot":"","sources":["../src/AndroidGlassBottomTabs.tsx"],"names":[],"mappings":"AAAA,OAAO,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AM,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"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { StyleSheet, Text } from 'react-native';
|
|
4
|
+
import { toNativeColor } from './utils';
|
|
5
|
+
const NativeAndroidGlassButton = requireNativeView('ExpoAndroidGlassView', 'AndroidGlassButton');
|
|
6
|
+
export default function AndroidGlassButton({ onPress, title, titleStyle, cornerRadius, tintColor, surfaceColor, fallbackColor, style, children, ...rest }) {
|
|
7
|
+
const borderRadius = StyleSheet.flatten(style)?.borderRadius;
|
|
8
|
+
return (<NativeAndroidGlassButton accessibilityRole="button" {...rest} style={[styles.button, style]} cornerRadius={cornerRadius ?? (typeof borderRadius === 'number' ? borderRadius : undefined)} tintColor={toNativeColor(tintColor)} surfaceColor={toNativeColor(surfaceColor)} fallbackColor={toNativeColor(fallbackColor)} onPress={onPress ? () => onPress() : undefined}>
|
|
9
|
+
{title != null ? (<Text style={[styles.title, tintColor != null && styles.titleOnTint, titleStyle]}>
|
|
10
|
+
{title}
|
|
11
|
+
</Text>) : null}
|
|
12
|
+
{children}
|
|
13
|
+
</NativeAndroidGlassButton>);
|
|
14
|
+
}
|
|
15
|
+
const styles = StyleSheet.create({
|
|
16
|
+
button: {
|
|
17
|
+
height: 48,
|
|
18
|
+
paddingHorizontal: 16,
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
gap: 8,
|
|
23
|
+
},
|
|
24
|
+
title: {
|
|
25
|
+
fontSize: 15,
|
|
26
|
+
color: '#000000',
|
|
27
|
+
},
|
|
28
|
+
titleOnTint: {
|
|
29
|
+
color: '#ffffff',
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=AndroidGlassButton.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassButton.android.js","sourceRoot":"","sources":["../src/AndroidGlassButton.android.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGhD,OAAO,EAAoB,aAAa,EAAE,MAAM,SAAS,CAAC;AAY1D,MAAM,wBAAwB,GAC5B,iBAAiB,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;AAElE,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,EACiB;IACxB,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAC7D,OAAO,CACL,CAAC,wBAAwB,C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","sourcesContent":["import { requireNativeView } from 'expo';\nimport * as React from 'react';\nimport { StyleSheet, Text } from 'react-native';\n\nimport type { AndroidGlassButtonProps } from './AndroidGlassComponents.types';\nimport { type NativeColor, toNativeColor } from './utils';\n\ntype NativeAndroidGlassButtonProps = Omit<\n AndroidGlassButtonProps,\n 'tintColor' | 'surfaceColor' | 'fallbackColor' | 'onPress' | 'title' | 'titleStyle'\n> & {\n tintColor?: NativeColor;\n surfaceColor?: NativeColor;\n fallbackColor?: NativeColor;\n onPress?: () => void;\n};\n\nconst NativeAndroidGlassButton: React.ComponentType<NativeAndroidGlassButtonProps> =\n requireNativeView('ExpoAndroidGlassView', 'AndroidGlassButton');\n\nexport default function AndroidGlassButton({\n onPress,\n title,\n titleStyle,\n cornerRadius,\n tintColor,\n surfaceColor,\n fallbackColor,\n style,\n children,\n ...rest\n}: AndroidGlassButtonProps) {\n const borderRadius = StyleSheet.flatten(style)?.borderRadius;\n return (\n <NativeAndroidGlassButton\n accessibilityRole=\"button\"\n {...rest}\n style={[styles.button, style]}\n cornerRadius={cornerRadius ?? (typeof borderRadius === 'number' ? borderRadius : undefined)}\n tintColor={toNativeColor(tintColor)}\n surfaceColor={toNativeColor(surfaceColor)}\n fallbackColor={toNativeColor(fallbackColor)}\n onPress={onPress ? () => onPress() : undefined}>\n {title != null ? (\n <Text style={[styles.title, tintColor != null && styles.titleOnTint, titleStyle]}>\n {title}\n </Text>\n ) : null}\n {children}\n </NativeAndroidGlassButton>\n );\n}\n\nconst styles = StyleSheet.create({\n button: {\n height: 48,\n paddingHorizontal: 16,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n },\n title: {\n fontSize: 15,\n color: '#000000',\n },\n titleOnTint: {\n color: '#ffffff',\n },\n});\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { AndroidGlassButtonProps } from './AndroidGlassComponents.types';
|
|
3
|
+
/** iOS and web fallback: a translucent capsule button with the same API. */
|
|
4
|
+
export default function AndroidGlassButton({ onPress, title, titleStyle, cornerRadius, tintColor, surfaceColor, fallbackColor, style, children, blurRadius: _blurRadius, refractionHeight: _refractionHeight, refractionAmount: _refractionAmount, chromaticAberration: _chromaticAberration, depthEffect: _depthEffect, vibrancy: _vibrancy, highlight: _highlight, shadow: _shadow, interactive: _interactive, ...rest }: AndroidGlassButtonProps): React.JSX.Element;
|
|
5
|
+
//# sourceMappingURL=AndroidGlassButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassButton.d.ts","sourceRoot":"","sources":["../src/AndroidGlassButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAI9E,4EAA4E;AAC5E,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,UAAU,EAAE,WAAW,EACvB,gBAAgB,EAAE,iBAAiB,EACnC,gBAAgB,EAAE,iBAAiB,EACnC,mBAAmB,EAAE,oBAAoB,EACzC,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,SAAS,EACnB,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,YAAY,EACzB,GAAG,IAAI,EACR,EAAE,uBAAuB,qBAuBzB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, Text } from 'react-native';
|
|
3
|
+
const DEFAULT_FALLBACK_COLOR = 'rgba(255, 255, 255, 0.7)';
|
|
4
|
+
/** iOS and web fallback: a translucent capsule button with the same API. */
|
|
5
|
+
export default function AndroidGlassButton({ onPress, title, titleStyle, cornerRadius, tintColor, surfaceColor, fallbackColor, style, children, blurRadius: _blurRadius, refractionHeight: _refractionHeight, refractionAmount: _refractionAmount, chromaticAberration: _chromaticAberration, depthEffect: _depthEffect, vibrancy: _vibrancy, highlight: _highlight, shadow: _shadow, interactive: _interactive, ...rest }) {
|
|
6
|
+
return (<Pressable accessibilityRole="button" {...rest} onPress={onPress} style={({ pressed }) => [
|
|
7
|
+
styles.button,
|
|
8
|
+
{
|
|
9
|
+
backgroundColor: tintColor ?? surfaceColor ?? fallbackColor ?? DEFAULT_FALLBACK_COLOR,
|
|
10
|
+
borderRadius: cornerRadius ?? 999,
|
|
11
|
+
opacity: pressed ? 0.75 : 1,
|
|
12
|
+
},
|
|
13
|
+
style,
|
|
14
|
+
]}>
|
|
15
|
+
{title != null ? (<Text style={[styles.title, tintColor != null && styles.titleOnTint, titleStyle]}>
|
|
16
|
+
{title}
|
|
17
|
+
</Text>) : null}
|
|
18
|
+
{children}
|
|
19
|
+
</Pressable>);
|
|
20
|
+
}
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
button: {
|
|
23
|
+
height: 48,
|
|
24
|
+
paddingHorizontal: 16,
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
|
+
gap: 8,
|
|
29
|
+
},
|
|
30
|
+
title: {
|
|
31
|
+
fontSize: 15,
|
|
32
|
+
color: '#000000',
|
|
33
|
+
},
|
|
34
|
+
titleOnTint: {
|
|
35
|
+
color: '#ffffff',
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=AndroidGlassButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassButton.js","sourceRoot":"","sources":["../src/AndroidGlassButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;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MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,EAAE;QACrB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,EAAE,CAAC;KACP;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE,SAAS;KACjB;IACD,WAAW,EAAE;QACX,KAAK,EAAE,SAAS;KACjB;CACF,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { Pressable, StyleSheet, Text } from 'react-native';\n\nimport type { AndroidGlassButtonProps } from './AndroidGlassComponents.types';\n\nconst DEFAULT_FALLBACK_COLOR = 'rgba(255, 255, 255, 0.7)';\n\n/** iOS and web fallback: a translucent capsule button with the same API. */\nexport default function AndroidGlassButton({\n onPress,\n title,\n titleStyle,\n cornerRadius,\n tintColor,\n surfaceColor,\n fallbackColor,\n style,\n children,\n blurRadius: _blurRadius,\n refractionHeight: _refractionHeight,\n refractionAmount: _refractionAmount,\n chromaticAberration: _chromaticAberration,\n depthEffect: _depthEffect,\n vibrancy: _vibrancy,\n highlight: _highlight,\n shadow: _shadow,\n interactive: _interactive,\n ...rest\n}: AndroidGlassButtonProps) {\n return (\n <Pressable\n accessibilityRole=\"button\"\n {...rest}\n onPress={onPress}\n style={({ pressed }) => [\n styles.button,\n {\n backgroundColor: tintColor ?? surfaceColor ?? fallbackColor ?? DEFAULT_FALLBACK_COLOR,\n borderRadius: cornerRadius ?? 999,\n opacity: pressed ? 0.75 : 1,\n },\n style,\n ]}>\n {title != null ? (\n <Text style={[styles.title, tintColor != null && styles.titleOnTint, titleStyle]}>\n {title}\n </Text>\n ) : null}\n {children}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n button: {\n height: 48,\n paddingHorizontal: 16,\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 8,\n },\n title: {\n fontSize: 15,\n color: '#000000',\n },\n titleOnTint: {\n color: '#ffffff',\n },\n});\n"]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ColorValue, StyleProp, TextStyle, ViewProps } from 'react-native';
|
|
3
|
+
import type { AndroidGlassViewProps } from './AndroidGlassView.types';
|
|
4
|
+
/**
|
|
5
|
+
* Accepts every `AndroidGlassView` glass prop. `cornerRadius` defaults to a capsule.
|
|
6
|
+
* Children (label, icon, …) are drawn inside the glass and follow its press deformation; they
|
|
7
|
+
* are decorative, so don't put interactive elements in a button.
|
|
8
|
+
*/
|
|
9
|
+
export type AndroidGlassButtonProps = AndroidGlassViewProps & {
|
|
10
|
+
/** Called when the button is tapped. */
|
|
11
|
+
onPress?: () => void;
|
|
12
|
+
/** Convenience label, rendered before the children. */
|
|
13
|
+
title?: string;
|
|
14
|
+
titleStyle?: StyleProp<TextStyle>;
|
|
15
|
+
/**
|
|
16
|
+
* Press and drag feedback: the glass stretches towards the finger and a highlight follows it.
|
|
17
|
+
* Default true.
|
|
18
|
+
*/
|
|
19
|
+
interactive?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type AndroidGlassToggleProps = ViewProps & {
|
|
22
|
+
value?: boolean;
|
|
23
|
+
onValueChange?: (value: boolean) => void;
|
|
24
|
+
/** Track colour when on. Default iOS green. */
|
|
25
|
+
accentColor?: ColorValue;
|
|
26
|
+
/** Track colour when off. */
|
|
27
|
+
trackColor?: ColorValue;
|
|
28
|
+
};
|
|
29
|
+
export type AndroidGlassSliderProps = ViewProps & {
|
|
30
|
+
value?: number;
|
|
31
|
+
/** Default 0. */
|
|
32
|
+
minimumValue?: number;
|
|
33
|
+
/** Default 1. */
|
|
34
|
+
maximumValue?: number;
|
|
35
|
+
/** Called continuously while the thumb is dragged. */
|
|
36
|
+
onValueChange?: (value: number) => void;
|
|
37
|
+
/** Called once when the finger is lifted, or after a tap on the track. */
|
|
38
|
+
onSlidingComplete?: (value: number) => void;
|
|
39
|
+
/** Colour of the filled part of the track. Default system blue. */
|
|
40
|
+
accentColor?: ColorValue;
|
|
41
|
+
trackColor?: ColorValue;
|
|
42
|
+
};
|
|
43
|
+
export type AndroidGlassBottomTabsProps = ViewProps & {
|
|
44
|
+
/** Index of the selected tab. */
|
|
45
|
+
selectedIndex?: number;
|
|
46
|
+
/** Called when the user taps a tab or drops the droplet on one. */
|
|
47
|
+
onTabSelected?: (index: number) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Minimizes the bar (an addition of this package): it gets shorter and narrower, each tab keeps
|
|
50
|
+
* only its first child (the icon) and the rest (the label) fades out. Animated natively. Inside a
|
|
51
|
+
* `MinimizeOnScrollProvider`, leave it out: the bar follows the provider. Android only.
|
|
52
|
+
*/
|
|
53
|
+
minimized?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Called with `false` when the user expands the minimized bar by touching it. With
|
|
56
|
+
* `useMinimizeOnScroll`, pass its `setMinimized`; inside a `MinimizeOnScrollProvider` it isn't
|
|
57
|
+
* needed.
|
|
58
|
+
*/
|
|
59
|
+
onMinimizedChange?: (minimized: boolean) => void;
|
|
60
|
+
/** Colour the selected tab's content takes under the droplet. Default system blue. */
|
|
61
|
+
accentColor?: ColorValue;
|
|
62
|
+
/** Colour of the glass bar. */
|
|
63
|
+
containerColor?: ColorValue;
|
|
64
|
+
/** One child per tab, e.g. `AndroidGlassTab`. Tabs get equal widths. */
|
|
65
|
+
children?: ReactNode;
|
|
66
|
+
};
|
|
67
|
+
export type AndroidGlassTabProps = {
|
|
68
|
+
icon?: ReactNode;
|
|
69
|
+
label?: string;
|
|
70
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=AndroidGlassComponents.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassComponents.types.d.ts","sourceRoot":"","sources":["../src/AndroidGlassComponents.types.ts"],"names":[],"mappings":"AAA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GAAG;IACpD,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mEAAmE;IACnE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,sFAAsF;IACtF,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidGlassComponents.types.js","sourceRoot":"","sources":["../src/AndroidGlassComponents.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\nimport type { ColorValue, StyleProp, TextStyle, ViewProps } from 'react-native';\n\nimport type { AndroidGlassViewProps } from './AndroidGlassView.types';\n\n/**\n * Accepts every `AndroidGlassView` glass prop. `cornerRadius` defaults to a capsule.\n * Children (label, icon, …) are drawn inside the glass and follow its press deformation; they\n * are decorative, so don't put interactive elements in a button.\n */\nexport type AndroidGlassButtonProps = AndroidGlassViewProps & {\n /** Called when the button is tapped. */\n onPress?: () => void;\n /** Convenience label, rendered before the children. */\n title?: string;\n titleStyle?: StyleProp<TextStyle>;\n /**\n * Press and drag feedback: the glass stretches towards the finger and a highlight follows it.\n * Default true.\n */\n interactive?: boolean;\n};\n\nexport type AndroidGlassToggleProps = ViewProps & {\n value?: boolean;\n onValueChange?: (value: boolean) => void;\n /** Track colour when on. Default iOS green. */\n accentColor?: ColorValue;\n /** Track colour when off. */\n trackColor?: ColorValue;\n};\n\nexport type AndroidGlassSliderProps = ViewProps & {\n value?: number;\n /** Default 0. */\n minimumValue?: number;\n /** Default 1. */\n maximumValue?: number;\n /** Called continuously while the thumb is dragged. */\n onValueChange?: (value: number) => void;\n /** Called once when the finger is lifted, or after a tap on the track. */\n onSlidingComplete?: (value: number) => void;\n /** Colour of the filled part of the track. Default system blue. */\n accentColor?: ColorValue;\n trackColor?: ColorValue;\n};\n\nexport type AndroidGlassBottomTabsProps = ViewProps & {\n /** Index of the selected tab. */\n selectedIndex?: number;\n /** Called when the user taps a tab or drops the droplet on one. */\n onTabSelected?: (index: number) => void;\n /**\n * Minimizes the bar (an addition of this package): it gets shorter and narrower, each tab keeps\n * only its first child (the icon) and the rest (the label) fades out. Animated natively. Inside a\n * `MinimizeOnScrollProvider`, leave it out: the bar follows the provider. Android only.\n */\n minimized?: boolean;\n /**\n * Called with `false` when the user expands the minimized bar by touching it. With\n * `useMinimizeOnScroll`, pass its `setMinimized`; inside a `MinimizeOnScrollProvider` it isn't\n * needed.\n */\n onMinimizedChange?: (minimized: boolean) => void;\n /** Colour the selected tab's content takes under the droplet. Default system blue. */\n accentColor?: ColorValue;\n /** Colour of the glass bar. */\n containerColor?: ColorValue;\n /** One child per tab, e.g. `AndroidGlassTab`. Tabs get equal widths. */\n children?: ReactNode;\n};\n\nexport type AndroidGlassTabProps = {\n icon?: ReactNode;\n label?: string;\n labelStyle?: StyleProp<TextStyle>;\n};\n"]}
|