@astratra/native-ui 1.2.0 → 1.3.0
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/package.json +2 -2
- package/src/components/TabBar.js +10 -6
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astratra/native-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Mobile UI kit for React Native / Expo: Apple's Liquid Glass on iOS and a calibrated visible surface on Android, glass buttons, pale cards, bars that fold on scroll, an Instagram-style tab bar, a collapsible header, a Markdown renderer for AI answers, pictures (natural-ratio images revealed gently, a shimmer placeholder, a full-screen viewer with pinch, double-tap and pull-to-close), and a thumbs up/down feedback bar for AI answers. Pure rules exported separately and tested in plain Node.",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=
|
|
6
|
+
"node": ">=22"
|
|
7
7
|
},
|
|
8
8
|
"main": "src/index.js",
|
|
9
9
|
"types": "src/index.d.ts",
|
package/src/components/TabBar.js
CHANGED
|
@@ -47,6 +47,10 @@ const DEFAULT_COLORS = {
|
|
|
47
47
|
light: { active: '#0d1235', idle: '#343a52', pill: 'rgba(13,18,53,0.08)', badge: '#e5484d', badgeRing: '#fdfdff' },
|
|
48
48
|
dark: { active: '#ffffff', idle: 'rgba(255,255,255,0.9)', pill: 'rgba(255,255,255,0.16)', badge: '#e5484d', badgeRing: '#1c1c1e' }
|
|
49
49
|
};
|
|
50
|
+
/* A label follows the phone's text size only so far, and shrinks rather than
|
|
51
|
+
leave its cell: at the largest sizes a long word filled the pill and ran into
|
|
52
|
+
its neighbours. */
|
|
53
|
+
const LABEL_FIT = { numberOfLines: 1, maxFontSizeMultiplier: 1.15, adjustsFontSizeToFit: true, minimumFontScale: 0.8 };
|
|
50
54
|
/* A quick spring, without a marked bounce. */
|
|
51
55
|
const SLIDE = { damping: 20, stiffness: 260, mass: 0.7 };
|
|
52
56
|
|
|
@@ -69,7 +73,7 @@ const styles = {
|
|
|
69
73
|
white slab the glass replaced. The clipping keeps the rounding. */
|
|
70
74
|
glass: { overflow: 'hidden' },
|
|
71
75
|
row: { flex: 1, flexDirection: 'row', alignItems: 'center', paddingHorizontal: TAB_ROW_MARGIN },
|
|
72
|
-
tab: { flex: 1, alignItems: 'center', justifyContent: 'center', gap: 4 },
|
|
76
|
+
tab: { flex: 1, alignItems: 'center', justifyContent: 'center', gap: 4, paddingHorizontal: 4 },
|
|
73
77
|
iconStack: { minWidth: 30, height: 24, alignItems: 'center', justifyContent: 'center' },
|
|
74
78
|
badge: {
|
|
75
79
|
position: 'absolute',
|
|
@@ -192,9 +196,9 @@ function TabBar({
|
|
|
192
196
|
glassEffectStyle: 'regular',
|
|
193
197
|
/* A tint in the glass, or the page's coloured cards show through
|
|
194
198
|
the bar and the labels vanish — glaring in dark mode. `clear`
|
|
195
|
-
glass let them scramble the labels;
|
|
196
|
-
|
|
197
|
-
tintColor: scheme === 'dark' ? 'rgba(0,0,0,0.
|
|
199
|
+
glass let them scramble the labels; a lighter tint still let the
|
|
200
|
+
page's text be read through the bar, seen on a phone. */
|
|
201
|
+
tintColor: scheme === 'dark' ? 'rgba(0,0,0,0.82)' : 'rgba(255,255,255,0.72)',
|
|
198
202
|
/* The APP's theme, not the phone's. */
|
|
199
203
|
colorScheme: scheme,
|
|
200
204
|
style: RN.StyleSheet.absoluteFill
|
|
@@ -296,7 +300,7 @@ function TabItem({ tab, active, onSelect, scale, fold, palette, testID }) {
|
|
|
296
300
|
),
|
|
297
301
|
h(
|
|
298
302
|
AnimatedText,
|
|
299
|
-
{
|
|
303
|
+
{ ...LABEL_FIT, style: [styles.label, { color, fontSize: 10 * scale }, active ? styles.labelActive : null, labelStyle] },
|
|
300
304
|
tab.label
|
|
301
305
|
)
|
|
302
306
|
)
|
|
@@ -337,7 +341,7 @@ function CenterTab({ tab, onSelect, fold, scale, palette, renderCenter, testID }
|
|
|
337
341
|
),
|
|
338
342
|
h(
|
|
339
343
|
AnimatedText,
|
|
340
|
-
{
|
|
344
|
+
{ ...LABEL_FIT, style: [styles.label, { color: palette.idle, fontSize: 10 * scale, marginTop: 1 }, labelStyle] },
|
|
341
345
|
tab.label
|
|
342
346
|
)
|
|
343
347
|
);
|