ScanScreen.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React, {Component} from 'react';
  2. import CommonTitleBar from '../views/CommonTitleBar';
  3. // import {QRScannerView} from 'ac-qrcode';
  4. import {Dimensions, StyleSheet, View} from 'react-native';
  5. const {width} = Dimensions.get('window');
  6. export default class ScanScreen extends Component {
  7. render() {
  8. return (
  9. <View style={styles.container}>
  10. <CommonTitleBar title={"扫一扫"} nav={this.props.navigation}/>
  11. <View style={styles.cameraContainer}>
  12. {/* <QRScannerView
  13. onScanResultReceived={this.barcodeReceived.bind(this)}
  14. renderTopBarView={() => this._renderTitleBar()}
  15. renderBottomMenuView={() => this._renderMenu()}
  16. /> */}
  17. </View>
  18. </View>
  19. );
  20. }
  21. _renderTitleBar() {
  22. }
  23. _renderMenu() {
  24. }
  25. barcodeReceived(e) {
  26. //跳转到扫码结果界面
  27. this.props.navigation.navigate('ScanResult', {resultText: e.data})
  28. }
  29. }
  30. const styles = StyleSheet.create({
  31. container: {
  32. flex: 1,
  33. flexDirection: 'column'
  34. },
  35. cameraContainer: {
  36. flex: 1,
  37. width: width,
  38. flexDirection: 'column',
  39. },
  40. preview: {
  41. flex: 1,
  42. width: width,
  43. justifyContent: 'flex-end',
  44. alignItems: 'center',
  45. height: 200,
  46. },
  47. capture: {
  48. flex: 0,
  49. backgroundColor: '#fff',
  50. borderRadius: 5,
  51. color: '#000',
  52. padding: 10,
  53. margin: 40
  54. }
  55. });