Authored by chenl

增加了品类loading加载。review by 于良。

... ... @@ -12,6 +12,7 @@ import ReactNative, {
} from 'react-native';
import ChannelSelector from '../../../common/components/ChannelSelector';
import LoadingIndicator from '../../../common/components/LoadingIndicator';
import CategoryList from './CategoryList';
... ... @@ -23,6 +24,8 @@ export default class Category extends Component {
render() {
let {isFetching} = this.props;
return (
<View style={styles.container}>
<ChannelSelector selectedChannelValue={this.props.currentChannelId} onSelectChannel={this.props.onSelectChannel} />
... ... @@ -33,6 +36,8 @@ export default class Category extends Component {
currentChannelId={this.props.currentChannelId}
pressSubCateRow={this.props.pressSubCateRow}
/>
<LoadingIndicator isVisible={isFetching} />
</View>
);
}
... ...
... ... @@ -112,6 +112,7 @@ class CategoryContainer extends Component {
render() {
let {
isFetching,
categoryList,
currentChannelId,
currentCateId,
... ... @@ -120,6 +121,7 @@ class CategoryContainer extends Component {
return (
<View style={styles.container}>
<Category
isFetching={isFetching}
categoryList={categoryList}
currentChannelId={currentChannelId}
currentCateId={currentCateId}
... ...
... ... @@ -3,6 +3,7 @@
import {Record, List, Map} from 'immutable';
let InitialState = Record({
isFetching: false,
currentChannelId: 'boy',
currentCateId: '0',
categoryList: new (Record({
... ...
... ... @@ -5,11 +5,14 @@ import Immutable, {Map} from 'immutable';
const {
SET_TYPE,
GET_CATEGORY_SUCCESS,
SET_CURRENT_CATEGORY_ID,
SET_CURRENT_CHANNEL_ID,
GET_CATEGORY_REQUEST,
GET_CATEGORY_SUCCESS,
GET_CATEGORY_FAILURE,
JUMP_TO_CATEGORY,
} = require('../../constants/actionTypes').default;
... ... @@ -21,6 +24,9 @@ export default function categoryReducer(state=initialState, action) {
case SET_TYPE: {
return state.set('type', action.payload);
}
case GET_CATEGORY_REQUEST: {
return state.set('isFetching', true);
}
case GET_CATEGORY_SUCCESS:{
let {
boy,
... ... @@ -31,7 +37,11 @@ export default function categoryReducer(state=initialState, action) {
return state.setIn(['categoryList', 'boy'],Immutable.fromJS(boy))
.setIn(['categoryList', 'girl'],Immutable.fromJS(girl))
.setIn(['categoryList', 'kids'],Immutable.fromJS(kids))
.setIn(['categoryList', 'lifestyle'],Immutable.fromJS(lifestyle));
.setIn(['categoryList', 'lifestyle'],Immutable.fromJS(lifestyle))
.set('isFetching', false);
}
case GET_CATEGORY_FAILURE: {
return state.set('isFetching', false);
}
case SET_CURRENT_CATEGORY_ID:{
return state.set('currentCateId',Immutable.fromJS(action.payload));
... ...