Senhores(as). Quando escrevo dessa forma:
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Button title="Pick an image from camera roll" onPress={pickImage} />
{image && <Image source={{ uri: image }} style={{ width: 200, height: 200 }} />}
</View>
me retorna " Error while updating property 'src' of a view managed by:RCTImageView null Value for uri cannot be cast from ReadableNativeMap to string"
se escrevo dessa forma:
<Button title="Pick an image from camera roll" onPress={pickImage} />
{image !== '' ? <View>
<Image source={{uri: image }} style={{ width: 200, height: 200 }} />
</View>:null}
esta me retornado: 'Warning: Failed prop type:Invalid prop 'source' supplied to 'Image'
posso estar errado mas creio que ambos estejam relacionado ao source... mas não sei como corrigir.
a uri:image vem da função:
async function pickImage(){
try {
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
})
if (!result.cancelled){
setimage({image:result.uri})
console.log(result.uri)
}
} catch (E) {
console.log(E)
}
}
console.log(result.uri) esta retornando "file:///data/user/0/host.exp.exponent/cache/ExperienceData/%2540anonymous%252Fapp-bc4b4820-9594-491f-bfdb-cd2750d6f674/ImagePicker/905aa553-a340-4516-a4b5-4310ed91289e.jpg"
desde já agradeço!!