66import android .os .Handler ;
77import android .os .Looper ;
88import android .view .View ;
9+ import android .view .Choreographer ;
910
1011import androidx .annotation .OptIn ;
1112
2526import com .facebook .react .bridge .ReadableMap ;
2627import com .facebook .react .bridge .WritableMap ;
2728import com .facebook .react .common .annotations .UnstableReactNativeAPI ;
28- import com .facebook .react .modules .core .ChoreographerCompat ;
2929import com .facebook .react .modules .core .DeviceEventManagerModule ;
3030import com .facebook .react .modules .core .ReactChoreographer ;
3131import com .facebook .react .runtime .ReactHostDelegate ;
@@ -99,7 +99,7 @@ public String getName() {
9999 }
100100
101101 private void loadBundleLegacy () {
102- final Activity currentActivity = getCurrentActivity ();
102+ final Activity currentActivity = getReactApplicationContext (). getCurrentActivity ();
103103 if (currentActivity == null ) {
104104 // The currentActivity can be null if it is backgrounded / destroyed, so we simply
105105 // no-op to prevent any null pointer exceptions.
@@ -223,7 +223,7 @@ public void run() {
223223 // React Native uses the id field to track react tags and will overwrite this field.
224224 // If that is fine, explicitly overwrite the id field to View.NO_ID before calling addRootView."
225225 private void resetReactRootViews (ReactDelegate reactDelegate ) {
226- ReactActivity currentActivity = (ReactActivity ) getCurrentActivity ();
226+ ReactActivity currentActivity = (ReactActivity ) getReactApplicationContext (). getCurrentActivity ();
227227 if (currentActivity != null ) {
228228 ReactRootView reactRootView = reactDelegate .getReactRootView ();
229229 if (reactRootView != null ) {
@@ -242,7 +242,7 @@ private void clearLifecycleEventListener() {
242242 }
243243
244244 private ReactDelegate resolveReactDelegate () {
245- ReactActivity currentActivity = (ReactActivity ) getCurrentActivity ();
245+ ReactActivity currentActivity = (ReactActivity ) getReactApplicationContext (). getCurrentActivity ();
246246 if (currentActivity == null ) {
247247 return null ;
248248 }
@@ -278,7 +278,7 @@ private ReactInstanceManager resolveInstanceManager() throws NoSuchFieldExceptio
278278 return instanceManager ;
279279 }
280280
281- final Activity currentActivity = getCurrentActivity ();
281+ final Activity currentActivity = getReactApplicationContext (). getCurrentActivity ();
282282 if (currentActivity == null ) {
283283 return null ;
284284 }
@@ -390,7 +390,7 @@ public void call(DownloadProgress downloadProgress) {
390390 getReactApplicationContext ().runOnUiQueueThread (new Runnable () {
391391 @ Override
392392 public void run () {
393- ReactChoreographer .getInstance ().postFrameCallback (ReactChoreographer .CallbackType .TIMERS_EVENTS , new ChoreographerCompat .FrameCallback () {
393+ ReactChoreographer .getInstance ().postFrameCallback (ReactChoreographer .CallbackType .TIMERS_EVENTS , new Choreographer .FrameCallback () {
394394 @ Override
395395 public void doFrame (long frameTimeNanos ) {
396396 if (!latestDownloadProgress .isCompleted ()) {
0 commit comments