Skip to content

Commit

Permalink
Prevent DEBUG React Native builds idling out (#37681)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #37681

User who run their applications using `npx react-native ios` have the application going into the
background if there is inactivity on the device. This is common for users developing on device (why touch
the device if you're tweaking background colours, etc...).

If the application is build with Xcode directly, this is already managed.  This change prevents the idle
timer from running in DEBUG builds.

## Changelog:
[iOS][Fixed] - Debug builds from cli disable idle to stop application going into background

Reviewed By: cipolleschi

Differential Revision: D46427401

fbshipit-source-id: 45969cd506a1b76bde3be81d27808bf0e792a817
  • Loading branch information
blakef authored and facebook-github-bot committed Jun 5, 2023
1 parent 805604d commit 41d5f4b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled)
#if RCT_NEW_ARCH_ENABLED
RCTEnableTurboModule(turboModuleEnabled);
#endif

#if DEBUG
// Disable idle timer in dev builds to avoid putting application in background and complicating
// Metro reconnection logic. Users only need this when running the application using our CLI tooling.
application.idleTimerDisabled = YES;
#endif
}

UIView *
Expand Down

0 comments on commit 41d5f4b

Please sign in to comment.