const isIPhone = new RegExp('\biPhone\b|\biPod\b', 'i').test(window.navigator.userAgent);
官方例子:
let moneyKeyboardWrapProps;
if (isIPhone) {
moneyKeyboardWrapProps = {
onTouchStart: e => e.preventDefault(),
};
}
antd源码:
解决:Unable to preventDefault inside passive event listener due to target being treated as passive.
onTouchStart 换成 onClick
if (isIPhone) {
moneyKeyboardWrapProps = {
onClick: e => e.preventDefault(),
};
}