From 41e661fc362dfb265f6beb0b47d100fa6c446570 Mon Sep 17 00:00:00 2001 From: louiszawadzki Date: Mon, 5 Jun 2023 18:11:03 +0200 Subject: [PATCH] Set iOS AppState to inactive when app is launching --- packages/react-native/Libraries/AppState/AppState.d.ts | 2 +- packages/react-native/React/CoreModules/RCTAppState.mm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/AppState/AppState.d.ts b/packages/react-native/Libraries/AppState/AppState.d.ts index 45beaca9bde90b..6333c8190565ce 100644 --- a/packages/react-native/Libraries/AppState/AppState.d.ts +++ b/packages/react-native/Libraries/AppState/AppState.d.ts @@ -24,7 +24,7 @@ import {NativeEventSubscription} from '../EventEmitter/RCTNativeAppEventEmitter' * App States * active - The app is running in the foreground * background - The app is running in the background. The user is either in another app or on the home screen - * inactive [iOS] - This is a transition state that currently never happens for typical React Native apps. + * inactive [iOS] - This is a transition state that happens when the app launches, is asking for permissions or when a call or SMS message is received. * unknown [iOS] - Initial value until the current app state is determined * extension [iOS] - The app is running as an app extension * diff --git a/packages/react-native/React/CoreModules/RCTAppState.mm b/packages/react-native/React/CoreModules/RCTAppState.mm index 389aa6d642dfd0..bb7ca9c2dc457b 100644 --- a/packages/react-native/React/CoreModules/RCTAppState.mm +++ b/packages/react-native/React/CoreModules/RCTAppState.mm @@ -20,7 +20,7 @@ static NSDictionary *states; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - states = @{@(UIApplicationStateActive) : @"active", @(UIApplicationStateBackground) : @"background"}; + states = @{@(UIApplicationStateActive) : @"active", @(UIApplicationStateBackground) : @"background", @(UIApplicationStateInactive) : @"inactive"}; }); if (RCTRunningInAppExtension()) {