callstack / callstack/react-native-paper

Add keepMounted flag to Modal/Dialog

未关闭
#4,267 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
feature request
主要语言
TypeScript
星标
14.5k
派生
2.2k
平均合并
5 天 23 小时
30 天内合并 PR
12

描述

**Is your feature request related to a problem? Please describe.**
Yes. It would be nice to persist the content sent to a modal/dialog even after it is closed to improve rendering performance.

**Describe the solution you'd like**
The default behavior of mounting the content when the modal/dialog is visible and unmounting it on close animation is great. However, I would like a way to keep the content mounted regardless if it is open. Two options could exist:
1. `after-first` - After opening for the first time, mount the content and keep keep it mounted for subsequent opens
2. `always` - Eagerly mount the content right away and again keep it mounted

Proposing new flag `mountingBehavior` on modal/dialog of type: `'open-only' | 'after-first' | 'always'` defaulted to `'open-only'`

**Describe alternatives you've considered**
I'm in the process of creating a custom dialog to accomplish this.

**Additional context**
[MUI](https://mui.com/material-ui/api/modal/#modal-prop-keepMounted) has a `keepMounted` flag for this.

贡献指南

打开贡献指南

调研方向

首先定位 Modal 和 Dialog 的入口点,以及它们当前仅在打开时挂载的行为。检查提议的 mountingBehavior 值—open-only、after-first 和 always—应如何应用于这两个组件。完成的标准是新的默认值保留现有行为,并且每个请求的选项都按指定方式保持内容处于挂载状态。

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

评估

技术栈
react-native, typescript
领域
mobile
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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