Last active
August 29, 2024 07:38
-
-
Save naqvitalha/f13772b7bc5d361fb95cdd008f47042b to your computer and use it in GitHub Desktop.
iOS images inside FlashList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const RecyclableImage = (props) => { | |
const imageUri = useRef(props.source.uri); | |
const imageRef = useRef(null); | |
if (props.source.uri && props.source.uri !== imageUri.current) { | |
imageUri.current = props.source.uri; | |
imageRef.current?.setNativeProps({ opacity: 0 }); | |
} | |
return <Image {...props} ref={imageRef} onLoad={()=> { imageRef.current?.setNativeProps({ opacity: 1 }) }} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment