callthemonline / react-sip

React wrapper for jssip
https://www.npmjs.com/package/react-sip
MIT License
50 stars 46 forks source link

Receiving events in a connect() wrapped component #20

Closed alvaromarithompson closed 6 years ago

alvaromarithompson commented 6 years ago

More than an issue, this is more like a request for advice 😄

I've followed the pattern described in one of the other open issues with regards to listening to event changes for sip and call. I've define my component using contextTypes, and using the componentWillReceiveProps() method I can see the change of status occurring as the SIP registration takes place.

In order to get make these status changes available to all my other component, I'm trying to dispatch this event to the react-redux framework, and in order to do this, I need to wrap my export statement from:

export default MyComponent;

to

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

This allows me to dispatch events back to the redux store.

However, as soon as I wrap my component in redux's connect() wrapper, the componentWillReceiveProps() stops receiving context changes, so I'm not able to get SIP status changes any further.

Is there another way to get status even changes?