<commit_before>import React, { Component } from 'react';
import { Text, View, Image, TextInput, ListView, TouchableHighlight } from 'react-native';
import helpers from '../helpers/helpers.js';
import Response from '../helpers/data/chickenData.js';
import Recipe from './Recipe.ios.js';

export default class Recipes extends Component {
  constructor(props) {
    super(props);
    const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
    this.state = {
      foodDataSource: ds.cloneWithRows(Response.results)
    }
  }

  selectRecipe(id) {
    helpers.recipes.getRecipe(id)
      .then( resp => {
        this.props.navigator.push({
          component: Recipe,
          passProps: {recipe: resp}
        })
      })
  }

  goBack() {
    this.props.navigator.pop();
  }

  render() {
    if (this.state.foodDataSource.length === 0) {
      return (
        <View style={[styles.container, this.border('yellow')]}>
          <TouchableHighlight style={styles.backButton} onPress={this.goBack.bind(this)}>
            <Image style={styles.backButtonImage} source={{uri: 'https://cdn0.iconfinder.com/data/icons/vector-basic-tab-bar-icons/48/back_button-128.png'}} />
          </TouchableHighlight>
          <View style={[styles.app, this.border('black')]} >
            <Text style={styles.welcome}>
              Sorry there are no matches for this food pairing at this time, please try another pairing
            </Text>
          </View>
        </View>
      )
    } else {
      return (
        <View style={styles.resultsList}>
          <View style={styles.navigationResults}>
            <TouchableHighlight style={styles.backButton} onPress={this.goBack.bind(this)}>
              <Image style={styles.backButtonImage} source={{uri: 'https://cdn0.iconfinder.com/data/icons/vector-basic-tab-bar-icons/48/back_button-128.png'}} />
            </TouchableHighlight>
            <View style={styles.resultsTitle}> 
              <Text style={styles.resultsTitleText}> Recipes results </Text>
            </View>
          </View>
          <ListView
            dataSource={this.state.foodDataSource}
            renderRow={(recipe, i) => (

              <TouchableHighlight
                key={i} 
                style={styles.listItem}
                underlayColor="grey"
                style={styles.resultsList}
                >
                <TouchableHighlight onPress={this.selectRecipe.bind(this, recipe.id)}>
                  <View style={styles.listItem}>
                    <Image source={{uri: recipe.imageUrls.size_240}} style={styles.resultsPicture} />
                    <Text style={styles.foodPairText}>{recipe.title}</Text>
                    <Text style={styles.foodPairText}>Time it takes: {recipe.readyInMinutes} minutes</Text>
                  </View>
                </TouchableHighlight>
              </TouchableHighlight>
              )}
          />
        </View>
      )<commit_msg>updated recipes to push data to recipe component<commit_after>import React, { Component } from 'react';
import { Text, View, Image, TextInput, ListView, TouchableHighlight } from 'react-native';
import helpers from '../helpers/helpers.js';
import Response from '../helpers/data/chickenData.js';
import Recipe from './Recipe.ios.js';
import styles from '../styles.ios.js';

export default class Recipes extends Component {
  constructor(props) {
    super(props);
    const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
    this.state = {
      foodDataSource: ds.cloneWithRows(props.recipes)
    }
  }

  selectRecipe(id) {
    helpers.recipes.getRecipe(id)
      .then( resp => {
        this.props.navigator.push({
          component: Recipe,
          passProps: {recipe: resp.data}
        })
      })
  }

  goBack() {
    this.props.navigator.pop();
  }

  render() {
    if (this.state.foodDataSource.length === 0) {
      return (
        <View style={[styles.container, this.border('yellow')]}>
          <TouchableHighlight style={styles.backButton} onPress={this.goBack.bind(this)}>
            <Image style={styles.backButtonImage} source={{uri: 'https://cdn0.iconfinder.com/data/icons/vector-basic-tab-bar-icons/48/back_button-128.png'}} />
          </TouchableHighlight>
          <View style={[styles.app, this.border('black')]} >
            <Text style={styles.welcome}>
              Sorry there are no matches for this food pairing at this time, please try another pairing
            </Text>
          </View>
        </View>
      )
    } else {
      return (
        <View style={styles.resultsList}>
          <View style={styles.navigationResults}>
            <TouchableHighlight style={styles.backButton} onPress={this.goBack.bind(this)}>
              <Image style={styles.backButtonImage} source={{uri: 'https://cdn0.iconfinder.com/data/icons/vector-basic-tab-bar-icons/48/back_button-128.png'}} />
            </TouchableHighlight>
            <View style={styles.resultsTitle}> 
              <Text style={styles.resultsTitleText}> Recipes results </Text>
            </View>
          </View>
          <ListView
            dataSource={this.state.foodDataSource}
            renderRow={(recipe, i) => (

              <TouchableHighlight
                key={i} 
                style={styles.listItem}
                underlayColor="grey"
                style={styles.resultsList}
                >
                <TouchableHighlight onPress={this.selectRecipe.bind(this, recipe.id)}>
                  <View style={styles.listItem}>
                    <Text style={styles.foodPairText}>{recipe.title}</Text>
                    <Text style={styles.foodPairText}>Time it takes: {recipe.readyInMinutes} minutes</Text>
                  </View>
                </TouchableHighlight>
              </TouchableHighlight>
              )}
          />
        </View>
      )
{'fraction_non_alphanumeric': 0.13713509843856075, 'fraction_numerical': 0.006279701289884589, 'mean_word_length': 2.142933333333333, 'pattern_counts': {'":': 0, '<': 66, '<?xml version=': 0, '>': 72, 'https://': 4, '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': '4118378', 'n_tokens_mistral': 1718, 'n_tokens_neox': 1641, 'n_words': 307}