More cleanup. More robust themed compononents

This commit is contained in:
2025-03-11 11:33:46 -05:00
parent 86d1df3558
commit cfcf118275
6 changed files with 271 additions and 206 deletions

View File

@@ -10,34 +10,34 @@ const DEFAULT_HEIGHT = 68;
type ThemedButtonProps = PressableProps & {
width?: DimensionValue;
height?: DimensionValue;
backgroundColor?: string;
containerStyle?: object;
buttonStyle?: object;
};
const ThemedButton: React.FC<ThemedButtonProps> = ({
width,
height,
width = DEFAULT_WIDTH,
height = DEFAULT_HEIGHT,
backgroundColor = Colors[useColorScheme() ?? 'dark'].text,
children,
containerStyle,
buttonStyle,
style,
...restProps // This now includes onPress automatically
}) => {
const scheme = useColorScheme() ?? 'dark';
return (
<ThemedView
style={[
styles.buttonContainer,
{
width: width ?? DEFAULT_WIDTH,
height: height ?? DEFAULT_HEIGHT,
width,
height,
},
containerStyle,
]}
>
<Pressable
style={[styles.button, { backgroundColor: Colors[scheme].text }, buttonStyle, style]}
style={[styles.button, { backgroundColor }, buttonStyle, style]}
{...restProps} // This passes onPress and all other Pressable props
>
{children}