Sale.js 1.16 KB
'use strict';

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

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

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

import appInitialState from './reducers/app/appInitialState';
import saleInitialState from './reducers/sale/saleInitialState';

import SaleContainer from './containers/SaleContainer';

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


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

export default function native(platform) {

	let YH_Sale = createReactClass({

		render() {
		  	const store = configureStore(getInitialState());
			store.dispatch(setPlatform(platform));
			store.dispatch(setHost(this.props.host));
			store.dispatch(setServiceHost(this.props.serviceHost));
			
			return (
				<Provider store={store}>
					<SaleContainer />
				</Provider>
			);
		}
	});

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