/* @flow */ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import ModalActions from 'actions/ModalActions'; import ReceiveActions from 'actions/ReceiveActions'; import type { State, Dispatch } from 'flowtype'; import Modal from './index'; type OwnProps = {||}; type StateProps = {| modal: $ElementType, accounts: $ElementType, devices: $ElementType, connect: $ElementType, selectedAccount: $ElementType, sendFormEthereum: $ElementType, sendFormRipple: $ElementType, receive: $ElementType, localStorage: $ElementType, wallet: $ElementType, |}; type DispatchProps = {| modalActions: typeof ModalActions, receiveActions: typeof ReceiveActions, |}; export type Props = {| ...OwnProps, ...StateProps, ...DispatchProps |}; const mapStateToProps = (state: State): StateProps => ({ modal: state.modal, accounts: state.accounts, devices: state.devices, connect: state.connect, selectedAccount: state.selectedAccount, sendFormEthereum: state.sendFormEthereum, sendFormRipple: state.sendFormRipple, receive: state.receive, localStorage: state.localStorage, wallet: state.wallet, }); const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({ modalActions: bindActionCreators(ModalActions, dispatch), receiveActions: bindActionCreators(ReceiveActions, dispatch), }); // export default connect(mapStateToProps, mapDispatchToProps)(Modal); export default withRouter( connect( mapStateToProps, mapDispatchToProps )(Modal) );