import '../Config'
import DebugConfig from '../Config/DebugConfig'
import * as React from 'react'
import {Component} from 'react'
import {Provider} from 'react-redux'
import RootContainer from './RootContainer'
import createStore from '../Redux'
import {Monitor} from "redux-saga";
import {StoreCreator} from "redux";

declare global {
  interface Console {
    tron: any,
  }
}
declare module 'reactotron-react-native' {
  export interface Reactotron {
    createSagaMonitor(): Monitor,
    createStore: StoreCreator,
  }
}


export const store = createStore();


/**
 * Provides an entry point into our application.  Both index.ios.js and index.android.js
 * call this component first.
 *
 * We create our Redux store here, put it into a provider and then bring in our
 * RootContainer.
 *
 * We separate like this to play nice with React Native's hot reloading.
 */
class App extends Component {
  render() {
    return (
      <Provider store={store}>
          <RootContainer/>
      </Provider>
    )
  }
}

//allow reactotron overlay for fast design in dev mode
export default DebugConfig.useReactotron
  ? console.tron.overlay(App)
  : App
//export default App
