Catch NotAllowedError in web GIF player + lint modules/ (#10806)
This commit is contained in:
@@ -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')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user