voice icon indicating copy to clipboard operation
voice copied to clipboard

`new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.

Open forchello opened this issue 4 years ago • 8 comments

Good evening! I ask you for help, I have been suffering for a very long time with this problem. I am trying to run test code from your repository and I get this error:

image

You say that this is just a warning, but the sound cannot be recorded. Thank you for your time

forchello avatar Oct 05 '21 16:10 forchello

I have the same problem too.

fbsoares-lu avatar Oct 21 '21 22:10 fbsoares-lu

I have the same problem too.

Didn't find a solution? It's just that even the example from the repository does not work for me.

forchello avatar Nov 03 '21 10:11 forchello

Adding the methods to the file removes the error! Not sure if this is the best fix!

https://github.com/software-mansion/react-native-reanimated/pull/2316/files

muhammedjailam avatar Nov 22 '21 16:11 muhammedjailam

+1

O-Pessoa avatar May 27 '22 19:05 O-Pessoa

same!

Muriel-Gasparini avatar Jul 28 '22 20:07 Muriel-Gasparini

same... any updates ?

Sanath91009 avatar Jul 29 '22 14:07 Sanath91009

Hey! Try this, probably it wil help you

forchello avatar Jul 29 '22 14:07 forchello

useEffect(() => { Voice.onSpeechStart = onSpeechStart; Voice.onSpeechEnd = onSpeechEnd; Voice.onSpeechResults = onSpeechResults; Voice.onSpeechPartialResults = onSpeechPartialResults;

return () => {
  Voice.destroy().then(Voice.removeAllListeners);
};
// eslint-disable-next-line react-hooks/exhaustive-deps

}, []);

const onSpeechStart = e => { console.log('onSpeechStart: ', e); setMicroIsLoading(true); };

const onSpeechEnd = e => { console.log('onSpeechEnd: ', e); setMicroIsLoading(false); };

const onSpeechResults = e => { console.log('onSpeechResults: ', e); setResult(e.value);

if (typeof e.value !== undefined) {
  translateDispatch(setSourceText(e.value[0]));
}

};

const onSpeechPartialResults = e => { console.log('onSpeechPartialResults: ', e); setPartResult(e.value); };

const _startRecognizing = async () => { if (await requestMicroPermission()) { try { setMicroIsLoading(true); await Voice.start(SourceLang); } catch (e) { console.error(e); } } else { console.log('micro permissions error'); } };

const _stopRecognizing = async () => { try { setMicroIsLoading(false); await Voice.stop(); } catch (e) { console.error(e); } };

forchello avatar Jul 29 '22 14:07 forchello

Adding the methods to the file removes the error! Not sure if this is the best fix!

https://github.com/software-mansion/react-native-reanimated/pull/2316/files

I don't use React Native Reanimated and I still get the warning. What to do? Is this a warning that doesn't change anything or do I need to fix this?

Volper212 avatar Aug 24 '22 10:08 Volper212

Adding the methods to the file removes the error! Not sure if this is the best fix! https://github.com/software-mansion/react-native-reanimated/pull/2316/files

I don't use React Native Reanimated and I still get the warning. What to do? Is this a warning that doesn't change anything or do I need to fix this?

You can add LogBox.ignoreLogs(['new NativeEventEmitter()']); inside your component and don`t worry anymore

forchello avatar Aug 28 '22 16:08 forchello