react / react/react-native

React Native 0.82 – JS Timers & Fetch Freeze After Launching a Non-React AppCompatActivity (Worked Fine in Earlier RN Versions)

未关闭
#54,534 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

🌐Networking Needs: Attention Needs: Repro
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

Environment

React: 19.1.1

React Native: 0.82.0

Hermes: Enabled

Platform: Android

Architecture: Reproducible on both Old Architecture & New Architecture

🚨 Summary

After upgrading to React Native 0.82.x, the JS Timers Module and Networking Module freeze whenever a non-React AppCompatActivity is launched from the app (e.g., from a 3rd-party native SDK).

This is a regression —
✅ Everything worked perfectly in RN 0.71 – 0.80
❌ The issue appears only after upgrading to RN 0.81 / 0.82

🔍 What Still Works

JS thread is alive

JS Promise microtasks execute

Native → JS events via DeviceEventEmitter work

React UI continues working

Synchronous JS code runs normally

❌ What Stops Working (Regression)

As soon as a non-React AppCompatActivity takes the foreground:

fetch() stops resolving or rejecting

setTimeout() does not execute

requestAnimationFrame() does not execute

NetworkingModule callbacks do not reach JS

TimersModule does not fire

Fetch requests still GO OUT successfully (verified via proxy tools)

Server responds, but JS never receives the response

This only happens after launching the external AppCompatActivity.

✔️ Working Behavior in Older React Native Versions

In React Native 0.71, 0.72, 0.73, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79 the exact same code and SDK integration works fully.

Fetch resolves normally.

Timers fire normally.

External AppCompatActivity does not impact the JS environment.

Therefore — this is a regression introduced in RN 0.81 or RN 0.82.

Steps to reproduce

Build any React Native app using RN 0.82

Integrate a simple native SDK that launches a plain AppCompatActivity (not ReactActivity)

Emit an event from the SDK → JS

Inside JS event listener:

Promise.resolve().then() → runs

setTimeout(...) → does NOT run

requestAnimationFrame(...) → does NOT run

fetch() → never resolves

Verify using proxy (e.g., Burp Suite):

Fetch does hit the server

Server sends a valid response

JS never receives the response callback

React Native Version

0.82.0

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info
npx @react-native-community/cli -v
20.0.1
shubham.garg@GLH0CY1VHGK2 ~ % npx @react-native-community/cli info
error: unknown command 'info'
(Did you mean init?)
Stacktrace or Logs
Actual Behavior (RN 0.82 Regression)

JS thread alive

Events delivered

Timers & fetch stop working

Network request reaches server

Response returns

JS never gets the response

📌 Expected Behavior (Worked in RN ≤ 0.80)

Launching a non-React Android Activity should NOT pause RN’s TimersModule or NetworkingModule

fetch should continue resolving normally

setTimeout, RAF, requestAnimationFrame should continue executing

This is how React Native behaved for many years until RN 0.81+.

🧠 Diagnosis

Evidence indicates:

ReactContext timers + networking modules get suspended when a non-React AppCompatActivity becomes active.

JS microtasks still run → JS engine (Hermes) alive.

NetworkingModule native → JS callback never fires → indicates bridge suspension.

This DID NOT occur in earlier RN versions.

You can check our sample app https://github.com/payu-intrepos/payu-non-seamless-react
MANDATORY Reproducer

https://github.com/ShubhGar/RN-Fetch-issue

Screenshots and Videos

No response

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先使用 React Native 0.82.0 运行 github.com/ShubhGar/RN-Fetch-issue 中的必需复现程序,然后将行为与列出的早期版本进行比较。重点关注 non-React AppCompatActivity 进入前台时的转换,并验证 fetch 回调、setTimeout 和 requestAnimationFrame 是否按预期恢复执行或继续执行。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, javascript, react-native
领域
mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。