how to get an image from flask api in react native how to get an image from flask api in react native flask flask

how to get an image from flask api in react native


You are sending an image as a response and accepting application/json in response.

you should do something like this:-

var image  fetch("http://10.0.2.2:5000/api/echo", {  method: "POST",  headers: {    "Content-Type": "application/json"  },  body: JSON.stringify({    x: 0,    y: 0  })})  .then(response => response.blob())  .then(images => {      // Then create a local URL for that image and print it       image = URL.createObjectURL(images)      console.log(image)  })  .catch(error => {    console.error(error);  });};