0

Hello Everyone i have problems when changing picture on react native that won't change the images

here is my code on this code the function for add photo

  const addPhoto = () => {ImagePicker.launchImageLibrary({
        quality:0.5,
        maxWidth:200,
        maxHeight:200
    }, (response) => {
        console.log('Response:', response);

        if (response.didCancel || response.error) {
            console.log('User Cancel Operation');
            showMessage('Anda Tidak Memilih Foto');
        } else {
            const source = {uri: response.uri};
            const dataImage = {
                uri: response.uri,
                type: response.type,
                name: response.fileName
            };
           setPhoto(source)
        }
    });
};

and here for showing the photo

               <TouchableOpacity onPress={addPhoto}>
                        <View style={styles.borderPhoto}>
                            {photo ? (<Image source={photo.uri} style={styles.photoContainer} />)
                            :(<View style={styles.photoContainer}>
                                    <Text style={styles.addPhoto}>Add Photo</Text>
                                </View>
                                )}
                        </View>
               </TouchableOpacity>

so on the image source when i add uri on photo.uri that will not showing error null but the image won't changes stay on default condition i use react-native-image-picker by the way

0 Answers0