0

音声からテキストへのアプリケーションに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);
  };
 }
}

すべての画面に同じコード構造を適用しました。

4

0 に答える 0