简体   繁体   中英

Ignored attempt to cancel touchmove event with cancelable=false,for example because scrolling is in progress and cannot be interrupted

while i'm using antd drawer. inside of that i'm using 'ui li ul ' tag.for that 'ul' scrollbar bar only working destop its not working for mobile and tablet even

componentWillUpdate() {
    window.addEventListener("touchmove", ontouchmove);
    function ontouchmove(e) {

      if (e.cancelable) {
        e.preventDefault();
        e.stopPropagation();
        return false;

      }
    }
}

import React from "react";
import "antd/dist/antd.css";
import "./index.css";
import { Drawer, Button } from "antd";

class App extends React.Component {
  state = { visible: false };

  componentWillUpdate() {
    window.addEventListener("touchmove", ontouchmove);
    function ontouchmove(e) {

      if (e.cancelable) {
        e.preventDefault();
        e.stopPropagation();
        return false;

      }
    }
  }

  showDrawer = (e) => {
    this.setState({
      visible: true
    });
  };

  onClose = (e) => {
    this.setState({
      visible: false
    });
  };

  render() {
    return (
      <div>
        <Button type="primary" onClick={this.showDrawer}>
          Open
        </Button>
        <Drawer
          title="Basic Drawer"
          placement="right"
          closable={false}
          onClose={this.onClose}
          visible={this.state.visible}
        >
          <div>
            <nav
              className="tab-list"
              style={{
                whiteSpace: "nowrap",
                overflow: "auto"
              }}
            >
              <ul style={{ listStyle: "none", Padding: 0, margin: 0 }}>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                 <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
                <li style={{ display: "inline-block", float: "none" }}>
                  sivasakthi
                </li>
              </ul>
            </nav>
            <div></div>
          </div>
        </Drawer>
      </div>
    );
  }
}

export default App;

actual result :when i scroll the nav tab it's not scrolling in mobile and tablet senorio.

expected result :when i scroll the nav tsb it should scroll.

在蚂蚁设计表中使用'getContainer' api 来解决这个问题参考这个链接

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM