import {createRef, PureComponent, type RefObject} from 'react' import {StyleSheet} from 'react-native' import {type GifViewProps} from './GifView.types' export class GifView extends PureComponent { private readonly videoPlayerRef: 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) { this.playAsync() } else { this.pauseAsync() } } } componentWillUnmount() { document.removeEventListener('visibilitychange', this.onVisibilityChange) } static async prefetchAsync(_: string[]): Promise { console.warn('prefetchAsync is not supported on web') } // Safari pauses backgrounded `