chore: lint project (#3279)
* chore: update eslint config * chore: lint lib files
This commit is contained in:
26
src/utils.ts
26
src/utils.ts
@@ -1,7 +1,7 @@
|
||||
import type { Component, RefObject, ComponentClass } from 'react';
|
||||
import { Image, UIManager, findNodeHandle } from "react-native";
|
||||
import type { ImageSourcePropType } from 'react-native';
|
||||
import type { ReactVideoSource } from './types/video';
|
||||
import type {Component, RefObject, ComponentClass} from 'react';
|
||||
import {Image, UIManager, findNodeHandle} from 'react-native';
|
||||
import type {ImageSourcePropType} from 'react-native';
|
||||
import type {ReactVideoSource} from './types/video';
|
||||
|
||||
type Source = ImageSourcePropType | ReactVideoSource;
|
||||
|
||||
@@ -14,24 +14,32 @@ export function resolveAssetSourceForVideo(source: Source): ReactVideoSource {
|
||||
return source as ReactVideoSource;
|
||||
}
|
||||
|
||||
export function getReactTag(ref: RefObject<Component<any, any, any> | ComponentClass<any, any> | null>): number {
|
||||
export function getReactTag(
|
||||
ref: RefObject<
|
||||
| Component<unknown, unknown, unknown>
|
||||
| ComponentClass<unknown, unknown>
|
||||
| null
|
||||
>,
|
||||
): number {
|
||||
if (!ref.current) {
|
||||
throw new Error("Video Component is not mounted");
|
||||
throw new Error('Video Component is not mounted');
|
||||
}
|
||||
|
||||
const reactTag = findNodeHandle(ref.current);
|
||||
|
||||
if (!reactTag) {
|
||||
throw new Error("Cannot find reactTag for Video Component in components tree");
|
||||
throw new Error(
|
||||
'Cannot find reactTag for Video Component in components tree',
|
||||
);
|
||||
}
|
||||
|
||||
return reactTag;
|
||||
}
|
||||
|
||||
export function getViewManagerConfig(name: string) {
|
||||
if('getViewManagerConfig' in UIManager) {
|
||||
if ('getViewManagerConfig' in UIManager) {
|
||||
return UIManager.getViewManagerConfig(name);
|
||||
}
|
||||
|
||||
return UIManager[name];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user