Here my codes :
Voice.onSpeechStart = this.onSpeechStart.bind(this);
Voice.onSpeechRecognized = this.onSpeechRecognized.bind(this);
Voice.onSpeechResults = this.onSpeechResults.bind(this);}
componentWillUnmount() {
Voice.destroy().then(Voice.removeAllListeners);}
onSpeechStart(e) {
this.setState({
started: "√"}
);}
onSpeechRecognized(e) {
this.setState({
recognized: "√"
});
}
onSpeechResults(e) {
this.setState({results: e.value});
if(matchSorter(this.setState.results,'login now') === 'login now'){
this.props.navigation.navigate("Dashboard");
}
else {
ToastAndroid.show("Please Try Again", ToastAndroid.SHORT);
}
}
async _startRecognition(e) {
this.setState({
recognized: "",
started: "",
results: []
});
try {
await Voice.start("en-US");
} catch (e) {
console.error(e);
}
render() {
return (
<Text>Say "Login now"</Text>
<TouchableOpacity
onPress={this._startRecognition.bind(this)}>
<Text> TAP HERE </Text>}
and this error coming out :
Error Image from Android-based Mobile:
*The output of "this.setState.results" when I say login now is "blogging nowlogging nowlogin nowjogging nowlog in now".
