react-native-twilio-programmable-voice
react-native-twilio-programmable-voice copied to clipboard
Typescript support
Does this project have type definitions?
Please include the following information for better support
The more context you provide around this issue the faster the community can help you
Did you follow all the instructions as specified in the Twilio Quickstart repositories? yes What version of React Native are you running? ~0.63.4 What version of react-native-twilio-programmable-voice are you running? ^4.3.0 What device are you using? (e.g iOS10 simulator, Android 7 device)? n/a Is your app running in foreground, background or not running? n/a Is there any relevant message in the log? Could not find a declaration file for module 'react-native-twilio-programmable-voice'. If using iOS, which pod version are you using? ~> 5.2.0
Step to reproduce
(1) import TwilioVoice from 'react-native-twilio-programmable-voice' in a typescript project
Advanced: Have you tried adding break point using AndroidStudio or XCode and analyse the logs? n/a can share a project with issue? Did you try to reinstall the pods completely? yes
Not at the moment. I will add it to the backlog but our backlog is long already. I don't expect it to be implemented anytime soon.
@danstepanov feel free to send a PR for this.
I hacked together what I see in the README, plus the undocumented removeEventListener that seems to be used in our code at least. Don't have time to make a proper PR right now, but here's the types:
declare module "react-native-twilio-programmable-voice" {
function accept(): void
function connect({ To }: { To: string }): void
function configureCallKit({
appName,
imageName,
ringtoneSound,
}: {
appName: string
imageName?: string
ringtoneSound?: string
}): void
function disconnect(): void
function getActiveCall(): Promise<boolean> // Not sure what the promise "activeCall" contains.
function getCallInvite(): Promise<boolean> // Not sure what the promise "callInvite" contains.
function hold(holdValue: boolean): void
function ignore(): void
function initWithToken(accessToken: string): Promise<boolean>
function reject(): void
function sendDigits(digits: string): void
function setMuted(mutedValue: boolean): void
function setSpeakerPhone(speakerEnabled: boolean): void
function unregister(): void
function addEventListener(type: "deviceReady", cb: () => void): void
function addEventListener(type: "deviceNotReady", cb: ({ err: string }) => void): void
function addEventListener(type: "callRejected", cb: (value: "callRejected") => void): void
function addEventListener(
type: "connectionDidConnect" | "callStateRinging",
cb: (data: {
call_sid: string
call_state: "CONNECTED" | "ACCEPTED" | "CONNECTING" | "RINGING" | "DISCONNECTED" | "CANCELLED"
call_from: string
call_to: string
}) => void,
): void
function addEventListener(
type:
| "connectionIsReconnecting"
| "connectionDidReconnect"
| "callInviteCancelled"
| "deviceDidReceiveIncoming",
cb: (data: { call_sid: string; call_from: string; call_to: string }) => void,
): void
function addEventListener(
type: "connectionDidDisconnect",
cb: (
data:
| null
| { err: string }
| {
call_sid: string
call_state: "CONNECTED" | "ACCEPTED" | "CONNECTING" | "RINGING" | "DISCONNECTED" | "CANCELLED"
call_from: string
call_to: string
err?: string
},
) => void,
): void
function addEventListener(type: "proximity", cb: (data: { isNear: boolean }) => void): void
function addEventListener(
type: "wiredHeadset",
cb: (data: { isPlugged: boolean; hasMic: boolean; deviceName: string }) => void,
): void
function removeEventListener(type: string, cb: function): void
}