-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
App state not working in android when I pull down the notifications bar on android #24149
Comments
Can you run If you believe this information is irrelevant to the reported issue, you may write `[skip envinfo]` alongside an explanation in your Environment: section.
|
Hello there 👋 this issue has been reported for an old version of React Native. Ideally we'd like everyone to be using 0.59 (see the awesome changes it brought) but we know updating can be a pain. To upgrade please refer to the documentation -> facebook.github.io/react-native/docs/upgrading#react-native-projects (if you are upgrading from an earlier version than 0.59.0 refer to pvinis/rn-diff-purge) But please, if it's actually still an issue with 0.59 please comment below with a repro and we can reopen it. Even better, please send us a pull request with a fix 😊 |
Hi there. I am experiencing this issue using RN 59.4:
|
@LaurenceRolandJames can you provide a repro? |
@kelset No problem, I have reproduced the issue in an app created using react-native init which uses the latest version of React Native (0.59.5): https://github.com/LaurenceRolandJames/AndroidNotificationsBarAppStateRepro To reproduce, run the app on an Android device with the developer tools open and compare the logs when closing and reopening the app to the logs when toggling the notification bar. App state changed logs will appear when closing and reopening the app, but will not appear when toggling the notification bar. React Native Environment Info:
Android device info:Device name: Galaxy S5 Neo |
thanks, reopening |
Hi @kelset , Any update on this? Thanks |
Hey @LaurenceRolandJames, @kelset, @akhilsanker, When a user pulls down I've implemented this locally and I can confirm it's working. I'll come up with a PR to discuss this API further. thanks. |
Thanks for opening the PR! 🤗 |
Summary: Addressed issue: #24149 On Android, activity's lifecycle events are not triggered when the user pulls down the Status Bar (opening Notification Drawer). In order to know that, you need to override [onWindowFocusChanged method](https://developer.android.com/reference/android/app/Activity.html#onWindowFocusChanged(boolean)). ## Changelog [Android] [Added] - Adds a new listener for `onWindowFocusChanged` [JavaScript] [Added] - New event, `focusChanged`, to listen on focus gain/loss Pull Request resolved: #25039 Differential Revision: D15644954 Pulled By: cpojer fbshipit-source-id: 823acffc4287bec4bf56e9f5ffcac65c01cf13d3
Hi any luck with this ? |
@sujatha2016 Yes, it's been released with RN 0.60. |
So we can close this I guess? |
@krizzu sorry about being a pain in neck but in my package.json the react-native = "^0.59.10" it means it uses 0.61.5 right ? correct me if am wrong. Believing the up caret uses the latest version of RN I tried adding focus and blur on AppState but it throws me an error Trying to subscribe unknown event focus.. Even my app is on RN version "0.59.10", Isn't there a way to achieve this ? |
@sujatha2016 Normally, having you can easily check what version you have using If you're planning on upgrading, use this helpful tool that shows you what files changed between version 0.59.10 and 0.60.6 |
Summary: Addressed issue: facebook#24149 On Android, activity's lifecycle events are not triggered when the user pulls down the Status Bar (opening Notification Drawer). In order to know that, you need to override [onWindowFocusChanged method](https://developer.android.com/reference/android/app/Activity.html#onWindowFocusChanged(boolean)). ## Changelog [Android] [Added] - Adds a new listener for `onWindowFocusChanged` [JavaScript] [Added] - New event, `focusChanged`, to listen on focus gain/loss Pull Request resolved: facebook#25039 Differential Revision: D15644954 Pulled By: cpojer fbshipit-source-id: 823acffc4287bec4bf56e9f5ffcac65c01cf13d3
Hello there 👋 this issue seems to have been inactive for the past few weeks. Because of this, it's likely that the issue is not a high priority anymore or it has been solved by OP; for these reasons, we'll close it. But please, if it's actually still an issue with 0.62 please comment below and we can reopen it or please send us a Pull Request with a fix 😊 |
Appstate.addEventListener("focus") is not working on Android 7 |
same issue hi @cinder92 Have you fixed this problem yet |
I couldn't get "focus" and "blur" working on Android either, pulling down the notification shade does not trigger the listener |
yes exactly I am facing same issue |
Could we possibly reopen this issue for another round of investigation? Seems like this feature has broken for quite a number of us since the fix 2 years ago. @kelset |
same problem in react native v.0.63.3, blur and focus event don't come when I pull down menu on android and I can't find any use case to trigger it.
|
Any update on this? |
any updates? |
Problem still exists on |
Yes this issue is still |
same here facing the issue |
1 similar comment
same here facing the issue |
Same issue, any updates on that? |
🐛 Bug Report
App state not working in android when I pull down the notifications bar.
To Reproduce
The app state listerner not working when I pull down the notifications bar in android.
Expected Behavior
To emit the app state event listener when I pull down the notifications bar and changes any settings, such as location on/off, wifi on/off etc..
Environment
The text was updated successfully, but these errors were encountered: