Outlet.js 1.42 KB
'use strict';

import React from 'react';
import createReactClass from 'create-react-class';
import ReactNative, {
	AppRegistry,
	Platform,
	StyleSheet,
	Dimensions,
	TouchableOpacity,
} from 'react-native';

import {
	Provider,
	connect
} from 'react-redux';

import configureStore from './store/configureStore';
import {Record, List, Map} from 'immutable';

import appInitialState from './reducers/app/appInitialState';
import outletInitialState from './reducers/outlet/outletInitialState';

import OutletContainer from './containers/OutletContainer';

import {
	setPlatform,
	setChannel,
	setHost,
	setServiceHost,
	setCategoryId,
} from './reducers/app/appActions';

import {

} from './reducers/outlet/outletActions';

function getInitialState() {
	const _initState = {
		app: (new appInitialState()),
    	outlet: (new outletInitialState()),
	};
	return _initState;
}

export default function native(platform) {

	let YH_Outlet = createReactClass({

		render() {
		  	const store = configureStore(getInitialState());
			store.dispatch(setPlatform(platform));

			let {serviceHost,host, channel,categoryId} = this.props;
			store.dispatch(setHost(host));
			store.dispatch(setServiceHost(serviceHost));
			store.dispatch(setChannel(channel));
			store.dispatch(setCategoryId(categoryId));

			return (
				<Provider store={store}>
					<OutletContainer />
				</Provider>
			);
		}
	});

	AppRegistry.registerComponent('YH_Outlet', () => YH_Outlet);
}