BrandStore.js 1.37 KB
'use strict';

import React from 'react';
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 brandStoreInitialState from './reducers/brandStore/brandStoreInitialState';

import BrandStoreContainer from './containers/BrandStoreContainer';

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

import {
	setShopId,
} from './reducers/brandStore/brandStoreActions';

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

export default function native(platform) {

	let YH_BrandStore = React.createClass({

		render() {
		  	const store = configureStore(getInitialState());
			store.dispatch(setPlatform(platform));
			let {storeId, host, channel} = this.props;
			store.dispatch(setHost(host));
			store.dispatch(setChannel(channel));
			store.dispatch(setShopId(storeId));

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

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

let styles = StyleSheet.create({

});