Authored by 孙凯

修改 数据传输方式 review by chenlin

... ... @@ -50,6 +50,15 @@ import {
setActivityId,
} from './reducers/app/appActions';
import {
updateDataSource
} from './reducers/screenSub/screenSubActions';
import {
updateCategoryDataSource
} from './reducers/screenCategory/screenCategoryActions';
function getInitialState() {
const _initState = {
app: (new appInitialState()),
... ... @@ -71,8 +80,7 @@ export default function native(platform) {
render() {
const store = configureStore(getInitialState());
store.dispatch(setPlatform(platform));
let {host, serviceHost, channel, type, brand_id, shop_id, dictParams, saleType, activityId} = this.props;
let {host, serviceHost, channel, type, brand_id, shop_id, dictParams, saleType, activityId, filterSubMap} = this.props;
store.dispatch(setHost(host));
store.dispatch(setServiceHost(serviceHost));
store.dispatch(setChannel(channel));
... ... @@ -90,12 +98,14 @@ export default function native(platform) {
</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 />
... ...
'use strict';
import React, {Component} from 'react';
import {
import ReactNative,{
StyleSheet,
Dimensions,
Platform,
View,
Text,
ListView,
NativeAppEventEmitter,
} from 'react-native';
import {Map} from 'immutable';
... ... @@ -121,6 +122,11 @@ export default class ProductListForShop extends Component {
dataSource={this.dataSource.cloneWithRowsAndSections(dataSource)}
renderRow={this.renderRow}
renderSectionHeader={this.renderSectionHeader}
onScroll={(event) => {
console.log('onScrollonScrollonScroll')
console.log(event.nativeEvent.contentOffset.y)
ReactNative.NativeModules.YH_ProductListRNViewHelper.hideNavigationBar(true);
}}
renderFooter={()=>{
if (endReached) {
return <View style={styles.placeholder} />;
... ...
... ... @@ -49,13 +49,6 @@ class ScreenCategoryContainer extends Component {
super(props);
this.selectItem = this.selectItem.bind(this);
this.selectSubItem = this.selectSubItem.bind(this);
this.updateFilterCategory = this.updateFilterCategory.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'updateFilterCategoryView',
(dic) => {
this.updateFilterCategory(dic);
}
);
}
componentWillUnmount() {
... ... @@ -72,12 +65,6 @@ class ScreenCategoryContainer extends Component {
ReactNative.NativeModules.YH_FilterHelper.didSelectCategoryItemFilter({data,key});
}
updateFilterCategory(dic){
if (dic) {
this.props.actions.updateDataSource(dic);
}
}
render() {
let {app, screenCategory} = this.props;
return (
... ...
... ... @@ -48,25 +48,12 @@ class ScreenSubContainer extends Component {
constructor(props) {
super(props);
this.selectItem = this.selectItem.bind(this);
this.updateFilterSub = this.updateFilterSub.bind(this);
this.subscription = NativeAppEventEmitter.addListener(
'updateFilterSub',
(dic) => {
this.updateFilterSub(dic);
}
);
}
componentWillUnmount() {
this.subscription && this.subscription.remove();
}
updateFilterSub(dic){
if (dic) {
this.props.actions.updateDataSource(dic);
}
}
selectItem(data,key){
this.props.actions.selectItem(data,key);
ReactNative.NativeModules.YH_FilterHelper.didSelectFilterSubItem({data,key});
... ...
... ... @@ -9,7 +9,7 @@ const {
} = require('../../constants/actionTypes').default;
export function updateDataSource(data) {
export function updateCategoryDataSource(data) {
return {
type: SET_DATASOURCE_CATEGORY,
payload: data
... ...
... ... @@ -9,6 +9,9 @@ const {
export function updateDataSource(data) {
if (!data) {
return;
}
let key = data?data.key:'';
let json = data;
if (key == 'brand') {
... ...