jiasongs / react-native-refresh

原生集成的下拉刷新。
MIT License
25 stars 11 forks source link

原生部分引入不同版本的依赖 会 影响滚动 #4

Closed hxzAugustinus closed 3 years ago

hxzAugustinus commented 3 years ago

我安装依赖后,把example里的NormalRefreshHeader.js 和 app.js直接复制到我的项目里时 直接运行,结果为下拉刷新正常工作,但是上拉滚动翻页时发现无法滚动或则滚动的非常难触发 https://github.com/hxzAugustinus/gitProject/blob/master/movic/video(11).MP4

当替换

  refreshControl={
          <RefreshHeaderNormal
            refreshing={refreshing}
            onRefresh={() => {
              setRefreshing(true);
              setTimeout(() => {
                setRefreshing(false);
              }, 3000);
            }}
          />
        }

refreshControl={<RefreshControl    refreshing={refreshing}    />}

时,发现上拉翻页滚动正常了; https://github.com/hxzAugustinus/gitProject/blob/master/movic/video(10).MP4

我的package.json

"dependencies": {
    "@react-native-community/async-storage": "^1.12.0",
    "@react-native-community/cameraroll": "^4.0.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^5.9.7",
    "@react-native-community/slider": "^3.0.3",
    "@react-native-community/viewpager": "^4.1.6",
    "@react-navigation/bottom-tabs": "^5.8.0",
    "@react-navigation/compat": "^5.1.28",
    "@react-navigation/core": "^5.12.3",
    "@react-navigation/native": "^5.7.3",
    "@react-navigation/stack": "^5.9.0",
    "@sentry/cli": "^1.55.0",
    "@sentry/react-native": "^1.9.0",
    "axios": "^0.19.2",
    "mobx": "^5.15.4",
    "mobx-react": "^6.1.8",
    "moment": "^2.24.0",
    "openinstall-react-native": "^1.2.7",
    "prop-types": "^15.7.2",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-ali-onepass": "^2.0.0",
    "react-native-config": "^1.3.3",
    "react-native-device-info": "^5.6.5",
    "react-native-exit-app": "^1.1.0",
    "react-native-gesture-handler": "^1.7.0",
    "react-native-http-cache": "https://github.com/bfbat100/react-native-http-cache",
    "react-native-image-picker": "^2.3.3",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.5.6",
    "react-native-orientation-locker": "^1.1.8",
    "react-native-permissions": "^2.1.5",
    "react-native-picker": "^4.3.7",
    "react-native-reanimated": "^1.13.0",
    "react-native-refresh": "^2.0.17",
    "react-native-root-toast": "^3.2.1",
    "react-native-safe-area-context": "^3.1.6",
    "react-native-screens": "^2.10.1",
    "react-native-splash-screen": "^3.2.0",
    "react-native-svg": "^12.1.0",
    "react-native-swiper": "^1.6.0-rc.3",
    "react-native-tab-view": "^2.15.1",
    "react-native-video": "^4.4.5",
    "react-native-view-shot": "^3.1.2",
    "react-native-webview": "^11.0.0",
    "rn-fetch-blob": "^0.12.0",
    "rn-placeholder": "^3.0.0"
  },
jiasongs commented 3 years ago

1、只有安卓有问题吗,iOS有问题吗 2、example中有此问题吗

hxzAugustinus commented 3 years ago

ios还没试,example没问题正常的,我还新建了一个rn0.61.5 , 只包含这个依赖也是正常运行 ,但在我的项目就不行感觉是和什么东西冲突了,但想了半天没想出和什么冲突

jiasongs commented 3 years ago

ios还没试,example没问题正常的,我还新建了一个rn0.61.5 , 只包含这个依赖也是正常运行 ,但在我的项目就不行感觉是和什么东西冲突了,但想了半天没想出和什么冲突

新建一个RN0.61.5的项目,然后把你出问题的能复现出来的Demo发给我,我修复一下,如果无法复现,我这边也无从下手

hxzAugustinus commented 3 years ago

image @jiasongs 如上图 如果原生部分也引入SmartRefreshLayout

 implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3'

会导致我这种情况出现

jiasongs commented 3 years ago

SmartRefreshLayout

把这个Demo发给我吧

hxzAugustinus commented 3 years ago

example 里的 dependencies 里 添加

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3'

然后运行就可以复现; 我这边访问Github 太卡了,demo发不动; 本质上就是引入重复导致的,我这边原生部分也引入了这个库

jiasongs commented 3 years ago

example 里的 dependencies 里 添加

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3'

然后运行就可以复现; 我这边访问Github 太卡了,demo发不动

好的,我晚上回家试一下

hxzAugustinus commented 3 years ago

其实不用试,是导入不同版本导致的 ;我修改我的原生部分的版本号

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3'

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'

保持和你的依赖版本一致就没问题了

jiasongs commented 3 years ago

其实不用试,是导入不同版本导致的 ;我修改我的原生部分的版本号

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.3'

implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0'

保持和你的依赖版本一致就没问题了

可能是SmartRefreshLayout:1.1.3改了一些东西,我需要适配下