0

I have created a card component when I pass title and subtitle its work when I add the image it's giving me an error this is my cardcomponent code

import React from "react";
import {
  View,
  Text,
  StyleSheet,
  Button,
  Image,
  ImageBackground,
} from "react-native";
import colors from "../config/colors";
import AppText from "./AppText";

export default function CardList({ title, subtitle, image }) {
  return (
    <View style={styles.card}>
      <Image source={require(image)} />
      <AppText>{title}</AppText>
      <AppText>{subtitle}</AppText>
    </View>
  );
}

const styles = StyleSheet.create({
  card: {
    backgroundColor: colors.white,
    borderRadius: 15,
    marginBottom: 20,
    paddingTop: 100,
  },
});

this is my app file

import React from "react";
import WelcomeScreen from "./app/screen/WelcomeScreen";
import { View, Text, StyleSheet, Button } from "react-native";

import AppText from "./app/components/AppText";
import AppButton from "./app/components/AppButton";
import CardList from "./app/components/CardList";
export default function App() {
  return (
    <View style={styles.cardStyle}>
      <CardList
        title="need blood"
        subtitle="$100"
        image={require("./app/assets/child.png")}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  cardStyle: {
    backgroundColor: "#f8f4f4",
    padding: 20,
    paddingTop: 100,
  },
});

I am adding some pictures here which before adding image propenter image description here when I add image its giving me error enter image description here

kukab
  • 561
  • 5
  • 18

0 Answers0