Skip to content

Instantly share code, notes, and snippets.

@naqvitalha
Last active August 29, 2024 07:38
Show Gist options
  • Save naqvitalha/f13772b7bc5d361fb95cdd008f47042b to your computer and use it in GitHub Desktop.
Save naqvitalha/f13772b7bc5d361fb95cdd008f47042b to your computer and use it in GitHub Desktop.
iOS images inside FlashList
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