mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #34772 from Englund0110/master
Updated types for react-webcam
This commit is contained in:
Vendored
+11
-6
@@ -1,8 +1,9 @@
|
||||
// Type definitions for react-webcam 0.3
|
||||
// Type definitions for react-webcam 1.1
|
||||
// Project: https://github.com/mozmorris/react-webcam
|
||||
// Definitions by: Lucas Servén Marín <https://github.com/squat>
|
||||
// Søren Englund <https://github.com/englund92>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
// TypeScript Version: 3.4
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
@@ -20,15 +21,19 @@ declare class Webcam extends React.Component<Webcam.WebcamProps, Webcam.WebcamSt
|
||||
declare namespace Webcam {
|
||||
interface WebcamProps {
|
||||
audio?: boolean;
|
||||
muted?: boolean;
|
||||
onUserMedia?(): void;
|
||||
onUserMediaError?(): void;
|
||||
height?: number|string;
|
||||
width?: number|string;
|
||||
screenshotFormat?: 'image/jpeg' | 'image/png' | 'image/webp';
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
audioSource?: string;
|
||||
videoSource?: string;
|
||||
onUserMedia?(): void;
|
||||
screenshotQuality?: number;
|
||||
minScreenshotWidth?: number;
|
||||
minScreenshotHeight?: number;
|
||||
audioConstraints?: MediaStreamConstraints["audio"];
|
||||
videoConstraints?: MediaStreamConstraints["video"];
|
||||
imageSmoothing?: boolean;
|
||||
}
|
||||
|
||||
interface WebcamState {
|
||||
|
||||
@@ -13,6 +13,12 @@ export class ReactWebcamTest extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const videoConstraints = {
|
||||
width: 1280,
|
||||
height: 720,
|
||||
facingMode: "user"
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Webcam
|
||||
@@ -21,6 +27,7 @@ export class ReactWebcamTest extends React.Component {
|
||||
ref={this.setRef}
|
||||
screenshotFormat="image/jpeg"
|
||||
width={350}
|
||||
videoConstraints={videoConstraints}
|
||||
/>
|
||||
<button onClick={this.capture}>Capture photo</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user