/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */

// import React, { Component } from 'react';
// import {
//   AppRegistry,
//   StyleSheet,
//   Text,
//   View
// } from 'react-native';

// class moto extends Component {
//   render() {
//     return (
//       <View style={styles.container}>
//         <Text style={styles.welcome}>
//           Welcome to React Native!
//         </Text>
//         <Text style={styles.instructions}>
//           To get started, edit index.android.js
//         </Text>
//         <Text style={styles.instructions}>
//           Shake or press menu button for dev menu
//         </Text>
//       </View>
//     );
//   }
// }

// const styles = StyleSheet.create({
//   container: {
//     flex: 1,
//     justifyContent: 'center',
//     alignItems: 'center',
//     backgroundColor: '#F5FCFF',
//   },
//   welcome: {
//     fontSize: 20,
//     textAlign: 'center',
//     margin: 10,
//   },
//   instructions: {
//     textAlign: 'center',
//     color: '#333333',
//     marginBottom: 5,
//   },
// });


'use strict';
import React from 'react';
import {
  AppRegistry,
  Component,
  Dimensions,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
  StatusBar,
  Image
} from 'react-native';
import Camera from 'react-native-camera';

class moto extends Component {

  onPhotoCapture() {
    var accessToken = 'get it';
    fetch('https://api.clarifai.com/v1/tag', {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer ' + accessToken,
      },
      body: JSON.stringify({url: 'THE IMAGE URL'})
    })
    .then((response) => response.json())
    .then((responseData) => {
      console.log(
        'Response Body -> ' + JSON.stringify(responseData.body)
      )
    })
    .done();
  }

  render() {
    return (
      <View style={styles.container}>
        <StatusBar hidden={true} />
        <Camera ref={cam => this.camera = cam }
          style={styles.preview}
          aspect={Camera.constants.Aspect.fill}
          captureTarget={Camera.constants.CaptureTarget.disk}>
        </Camera>
        <TouchableOpacity 
            style={styles.actionButton}
            onPress={this.takePicture.bind(this)}>
            <Image source={require('./img/camera-icon.png')} />
        </TouchableOpacity>
      </View>
    );
  }

  takePicture() {
    console.log("Hello");
    this.camera.capture()
      .then((data) => {
        console.log(data);
      })
      .catch(err => console.error(err));
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1
  },
  preview: {
    flex: 1,
    justifyContent: 'flex-end',
    alignItems: 'center',
    height: Dimensions.get('window').height,
    width: Dimensions.get('window').width
  },
  capture: {
    flex: 0,
    backgroundColor: '#fff',
    borderRadius: 5,
    color: '#000',
    padding: 10,
    margin: 40
  },
  actionButton: {
        position: 'absolute',
        bottom: 25,
        padding: 16,
        right: 20,
        left: 20,
        borderRadius: 20,
        alignItems: 'center',
  }
});

AppRegistry.registerComponent('moto', () => moto);

@@ -1,1087 +1,4 @@
-/**%0A * Sample React Native App%0A * https://github.com/facebook/react-native%0A */%0A%0A// import React, %7B Component %7D from 'react';%0A// import %7B%0A//   AppRegistry,%0A//   StyleSheet,%0A//   Text,%0A//   View%0A// %7D from 'react-native';%0A%0A// class moto extends Component %7B%0A//   render() %7B%0A//     return (%0A//       %3CView style=%7Bstyles.container%7D%3E%0A//         %3CText style=%7Bstyles.welcome%7D%3E%0A//           Welcome to React Native!%0A//         %3C/Text%3E%0A//         %3CText style=%7Bstyles.instructions%7D%3E%0A//           To get started, edit index.android.js%0A//         %3C/Text%3E%0A//         %3CText style=%7Bstyles.instructions%7D%3E%0A//           Shake or press menu button for dev menu%0A//         %3C/Text%3E%0A//       %3C/View%3E%0A//     );%0A//   %7D%0A// %7D%0A%0A// const styles = StyleSheet.create(%7B%0A//   container: %7B%0A//     flex: 1,%0A//     justifyContent: 'center',%0A//     alignItems: 'center',%0A//     backgroundColor: '#F5FCFF',%0A//   %7D,%0A//   welcome: %7B%0A//     fontSize: 20,%0A//     textAlign: 'center',%0A//     margin: 10,%0A//   %7D,%0A//   instructions: %7B%0A//     textAlign: 'center',%0A//     color: '#333333',%0A//     marginBottom: 5,%0A//   %7D,%0A// %7D);%0A%0A%0A
 'use

Remove unused code