Repository navigation
fix: keep the screen on during active guidance - #26
Merged
Merged
Conversation
Guidance on navigation maps (both platforms) and in Android's <NavigationView> let the screen sleep mid-trip, and iOS <NavigationView> reset an app's own isIdleTimerDisabled to false when it closed. The session now keeps the screen on while guidance runs and restores the app's previous setting when it stops. Navigation.setKeepScreenOn(false) opts out.
mfazekas
force-pushed
the
keep-screen-on-during-guidance
branch
from
October 28, 2026 23:56
3b8397b to
bf3776f
Compare
mfazekas
marked this pull request as ready for review
October 29, 2026 00:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Active guidance didn't keep the screen on. Only the iOS SDK's
NavigationViewController(and CarPlay) disables the idle timer, so guidance on a navigation map (mapViewImpl="rnmbxnav",<RNNavigationView>) on both platforms and Android's<NavigationView>let the phone sleep mid-trip. On iOS,<NavigationView>also resetisIdleTimerDisabledtofalseon close, clobbering apps that set it themselves. Same request as googlemaps/react-native-navigation-sdk#302.The fix lives in the session, since guidance is process-wide and can run without any view: it keeps the screen on from
startActiveGuidance(or<NavigationView>starting guidance) untilstopNavigation/ unmount, and then restores what the app had.isIdleTimerDisabled, sets it totrue, and puts the saved value back afterwards.<NavigationView>setsshouldManageApplicationIdleTimer = false, so the session is the only owner (the SDK's manager always writesfalsewhen done).keepScreenOnon the activity's decor view rather thanFLAG_KEEP_SCREEN_ONon the window, so apps (or expo-keep-awake) that use the window flag are untouched. It's reapplied on host resume in case the activity changed.Navigation.setKeepScreenOn(false)opts out, like the SDK'sshouldManageApplicationIdleTimer. It's on by default.Verified on an iOS 26.5 simulator (reading
UIApplication.shared.isIdleTimerDisabledwith lldb) and an API 36 emulator (dumpsys window/dumpsys power, withscreen_off_timeoutset to 15 s during simulated guidance):<RNNavigationView>NOwhile guidingYESwhile guiding,NOafter stop<NavigationView>, app had setYESNOafter closeYESafter close<NavigationView>,<RNNavigationView>KEEP_SCREEN_ON,mWakefulness=Asleepwithin 30 sKEEP_SCREEN_ONand the WindowManager screen wake lock, stillAwakeafter 40 s; cleared on stopsetKeepScreenOn(false), both platformsLint, typecheck and tests pass.