@@ -22,13 +22,17 @@ module.exports = class Reader extends Component {
2222 onLoad : PropTypes . func ,
2323 onImageLoad : PropTypes . func ,
2424 delay : PropTypes . oneOfType ( [ PropTypes . number , PropTypes . bool ] ) ,
25- facingMode : PropTypes . string ,
25+ facingMode : PropTypes . oneOf ( [ 'rear' , 'front' ] ) ,
2626 legacyMode : PropTypes . bool ,
2727 maxImageSize : PropTypes . number ,
28- style : PropTypes . object ,
28+ style : PropTypes . any ,
2929 className : PropTypes . string ,
3030 } ;
31- static defaultProps = { delay : 500 , style : { } , maxImageSize : 1000 } ;
31+ static defaultProps = {
32+ delay : 500 ,
33+ maxImageSize : 1000 ,
34+ facingMode : 'rear'
35+ } ;
3236
3337 els = { } ;
3438
@@ -119,12 +123,13 @@ module.exports = class Reader extends Component {
119123 initiate ( props = this . props ) {
120124 const { onError, facingMode } = props
121125
126+ console . log ( facingMode )
127+
122128 getDeviceId ( facingMode )
123129 . then ( deviceId => {
124130 return navigator . mediaDevices . getUserMedia ( {
125131 video : {
126132 deviceId,
127- facingMode : facingMode == 'rear' ? 'environment' : 'user' ,
128133 width : { min : 360 , ideal : 1280 , max : 1920 } ,
129134 height : { min : 240 , ideal : 720 , max : 1080 } ,
130135 } ,
0 commit comments