App.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Sample React Native App
  3. * https://github.com/facebook/react-native
  4. *
  5. * @format
  6. * @flow
  7. */
  8. import React, {Component} from 'react';
  9. import {Platform, StyleSheet, Text, View,Toast} from 'react-native';
  10. import QRScannerView from './qr'
  11. export default class DefaultScreen extends Component {
  12. render() {
  13. return (
  14. < QRScannerView
  15. onScanResultReceived={this.barcodeReceived.bind(this)}
  16. renderTopBarView={() => this._renderTitleBar()}
  17. renderBottomMenuView={() => this._renderMenu()}
  18. />
  19. )
  20. }
  21. _renderTitleBar(){
  22. return(
  23. <Text
  24. style={{color:'white',textAlignVertical:'center', textAlign:'center',font:20,padding:12}}
  25. >Here is title bar</Text>
  26. );
  27. }
  28. _renderMenu() {
  29. return (
  30. <Text
  31. style={{color:'white',textAlignVertical:'center', textAlign:'center',font:20,padding:12}}
  32. >
  33. Here is bottom menu
  34. </Text>
  35. )
  36. }
  37. barcodeReceived(e) {
  38. alert('Type: ' + e.type + '\nData: ' + e.data);
  39. //console.log(e)
  40. }
  41. }