Ant-design-mobile: Modal等弹窗无法关闭的问题

Created on 23 Apr 2018  ·  15Comments  ·  Source: ant-design/ant-design-mobile

* 问题1:版本2.1.8,Modal.alert 在IOS 8. 系统中不执行 onPress 方法,无法关闭弹窗 *
*
问题2:版本2.1.8,Picker 和 datePicker 等组件 在 android 4.4.0 系统中,无法关闭弹窗 **

Most helpful comment

已通过fastclick解决

import fastclick from 'fastclick'
fastclick.attach(document.body, {});

All 15 comments

Translation of this issue:


Modal and other pop-ups cannot be closed

* Issue 1: Version 2.1.8, Modal.alert does not implement the onPress method in IOS 8. systems and cannot close the popup *
*
Issue 2: Version 2.1.8, picker, datePicker, etc. In android 4.4.0 system, popups cannot be closed **

你的modal内容高度会出现问题吗?我的modal内容会和html高度相同

我也有这个问题
ios 10.3.3 微信浏览器跟safari浏览器无法关闭
ios 11.3.0都没问题

切换到2.1.6 可以解决这个问题

已通过fastclick解决

import fastclick from 'fastclick'
fastclick.attach(document.body, {});

* 问题1:版本2.1.8,Modal.alert 在IOS 8. 系统中不执行 onPress 方法,无法关闭弹窗 *
*
解决 **:
在 node_modules/antd-mobile/modal/alert.js 中

`
 function onWrapTouchStart(e) {
    if (!/iPhone|iPod|iPad/i.test(navigator.userAgent)) {
        return;
    }
    var pNode = (0, _closest2['default'])(e.currentTarget, '.' + prefixCls + '-footer');
    if (!pNode) {
        e.preventDefault();
    }
}

`
pNode 部分系统为 null,所以无法点击。
增加了 babel-polyfill 解决了

* 问题2:版本2.1.8,Picker 和 datePicker 等组件 在 android 4.4.0 系统中,无法关闭弹窗 *
* 解决 *
Modal、datePicker、picker 等组件生成DOM时是在 body 最后插入的。这时因为 z-index 的原因导致这些组件无法点击到

@iceberg211 @niices @jindada @luolonghao

无法关闭弹窗的问题,试着引入fastclick解决下

@MickeyMouse623 问题2 官网线上 demo 在 android 4.4.0 能复现吗?

@jindada 2.1.6 这两个问题都没有吗?2.1.8 有?官网 demo 有没有?麻烦再次帮忙确认下、感谢

@MickeyMouse623
问题1:版本2.1.8,Modal.alert 在IOS 8.* 系统中不执行 onPress 方法,无法关闭弹窗 **
请引入fastclick解决

@likezero @warmhug

fastclick已经两年没有维护了,是否考虑去掉对fastclick的依赖?目前观察到引入fastclick反而会导致原生input元素focus事件在iOS上延迟甚至无反应

@kpaxqin
后续会考虑。但目前还是有依赖,你说的延迟无反应有具体的复现demo 以及运行环境吗?

@kpaxqin @likezero https://github.com/ant-design/ant-design-mobile/blob/d2171f7863fa153eca4568f924a9dc8cd729a771/components/modal/alert.tsx#L62
这里应该是有 bug 帮忙 check 下,其他地方应该没有强依赖 fastclick

Ref #2477 #2428 #2442

@kpaxqin
后续会考虑。但目前还是有依赖,你说的延迟无反应有具体的复现demo 以及运行环境吗?

Note: As of late 2015 most mobile browsers - notably Chrome and Safari - no longer have a 300ms touch delay, so fastclick offers no benefit on newer browsers, and risks introducing bugs into your application. Consider carefully whether you really need to use it.

Model组件包含input输入类型组件,会造成Model无法关闭,解决方式:#3467

Was this page helpful?
0 / 5 - 0 ratings