forked from mieszko4/react-native-zoom-us
-
Notifications
You must be signed in to change notification settings - Fork 1
/
native.ts
46 lines (40 loc) · 1.19 KB
/
native.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {
NativeModules,
HostComponent,
requireNativeComponent,
Platform,
StyleProp,
ViewStyle,
} from 'react-native'
export const VideoAspectModeEnum = {
VIDEO_ASPECT_ORIGINAL: 0,
VIDEO_ASPECT_FULL_FILLED: 1,
VIDEO_ASPECT_LETTER_BOX: 2,
VIDEO_ASPECT_PAN_AND_SCAN: 3,
VIDEO_ASPECT_TRUSTEE: 4,
} as const
type Values<T> = T[keyof T];
export type VideoAspectMode = Values<typeof VideoAspectModeEnum>;
export interface NativeLayoutUnit {
kind: "active" | "preview" | "share" | "attendee" | "active-share"
x: number
y: number
width: number
height: number
border?: boolean
showUsername?: boolean
showAudioOff?: boolean
userIndex?: number
background?: string
aspectMode?: VideoAspectMode
}
export interface NativeVideoProps {
style?: StyleProp<ViewStyle>
layout: NativeLayoutUnit[]
}
// TODO: implement for iOS -> https://github.com/mieszko4/react-native-zoom-us/issues/113
export const RNZoomUsVideoView = (
Platform.OS === 'android' ? requireNativeComponent('RNZoomUsVideoView') : null
) as HostComponent<NativeVideoProps> | null
export const RNZoomUs = NativeModules.RNZoomUs
if (!RNZoomUs) console.error('[react-native-zoom-us] RNZoomUs native module is not linked.')