Fix state-tracking
parent
7181a75bfb
commit
568ff92582
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue