mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-04-07 09:31:53 +01:00
feat: upgrade to native wind v5
This commit is contained in:
@@ -1,20 +1,29 @@
|
||||
import { Platform, Text as RNText, type TextProps } from "react-native";
|
||||
export function Text(props: TextProps) {
|
||||
const { style, ...otherProps } = props;
|
||||
|
||||
interface CustomTextProps extends TextProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function Text({ className, ...props }: CustomTextProps) {
|
||||
if (Platform.isTV)
|
||||
return (
|
||||
<RNText
|
||||
allowFontScaling={false}
|
||||
style={[{ color: "white" }, style]}
|
||||
{...otherProps}
|
||||
/>
|
||||
<RNText allowFontScaling={false} className={clsx(className)} {...props} />
|
||||
);
|
||||
|
||||
return (
|
||||
<RNText
|
||||
allowFontScaling={false}
|
||||
style={[{ color: "white" }, style]}
|
||||
{...otherProps}
|
||||
/>
|
||||
<RNText allowFontScaling={false} className={clsx(className)} {...props} />
|
||||
);
|
||||
}
|
||||
|
||||
const clsx = (className?: string) => {
|
||||
const colorClassRegex = /\btext-[a-z]+-\d+\b/;
|
||||
const hasColorClass = className ? colorClassRegex.test(className) : false;
|
||||
const defaultClassName = "text-white";
|
||||
const classes = [
|
||||
...(hasColorClass ? [] : [defaultClassName]),
|
||||
...(className ? [className] : []),
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" ");
|
||||
return classes;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user