react-sip
react-sip copied to clipboard
Silly question contexts
Hello :)
Sorry for a possibly silly question but i am unable to use the contexts when i try to access {sip.status} I get Line 53: 'sip' is not defined no-undef
and if i import sip also does not work, what silly thing am I doing wrong and thanks for the help! :)
(Registration and everything else works)
@mattronix i am having bit of issue accessing context can you please share sample of your code how did you do that, that would be awesome. I didn't find any sample code regarding that in readme
This library uses React legacy context.
My child component :
import { sipPropType, callPropType } from '@evercall/react-sip';
const SipPhone = (props, context) => {
const Sip = context;
const handleCall = () => {
console.log('handleCall', '\n' , Sip)
}
return (
<div>
<Button onClick={handleCall}>Call</Button>
</div>
);
}
SipPhone.contextTypes = {
sip: sipPropType,
call: callPropType,
registerSip: PropTypes.func,
unregisterSip: PropTypes.func,
answerCall: PropTypes.func,
startCall: PropTypes.func,
stopCall: PropTypes.func,
}
export default SipPhone;
Parent component :
import { SipProvider } from '@evercall/react-sip';
<SipProvider {...SETTINGS from Readme} >
<SipPhone/>
</SipProvider>