问题描述
我将 react-native-voice/voice 用于我的语音转文本应用程序。但是 voice search
仅适用于初始屏幕,不适用于任何其他屏幕。下面是我实现的代码。请问有什么线索吗?
class BuyerContainer extends Component {
constructor(props) {
super(props);
// Binding the listeners
Voice.onSpeechError = this.onSpeechError.bind(this);
Voice.onSpeechResults = this.onSpeechResults.bind(this);
}
// Called when I navigate to other screen
// Used this because componentwillUnmount does not work for stack navigator
onNavigation = async routeName => {
await Voice.destroy().then(Voice.removeAllListeners);
this.props.navigation.navigate(routeName);
};
}
}
我为所有屏幕应用了相同的代码结构。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)