border pour themedVeiw

This commit is contained in:
trochas
2025-11-06 18:58:49 +01:00
parent 73eb7b416a
commit a2f510db35
2 changed files with 18 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ export default function BonjourScreen() {
return null;
}
return(
<ThemedView lvl={2} style={styles.card}>
<ThemedView lvl={2} border={5} style={styles.card}>
<Image source={{ uri: item.Image }} style={styles.image} />
<ThemedView lvl={2} style={styles.info}>
<ThemedText style={styles.group}>{item.group}</ThemedText>

View File

@@ -6,18 +6,32 @@ export type ThemedViewProps = ViewProps & {
lightColor?: string;
darkColor?: string;
lvl?:number;
border?:number;
};
export function ThemedView({ style, lightColor, darkColor,lvl=1, ...otherProps }: ThemedViewProps) {
export function ThemedView({ style, lightColor, darkColor,lvl=1,border=-1, ...otherProps }: ThemedViewProps) {
var lvlStr:string = "background";
var borderColor ="";
if(lvl>=0 && lvl<6){
lvlStr+=lvl;
}
else lvlStr+='5';
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor },lvlStr as 'background0'|'background1'|'background2'|'background3'|'background4'|'background5');
return <View style={[{ backgroundColor }, style]} {...otherProps} />;
if(border!=-1){
var borderStr = "";
if(border>=0 && border<6){
borderStr="background"+border;
borderColor = useThemeColor({ light: lightColor, dark: darkColor },borderStr as 'background0'|'background1'|'background2'|'background3'|'background4'|'background5');
}
else{
borderColor = backgroundColor
}
}
return <View style={[{ backgroundColor, borderColor }, style]} {...otherProps} />;
}