App.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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,TouchableOpacity} 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. >这里添加标题</Text>
  26. );
  27. }
  28. _renderMenu() {
  29. return (
  30. <Text
  31. style={{color:'white',textAlignVertical:'center', textAlign:'center',font:20,padding:12}}
  32. >这里添加底部菜单</Text>
  33. )
  34. }
  35. barcodeReceived(e) {
  36. Toast.show('Type: ' + e.type + '\nData: ' + e.data);
  37. //console.log(e)
  38. }
  39. }