From 0e238ad10ece4774fc84fe384e04bf9513fa9772 Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Sun, 11 Jan 2026 11:48:30 +0100 Subject: [PATCH] feat(ios): glassview container for badges --- components/Badge.tsx | 47 +++++++++++++++++++++++++++++++++++++++- components/GenreTags.tsx | 30 +++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/components/Badge.tsx b/components/Badge.tsx index aff8cb83..b33fff2b 100644 --- a/components/Badge.tsx +++ b/components/Badge.tsx @@ -1,4 +1,5 @@ -import { View, type ViewProps } from "react-native"; +import { Platform, StyleSheet, View, type ViewProps } from "react-native"; +import { GlassEffectView } from "react-native-glass-effect-view"; import { Text } from "./common/Text"; interface Props extends ViewProps { @@ -13,6 +14,30 @@ export const Badge: React.FC = ({ variant = "purple", ...props }) => { + const content = ( + + {iconLeft && {iconLeft}} + + {text} + + + ); + + if (Platform.OS === "ios") { + return ( + + + {content} + + + ); + } + return ( = ({ ); }; + +const styles = StyleSheet.create({ + container: { + overflow: "hidden", + alignSelf: "flex-start", + flexShrink: 1, + flexGrow: 0, + }, + content: { + flexDirection: "row", + alignItems: "center", + paddingHorizontal: 10, + paddingVertical: 4, + borderRadius: 50, + backgroundColor: "transparent", + }, + iconLeft: { + marginRight: 4, + }, +}); diff --git a/components/GenreTags.tsx b/components/GenreTags.tsx index 6708269d..030d554c 100644 --- a/components/GenreTags.tsx +++ b/components/GenreTags.tsx @@ -1,11 +1,14 @@ // GenreTags.tsx import type React from "react"; import { + Platform, type StyleProp, + StyleSheet, type TextStyle, View, type ViewProps, } from "react-native"; +import { GlassEffectView } from "react-native-glass-effect-view"; import { Text } from "./common/Text"; interface TagProps { @@ -20,6 +23,23 @@ export const Tag: React.FC< textStyle?: StyleProp; } & ViewProps > = ({ text, textClass, textStyle, ...props }) => { + if (Platform.OS === "ios") { + return ( + + + + {text} + + + + ); + } + return ( @@ -29,6 +49,16 @@ export const Tag: React.FC< ); }; +const styles = StyleSheet.create({ + container: { + overflow: "hidden", + borderRadius: 50, + }, + glass: { + borderRadius: 50, + }, +}); + export const Tags: React.FC< TagProps & { tagProps?: ViewProps } & ViewProps > = ({ tags, textClass = "text-xs", tagProps, ...props }) => {