forward ThemedReactContext#has/getCurrentActivity calls to wrapped context
Summary: `ThemedReactContext` wraps the actual `ReactContext` but doesn't actually receive any lifecycle events, which would set `mCurrentActivity`, so that's always stuck as `null`. To fix, we override `has/getCurrentActivity` and forward the call to the wrapped context, which actually has the correct lifecycle status. Fixes issue #9310 on github. Reviewed By: mkonicek Differential Revision: D3703005 fbshipit-source-id: 363e87ac91d50516899b413e823d5312cbb807f4
This commit is contained in:
parent
f76f4cf432
commit
96e41218ed
|
@ -9,10 +9,10 @@
|
|||
|
||||
package com.facebook.react.uimanager;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
|
@ -47,4 +47,14 @@ public class ThemedReactContext extends ReactContext {
|
|||
public void removeLifecycleEventListener(LifecycleEventListener listener) {
|
||||
mReactApplicationContext.removeLifecycleEventListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCurrentActivity() {
|
||||
return mReactApplicationContext.hasCurrentActivity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable Activity getCurrentActivity() {
|
||||
return mReactApplicationContext.getCurrentActivity();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue