selection chantier (animation,correction) ; ajustement et amélioration du thème ; chantier provider
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Pressable, type PressableProps } from 'react-native';
|
||||
import { Pressable, ViewStyle, type PressableProps } from 'react-native';
|
||||
|
||||
import { useThemeColor } from '@/hooks/use-theme-color';
|
||||
|
||||
@@ -8,10 +8,11 @@ export type ThemedPressableProps = PressableProps & {
|
||||
lvl?:number;
|
||||
border?:number;
|
||||
opacity?:string;
|
||||
shadow?: boolean;
|
||||
};
|
||||
|
||||
//nb : pour border ne pas oublier de mettre en plus "borderWidth" dans le style du composant /!\
|
||||
export function ThemedButton({ style, lightColor, darkColor,lvl=1,border=-1,opacity="FF", ...otherProps }: ThemedPressableProps) {
|
||||
export function ThemedButton({ style, lightColor, darkColor,lvl=1,border=-1,opacity="FF",shadow=false, ...otherProps }: ThemedPressableProps) {
|
||||
var lvlStr:string = "background";
|
||||
var borderColor ="";
|
||||
if(lvl>=0 && lvl<6){
|
||||
@@ -33,7 +34,15 @@ export function ThemedButton({ style, lightColor, darkColor,lvl=1,border=-1,opac
|
||||
}
|
||||
}
|
||||
|
||||
const shadowStyle: ViewStyle = {
|
||||
//android
|
||||
elevation: 10,
|
||||
//iOS
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 4 },
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 6,
|
||||
}
|
||||
|
||||
|
||||
return <Pressable style={(state) =>[{ backgroundColor, borderColor }, typeof style === 'function' ? style(state) : style,]} {...otherProps}/>;
|
||||
return <Pressable style={(state) =>[{ backgroundColor, borderColor }, shadow && shadowStyle, typeof style === 'function' ? style(state) : style,]} {...otherProps}/>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user