selection chantier (animation,correction) ; ajustement et amélioration du thème ; chantier provider

This commit is contained in:
Rochas
2025-12-06 22:33:01 +01:00
parent a10b2fa953
commit c581f1511f
9 changed files with 321 additions and 151 deletions

View File

@@ -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}/>;
}