<commit_before>/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;

var ImagePickerAndroid = React.createClass({
  render: function() {
    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>
    );
  }
});

var 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,
  },
});

AppRegistry.registerComponent('ImagePickerAndroid', () => ImagePickerAndroid);<commit_msg>step 3: use it in your JavaScript code<commit_after>/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  NativeModules,
  StyleSheet,
  Text,
  View,
  Image,
} = React;

let { UIImagePickerManager: ImagePickerManager } = NativeModules;

var ImagePickerAndroid = React.createClass({
  getInitialState: function() {
    return {
      imageURI: 'https://homepages.cae.wisc.edu/~ece533/images/cat.png',
    };
  },

  render: function() {
    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>

        <Text
          onPress={this._pickFromCamera.bind(this)}
          style={styles.imagePickerButton}>
          Touch me to take a photo!
        </Text>
        <Text
          onPress={this._pickFromImageLibrary.bind(this)}
          style={styles.imagePickerButton}>
          Touch me to pick from gallery!
        </Text>

        <Image
          style={styles.image}
          source={{ uri: this.state.imageURI }}
        />
      </View>
    );
  },

  _pickFromCamera: function() {
    ImagePickerManager.launchCamera({}, (cancelled, response) => {
      if (!cancelled) {
        this.setState({ imageURI: response.uri });
      }
    });
  },

  _pickFromImageLibrary: function() {
    ImagePickerManager.launchImageLibrary({}, (cancelled, response) => {
      if (!cancelled) {
        this.setState({ imageURI: response.uri });
      }
    });
  }
});

var 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: 19,
  },

  imagePickerButton: {
    textAlign: 'center',
    color: '#2222AA',
    marginBottom: 4,
  },
  image: {
    width: 256,
    height: 256,
    marginTop: 4,
  },
});

AppRegistry.registerComponent('ImagePickerAndroid', () => ImagePickerAndroid);
{'fraction_non_alphanumeric': 0.14035087719298245, 'fraction_numerical': 0.012573099415204679, 'mean_word_length': 2.5159301130524154, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 28, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2174773', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1043, 'n_words': 236}