forked from MABelanger/react-html5-camera-photo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppWithDynamicProperties.js
45 lines (40 loc) · 1.06 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
42
43
44
45
import React, { Component } from 'react';
import Camera, { FACING_MODES } from '../lib';
import './reset.css';
/*
* dynamic properties is : idealFacingMode, idealResolution, isMaxResolution
* In this example we set the idealFacingMode
*/
class App extends Component {
constructor (props, context) {
super(props, context);
this.state = {
idealFacingMode: FACING_MODES.ENVIRONMENT
};
this.renderButtons = this.renderButtons.bind(this);
}
renderButtons () {
return (
<div>
<button onClick={ (e) => {
this.setState({idealFacingMode: FACING_MODES.USER});
}}> FACING_MODES.USER </button>
<button onClick={ (e) => {
this.setState({idealFacingMode: FACING_MODES.ENVIRONMENT});
}}> FACING_MODES.ENVIRONMENT </button>
</div>
);
}
render () {
return (
<div className="App">
{ this.renderButtons() }
<Camera
idealFacingMode = {this.state.idealFacingMode}
onTakePhoto = { () => {} }
/>
</div>
);
}
}
export default App;