<commit_before><commit_msg>Initially add QRcode Scanner component.<commit_after>'use strict';

const React = require('react-native');

const {
	View,
	Text
} = React;

const Camera = require('react-native-camera');
const SCREEN_HEIGHT = Dimensions.get('window').height;
const SCREEN_WIDTH = Dimensions.get('window').width;

const QRcodeScanner = React.createClass({
	readed:false,
	componentDidMount:function(){
	},
	getInitialState:function(){
		return {
			torchMode:0
		}
	},
	render:function(){

		return (
			<View style={{ flex:1 }}>
				<Camera style={{ height:Layout.SCREEN_HEIGHT - 20, width:Layout.SCREEN_WIDTH }}
					torchMode = { this.state.torchMode }
					onBarCodeRead = { this.barcodeHandler }
				/>
				<View onTouchEnd = { () => { if( this.state.torchMode == 0 ){ this.trunOnTorch() } else { this.turnOffTorch() } } }>
					<Text>{ () => { return this.state.torchMode == 0 ? 'on' : 'off' } }Hello</Text>
				</View>
			</View>
		)
	},
	barcodeHandler:function( str ){

		if( !this.readed ){
			console.log( JSON.stringify( str ) );
			this.readed = true;
		}
	},
	trunOnTorch:function(){

		this.setState({
			torchMode:1
		})
	},
	turnOffTorch:function(){
		this.setState({
			torchMode:0
		})
	}
})

module.exports = QRcodeScanner;
{'fraction_non_alphanumeric': 0.16919393455706305, 'fraction_numerical': 0.006384676775738229, 'mean_word_length': 3.786259541984733, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2707070', 'n_tokens_mistral': 500, 'n_tokens_neox': 454, 'n_words': 78}