-
Notifications
You must be signed in to change notification settings - Fork 93
/
AppWithDynamicProperties.js
41 lines (36 loc) · 1.03 KB
/
AppWithDynamicProperties.js
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
import React, { useState } from 'react';
import Camera, { FACING_MODES } from '../lib';
import './reset.css';
/*
* dynamic properties is : idealFacingMode, idealResolution, isMaxResolution
* In this example we set the idealFacingMode
*/
function App (props) {
const [idealFacingMode, setIdealFacingMode] = useState(null);
const [isMaxResolution, setIsMaxResolution] = useState(false);
function renderButtons () {
return (
<div>
<button onClick={ (e) => {
setIdealFacingMode(FACING_MODES.USER);
setIsMaxResolution(false);
}}> FACING_MODES.USER </button>
<button onClick={ (e) => {
setIdealFacingMode(FACING_MODES.ENVIRONMENT);
setIsMaxResolution(true);
}}> FACING_MODES.ENVIRONMENT & MaxResolution</button>
</div>
);
}
return (
<div>
{ renderButtons() }
<Camera
idealFacingMode = {idealFacingMode}
isMaxResolution = {isMaxResolution}
onTakePhoto = { () => {} }
/>
</div>
);
}
export default App;