ant-design / ant-design-mobile

Essential UI blocks for building mobile web apps.
https://mobile.ant.design
MIT License
11.61k stars 2.39k forks source link

feat: add `closeOnBack` to Popup, CenterPopup and other components built on them #6438

Open guoyunhe opened 9 months ago

guoyunhe commented 9 months ago

Fix #6436

目前有很多用户已经习惯了手势左滑后退来关闭一些 Popup,比如 Android 版微信的这个 Popup,是可以用手势左滑(后退)关闭的。

image

而 Ant Design Mobile 的 Popup 目前并不支持在检测到后退事件(popstate)时关闭。

建议 Popup 增加此属性,并应用到所有依赖 Popup 的子组件,如 Dialog,Modal,Picker,ActionSheet 等。

closeOnBack: boolean;

用法:

<Popup closeOnBack />

Modal.show({
  closeOnBack: true,
})
codecov[bot] commented 9 months ago

Codecov Report

Attention: 12 lines in your changes are missing coverage. Please review.

Comparison is base (671ea15) 92.10% compared to head (1cd3e80) 91.94%.

Files Patch % Lines
src/components/center-popup/center-popup.tsx 33.33% 6 Missing :warning:
src/components/popup/popup.tsx 33.33% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #6438 +/- ## ========================================== - Coverage 92.10% 91.94% -0.16% ========================================== Files 316 316 Lines 6861 6877 +16 Branches 1719 1723 +4 ========================================== + Hits 6319 6323 +4 - Misses 504 516 +12 Partials 38 38 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 9 months ago

PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6438.surge.sh