Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

rn_cam.native.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React, { PureComponent } from 'react';
  2. import { AppRegistry, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
  3. import { RNCamera } from 'react-native-camera';
  4. class ExampleApp extends PureComponent {
  5. render() {
  6. var rn_cam_styles_z = tglob_au.run_dev_cbs("rn_cam_styles",{that:this}) || {}
  7. var rn_cam_styles = rn_cam_styles_z.o
  8. return (
  9. <View style={rn_cam_styles.container || {}}>
  10. <RNCamera
  11. ref={ref => {
  12. this.camera = ref;
  13. }}
  14. style={rn_cam_styles.preview}
  15. type={RNCamera.Constants.Type.back}
  16. flashMode={RNCamera.Constants.FlashMode.on}
  17. androidCameraPermissionOptions={{
  18. title: 'Permission to use camera',
  19. message: 'We need your permission to use your camera',
  20. buttonPositive: 'Ok',
  21. buttonNegative: 'Cancel',
  22. }}
  23. /*
  24. androidRecordAudioPermissionOptions={{
  25. title: 'Permission to use audio recording',
  26. message: 'We need your permission to use your audio',
  27. buttonPositive: 'Ok',
  28. buttonNegative: 'Cancel',
  29. }}
  30. */
  31. onGoogleVisionBarcodesDetected={({ barcodes }) => {
  32. console.log(barcodes);
  33. }}
  34. />
  35. <View style={{ flex: 0, flexDirection: 'row', justifyContent: 'center' }}>
  36. <TouchableOpacity onPress={this.takePicture.bind(this)} style={rn_cam_styles.capture}>
  37. <Text style={{ fontSize: 14 }}> SNAP </Text>
  38. </TouchableOpacity>
  39. </View>
  40. </View>
  41. );
  42. }
  43. takePicture = async () => {
  44. if (this.camera) {
  45. const options = { quality: 0.5, base64: true };
  46. const data = await this.camera.takePictureAsync(options);
  47. console.log(data.uri);
  48. }
  49. };
  50. }
  51. const styles = StyleSheet.create({
  52. container: {
  53. flex: 1,
  54. flexDirection: 'column',
  55. backgroundColor: 'black',
  56. },
  57. preview: {
  58. flex: 1,
  59. justifyContent: 'flex-end',
  60. alignItems: 'center',
  61. },
  62. capture: {
  63. flex: 0,
  64. backgroundColor: '#fff',
  65. borderRadius: 5,
  66. padding: 15,
  67. paddingHorizontal: 20,
  68. alignSelf: 'center',
  69. margin: 20,
  70. },
  71. });
  72. export {ExampleApp}