ActivityOrderDetailContainer.js 1.68 KB
'use strict';

import React, {Component} from 'react';

import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import {Map} from 'immutable';
import * as allianceActions from '../reducers/alliance/allianceActions';
import ActivityOrderDetail from "../components/ActivityOrderDetail";
import ReactNative, {Platform, StyleSheet, View} from "react-native";
import LoadingIndicator from '../../common/components/LoadingIndicator';

const actions = [
    allianceActions,
];

function mapStateToProps(state) {
    return {
        ...state
    };
}

function mapDispatchToProps(dispatch) {

    const creators = Map()
        .merge(...actions)
        .filter(value => typeof value === 'function')
        .toObject();

    return {
        actions: bindActionCreators(creators, dispatch),
        dispatch
    };
}

class ActivityOrderDetailContainer extends Component {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this.props.actions.getActivityDetail(this.props.alliance.orderCode);
    }

    componentWillUnmount() {

    }

    render() {
        let {activityDetail} = this.props.alliance;
        let isFetching = activityDetail.isFetching;
        // console.log(`---------------->render:"${activityDetail}"`);
        return (
            <View style={styles.container}>
                <ActivityOrderDetail
                    orderDetail={activityDetail}
                />
                <LoadingIndicator isVisible={isFetching}/>
            </View>
        )
    }
}

let styles = StyleSheet.create({
    container: {
        flex: 1,
    },
});

export default connect(mapStateToProps, mapDispatchToProps)(ActivityOrderDetailContainer);