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

Swiper 在 RN 使用报如下错误: ERROR Invariant Violation: Tried to register two views with the same name RNCViewPager #10017

Closed
xiamu14 opened this issue Aug 10, 2021 · 2 comments
Labels
F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x

Comments

@xiamu14
Copy link

xiamu14 commented Aug 10, 2021

相关平台

React Native

复现仓库

https://github.com/xiamu14/test-taro-webview

使用框架: React

复现步骤

  1. 复制taro 文档里提供的 swiper 示例代码
  2. 运行 taro dev:rn
  3. 调试模式即会出现该错误

期望结果

Swiper 组件功能能够在 RN 正常使用

实际结果

使用 Swiper 时报这个错误:ERROR Invariant Violation: Tried to register two views with the same name RNCViewPager

环境信息

Taro CLI 3.2.13 environment info:
    System:
      OS: macOS 11.4
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.16.1 - /var/folders/99/hmsg6_ss57q2y3gsb0_rpmy80000gn/T/yarn--1628580467802-0.9077641265278256/node
      Yarn: 1.22.10 - /var/folders/99/hmsg6_ss57q2y3gsb0_rpmy80000gn/T/yarn--1628580467802-0.9077641265278256/yarn
      npm: 7.18.1 - ~/.nvm/versions/node/v14.16.1/bin/npm
    npmPackages:
      @tarojs/cli: ^3.2.13 => 3.2.13
      @tarojs/components: 3.2.13 => 3.2.13
      @tarojs/mini-runner: 3.2.13 => 3.2.13
      @tarojs/react: 3.2.13 => 3.2.13
      @tarojs/runtime: 3.2.13 => 3.2.13
      @tarojs/taro: 3.2.13 => 3.2.13
      @tarojs/webpack-runner: 3.2.13 => 3.2.13
      babel-preset-taro: 3.2.13 => 3.2.13
      eslint-config-taro: 3.2.13 => 3.2.13
      react: ^17.0.0 => 17.0.2
      react-native: ^0.64.0 => 0.64.2
@taro-bot2 taro-bot2 bot added F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x labels Aug 10, 2021
@zhiqingchen
Copy link
Member

zhiqingchen commented Aug 10, 2021

yarn why @react-native-community/viewpager
一般为安装了两个版本的 @react-native-community/viewpager 或者 react-native-pager-view
或者同时安装了react-native-pager-view和@react-native-community/viewpager

@zhiqingchen
Copy link
Member

升级新版本,并保证只存在一个即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants