<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 Sample1 = 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.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake 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('Sample1', () => Sample1);
<commit_msg>added sample project<commit_after>/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var WebViewBridgeNative = require('react-native-webview-bridge');

var myPageScripts = function() {
  function WebViewBridgeReady(cb) {
    if (window.WebViewBridge) {
      cb(window.WebViewBridge);
      return;
    }
    function handler() {
      document.removeEventListener('WebViewBridge', handler, false);
      cb(window.WebViewBridge);
    }
    document.addEventListener('WebViewBridge', handler, false);
  }
  WebViewBridgeReady(function (WebViewBridge) {
    WebViewBridge.send("Hello this is me calling from web page");
  });
};

//convert function definition into string
myPageScripts = `(${myPageScripts.toString()}());`;

var {
  AppRegistry,
  Component
} = React;

class Sample1 extends Component {
  constructor(props) {
    super(props);
    this.once = true;
  }

  componentDidMount() {
    var myWebViewBridgeRef = this.refs.myWebViewBridge;

    var onMessage = function(message) {
      console.log("Received message", message);
    };
    myWebViewBridgeRef.onMessage(onMessage);

    myWebViewBridgeRef.injectBridgeScript();

    //this opens up the printer window dialoge
    setTimeout(() => {
      myWebViewBridgeRef.print();
    }, 5000);
  }

  onNavigationStateChange(navState) {
    var myWebViewBridgeRef = this.refs.myWebViewBridge;
    if (this.once) {
      this.once = false;
      setTimeout(() => {
        myWebViewBridgeRef.evalScript(myPageScripts);
      }, 1000);
    }

    console.log(navState.url);
  }

  render() {
    var url = 'http://google.com';

    return (
      <WebViewBridgeNative
        ref="myWebViewBridge"
        onNavigationStateChange={this.onNavigationStateChange.bind(this)}
        url={url}
        style={{flex: 1}}/>
    );
  }
}


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

{'fraction_non_alphanumeric': 0.13890739506995337, 'fraction_numerical': 0.009327115256495669, 'mean_word_length': 3.004, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 16, 'https://': 2, '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': '2824219', 'n_tokens_mistral': 967, 'n_tokens_neox': 919, 'n_words': 192}