ProductList.js
4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
'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 productListForBrandInitialState from './reducers/productListForBrand/productListForBrandInitialState';
import ProductListForBrandContainer from './containers/ProductListForBrandContainer';
import productListForShopInitialState from './reducers/productListForShop/productListForShopInitialState';
import ProductListForShopContainer from './containers/ProductListForShopContainer';
import ProductListPoolContainer from './containers/ProductListPoolContainer';
import ProductListPoolInitialState from './reducers/productListPool/productListPoolInitialState';
import CategoryProListInitialState from './reducers/categoryProList/categoryProListInitialState';
import screenInitialState from './reducers/screen/screenInitialState';
import screenCategoryInitialState from './reducers/screenCategory/screenCategoryInitialState';
import screenSubInitialState from './reducers/screenSub/screenSubInitialState';
import ScreenContainer from './containers/ScreenContainer';
import ScreenCategoryContainer from './containers/ScreenCategoryContainer';
import ScreenSubContainer from './containers/ScreenSubContainer';
import CategoryProductListContainer from './containers/CategoryProListContainer'
import {
setPlatform,
setChannel,
setHost,
setServiceHost,
setType,
setShop,
setBrandId,
setOriginParams,
setSaleType,
setActivityId,
setBannerUrl,
setListType
} from './reducers/app/appActions';
import {
updateDataSource
} from './reducers/screenSub/screenSubActions';
import {
updateCategoryDataSource
} from './reducers/screenCategory/screenCategoryActions';
function getInitialState() {
const _initState = {
app: (new appInitialState()),
productForBrand: (new productListForBrandInitialState()),
screen: (new screenInitialState()),
screenCategory: (new screenCategoryInitialState()),
screenSub: (new screenSubInitialState()),
productListForShop: (new productListForShopInitialState()),
productListPool: (new ProductListPoolInitialState()),
categoryProList: (new CategoryProListInitialState()),
};
return _initState;
}
export default function native(platform) {
let YH_ProductListRNView = createReactClass({
render() {
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
let {
host,
serviceHost,
channel,
type,
brand_id,
shop_id,
dictParams,
saleType,
activityId,
filterSubMap,
bannerUrl,
listType,
} = this.props;
store.dispatch(setHost(host));
store.dispatch(setServiceHost(serviceHost));
store.dispatch(setChannel(channel));
store.dispatch(setType(type));
store.dispatch(setBrandId(brand_id));
store.dispatch(setShop(shop_id));
store.dispatch(setOriginParams(dictParams));
store.dispatch(setSaleType(saleType));
store.dispatch(setActivityId(activityId));
store.dispatch(setBannerUrl(bannerUrl));
store.dispatch(setListType(listType));
if (type == 'YH_ScreenCategoryView' ) {
return (
<Provider store={store}>
<ScreenContainer />
</Provider>
);
} else if(type == 'YH_ProductFilterCategoryView' ){
store.dispatch(updateCategoryDataSource(filterSubMap));
return (
<Provider store={store}>
<ScreenCategoryContainer />
</Provider>
);
} else if (type == 'YH_ProductFilterSubView' ){
store.dispatch(updateDataSource(filterSubMap));
return (
<Provider store={store}>
<ScreenSubContainer />
</Provider>
);
} else if (type == 'YH_ProductListForBrandRNView' ){
return (
<Provider store={store}>
<ProductListForBrandContainer />
</Provider>
);
} else if (type == 'YH_ProductListForShopRNView' ){
return (
<Provider store={store}>
<ProductListForShopContainer />
</Provider>
);
} else if (type == 'YH_ProductListPoolView' ||
type == 'YH_VipProListVC' ||
type == 'YH_PromotionProductListVC' ||
type == 'YH_OutLetProListVC' ||
type == 'YH_InstalmentView' ||
type == 'YH_NewUserView' ||
type == 'YH_ActivityProListVC' ||
type == 'YH_LatestView' ||
type == 'YH_FilterProListVC'){
return (
<Provider store={store}>
<ProductListPoolContainer />
</Provider>
);
} else if (type == 'YH_CategoryProList') {
return (
<Provider store={store}>
<CategoryProductListContainer />
</Provider>
);
}
return null;
}
});
AppRegistry.registerComponent('YH_ProductListRNView', () => YH_ProductListRNView);
}
let styles = StyleSheet.create({
});