Questions tagged [deviceeventemitter]

7 questions
24
votes
2 answers

DeviceEventEmitter vs NativeAppEventEmitter

I want to use events to communicate between native ios/android and my react native app. I see two ways to do this: DeviceEventEmitter and NativeAppEventEmitter, which seem to be fairly identical. What's the difference between them? Why should I pick…
Rubys
  • 3,167
  • 2
  • 25
  • 26
4
votes
1 answer

Background task for reading accelerometer data

I have a React Native application and I am reading accelerometer data each 20ms using the react-native-sensor-manager package. I start the listener and log it into Reactotron each time it reads data, each…
2
votes
1 answer

DeviceEventEmitter on iOS

I'm working on a react-native app. I'm trying to emit events from native code to my react native code. This works in Android, but struggling with iOS. I'm successfully listening to events being sent from my native Android code. The same events are…
alehel
  • 356
  • 1
  • 2
  • 11
1
vote
0 answers

[React Native]: Can't find variable: DeviceEventEmitter

I'm attempting to use the event listener to direct when to open/close a view (i.e close on navigation), but I can't seem to reference the DeviceEventEmitter variable. It seems to be OK on componentWillMount, but then crashes when the actual…
jajabarr
  • 551
  • 2
  • 5
  • 19
0
votes
0 answers

How to unsubscribe from a DeviceEventEmitter eventListener?

I have the following useEffect hook that adds an event listener if isAuthenticated is true: useEffect(() => { if (isAuthenticated) { Doorman.guard(onSessionExpiration); } }, [isAuthenticated, onSessionExpiration]); The problem is…
Onyx
  • 5,186
  • 8
  • 39
  • 86
0
votes
2 answers

React native UI is not getting rendered after callback from native event emitter. Even callback having state change

I want to navigate the user to another screen in react native project after native app widget click in android. I was able to catch event using native event emitter in my MainView.js and there i changed state of one of my component and it got…
0
votes
1 answer

DeviceEventEmitter stops emitting events to application when screen locked

I'm capturing location information with a native module and attempting to send it via a DeviceEventEmitter to my application: [self.bridge.eventDispatcher sendDeviceEventWithName:@"locationUpdated" body:locationEvent]; This works great when the…
outside2344
  • 2,075
  • 2
  • 29
  • 52