ant-design / ant-design-mobile-rn

Ant Design for React Native
https://rn.mobile.ant.design/
MIT License
3.04k stars 612 forks source link

Tried to register two views with the same name RNCViewPager #697

Closed renjinlong closed 4 years ago

renjinlong commented 4 years ago

Reproduction link

http://www.baidu.com

Steps to reproduce

@ant-design/react-native 使用viewpager1.1.7 另一个组件使用viewpager2.0.1 ,rn0.61.4就会报错说不能注册两个viewpager

What is expected?

将viewpager放到peerDependencies中

What is actually happening?

不能正常运行程序

Environment Info
antd 3.2.0
React react-native 0.61.4
System android&ios
Browser 非浏览器
BANG88 commented 4 years ago

这样每次都要提示用户安装viewpager了 😭

BANG88 commented 4 years ago

如果你用 yarn 的话可以试试在 package.json 里面加上

  "resolutions": {
        "@react-native-community/viewpager": "^2.0.1"
  }
ChuanJun888 commented 4 years ago

worked

xgAnd commented 4 years ago

如果你用 yarn 的话可以试试在 package.json 里面加上

  "resolutions": {
        "@react-native-community/viewpager": "^2.0.1"
  }

请教个问题。您说的增加 "resolutions": { "@react-native-community/viewpager": "^2.0.1" } 我理解为是在是在您的项目下的package.json中增加,并重新执行 yarn add 来重新安装node_modules。 72DDF8D5-7547-428E-A7BE-72AF805F1AB1

但是我在实际的操作中遇到了错误。 33A2C69D-4FCA-4B33-9919-A53111983A22 2A35E4C0-1823-4C0C-8D1D-96049A80DCE9

但是我在这个报错的文件中并没有找到相关的变量定义。有没有路过的老哥帮忙解惑一下。万分感谢。

BANG88 commented 4 years ago

不是在这里,是在你项目的package.json 里面添加。 然后 在运行 yarn 一次。

yazhengwang commented 4 years ago

不是在这里,是在你项目的package.json 里面添加。 然后 在运行 yarn 一次。

嗯,解决了,我是删除node_modules后yarn 才生效的

MX8CLUB commented 4 years ago

如果你用 yarn 的话可以试试在 package.json 里面加上

  "resolutions": {
        "@react-native-community/viewpager": "^2.0.1"
  }

我怎么不行?react-native 0.61.5 "@ant-design/react-native": "^3.2.0"

还是同样报错

BANG88 commented 4 years ago

@MX8CLUB 删掉 node_modules 再重新yarn 一次

MX8CLUB commented 4 years ago

@MX8CLUB 删掉 node_modules 再重新yarn 一次

是我@react-native-community/viewpager不是2.0.1,是3.1.0的。改了重新yarn就好了

evan0204 commented 4 years ago

如果你用 yarn 的话可以试试在 package.json 里面加上

  "resolutions": {
        "@react-native-community/viewpager": "^2.0.1"
  }

那如果是一直使用npm的话,该如何解决?修改了组件版本后也还是不行。yarn方式有效

xiaoosnggao commented 4 years ago

我这里按照上面的方法加了这些东西,但是提示其他的错误!

Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager.
"dependencies": {
    "@ant-design/react-native": "^3.2.0",
    "@react-native-community/async-storage": "^1.7.1",
    "axios": "^0.19.1",
    "babel-plugin-import": "^1.13.0",
    "crypto-js": "^3.1.9-1",
    "moment": "^2.24.0",
    "node-forge": "^0.9.1",
    "pure-render-decorator": "^1.2.1",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-ezswiper": "^1.3.0",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-image-zoom-viewer": "^2.2.27",
    "react-native-qrcode-svg": "^6.0.3",
    "react-native-reanimated": "^1.5.0",
    "react-native-router-flux": "^4.2.0",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-screens": "^2.0.0-alpha.24",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-secharts": "^1.7.0",
    "react-native-splash-screen": "^3.2.0",
    "react-native-storage": "^1.0.1",
    "react-native-svg": "^10.1.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^8.0.3",
    "react-navigation": "^4.0.10",
    "react-redux": "^7.1.3",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "rn-fetch-blob": "^0.12.0"
  },
  "resolutions": {
    "@react-native-community/viewpager": "^2.0.1"
   },
xiaoosnggao commented 4 years ago

并且我的 node_modules project/node_modules/@react-native-community/viewpager 版本号变为2.0.2

tourze commented 4 years ago

我这里按照上面的方法加了这些东西,但是提示其他的错误!

Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager.
"dependencies": {
    "@ant-design/react-native": "^3.2.0",
    "@react-native-community/async-storage": "^1.7.1",
    "axios": "^0.19.1",
    "babel-plugin-import": "^1.13.0",
    "crypto-js": "^3.1.9-1",
    "moment": "^2.24.0",
    "node-forge": "^0.9.1",
    "pure-render-decorator": "^1.2.1",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-ezswiper": "^1.3.0",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-image-zoom-viewer": "^2.2.27",
    "react-native-qrcode-svg": "^6.0.3",
    "react-native-reanimated": "^1.5.0",
    "react-native-router-flux": "^4.2.0",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-screens": "^2.0.0-alpha.24",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-secharts": "^1.7.0",
    "react-native-splash-screen": "^3.2.0",
    "react-native-storage": "^1.0.1",
    "react-native-svg": "^10.1.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^8.0.3",
    "react-navigation": "^4.0.10",
    "react-redux": "^7.1.3",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "rn-fetch-blob": "^0.12.0"
  },
  "resolutions": {
    "@react-native-community/viewpager": "^2.0.1"
   },

同遇到这个问题,求解决。。。

junguoguo2017 commented 4 years ago

我这里按照上面的方法加了这些东西,但是提示其他的错误!

Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager.
"dependencies": {
    "@ant-design/react-native": "^3.2.0",
    "@react-native-community/async-storage": "^1.7.1",
    "axios": "^0.19.1",
    "babel-plugin-import": "^1.13.0",
    "crypto-js": "^3.1.9-1",
    "moment": "^2.24.0",
    "node-forge": "^0.9.1",
    "pure-render-decorator": "^1.2.1",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-ezswiper": "^1.3.0",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-image-zoom-viewer": "^2.2.27",
    "react-native-qrcode-svg": "^6.0.3",
    "react-native-reanimated": "^1.5.0",
    "react-native-router-flux": "^4.2.0",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-screens": "^2.0.0-alpha.24",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-secharts": "^1.7.0",
    "react-native-splash-screen": "^3.2.0",
    "react-native-storage": "^1.0.1",
    "react-native-svg": "^10.1.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^8.0.3",
    "react-navigation": "^4.0.10",
    "react-redux": "^7.1.3",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "rn-fetch-blob": "^0.12.0"
  },
  "resolutions": {
    "@react-native-community/viewpager": "^2.0.1"
   },

同遇到这个问题,求解决。。。

I'm just like you

leeeGreat commented 4 years ago

你们都是说的yarn install,可是用的npm install并不好使啊?

leeeGreat commented 4 years ago

如果你用 yarn 的话可以试试在 package.json 里面加上

  "resolutions": {
        "@react-native-community/viewpager": "^2.0.1"
  }

那如果是一直使用npm的话,该如何解决?修改了组件版本后也还是不行。yarn方式有效

这个怎么解决的啊,用的npm,影响远端自动化打包啊

ZhangTaoK commented 4 years ago

我这里按照上面的方法加了这些东西,但是提示其他的错误!

Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager.
"dependencies": {
    "@ant-design/react-native": "^3.2.0",
    "@react-native-community/async-storage": "^1.7.1",
    "axios": "^0.19.1",
    "babel-plugin-import": "^1.13.0",
    "crypto-js": "^3.1.9-1",
    "moment": "^2.24.0",
    "node-forge": "^0.9.1",
    "pure-render-decorator": "^1.2.1",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-ezswiper": "^1.3.0",
    "react-native-gesture-handler": "^1.5.3",
    "react-native-image-zoom-viewer": "^2.2.27",
    "react-native-qrcode-svg": "^6.0.3",
    "react-native-reanimated": "^1.5.0",
    "react-native-router-flux": "^4.2.0",
    "react-native-safe-area-context": "^0.6.2",
    "react-native-screens": "^2.0.0-alpha.24",
    "react-native-scrollable-tab-view": "^1.0.0",
    "react-native-secharts": "^1.7.0",
    "react-native-splash-screen": "^3.2.0",
    "react-native-storage": "^1.0.1",
    "react-native-svg": "^10.1.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^8.0.3",
    "react-navigation": "^4.0.10",
    "react-redux": "^7.1.3",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.8",
    "rn-fetch-blob": "^0.12.0"
  },
  "resolutions": {
    "@react-native-community/viewpager": "^2.0.1"
   },

同遇到这个问题,求解决。。。

I'm just like you

我是这样解决的: 在你的 package.json 里面升级 viewpager 的版本

  "dependencies": {
        "@react-native-community/viewpager": "^4.1.0"
  },
  "resolutions": {
        "@react-native-community/viewpager": "^4.1.0"
  }

在通过运行 yarn 即可解决问题。但同样的,我也无法在npm环境下解决这个问题

BANG88 commented 4 years ago

如果你们用的是4.0.0 的话可以自己安装Peer依赖了,4.0 里面没有强制依赖某一个版本。如果还出现这个问题就不是ANT这边的问题了。 关于怎么link相应的模块 去对应的repo查看即可。

marlti7 commented 3 years ago

我只想知道 npm 怎么解决? 没问yarn

inkCrazy commented 2 years ago

"dependencies": { "@ant-design/react-native": "^3.1.11", "@react-native-community/async-storage": "^1.5.0", "axios": "^0.19.0", "dayjs": "^1.8.15", "react": "16.8.3", "react-native": "0.59.10", "react-native-gesture-handler": "1.3.0", "react-native-keyboard-aware-scroll-view": "^0.8.0", "react-native-modal": "^11.1.0", "react-native-nfc-manager": "^1.2.2", "react-native-selfadapt-modal": "^1.1.3", "react-native-splash-screen": "^3.1.1", "react-native-storage": "^1.0.1", "react-navigation": "3.11.0" }, 我加了"resolutions": { "@react-native-community/viewpager": "^2.0.1" }也没用 你们都怎么解决的?

inkCrazy commented 2 years ago

并且我的 node_modules project/node_modules/@react-native-community/viewpager 版本号变为2.0.2

兄弟你最后怎么解决的?