Please provide the following:
- SDK Version: 37.0
- Platforms(Android/iOS/web/all): Android
Problem:
restart the expo application when setting an image with image-picker
I think it is because of the version of sdk that I use, but in that case there is no other way to fix this problem?
import * as ImagePicker from 'expo-image-picker';
import * as Permissions from 'expo-permissions';
const ShowImagen = (props) => {
const prop = props.prop
//conincide solo permisos para nandroid
const [image, setImage] = useState(null);
useEffect(() => {
const { status } = Permissions.askAsync(Permissions.CAMERA_ROLL);
if (status !== 'granted') {
console.log("problem for show images")
}
}, [])
const pickImage = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.All,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
});
if (!result.cancelled) {
setImage(result.uri);
// console.log('resultado',result.uri)
// prop.setFieldValue('image',result.uri)
}
};
return (
<View>
<Button style={{width:150,alignSelf:'center'}}
onPress={pickImage}
>
<Text>Seleccionar imagen</Text>
</Button>
{image && <Image source={{ uri: image }} style={{ width: 100, height: 100 }} />}
</View>
// {image && <Image source={{ uri: image }} style={{ width: 100, height: 100 }} />}
);
}