-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Timer] EventDispatcher sendDeviceEventWithName only called once. #1218
Comments
To add to this I have found out that the block for Discovery library isn't called multiple times until you close the app and reopen it. It does however work if its not called within a React Native environment. Looking at the Discovery library the only things that I think could be breaking with React Native are the timers and queues that are being set. Any help would be appreciated. |
RN pauses timers when the app is backgrounded. Not sure why this is -- it probably shouldn't do this at the infrastructure level. |
The timers don't seem to fire until the app is closed and reopened. |
cc @nicklockwood and @a2, this is weird that timers are suppressed |
I assume this has to do with the way run loops (and run loop modes) work? |
I know NSTimers work without the use of React Native within a standard native app. |
@a2 that could be part of it since the run loop is driven by the display link. This for sure is part of the problem: react-native/React/Modules/RCTTiming.m Line 89 in 4eece85
for (NSString *name in @[UIApplicationWillResignActiveNotification,
UIApplicationDidEnterBackgroundNotification,
UIApplicationWillTerminateNotification]) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(stopTimers)
name:name
object:nil];
} |
@ide That would definitely do it! 😕 |
Any update on this? |
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed. |
Any update on this, sorry for the spam. Just seems to have gone quiet. |
Hi there! This issue is being closed because it has been inactive for a while. But don't worry, it will live on with ProductPains! Check out it's new home: https://productpains.com/post/react-native/timer-eventdispatcher-senddeviceeventwithname-only-called-once |
Hello, I think the EventDispatcher sendDeviceEventWithName has a bug in which the EventDispatcher sendDeviceEventWithName is only called once initially until you close the app down to the background and then reopen it. Once you open it the Events seem to be triggered as expected.
I have created a native bridge to a library located https://github.com/omergul123/Discovery It's also worth pointing out that the library works fine whilst not in a React Native project.
My bridge looks like this
The Javascript component looks like this.
The text was updated successfully, but these errors were encountered: