-1
I need to save the path of the photo taken through the camera.takePictureAsync. I created the variable through the Hook concept as defined below:
const [path,setPath] = useState('');
When the setPath method is used and run the console.log('Path : ',path); the value Undefined appears. Apparently the path variable is not being changed. I don’t know what might be happening.
follows the Function I’m using.
async function takePicture(camera){
const options = {quality:0.5,base64:true};
const data = await camera.takePictureAsync(options);
console.log('URI: ',data.uri);
setCapturedPhoto(data.uri);
setOpen(true);
let v = '"' + data.uri + '"';
setPath(v)
console.log('Caminho : ',path);
//chama função salvar a foto
await savePicture(data.uri);
}