mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Feature to listen on window focus events (#25039)
Summary: Addressed issue: https://github.com/facebook/react-native/issues/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: https://github.com/facebook/react-native/pull/25039 Differential Revision: D15644954 Pulled By: cpojer fbshipit-source-id: 823acffc4287bec4bf56e9f5ffcac65c01cf13d3
This commit is contained in:
committed by
Facebook Github Bot
parent
bf8d918681
commit
d45818fe47
@@ -125,6 +125,12 @@ public abstract class ReactActivity extends AppCompatActivity
|
||||
mDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
mDelegate.onWindowFocusChanged(hasFocus);
|
||||
}
|
||||
|
||||
protected final ReactNativeHost getReactNativeHost() {
|
||||
return mDelegate.getReactNativeHost();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user