BrandStore.js 1.56 KB
'use strict';

import React from 'react';
import ReactNative, {
	AppRegistry,
	Platform,
	StyleSheet,
	Dimensions,
	TouchableOpacity,
} 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 brandStoreInitialState from './reducers/brandStore/brandStoreInitialState';

import BrandStoreContainer from './containers/BrandStoreContainer';

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

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

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

export default function native(platform) {

	let YH_BrandStore = createReactClass({

		render() {
		  	const store = configureStore(getInitialState());
			store.dispatch(setPlatform(platform));
			let {storeId, host, channel, keyWord} = this.props;
			store.dispatch(setHost(host));
			store.dispatch(setChannel(channel));
			store.dispatch(setShopId(storeId));
			//5.7.0 新增搜索关键词跳转到店铺落地页,上报关键词
			store.dispatch(setKeyWord(keyWord));

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

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

let styles = StyleSheet.create({

});