/**
 * @flow
 */

import React, { Component } from 'react';
import {
  createReduxContainer,
} from 'react-navigation-redux-helpers';
import { connect } from 'react-redux';

import NavigationStack from './navigationStack';
import { StoreContext } from '../utils/constants';


const AppNavigation = createReduxContainer(NavigationStack);

const mapStateToProps = state => ({
  state: state.nav,
});

const ReduxNavigation = connect(mapStateToProps)(AppNavigation);


function Navigation() {
  return (
    <StoreContext.Provider value={{ theme: global.theme }}>
      <ReduxNavigation />
    </StoreContext.Provider>
  );
}


export default Navigation;
