Commit dfa0a536 by Giang Tran

fix image

parent 0b6c1cb8
...@@ -36,7 +36,7 @@ const options = { ...@@ -36,7 +36,7 @@ const options = {
const PickerImg = (props) => { const PickerImg = (props) => {
const naviagtion = useNavigation(); const naviagtion = useNavigation();
const [isModalVisible, setModalVisible] = useState(false); const [isModalVisible, setModalVisible] = useState(false);
// const [imgAvatart, setImgAvatart] = useState(props.user.picture_url); const [imgAvatart, setImgAvatart] = useState(props.user.picture_url);
// useEffect(() => { // useEffect(() => {
// setTimeout(() => { // setTimeout(() => {
...@@ -70,6 +70,7 @@ const PickerImg = (props) => { ...@@ -70,6 +70,7 @@ const PickerImg = (props) => {
Alert.alert(I18n.t('Notification'), res.data.message); Alert.alert(I18n.t('Notification'), res.data.message);
}, 500); }, 500);
} else { } else {
setImgAvatart(props.user.picture_url);
setTimeout(() => { setTimeout(() => {
Alert.alert(I18n.t('Notification'), res.data.message); Alert.alert(I18n.t('Notification'), res.data.message);
}, 500); }, 500);
...@@ -86,6 +87,7 @@ const PickerImg = (props) => { ...@@ -86,6 +87,7 @@ const PickerImg = (props) => {
}).then((image) => { }).then((image) => {
setModalVisible(false); setModalVisible(false);
callApi(image.path); callApi(image.path);
setImgAvatart(image.path);
}); });
}; };
...@@ -99,16 +101,14 @@ const PickerImg = (props) => { ...@@ -99,16 +101,14 @@ const PickerImg = (props) => {
}).then((image) => { }).then((image) => {
setModalVisible(false); setModalVisible(false);
callApi(image.path); callApi(image.path);
setImgAvatart(image.path);
}); });
}; };
return ( return (
<TouchableOpacity onPress={() => setModalVisible(true)}> <TouchableOpacity onPress={() => setModalVisible(true)}>
<View style={styles.containerImg}> <View style={styles.containerImg}>
{props.user.picture_url ? ( {imgAvatart ? (
<Image <Image source={{uri: imgAvatart}} style={styles.imgAvatar} />
source={{uri: props.user.picture_url}}
style={styles.imgAvatar}
/>
) : ( ) : (
<View style={styles.imgAvatar} /> <View style={styles.imgAvatar} />
)} )}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment