react-navigation / react-navigation/react-navigation.github.io

Can't keep a screen mounted

Open
#808 9 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
324
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

Current Behavior

From the docs:

navigation.navigate({ name: SCREEN, key: SCREEN_KEY_A });
navigation.navigate({ name: SCREEN, key: SCREEN_KEY_B });
navigation.navigate({ name: SCREEN, key: SCREEN_KEY_C });
navigation.navigate({ name: SCREEN, key: SCREEN_KEY_D });

then

navigation.navigate({ key: SCREEN_KEY_A }); // will go to screen A FROM screen D

It will unmount B, C and D. (btw I think this should be highlighted more in the docs)
What if I want to keep let's say D mounted? And when I navigate to D again, I want to reuse the same instance.

My use case is a webview that I want to keep mounted in the background.
I found an old question in stackoverflow, never answered https://stackoverflow.com/questions/41818857/keep-react-native-webview-mounted

Expected Behavior

  • I want to have the option to keep a screen mounted and reuse the same instance when I navigate back to it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the navigation.navigate example in the issue and review the linked Stack Overflow question for the stated WebView use case. Determine where screen mounting and reuse are documented or configured, then update the behavior or documentation so the expected option and its effect on mounted screens are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
documentation, mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.