UNPKG

@jaydhimar/react-native-pip

Version:

A React Native library for Picture-in-Picture mode with support for both iOS and Android platforms.

27 lines (22 loc) 687 B
import type { TurboModule } from 'react-native'; import { TurboModuleRegistry } from 'react-native'; export interface PipConfig { aspectRatio?: { width: number; height: number; }; autoEnterOnBackground?: boolean; } export interface PipEvents { onEnterPip?: () => void; onExitPip?: () => void; onError?: (error: string) => void; } export interface Spec extends TurboModule { isPipSupported(): Promise<boolean>; enterPictureInPicture(config?: PipConfig): Promise<boolean>; exitPictureInPicture(): Promise<boolean>; addListener(eventType: string): void; removeListeners(count: number): void; } export default TurboModuleRegistry.getEnforcing<Spec>('Pip');