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

Can't keep a screen mounted

未关闭
#808 9 条评论 9 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
324
派生
2k
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中的 navigation.navigate 示例开始,并查看所链接的 Stack Overflow 问题,了解其中所述的 WebView 使用场景。确定屏幕的挂载和复用在哪里进行了文档说明或配置,然后更新行为或文档,使预期选项及其对已挂载屏幕的影响变得明确。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, react-native
领域
documentation, mobile
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。