How to use the react-native-camera.constants function in react-native-camera

To help you get started, we’ve selected a few react-native-camera examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github squatsandsciencelabs / OpenBarbellApp / app / shared_features / camera / VideoRecorder.js View on Github external
_record() {
        this.camera.capture({
            mode: Camera.constants.CaptureMode.video,
            audio: true
        }).then((data) => {
            if (this.props.setID) {
                this.props.saveVideo(this.props.setID, data.path, this.props.videoType);
            }
            // TODO: share options can be here, but for now just finish
        }).catch((err) => {
            console.tron.log("ERROR " + err);
            this.props.saveVideoError(this.props.setID, err);
            Alert.alert('There was an issue saving your video. Please try again');
        });
    }
github insiderdev / react-native-qrcode-app / js / BarcodeScannerApp.js View on Github external
toggleFlash() {
    this.setState({
      flashlightEnabled: !this.state.flashlightEnabled,
      torchMode: this.state.torchMode == Camera.constants.TorchMode.off ?
                    Camera.constants.TorchMode.on : Camera.constants.TorchMode.off
    });
  }
github bekk / react-native-workshop / app / components / camera-picker.js View on Github external
render() {
    return (
      <View style={styles.container}>
        <Camera
          ref={(cam) => {
            this.camera = cam;
          }}
          style={styles.preview}
          aspect="fill"
          captureTarget={Camera.constants.CaptureTarget.disk}>
          <Text style={styles.capture} onPress={this.takePicture.bind(this)}>[CAPTURE]</Text>
        </Camera>
      </View>
    );
  }
github squatsandsciencelabs / OpenBarbellApp / app / shared_features / camera / VideoRecorder.js View on Github external
_renderCamera() {
        if (this.props.isModalShowing) {
            return (
                <View style={[{flex: 1}, styles.container]}>                
                    <Camera
                        ref={(cam) => {this.camera = cam}}
                        style={{flex: 1}}
                        type={this.props.cameraType}
                        aspect={Camera.constants.Aspect.fit}
                    >
                        <View style={styles.cancelButton}>
                            <View>
                            <TouchableOpacity onPress={()=>this._closeModal()}>
                                <View><Text style={styles.cancelText}>Cancel</Text></View>
                            </TouchableOpacity>
                            </View>
                        </View>

                        <View style={{position: 'absolute', bottom: 50, left: 0, right: 0, alignItems: 'center'}}>
                            { this._renderActionButton() }
                        </View>

                        {this._renderToggleCameraTypeButton()}

                    </Camera>
github insiderdev / react-native-qrcode-app / js / BarcodeScannerApp.js View on Github external
toggleFlash() {
    this.setState({
      flashlightEnabled: !this.state.flashlightEnabled,
      torchMode: this.state.torchMode == Camera.constants.TorchMode.off ?
                    Camera.constants.TorchMode.on : Camera.constants.TorchMode.off
    });
  }
github Skjutsgruppen / skjutsgruppen-reactnative / app / components / experience / camera.js View on Github external
constructor(props) {
    super(props);

    this.camera = null;

    this.state = {
      aspect: Camera.constants.Aspect.fill,
      captureTarget: Camera.constants.CaptureTarget.cameraRoll,
      type: Camera.constants.Type.front,
      orientation: Camera.constants.Orientation.auto,
      flashMode: Camera.constants.FlashMode.auto,
      loading: true,
      permissionDenied: false,
    };
  }
github Michaelvilleneuve / react-native-snapchat-clone / src / components / Capture / Capture.js View on Github external
render() {
    return (
      <View style={styles.main}>
        <Camera
          ref={(cam) => {
            this.camera = cam;
          }}
          captureTarget="memory"
          style={styles.camera}
          aspect={Camera.constants.Aspect.fill}>
        </Camera>
        <View style={styles.buttonContainer}>
          <View style={styles.smallButtonContainer}>
            <Button 
              onPress={this.snap.bind(this)} 
              transparent 
              style={styles.captureButton}>
              <Icon name='ios-camera-outline' />
            </Button>
          </View>
        </View>
      </View>
    );
  }
}
github iZaL / insta-snap / src / components / Media / MediaCaptureScene.js View on Github external
</TouchableHighlight>
          </View>

        </View>

      );

    } else {
      return (
        <View style={styles.container}>
          <Camera
            ref={(cam) => {
            this.camera = cam;
          }}
            style={styles.preview}
            aspect={Camera.constants.Aspect.fill}
            captureTarget={Camera.constants.CaptureTarget.disk}
            captureMode={cameraMode === 'video' ? Camera.constants.CaptureMode.video : Camera.constants.CaptureMode.still }
            type={cameraType === 'front' ? Camera.constants.Type.front : Camera.constants.Type.back }
            captureQuality="medium"
          >
            <View style={styles.buttonWrapper}>

              <View style={styles.rightCol}>
                <TouchableHighlight onPress={()=> this.switchCameraMode() } underlayColor="transparent">
                  <Icon
                    name={cameraMode === 'video' ? 'ios-camera' : 'md-videocam'}
                    size={25}
                    color="white"
                    style={styles.videoCameraButton}
                  />
                </TouchableHighlight>
github ali322 / CNodeRN / app / component / scanner.js View on Github external
render() {
    return (
      <Camera
        style={styles.preview}
        aspect={Camera.constants.Aspect.fill}
        onBarCodeRead={this.props.onBarCodeRead}
      >
        <View style={styles.topOverLayer} />
        <View style={styles.scannerContainer}>
          <View style={styles.horizontalOverLayer} />
          <View style={styles.scanner}>
            <View key={1} style={[styles.borderLeftTop, styles.borderBox]} />
            <View key={2} style={[styles.borderRightTop, styles.borderBox]} />
            <View key={3} style={[styles.borderLeftBottom, styles.borderBox]} />
            <View
              key={4}
              style={[styles.borderRightBottom, styles.borderBox]}
            />
          </View>
          <View style={styles.horizontalOverLayer} />
        </View>
github react-native-community / react-native-camera / Example / Example.js View on Github external
constructor(props) {
    super(props);

    this.camera = null;

    this.state = {
      camera: {
        aspect: Camera.constants.Aspect.fill,
        captureTarget: Camera.constants.CaptureTarget.cameraRoll,
        type: Camera.constants.Type.back,
        orientation: Camera.constants.Orientation.auto,
        flashMode: Camera.constants.FlashMode.auto,
      },
      isRecording: false
    };
  }