Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.5 swiper组件无法手动滑动 #16517

Open
ShaoGongBra opened this issue Sep 13, 2024 · 1 comment
Open

4.0.5 swiper组件无法手动滑动 #16517

ShaoGongBra opened this issue Sep 13, 2024 · 1 comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-4 Version - 4.x

Comments

@ShaoGongBra
Copy link
Contributor

ShaoGongBra commented Sep 13, 2024

相关平台

H5

浏览器版本: 所有
使用框架: React

复现步骤

只要将Swiper嵌套在ScrollView里面,就无法手动滑动Swiper

<ScrollView style={{ height: px(1000) }}>
    <Swiper autoplay circular interval={2800} style={{ height: px(500) }}>
      {
        [
          {
            "image": "https://cdn.whxx.net/2024-07-23/90a0b94e58c153532ffd.png",
            "title": "实景鉴赏",
            "desc": "",
            "url": ""
          },
          {
            "image": "https://cdn.whxx.net/2024-07-23/681f655f025128863b56.png",
            "title": "实景鉴赏",
            "desc": "",
            "url": "duxcmsContent/pages/article/detail?id=17"
          },
          {
            "image": "https://cdn.whxx.net/2024-07-23/18ffc7f104d5a2f433fc.jpg",
            "title": "实景鉴赏",
            "desc": "",
            "url": "https://mp.weixin.qq.com/s/e5NgkUntaOvR0mQ5WWyfDA"
          },
          {
            "image": "https://cdn.whxx.net/2024-08-31/95a5ffc76b997415b992.png",
            "url": "playerUnion/pages/match/detail?id=17"
          }
        ].map(item => {
          return <SwiperItem key={item.id}>
            <Image src={item.image} className='w-full h-full'
              onClick={() => {
                if (item.url?.startsWith('http')) {
                  window.location.href = item.url
                } else {
                  nav(item.url)
                }
              }}
            />
          </SwiperItem>
        })
      }
    </Swiper>
  </ScrollView>

期望结果

1

实际结果

2

环境信息

Taro CLI 4.0.5 environment info:
    System:
      OS: macOS 14.5
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 22.8.0 - /var/folders/rf/gd60z12164z72bny7z_0d4f80000gn/T/yarn--1726195625894-0.2265751482366889/node
      Yarn: 1.22.22 - /var/folders/rf/gd60z12164z72bny7z_0d4f80000gn/T/yarn--1726195625894-0.2265751482366889/yarn
      npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
    npmPackages:
      @tarojs/cli: 4.0.5 => 4.0.5 
      @tarojs/components: 4.0.5 => 4.0.5 
      @tarojs/helper: 4.0.5 => 4.0.5 
      @tarojs/plugin-framework-react: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-alipay: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-h5: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-jd: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-qq: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-swan: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-tt: 4.0.5 => 4.0.5 
      @tarojs/plugin-platform-weapp: 4.0.5 => 4.0.5 
      @tarojs/react: 4.0.5 => 4.0.5 
      @tarojs/rn-runner: 4.0.5 => 4.0.5 
      @tarojs/rn-supporter: 4.0.5 => 4.0.5 
      @tarojs/runtime: 4.0.5 => 4.0.5 
      @tarojs/shared: 4.0.5 => 4.0.5 
      @tarojs/taro: 4.0.5 => 4.0.5 
      @tarojs/taro-loader: 4.0.5 => 4.0.5 
      @tarojs/taro-rn: 4.0.5 => 4.0.5 
      @tarojs/webpack5-runner: 4.0.5 => 4.0.5 
      babel-preset-taro: 4.0.5 => 4.0.5 
      eslint-config-taro: 4.0.5 => 4.0.5 
      expo: ~51.0.32 => 51.0.32 
      react: ^18.2.0 => 18.3.1 
      react-native: ~0.75.3 => 0.75.3
@TheKonka TheKonka added F-react Framework - React T-h5 Target - 编译到 H5 V-4 Version - 4.x labels Sep 13, 2024
@github-project-automation github-project-automation bot moved this to Padding in H5 Sep 13, 2024
@ShaoGongBra
Copy link
Contributor Author

ShaoGongBra commented Sep 13, 2024

注释掉 scrollView的handleTouchMove恢复正常,不知道有没有其他影响

diff --git a/node_modules/@tarojs/components/dist/components/taro-scroll-view-core.js b/node_modules/@tarojs/components/dist/components/taro-scroll-view-core.js
index 3fbf3df..a3a5c70 100644
--- a/node_modules/@tarojs/components/dist/components/taro-scroll-view-core.js
+++ b/node_modules/@tarojs/components/dist/components/taro-scroll-view-core.js
@@ -172,7 +172,10 @@ const ScrollView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
     "animated": [4, "scroll-with-animation"],
     "mpScrollToMethod": [64],
     "mpScrollIntoViewMethod": [64]
-  }, [[1, "scroll", "handleScroll"], [1, "touchmove", "handleTouchMove"]]]);
+  }, [
+    [1, "scroll", "handleScroll"],
+    // [1, "touchmove", "handleTouchMove"]
+  ]]);
 function defineCustomElement$1() {
   if (typeof customElements === "undefined") {
     return;

This was referenced Sep 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-h5 Target - 编译到 H5 V-4 Version - 4.x
Projects
Status: Padding
Development

No branches or pull requests

2 participants