react-native-fast-image: Crash on Android if source is an invalid URL
If I pass as source an object like this { uri: 'INVALID_URL' } I get the following error on Android:
Error while updating property 'source' of a view managed by: FastImageView
null
Must not be null or empty
At the moment I am normalising the source using this (ugly) code to avoid the crash:
const normalisedSource = source && typeof source.uri === 'string' && !source.uri.split('https://')[1] ? null : source;
but I think it would be better if the library prevents it.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 13
- Comments: 15
not all image start https, http ?? const normalisedSource = source && typeof source.uri === ‘string’ && !source.uri.split(‘http’)[1] ? null : source;
I think the library itself should take of this issue, on ios it works perfectly.
render() { return ( <FastImage source={{uri: this.getUriImage(_uri)}}/> ) }
function getUriImage(uri) { return uri !== null && uri !== undefined && uri.includes(“/”) && uri.includes(“.”) ? uri : “” }
Thanks you, my problem is solved using this
not all images start with https or http. what about local images
so I need adjust every source ? It’s so Unfriendly!!!
this is log.
where do i have do make this change?