Open
Description
When i set a default image before obtaining the signedURL from AWS to get my image, the CachedImage component never render the URL and just keeps my default Image.
This works on a regular Image view but not the cachedImage
`
function S3ImageLoader(props) {
const { media, style } = props;
let [photoUrl, setPhotoUrl] = useState(DefaultUser)
let [loading, setLoading] = useState(true)
useEffect(() => {
getPhotoUrl()
}, [])
async function getPhotoUrl() {
if(!media.key || !media.bucket) {
return setPhotoUrl(DefaultUser)
}
var url = S3.getSignedUrl('getObject', {Bucket: media.bucket, Key: media.key});
setPhotoUrl({uri: url});
// URL is logged as expected.
console.log(url);
}
return (
<Lightbox style={[styles.lightbox, style]}>
<React.Fragment>
{
loading ?
<Spinner style={styles.loading} color={Red700}/> : null
}
<CachedImage
resizeMode="cover"
indicatorProps={ImageIndicator}
onLoadStart={() => setLoading(true)}
onLoadEnd={() => setLoading(false)}
onError={() => setPhotoUrl(DefaultUser)}
style={styles.photo}
source={photoUrl}/>
</React.Fragment>
</Lightbox>
)
}
`
Metadata
Metadata
Assignees
Labels
No labels