Catch NotAllowedError in web GIF player + lint modules/ (#10806)

This commit is contained in:
Samuel Newman
2026-06-09 17:20:34 +03:00
committed by GitHub
parent bc94c8c07b
commit 4c4ebd0510
4 changed files with 125 additions and 5 deletions
@@ -67,7 +67,18 @@ export class GifView extends PureComponent<GifViewProps> {
}
async playAsync(): Promise<void> {
this.videoPlayerRef.current?.play()
try {
await this.videoPlayerRef.current?.play()
} catch (err) {
// `play()` rejects with a NotAllowedError when the browser blocks
// playback (e.g. Safari low-power mode or autoplay policy). This is
// expected and benign - the GIF simply stays paused - so swallow it
// rather than letting it surface as an unhandled rejection.
if (err instanceof DOMException && err.name === 'NotAllowedError') {
return
}
throw err
}
}
async pauseAsync(): Promise<void> {
@@ -1,12 +1,12 @@
import React from 'react'
import {StyleProp, ViewStyle} from 'react-native'
import {type StyleProp, type ViewStyle} from 'react-native'
import {requireNativeModule, requireNativeViewManager} from 'expo-modules-core'
import {VisibilityViewProps} from './types'
import {type VisibilityViewProps} from './types'
const NativeView: React.ComponentType<{
onChangeStatus: (e: {nativeEvent: {isActive: boolean}}) => void
children: React.ReactNode
enabled: Boolean
enabled: boolean
style: StyleProp<ViewStyle>
}> = requireNativeViewManager('ExpoBlueskyVisibilityView')