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.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. androidRecordAudioPermissionOptions={{
  24. title: 'Permission to use audio recording',
  25. message: 'We need your permission to use your audio',
  26. buttonPositive: 'Ok',
  27. buttonNegative: 'Cancel',
  28. }}
  29. onGoogleVisionBarcodesDetected={({ barcodes }) => {
  30. console.log(barcodes);
  31. }}
  32. />
  33. <View style={{ flex: 0, flexDirection: 'row', justifyContent: 'center' }}>
  34. <TouchableOpacity onPress={this.takePicture.bind(this)} style={rn_cam_styles.capture}>
  35. <Text style={{ fontSize: 14 }}> SNAP </Text>
  36. </TouchableOpacity>
  37. </View>
  38. </View>
  39. );
  40. }
  41. takePicture = async () => {
  42. if (this.camera) {
  43. const options = { quality: 0.5, base64: true };
  44. const data = await this.camera.takePictureAsync(options);
  45. console.log(data.uri);
  46. }
  47. };
  48. }
  49. const styles = StyleSheet.create({
  50. container: {
  51. flex: 1,
  52. flexDirection: 'column',
  53. backgroundColor: 'black',
  54. },
  55. preview: {
  56. flex: 1,
  57. justifyContent: 'flex-end',
  58. alignItems: 'center',
  59. },
  60. capture: {
  61. flex: 0,
  62. backgroundColor: '#fff',
  63. borderRadius: 5,
  64. padding: 15,
  65. paddingHorizontal: 20,
  66. alignSelf: 'center',
  67. margin: 20,
  68. },
  69. });
  70. export {ExampleApp}