PersonalInfo.js 1.66 KB
'use strict';

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

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

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

import appInitialState from './reducers/app/appInitialState';
import personalInfoInitialState from './reducers/personalInfo/personalInfoInitialState';
import vipLevelInitialState from './reducers/vipLevel/vipLevelInitialState';
import PersonalInfoContainer from './containers/PersonalInfoContainer';
import VIPLevelContainer from './containers/VIPLevelContainer';

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

import {
	setNickname,
} from './reducers/vipLevel/vipLevelActions';

function getInitialState() {
	const _initState = {
		app: (new appInitialState()),
		personalInfo: (new personalInfoInitialState()),
		vipLevel: (new vipLevelInitialState()),
	};
	return _initState;
}

export default function native(platform) {

	let YH_PersonalInfo = createReactClass({
		render() {
		  	const store = configureStore(getInitialState());
			if (this.props.type == 'VIPLevel') {
				let nickname = this.props.nickname;
				store.dispatch(setNickname(nickname));
				return(
					<Provider store={store}>
					<VIPLevelContainer />
					</Provider>
				);
			} else {
				return (
					<Provider store={store}>
						<PersonalInfoContainer />
					</Provider>
				);
			}
		}
	});

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

let styles = StyleSheet.create({

});