liquid-glass-native-tab-kit 0.1.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/LICENSE +21 -0
- package/README.md +109 -0
- package/package.json +48 -0
- package/src/NativeTabsKit.js +101 -0
- package/src/index.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Talha Rasool
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# liquid-glass-native-tab-kit
|
|
2
|
+
|
|
3
|
+
A cross-platform React Native bottom tab bar built on the **real native `UITabBar`**.
|
|
4
|
+
|
|
5
|
+
Because it uses the actual platform tab bar on iOS, you get Apple's **native Liquid Glass** effect for free on **iOS 26+** — the translucent, light-bending, blurred tab bar — with zero extra configuration. Not a fake blur view, not an approximation. The real thing, rendered by the OS.
|
|
6
|
+
|
|
7
|
+
It also bakes in the practical workarounds you need when a native tab bar *won't* let you style things the JS way:
|
|
8
|
+
|
|
9
|
+
- 🎯 **Custom-sized icons** — resize/pad them in the asset, not in code
|
|
10
|
+
- 🔁 **Active / inactive icons** — swap images or just recolor with a tint
|
|
11
|
+
- 🎨 **Reliable tint colors on iOS** — via `experimental_bakedTintColors`
|
|
12
|
+
- 🍎 **Native Liquid Glass on iOS 26+** — inherited from the OS tab bar
|
|
13
|
+
- 🤖 **Graceful Android fallback** — JS tab bar with focus-based icon swapping
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why this exists
|
|
18
|
+
|
|
19
|
+
Native tab bars look and feel great — and on iOS 26 they render in Liquid Glass automatically. The catch: because they're **real native components**, you can't just set `fontSize`, resize an icon, or expect a `tintColor` to apply the way you would with a JS-drawn tab bar. Those props simply don't reach the native view.
|
|
20
|
+
|
|
21
|
+
This package packages the three fixes that actually work:
|
|
22
|
+
|
|
23
|
+
### 1. Can't change the icon size or text? Change the asset.
|
|
24
|
+
The native bar renders your icon at its own scale. Instead of fighting it in code, **export the icon at the exact size and padding you want from Figma** and ship that image (`@2x` / `@3x`). What you upload is what you get.
|
|
25
|
+
|
|
26
|
+
### 2. Active vs. inactive icons
|
|
27
|
+
Two ways, both supported:
|
|
28
|
+
- **One template image + tint color** — let `activeTintColor` / `inactiveTintColor` do the work (recommended for iOS).
|
|
29
|
+
- **Separate `activeIcon` / `inactiveIcon` images** — used on Android, where the JS tab bar re-renders on focus and can swap them.
|
|
30
|
+
|
|
31
|
+
### 3. The tint color won't apply on iOS → `experimental_bakedTintColors`
|
|
32
|
+
On iOS the native `UITabBar` renders your icons as-is and **ignores the active/inactive tint** unless you tell the library to *bake* the tint into the icons. That one flag is the difference between "my colors do nothing" and "it just works":
|
|
33
|
+
|
|
34
|
+
```jsx
|
|
35
|
+
<NativeTab.Navigator experimental_bakedTintColors>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`native-tabs-kit` sets this for you (on by default).
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
npm install liquid-glass-native-tab-kit @bottom-tabs/react-navigation @react-navigation/bottom-tabs
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`@bottom-tabs/react-navigation`, `@react-navigation/bottom-tabs`, `react`, and `react-native` are peer dependencies.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
```jsx
|
|
55
|
+
import { NativeTabsKit } from "liquid-glass-native-tab-kit";
|
|
56
|
+
import Home from "./Home";
|
|
57
|
+
import Wallet from "./Wallet";
|
|
58
|
+
import Settings from "./Settings";
|
|
59
|
+
|
|
60
|
+
const screens = [
|
|
61
|
+
{ name: "Home", component: Home, icon: require("./icons/home.png") },
|
|
62
|
+
{ name: "Wallet", component: Wallet, icon: require("./icons/wallet.png") },
|
|
63
|
+
{
|
|
64
|
+
name: "Settings",
|
|
65
|
+
component: Settings,
|
|
66
|
+
// optional: separate art per state (used on Android)
|
|
67
|
+
activeIcon: require("./icons/settings-active.png"),
|
|
68
|
+
inactiveIcon: require("./icons/settings.png"),
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
export default function Tabs() {
|
|
73
|
+
return (
|
|
74
|
+
<NativeTabsKit
|
|
75
|
+
screens={screens}
|
|
76
|
+
activeTintColor="#0A84FF"
|
|
77
|
+
inactiveTintColor="#8E8E93"
|
|
78
|
+
initialRouteName="Home"
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Wrap it in a `NavigationContainer` as usual.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Props
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Default | Description |
|
|
91
|
+
| --- | --- | --- | --- |
|
|
92
|
+
| `screens` | `Array` | `[]` | `{ name, component, icon, activeIcon?, inactiveIcon? }` per tab |
|
|
93
|
+
| `activeTintColor` | `string` | — | Tint for the focused tab |
|
|
94
|
+
| `inactiveTintColor` | `string` | `"#8E8E93"` | Tint for unfocused tabs |
|
|
95
|
+
| `initialRouteName` | `string` | — | Starting tab |
|
|
96
|
+
| `backgroundColor` | `string` | `"#fff"` | Android tab bar background (iOS uses native Liquid Glass) |
|
|
97
|
+
| `screenProps` | `object` | `{}` | Extra props spread into every screen |
|
|
98
|
+
| `bakedTintColors` | `boolean` | `true` | iOS: bake tint into icons so active/inactive colors apply |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Notes
|
|
103
|
+
|
|
104
|
+
- Ships as source (JSX). Metro transpiles it from `node_modules` automatically — no build step required.
|
|
105
|
+
- Liquid Glass is provided by the OS on iOS 26+. On older iOS it renders the standard native tab bar.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
MIT © Talha Rasool
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "liquid-glass-native-tab-kit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A cross-platform React Native bottom tab bar built on the real native UITabBar — get Apple's native Liquid Glass effect for free on iOS 26+, plus custom-sized icons, active/inactive icon swapping, and reliable tint colors via experimental_bakedTintColors.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react-native",
|
|
7
|
+
"bottom-tabs",
|
|
8
|
+
"native-tabs",
|
|
9
|
+
"tab-bar",
|
|
10
|
+
"navigation",
|
|
11
|
+
"liquid-glass",
|
|
12
|
+
"ios26",
|
|
13
|
+
"expo",
|
|
14
|
+
"ios",
|
|
15
|
+
"android",
|
|
16
|
+
"tint-color",
|
|
17
|
+
"experimental_bakedTintColors"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Talha Rasool <talharasool700@gmail.com>",
|
|
21
|
+
"main": "src/index.js",
|
|
22
|
+
"files": [
|
|
23
|
+
"src",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"prepublishOnly": "echo \"Ship the source directly — Metro transpiles JSX from node_modules.\""
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@bottom-tabs/react-navigation": ">=0.9.0",
|
|
32
|
+
"@react-navigation/bottom-tabs": ">=6.0.0",
|
|
33
|
+
"react": "*",
|
|
34
|
+
"react-native": "*"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"@bottom-tabs/react-navigation": {
|
|
38
|
+
"optional": false
|
|
39
|
+
},
|
|
40
|
+
"@react-navigation/bottom-tabs": {
|
|
41
|
+
"optional": false
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"repository": {
|
|
45
|
+
"type": "git",
|
|
46
|
+
"url": ""
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createNativeBottomTabNavigator } from "@bottom-tabs/react-navigation";
|
|
2
|
+
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Image, Platform } from "react-native";
|
|
5
|
+
|
|
6
|
+
const NativeTab = createNativeBottomTabNavigator();
|
|
7
|
+
const JsTab = createBottomTabNavigator();
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* NativeTabsKit
|
|
11
|
+
*
|
|
12
|
+
* A cross-platform bottom tab bar.
|
|
13
|
+
*
|
|
14
|
+
* On iOS it renders the REAL native UITabBar (via @bottom-tabs/react-navigation),
|
|
15
|
+
* which means you get Apple's native Liquid Glass effect for free on iOS 26+ —
|
|
16
|
+
* the translucent, light-bending tab bar — with no extra config.
|
|
17
|
+
*
|
|
18
|
+
* Because it's a native tab bar, you can't resize icons or text from JS the way
|
|
19
|
+
* you can with the JS tab bar. The intended workaround is baked in:
|
|
20
|
+
* 1. Ship the icon at the exact size/padding you want (export from Figma).
|
|
21
|
+
* 2. Provide ONE template image per tab and let the tint color handle the
|
|
22
|
+
* active/inactive states — enabled reliably via experimental_bakedTintColors.
|
|
23
|
+
* 3. Or provide separate active/inactive images (used on Android, where the
|
|
24
|
+
* JS tab bar can swap on focus).
|
|
25
|
+
*
|
|
26
|
+
* @param {Object} props
|
|
27
|
+
* @param {Array} props.screens [{ name, component, icon, activeIcon?, inactiveIcon? }]
|
|
28
|
+
* @param {string} props.activeTintColor tint for the focused tab
|
|
29
|
+
* @param {string} props.inactiveTintColor tint for unfocused tabs
|
|
30
|
+
* @param {string} [props.initialRouteName]
|
|
31
|
+
* @param {string} [props.backgroundColor] Android tab bar background (iOS uses native Liquid Glass)
|
|
32
|
+
* @param {Object} [props.screenProps] extra props spread into every screen
|
|
33
|
+
* @param {boolean}[props.bakedTintColors] iOS: bake tint into icons so active/inactive colors apply (default true)
|
|
34
|
+
*/
|
|
35
|
+
export default function NativeTabsKit({
|
|
36
|
+
screens = [],
|
|
37
|
+
activeTintColor,
|
|
38
|
+
inactiveTintColor = "#8E8E93",
|
|
39
|
+
initialRouteName,
|
|
40
|
+
backgroundColor = "#fff",
|
|
41
|
+
screenProps = {},
|
|
42
|
+
bakedTintColors = true,
|
|
43
|
+
}) {
|
|
44
|
+
if (Platform.OS === "ios") {
|
|
45
|
+
return (
|
|
46
|
+
<NativeTab.Navigator
|
|
47
|
+
tabBarActiveTintColor={activeTintColor}
|
|
48
|
+
tabBarInactiveTintColor={inactiveTintColor}
|
|
49
|
+
screenOptions={{ headerShown: false }}
|
|
50
|
+
initialRouteName={initialRouteName}
|
|
51
|
+
// The key line: without this the native UITabBar renders your icons
|
|
52
|
+
// as-is and ignores active/inactive tint. Baking the tint in makes the
|
|
53
|
+
// colors actually apply.
|
|
54
|
+
experimental_bakedTintColors={bakedTintColors}
|
|
55
|
+
>
|
|
56
|
+
{screens.map(({ name, component: Screen, icon, activeIcon }) => (
|
|
57
|
+
<NativeTab.Screen
|
|
58
|
+
key={name}
|
|
59
|
+
name={name}
|
|
60
|
+
options={{ tabBarIcon: () => activeIcon || icon }}
|
|
61
|
+
>
|
|
62
|
+
{(props) => <Screen {...props} {...screenProps} />}
|
|
63
|
+
</NativeTab.Screen>
|
|
64
|
+
))}
|
|
65
|
+
</NativeTab.Navigator>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Android: JS tab bar. It re-renders per focus, so we can swap active/inactive
|
|
70
|
+
// images AND apply tintColor.
|
|
71
|
+
return (
|
|
72
|
+
<JsTab.Navigator
|
|
73
|
+
initialRouteName={initialRouteName}
|
|
74
|
+
screenOptions={({ route }) => ({
|
|
75
|
+
headerShown: false,
|
|
76
|
+
tabBarActiveTintColor: activeTintColor,
|
|
77
|
+
tabBarInactiveTintColor: inactiveTintColor,
|
|
78
|
+
tabBarStyle: { backgroundColor },
|
|
79
|
+
tabBarIcon: ({ focused, color, size }) => {
|
|
80
|
+
const screen = screens.find((s) => s.name === route.name);
|
|
81
|
+
const source = focused
|
|
82
|
+
? screen?.activeIcon || screen?.icon
|
|
83
|
+
: screen?.inactiveIcon || screen?.icon;
|
|
84
|
+
return (
|
|
85
|
+
<Image
|
|
86
|
+
source={source}
|
|
87
|
+
style={{ width: size, height: size, tintColor: color }}
|
|
88
|
+
resizeMode="contain"
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
})}
|
|
93
|
+
>
|
|
94
|
+
{screens.map(({ name, component: Screen }) => (
|
|
95
|
+
<JsTab.Screen key={name} name={name}>
|
|
96
|
+
{(props) => <Screen {...props} {...screenProps} />}
|
|
97
|
+
</JsTab.Screen>
|
|
98
|
+
))}
|
|
99
|
+
</JsTab.Navigator>
|
|
100
|
+
);
|
|
101
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, default as NativeTabsKit } from "./NativeTabsKit";
|