border pour themedVeiw
This commit is contained in:
@@ -44,7 +44,7 @@ export default function BonjourScreen() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return(
|
return(
|
||||||
<ThemedView lvl={2} style={styles.card}>
|
<ThemedView lvl={2} border={5} style={styles.card}>
|
||||||
<Image source={{ uri: item.Image }} style={styles.image} />
|
<Image source={{ uri: item.Image }} style={styles.image} />
|
||||||
<ThemedView lvl={2} style={styles.info}>
|
<ThemedView lvl={2} style={styles.info}>
|
||||||
<ThemedText style={styles.group}>{item.group}</ThemedText>
|
<ThemedText style={styles.group}>{item.group}</ThemedText>
|
||||||
|
|||||||
@@ -6,18 +6,32 @@ export type ThemedViewProps = ViewProps & {
|
|||||||
lightColor?: string;
|
lightColor?: string;
|
||||||
darkColor?: string;
|
darkColor?: string;
|
||||||
lvl?:number;
|
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 lvlStr:string = "background";
|
||||||
|
var borderColor ="";
|
||||||
if(lvl>=0 && lvl<6){
|
if(lvl>=0 && lvl<6){
|
||||||
lvlStr+=lvl;
|
lvlStr+=lvl;
|
||||||
}
|
}
|
||||||
else lvlStr+='5';
|
else lvlStr+='5';
|
||||||
|
|
||||||
|
|
||||||
const backgroundColor = useThemeColor({ light: lightColor, dark: darkColor },lvlStr as 'background0'|'background1'|'background2'|'background3'|'background4'|'background5');
|
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} />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user