Fix state-tracking

zio/stable
Paul Frazee 2022-12-14 15:49:45 -06:00
parent 7181a75bfb
commit 568ff92582
1 changed files with 10 additions and 2 deletions

View File

@ -48,15 +48,23 @@ export function AutoSizedImage({
}, [imgInfo, containerInfo])
useEffect(() => {
let aborted = false
Image.getSize(
uri,
(width: number, height: number) => {
if (!aborted) {
setImgInfo({width, height})
}
},
(error: any) => {
if (!aborted) {
setError(String(error))
}
},
)
return () => {
aborted = true
}
}, [uri])
const onLayout = (evt: LayoutChangeEvent) => {