[iOS] Inconsistent unmount lifecycle/cleanup triggered on App Kill when Keyboard is (or was) active
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C++
- Estrellas
- 127k
- Forks
- 25.3k
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 4
Descripción
Description
A breaking change in lifecycle behavior has been observed in versions 0.83.4 and 0.84.1.
On iOS, when a user force-quits (kills) the app, React components normally do not trigger their unmount lifecycles (componentWillUnmount or useEffect cleanup) because the JS engine is terminated abruptly.
However, in these specific versions, if the keyboard was currently open or had been opened and then closed during the session, the unmount lifecycle is triggered upon the app being killed. If the keyboard was never opened during the app's session, the unmount lifecycle is not triggered (matching traditional behavior).
This inconsistency causes side effects, such as unexpected API calls or local storage wipes, to run during a process termination where they previously did not.
This behavior doesn't happen on Android and creates inconsistency between platforms.
Steps to reproduce
Since app is killed debugger is detached. AsyncStorage is used to save timestamp of unmount called
-
Open the application.
-
Observe a component that logs to the console useEffect and class component unmount timestamp
-
Scenario A (No Keyboard): Kill the app via the iOS App Switcher.
Result: No logs appear on next launch (Expected behavior). -
Scenario B (Keyboard Active): Reopen the app, tap a TextInput to bring up the keyboard. Kill the app via the App Switcher.
Result: The unmount logs appear next launch (Inconsistent behavior). -
Scenario C (Keyboard Dismissed): Reopen the app, open the keyboard, close the keyboard. Kill the app via the App Switcher.
Result: The unmount logs appear next launch (Inconsistent behavior).
React Native Version
0.83.4, 0.84.1
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
System:
OS: macOS 26.1
CPU: (12) arm64 Apple M4 Pro
Memory: 380.42 MB / 24.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.15.0
path: /Users/stas/.nvm/versions/node/v22.15.0/bin/node
Yarn:
version: 1.22.22
path: /Users/stas/.nvm/versions/node/v22.15.0/bin/yarn
npm:
version: 10.9.2
path: /Users/stas/.nvm/versions/node/v22.15.0/bin/npm
Watchman:
version: 2026.01.12.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.2
- iOS 26.2
- macOS 26.2
- tvOS 26.2
- visionOS 26.2
- watchOS 26.2
Android SDK: Not Found
IDEs:
Android Studio: 2024.3 AI-243.25659.59.2432.13423653
Xcode:
version: 26.3/17C529
path: /usr/bin/xcodebuild
Languages:
Java:
version: 21.0.6
path: /usr/bin/javac
Ruby:
version: 3.4.3
path: /Users/stas/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.1.0
wanted: 20.1.0
react:
installed: 19.2.3
wanted: 19.2.3
react-native:
installed: 0.84.1
wanted: 0.84.1
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
Not a crash so no specific log is present
MANDATORY Reproducer
https://github.com/worksnk/rn_ios_unmount_breaking_change
Screenshots and Videos
Video shows 3 scenarios in described in steps with logs
https://github.com/user-attachments/assets/cd11d754-182c-4d2e-b9f0-99ee9190d3a5
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el reproducer obligatorio en rn_ios_unmount_breaking_change y verifica los tres escenarios de teclado en React Native 0.83.4 o 0.84.1 para iOS. Compara las marcas de tiempo de unmount después de forzar el cierre, con y sin abrir el teclado; se considera terminado cuando el comportamiento se entiende y la limpieza no intencionada al matar la app ya no se activa, con cobertura de regresión cuando corresponda.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- ios, javascript
- Área
- mobile, mobile-dev
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100