maxs15 / maxs15/react-native-modalbox

backButtonClose={true}下,点击安卓物理返回键回退好几个页面。

Open
#276 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.9k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

backButtonClose={true} 时,如果遮罩层是打开状态,点击安卓物理返回键会关闭它。
但是带来一个问题,某页面使用了ModalBox,如果重来没让它弹出来过,那么按物理返回键回到上页面,是正常到。只要在改页面弹出过ModalBox(无论是点击背景让它关闭还是点击返回键关闭),然后点击物理返回键页面会回退好几个页面。

问题很怪异,之前用ModalBox都没出现过这个问题,也可能跟公司RN框架有冲突。

提此问题,希望能帮助到遇到同样问题的人,作者也可以看看backButtonClose实现是否有问题。

解决方法: 去掉backButtonClose,或者backButtonClose={false},如果需要点击物理返回键关闭ModalBox,可以通过监听安卓物理返回键来判读ModalBox是否是打开的,自己手动关闭。

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

No file or test is named. Reproduce the issue on Android with ModalBox and backButtonClose={true}, comparing a page where the modal was opened with one where it was not; inspect the back-button handling entry point and verify that closing the modal does not navigate through multiple pages.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.