fix: image not shown

This commit is contained in:
Jakob Stornig 2024-01-02 14:50:42 +01:00
parent 62e71d1b49
commit a51dee6795
2 changed files with 3 additions and 3 deletions

View file

@ -53,7 +53,7 @@ export default function Page() {
<Widget> <Widget>
<BudgetRemaining budget={budget} spent={spent} /> <BudgetRemaining budget={budget} spent={spent} />
</Widget> </Widget>
<Widget text='#TODO Insert Pie-Chart' image='../../../assets/images/8b14el.jpg'/> <Widget text='#TODO Insert Pie-Chart' image={require('../../../assets/images/8b14el.jpg')}/>
<Widget> <Widget>
<BudgetOverview budget={budget} spent={spent} /> <BudgetOverview budget={budget} spent={spent} />
</Widget> </Widget>

View file

@ -6,7 +6,7 @@ interface WidgetProps {
title?: string; title?: string;
text?: string; text?: string;
children?: ReactNode; children?: ReactNode;
image?: string; image?: any;
} }
const Widget: React.FC<WidgetProps> = ({ title, text, children, image }) => { // Add the 'image' prop to the destructuring const Widget: React.FC<WidgetProps> = ({ title, text, children, image }) => { // Add the 'image' prop to the destructuring
@ -54,7 +54,7 @@ const Widget: React.FC<WidgetProps> = ({ title, text, children, image }) => { //
<View style={styles.widgetContainer}> <View style={styles.widgetContainer}>
{!!title && <Text style={styles.widgetTitle}>{title}</Text>} {!!title && <Text style={styles.widgetTitle}>{title}</Text>}
{!!text && <Text style={styles.widgetText}>{text}</Text>} {!!text && <Text style={styles.widgetText}>{text}</Text>}
{!!image && <Image source={{ uri: image }} style={styles.imageStyle} />} {!!image && <Image source={image} style={styles.imageStyle} />}
{children} {children}
</View> </View>
); );