-
Notifications
You must be signed in to change notification settings - Fork 527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use react-native-video-controls with typescript? #241
Comments
any news? facing the same problem |
just create index.d.ts file and put there |
this is a better implementation if you want to have real typings instead of create a declare module 'react-native-video-controls' {
import * as React from 'react';
import {VideoProperties} from 'react-native-video';
type VideoControlsProps = {
onEnterFullscreen?: () => void;
onExitFullscreen?: () => void;
onHideControls?: () => void;
onShowControls?: () => void;
onError?: () => void;
onPause?: () => void;
onPlay?: () => void;
onBack?: () => void;
onEnd?: () => void;
toggleResizeModeOnFullscreen?: boolean;
controlTimeout?: number;
showOnStart?: boolean;
showTimeRemaining?: boolean;
tapAnywhereToPause?: boolean;
disableFullscreen?: boolean;
disablePlayPause?: boolean;
disableSeekbar?: boolean;
disableVolume?: boolean;
disableTimer?: boolean;
disableBack?: boolean;
};
export default class Video extends React.Component<
VideoProperties & VideoControlsProps
> {
player: {
ref: {
presentFullscreenPlayer(): void;
dismissFullscreenPlayer(): void;
restoreUserInterfaceForPictureInPictureStopCompleted(
restored: boolean,
): void;
save(): Promise<void>;
seek(time: number, tolerance?: number): void;
};
};
}
} the typings are not 100% complete, but you can easily improve them from here |
When I import the Video component from the package, I get this error:
How do I implement the typing for it? I tried the recommendation but it doesn't seem a declaration file exists. How do I declare it without doing it manually? Thanks!
The text was updated successfully, but these errors were encountered: