mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add bridgeless check so that we notify listeners if activity is already resumed
Summary: When a native module registers itself as a lifecycle event listener, ReactContext will immediately call `onHostResume` if the activity is already in a resumed state. We rely on this behavior for things like NativeAnimatedModule, which only enqueues the frame callback in onHostResume. However, ReactContext only does this if `hasActiveCatalystInstance()` returns true - which makes sense, because we don't want to notify listeners if the instance has been destroyed. But in bridgeless mode, `hasActiveCatalystInstance` returns false, and we never call `onHostResume` in this case. This diff fixes an issue where native driver animations don't work the first time you navigate to a screen with bridgeless mode enabled. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D22560314 fbshipit-source-id: 1a60cb482896308e21d6e438eb9a7314f580ad04
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5ac524bdbc
commit
e12cf7d069
@@ -183,7 +183,7 @@ public class ReactContext extends ContextWrapper {
|
||||
|
||||
public void addLifecycleEventListener(final LifecycleEventListener listener) {
|
||||
mLifecycleEventListeners.add(listener);
|
||||
if (hasActiveCatalystInstance()) {
|
||||
if (hasActiveCatalystInstance() || isBridgeless()) {
|
||||
switch (mLifecycleState) {
|
||||
case BEFORE_CREATE:
|
||||
case BEFORE_RESUME:
|
||||
|
||||
Reference in New Issue
Block a user