{"size": 2387, "ext": "js", "max_stars_repo_path": "Components/HomeNavigator.js", "max_stars_repo_name": "Xanderdeng/Golden-Express-Frontend", "max_stars_repo_stars_event_min_datetime": "2021-02-02T10:34:59.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-02T10:34:59.000Z", "max_issues_repo_path": "Components/HomeNavigator.js", "max_issues_repo_name": "charlesxdeng/Golden-Express-Frontend", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Components/HomeNavigator.js", "max_forks_repo_name": "charlesxdeng/Golden-Express-Frontend", "max_forks_repo_forks_event_min_datetime": "2019-01-17T13:35:32.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-01T05:43:06.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 2, "avg_line_length": 26.2307692308, "max_line_length": 77, "alphanum_fraction": 0.6799329703}
import React from 'react';
import {
  StyleSheet,
  View,
  Text,
  TouchableOpacity,
  TextInput,
  ListView,
  Alert,
  Button,
  RefreshControl,
  Image,
  ScrollView
} from 'react-native';
 // Version can be specified in package.json
import { StackNavigator, TabNavigator, TabBarBottom} from 'react-navigation';
import { createStackNavigator } from 'react-navigation';
import styles from './Styles'
import RegisterScreen from './RegisterScreen'
import LoginScreen from './LoginScreen'
import HomeScreen from './HomeScreen'
import Result from './ResultScreen'
import GroceryListScreen from './GroceryListScreen'
import HorizontalMealScroll from './HorizontalMealScroll'
import SearchScreen from './SearchScreen'
import CheckoutScreen from './CheckoutScreen'
import FeedbackScreen from './FeedbackScreen'
import CategoriesScreen from './CategoriesScreen'
import SearchNavigator from './SearchNavigator'
import HomeSearch from './HomeSearch'
import HomeResults from './HomeResults'
export default class HomeNavigator extends React.Component{
  constructor(props)
  {
    super(props);
    this.state = {
    }
    this.navigateCart = this.navigateCart.bind(this)
    this.navigateHome = this.navigateHome.bind(this)
    this.closeDrawer = this.closeDrawer.bind(this)
    this.openDrawer = this.openDrawer.bind(this)
    this.openProduct = this.openProduct.bind(this)
  }
  openDrawer(){
    this.props.screenProps.openDrawer()
  }
  closeDrawer(){
    this.props.screenProps.closeDrawer()
  }
  navigateCart() {
    this.props.screenProps.cart()
  }
  navigateHome() {
    this.props.navigation.navigate('Home')
  }
  openProduct(item){
    this.props.screenProps.openProduct(item)
  }
  render(){
    const stack = {
      HomePage: {
        screen: HomeScreen,
      },
      HomeSearch: {
      screen: HomeSearch,
    },
    HomeResults: {
      screen: HomeResults
    }
    }
    const HomeStack = StackNavigator(stack, {initialRouteName:'HomePage',
      headerMode: 'screen',
      navigationOptions: {
        headerVisible: true,
      }
    })
    return (
      <View style={{flex: 1}}>
        <HomeStack
          screenProps={{
            cart: this.navigateCart,
            home: this.navigateHome,
            openDrawer: this.openDrawer,
            closeDrawer: this.closeDrawer,
            openProduct: this.openProduct
          }}/>
      </View>
    )
  }
};
