Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_speak = () => {
const start = () => {
this.setState({ inProgress: true });
};
const complete = () => {
this.state.inProgress &&
this.setState({ inProgress: false, paused: false });
};
Speech.speak(this.state.selectedExample.text, {
voice: this.state.voice,
language: this.state.selectedExample.language,
pitch: this.state.pitch,
rate: this.state.rate,
onStart: start,
onDone: complete,
onStopped: complete,
onError: complete,
});
}
(buttonIndex) => {
switch (buttonIndex) {
case 0:
Speech.speak(currentMessage.text)
break
case 1:
Clipboard.setString(currentMessage.text)
break
}
},
)
_loadAllVoices = async () => {
const availableVoices = await Speech.getAvailableVoicesAsync();
this.setState({
voiceList: availableVoices,
voice: availableVoices[0].identifier,
});
}
_pause = async () => {
await Speech.pause();
this.setState({ paused: true });
}
_resume = () => {
Speech.resume();
this.setState({ paused: false });
}
_stop = () => {
Speech.stop();
}