import {createRef, PureComponent} from 'react' import {StyleSheet} from 'react-native' import {type GifViewProps} from './GifView.types' export class GifView extends PureComponent { private readonly videoPlayerRef: React.RefObject = createRef() private isLoaded = false constructor(props: GifViewProps | Readonly) { super(props) } componentDidMount() { document.addEventListener('visibilitychange', this.onVisibilityChange) } componentDidUpdate(prevProps: Readonly) { if (prevProps.autoplay !== this.props.autoplay) { if (this.props.autoplay) { void this.playAsync() } else { void this.pauseAsync() } } } componentWillUnmount() { document.removeEventListener('visibilitychange', this.onVisibilityChange) } // eslint-disable-next-line @typescript-eslint/require-await static async prefetchAsync(_: string[]): Promise { console.warn('prefetchAsync is not supported on web') } // Safari pauses backgrounded `