Comments (7)
I'm not sure, I would have to look into it. Can you possibly record a .gif
of the instance or provide a use case for me to test (some context of the code and platform you are using)? I assume this is due to a listener not being destroyed before the component is, as the callback is asynchronous.
from voice.
Sorry for no .gif,
Hi, when I use navigate to the function onSpeechResult to redirect to the next page
onSpeechResults(e) {
const { navigate } = this.props.navigation;
navigate('Result', {channelp:0, searchit: true, skeyword: keyvt});
}
but as I go back using navigation.goBack() , the error I mention which happen. But I notice that if the result page is within the current page and move to the other pages and goback, it didn't have any issue.
WHat Listner should I destroy?
thanks,
from voice.
I would do something similar to the example:
removeListeners() {
const error = Voice.destroy();
if (Voice.onSpeechStart != null) {
Voice.onSpeechStart.remove();
Voice.onSpeechStart = null;
}
if (Voice.onSpeechRecognized != null) {
Voice.onSpeechRecognized.remove();
Voice.onSpeechRecognized = null;
}
if (Voice.onSpeechEnd != null) {
Voice.onSpeechEnd.remove();
Voice.onSpeechEnd = null;
}
if (Voice.onSpeechError != null) {
Voice.onSpeechError.remove();
Voice.onSpeechError = null;
}
if (Voice.onSpeechResults != null) {
Voice.onSpeechResults.remove();
Voice.onSpeechResults = null;
}
if (Voice.onSpeechPartialResults != null) {
Voice.onSpeechPartialResults.remove();
Voice.onSpeechPartialResults = null;
}
if (Voice.onSpeechVolumeChanged != null) {
Voice.onSpeechVolumeChanged.remove();
Voice.onSpeechVolumeChanged = null;
}
}
And before you navigate from the page or when the component is going to unmount:
onSpeechResults(e) {
const { navigate } = this.props.navigation;
this.removeListeners();
navigate('Result', {channelp:0, searchit: true, skeyword: keyvt});
}
from voice.
got this error
Voice.onSpeechStart.remove is not a function
thanks,
from voice.
Ah, I see, I assumed wrong. Try doing this:
removeListeners() {
Voice.destroy();
}
The listeners are removed in the Voice.destroy()
method.
from voice.
Now, its working. Thanks
from voice.
Just a heads up, you may want to update VoiceTest to reflect this change. Great stuff, BTW.
from voice.
Related Issues (20)
- React native issues warning about NativeEventEmitter HOT 5
- `react-native-voice` Compatibility Issue with Android 13 ColorOS ROM ("13/Didn't understand, please try again.") HOT 3
- patata
- Remove background noise HOT 1
- "Cannot make recognizer for sq-AL. Supported locale identifiers are..." HOT 3
- Error with Android 13 (Code 9, Code 12) HOT 6
- Your JavaScript code tried to access a native module that doesn't exist. HOT 1
- Word Period Issue
- Repeated kAFAssistantErrorDomain error 1107 HOT 2
- Any plan to support contextualStrings on iOS and Android?
- Expo Android: Could not find method compile() for arguments HOT 3
- React Native Screen Recorder and Voice Recogniser does not work together
- Is there any way to ignore speaker output? HOT 3
- Single letter or Alphabet only not recognize
- Bluetooth recognition crash
- Error in Android Build Process: Deprecated Configurations and Implicit Dependencies in @react-native-voice_voice Module HOT 4
- Cannot update listeners while Voice is recording.
- intergrate with WebRTC
- Facing build error after manually linking in android HOT 8
- Offline mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from voice.