1import * as React from 'react' 2import * as Kb from '../../../common-adapters/mobile.native' 3import * as QR from '../../../common-adapters/qr.native' 4import * as Styles from '../../../styles' 5import {Props} from '.' 6 7const QRScan = (props: Props) => ( 8 <Kb.Box2 direction="vertical" style={styles.container}> 9 {!props.waiting && ( 10 <QR.QRScanner 11 notAuthorizedView={<QR.QRNotAuthorized />} 12 onBarCodeRead={data => props.onSubmitTextCode(data)} 13 style={styles.camera} 14 /> 15 )} 16 {!props.waiting && <QR.QRLines canScan={true} />} 17 {props.waiting && <Kb.ProgressIndicator style={styles.waiting} type="Large" white={true} />} 18 </Kb.Box2> 19) 20 21const styles = Styles.styleSheetCreate(() => ({ 22 camera: { 23 flexGrow: 1, 24 }, 25 container: { 26 alignSelf: 'stretch', 27 backgroundColor: Styles.globalColors.black, 28 height: 160, 29 overflow: 'hidden', 30 position: 'relative', 31 }, 32 waiting: { 33 ...Styles.globalStyles.fillAbsolute, 34 }, 35})) 36 37export default QRScan 38