Created
July 1, 2026 15:08
-
-
Save fav-devs/f7740e4cc680d9cc0061e8ec4fe39c50 to your computer and use it in GitHub Desktop.
IOS like tabbar for android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Home, Search, Plus, CheckSquare, GraduationCap } from "lucide-react-native"; | |
| import React from "react"; | |
| import { Pressable, StyleSheet, View } from "react-native"; | |
| import Animated, { interpolate, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated"; | |
| import { BlurView } from "expo-blur"; | |
| const tabs = [Home, Search, Plus, CheckSquare, GraduationCap]; | |
| export function GlassTabBar({ activeIndex, onChange }: { | |
| activeIndex: number; | |
| onChange: (index: number) => void; | |
| }) { | |
| const progress = useSharedValue(activeIndex); | |
| React.useEffect(() => { | |
| progress.value = withTiming(activeIndex, { duration: 220 }); | |
| }, [activeIndex]); | |
| const indicatorStyle = useAnimatedStyle(() => ({ | |
| transform: [{ translateX: progress.value * 64 }], | |
| })); | |
| return ( | |
| <View style={styles.wrap}> | |
| <BlurView intensity={35} tint="systemChromeMaterial" style={styles.blur}> | |
| <Animated.View style={[styles.indicator, indicatorStyle]} /> | |
| {tabs.map((Icon, index) => { | |
| const active = index === activeIndex; | |
| const isPlus = index === 2; | |
| return ( | |
| <Pressable key={index} onPress={() => onChange(index)} style={styles.item}> | |
| <View style={[isPlus && styles.plus]}> | |
| <Icon | |
| size={isPlus ? 22 : 21} | |
| color={isPlus ? "#fff" : active ? "#111827" : "rgba(0,0,0,0.45)"} | |
| strokeWidth={active ? 2.6 : 2.1} | |
| /> | |
| </View> | |
| </Pressable> | |
| ); | |
| })} | |
| </BlurView> | |
| </View> | |
| ); | |
| } | |
| const styles = StyleSheet.create({ | |
| wrap: { | |
| position: "absolute", | |
| left: 28, | |
| right: 28, | |
| bottom: 28, | |
| alignItems: "center", | |
| }, | |
| blur: { | |
| width: 320, | |
| height: 58, | |
| borderRadius: 29, | |
| overflow: "hidden", | |
| flexDirection: "row", | |
| padding: 6, | |
| backgroundColor: "rgba(255,255,255,0.18)", | |
| shadowColor: "#000", | |
| shadowOpacity: 0.18, | |
| shadowRadius: 18, | |
| shadowOffset: { width: 0, height: 8 }, | |
| elevation: 12, | |
| }, | |
| indicator: { | |
| position: "absolute", | |
| left: 6, | |
| top: 6, | |
| width: 58, | |
| height: 46, | |
| borderRadius: 23, | |
| backgroundColor: "rgba(255,255,255,0.88)", | |
| }, | |
| item: { | |
| width: 64, | |
| height: 46, | |
| alignItems: "center", | |
| justifyContent: "center", | |
| }, | |
| plus: { | |
| width: 36, | |
| height: 36, | |
| borderRadius: 18, | |
| backgroundColor: "#163CE3", | |
| alignItems: "center", | |
| justifyContent: "center", | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment