title: How to open the camera and taking the picture in react native?
body: <p>I want to open the device camera from my app when user click on the button and when user click on back button it should react to my application from device camera. I am able to open camera and take photo by running react native project. But I want to do it how camera works in what's app. That is clicking on button -> opening camera -> send button .</p>
  
  <p>I am an beginner in react native .I tried many ways but I am not getting how it can be done.</p>
  
  <p>Can anybody assist me to do this.</p>
  
  <p>My App.js code is,</p>
  
  <pre><code>'use strict';
  import React, { Component } from 'react';
  import {
    AppRegistry,
    Dimensions,
    StyleSheet,
    Text,
    TouchableHighlight,
    View
  } from 'react-native';
  import Camera from 'react-native-camera';
  
  class BadInstagramCloneApp extends Component {
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;Camera
            ref={(cam) =&gt; {
              this.camera = cam;
            }}
            style={styles.preview}
            aspect={Camera.constants.Aspect.fill}&gt;
            &lt;Text style={styles.capture} onPress={this.takePicture.bind(this)}&gt;[CAPTURE]&lt;/Text&gt;
          &lt;/Camera&gt;
        &lt;/View&gt;
      );
    }
  
    takePicture() {
      const options = {};
      //options.location = ...
      this.camera.capture({metadata: options})
        .then((data) =&gt; console.log(data))
        .catch(err =&gt; console.error(err));
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      flexDirection: 'row',
    },
    preview: {
      flex: 1,
      justifyContent: 'flex-end',
      alignItems: 'center'
    },
    capture: {
      flex: 0,
      backgroundColor: '#fff',
      borderRadius: 5,
      color: '#000',
      padding: 10,
      margin: 40
    }
  });
  
  AppRegistry.registerComponent('BadInstagramCloneApp', () =&gt; BadInstagramCloneApp);
  </code></pre>