Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

227
Views
React Native don't show image when I fetch image file path from database

I have a database with a courses table.

enter image description here

I want to show the image through the image path saved in the field image column.

In my react native app I have a component that lists Carts where cart's images are saved in disk

Like: C:\Users\Public\Pictures\Rectangle_2.png. Then I put the path in image column.

CartList.js

import Carts from './../Cart';
const Item = ({item}) => {
  return (
    <Carts
      name={item.name}
      price={item.price}
      offPrice={item.offPrice}
      image={item.image}
    />
  );
};
class CartList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [],
    };
  }
  componentDidMount() {
    this.requestAPI();
  }
  requestAPI = () => {
    const apiURL = 'http://myApi/api/courses';
    fetch(apiURL)
      .then(response => response.json())
      .then(responseJson => {
        this.setState({
          data: responseJson,
        });
      });
  };

  renderItem = ({item}) => {
    return <Item item={item} />;
  };
  render() {
    return (
      <>
        <FlatList
          data={this.state.data}
          renderItem={this.renderItem}
          keyEtractor={item => item.id.toString()}
        />
      </>
    );
  }
}

I access to image path through props in Cart.

Cart.js

const Cart = (props) => {
  return (
    <View
      <Image
        style={{
          width: '40%',
          height: 100,
        }}
        source={{uri:props.image}}
      />
    </View>
  );
};
export default Cart;

when I run the app, then I get this error:

enter image description here

How can I solve this problem?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This happens if you have incorrect image path, please check that your remote path of image is correct, I think the image path is misleading.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!