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

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

Open
xgAnd opened this issue Nov 13, 2019 · 22 comments
Open

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

xgAnd opened this issue Nov 13, 2019 · 22 comments

Comments

@xgAnd
Copy link

xgAnd commented Nov 13, 2019

Steps to Reproduce

according to the react-native method to upgrade.And use this module in the latest version
"react-native-scrollable-tab-view": "^1.0.0",when I start my service use npm start I get the error Tried to register two views with the same name RNCViewPager I guese the error is from this.if you have some ideas please tell me,thanks a lot.

Expected Behavior

Write what you thought would happen.
hode run without error.
BD76CB8C-99C7-4794-8A03-A7A01E63F38C
23FB069C-D1F3-4397-8747-F6AD2DF79706
3A3A3C74-6A3D-4103-BB9B-5B61F5D0EB7E

@nicolaspavlotsky
Copy link

You ever got a solution for this?

@xgAnd
Copy link
Author

xgAnd commented Nov 18, 2019

You ever got a solution for this?

hello. i find the solution for this.i guess you maybe use @ant-design/react-native 3.2.0 or use some third module it contians react-native-viewpager.but this version is different.And then can not compatibled.like @ant-design/react-native 3.2.0 it use react-native-viewpager version is 1.1.7 and this module use version is 2.0.1.so get the error Tried to register two views with the same name RNCViewPager.if you use @ant-design/react-native also you can use the 3.1.15 version or you can try the method they provided.
[https://github.com/ant-design/ant-design-mobile-rn/issues/697]
if not you should check you package.json.which look at use react-native-viewpager.😂
hope this can help for you.

@yuanbolin
Copy link

Have you found the solution

@xgAnd
Copy link
Author

xgAnd commented Dec 10, 2019

Have you found the solution

this error reason is two module use different @react-native-community/viewpager version. you should make the two module use the same.
ant-design/react-native 3.2.0 use version is 1.1.7
you can add this in your package.json and yarn again.
"resolutions": {
"@react-native-community/viewpager": "^2.0.1"
}

this code can upgrade the version to 2.xx if another is use this version.

if not work. i guess maybe the another module use the @react-native-community/viewpager version is 3.xx you should use this module version which use version is 2.xx .
hope this can help for you.

@mohammad-goldast
Copy link

Same problem

@xiaoosnggao
Copy link

@xgAnd
I have some problems here

1.Add the following to package.json in the root directory of my project:

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

2.perform yarn

3.performnpm run android

The following error appears

Invariant Violation: requireNativeComponent: "RNCViewPager" was not found in the UIManager.

This error is located at:
    in RNCViewPager (at ViewPager.js:150)
    in ViewPager (at createAnimatedComponent.js:151)
    in AnimatedComponent (at react-native-scrollable-tab-view/index.js:253)
    in RCTView (at react-native-scrollable-tab-view/index.js:396)
    in ScrollableTabView (at Mall.js:154)
    in RCTView (at Mall.js:65)
    in Mall (created by ConnectFunction)
    in ConnectFunction (at navigationStore.js:441)
    in StatelessWrapped (at SceneView.js:9)
    in SceneView (at StackViewLayout.tsx:889)
    in RCTView (at StackViewLayout.tsx:888)
    in RCTView (at StackViewLayout.tsx:887)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewCard.tsx:106)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at screens.native.js:101)
    in Screen (at StackViewCard.tsx:93)
    in Card (at createPointerEventsContainer.tsx:95)
    in Container (at StackViewLayout.tsx:975)
    in RCTView (at screens.native.js:132)
    in ScreenContainer (at StackViewLayout.tsx:384)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewLayout.tsx:374)
    in PanGestureHandler (at StackViewLayout.tsx:367)
    in StackViewLayout (at withOrientation.js:30)
    in withOrientation (at StackView.tsx:104)
    in RCTView (at Transitioner.tsx:267)
    in Transitioner (at StackView.tsx:41)
    in StackView (at createNavigator.js:80)
    in Navigator (at createKeyboardAwareNavigator.js:12)
    in KeyboardAwareNavigator (at SceneView.js:9)
    in SceneView (at createTabNavigator.tsx:67)
    in RCTView (at ResourceSavingScene.tsx:37)
    in RCTView (at ResourceSavingScene.tsx:26)
    in ResourceSavingScene (at createBottomTabNavigator.tsx:157)
    in RCTView (at screens.native.js:132)
    in ScreenContainer (at createBottomTabNavigator.tsx:147)
    in RCTView (at createBottomTabNavigator.tsx:146)
    in TabNavigationView (at createTabNavigator.tsx:228)
    in NavigationView (at createNavigator.js:80)
    in Navigator (at SceneView.js:9)
    in SceneView (at StackViewLayout.tsx:889)
    in RCTView (at StackViewLayout.tsx:888)
    in RCTView (at StackViewLayout.tsx:887)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewCard.tsx:106)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at screens.native.js:101)
    in Screen (at StackViewCard.tsx:93)
    in Card (at createPointerEventsContainer.tsx:95)
    in Container (at StackViewLayout.tsx:975)
    in RCTView (at screens.native.js:132)
    in ScreenContainer (at StackViewLayout.tsx:384)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewLayout.tsx:374)
    in PanGestureHandler (at StackViewLayout.tsx:367)
    in StackViewLayout (at withOrientation.js:30)
    in withOrientation (at StackView.tsx:104)
    in RCTView (at Transitioner.tsx:267)
    in Transitioner (at StackView.tsx:41)
    in StackView (at createNavigator.js:80)
    in Navigator (at createKeyboardAwareNavigator.js:12)
    in KeyboardAwareNavigator (at SceneView.js:9)
    in SceneView (at StackViewLayout.tsx:889)
    in RCTView (at StackViewLayout.tsx:888)
    in RCTView (at StackViewLayout.tsx:887)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewCard.tsx:106)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at screens.native.js:101)
    in Screen (at StackViewCard.tsx:93)
    in Card (at createPointerEventsContainer.tsx:95)
    in Container (at StackViewLayout.tsx:975)
    in RCTView (at screens.native.js:132)
    in ScreenContainer (at StackViewLayout.tsx:384)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewLayout.tsx:374)
    in PanGestureHandler (at StackViewLayout.tsx:367)
    in StackViewLayout (at withOrientation.js:30)
    in withOrientation (at StackView.tsx:104)
    in RCTView (at Transitioner.tsx:267)
    in Transitioner (at StackView.tsx:41)
    in StackView (at createNavigator.js:80)
    in Navigator (at createKeyboardAwareNavigator.js:12)
    in KeyboardAwareNavigator (at LightboxRenderer.js:14)
    in RCTView (at LightboxRenderer.js:13)
    in _default (at createNavigator.js:80)
    in Navigator (at SceneView.js:9)
    in SceneView (at StackViewLayout.tsx:889)
    in RCTView (at StackViewLayout.tsx:888)
    in RCTView (at StackViewLayout.tsx:887)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewCard.tsx:106)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at screens.native.js:101)
    in Screen (at StackViewCard.tsx:93)
    in Card (at createPointerEventsContainer.tsx:95)
    in Container (at StackViewLayout.tsx:975)
    in RCTView (at screens.native.js:132)
    in ScreenContainer (at StackViewLayout.tsx:384)
    in RCTView (at createAnimatedComponent.js:151)
    in AnimatedComponent (at StackViewLayout.tsx:374)
    in PanGestureHandler (at StackViewLayout.tsx:367)
    in StackViewLayout (at withOrientation.js:30)
    in withOrientation (at StackView.tsx:104)
    in RCTView (at Transitioner.tsx:267)
    in Transitioner (at StackView.tsx:41)
    in StackView (at createNavigator.js:80)
    in Navigator (at createKeyboardAwareNavigator.js:12)
    in KeyboardAwareNavigator (at OverlayRenderer.js:22)
    in RCTView (at OverlayRenderer.js:21)
    in _default (at createNavigator.js:80)
    in Navigator (at createAppContainer.js:430)
    in NavigationContainer (at Router.js:97)
    in App (at Router.js:122)
    in Router (at App.js:131)
    in Provider (at App.js:128)
    in RCTView (created by Portal.Host)
    in Portal.Host (created by Provider)
    in ThemeProvider (created by Provider)
    in LocaleProvider (created by Provider)
    in Provider (at App.js:127)
    in App (at renderApplication.js:40)
    in RCTView (at AppContainer.js:101)
    in RCTView (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:39)

@xiaoosnggao
Copy link

And my node_modules project/node_modules/@reaction-native-community/viewpager version number has changed to 2.0.2

@xgAnd
Copy link
Author

xgAnd commented Jan 17, 2020

And my node_modules project/node_modules/@reaction-native-community/viewpager version number has changed to 2.0.2
the error msg show not find.if you native version is low than 0.60 you can try

react-native link

in your project root file. if not low than 0.60 you can try close all and delete node_modules and yarn. try to download again.
hope this can help for you.

@ShaneMatthias
Copy link

Thanks all! Downgrading to @react-native-community/viewpager: 2.0.2 worked for me!

@nikhiysham
Copy link

Have you found the solution

this error reason is two module use different @react-native-community/viewpager version. you should make the two module use the same.
ant-design/react-native 3.2.0 use version is 1.1.7
you can add this in your package.json and yarn again.
"resolutions": {
"@react-native-community/viewpager": "^2.0.1"
}

this code can upgrade the version to 2.xx if another is use this version.

if not work. i guess maybe the another module use the @react-native-community/viewpager version is 3.xx you should use this module version which use version is 2.xx .
hope this can help for you.

help me so much.. Thanks

@nabilfreeman
Copy link

nabilfreeman commented Apr 9, 2020

I also had this problem but could only solve it by removing react-native-community/viewpager as a top-level dependency. Not even setting the same version 2.0.2 worked.

I was using it for an image carousel in part of the app, so I styled this scrollable tab view plugin to also be usable for the carousel.

Pretty strange problem but happy I found this workaround.

@zmnv
Copy link

zmnv commented Apr 27, 2020

Any solutions?

@nabilfreeman
Copy link

@zmnv the only thing that worked for me was removing one of the conflicting deps. Try open the node_modules folder in Sublime or other text editor and search the entire directory for viewpager - see which modules are implementing different versions of it.

If all your deps implement the same version of viewpager this error will go away.

@zmnv
Copy link

zmnv commented Apr 27, 2020

@nabilfreeman yeah, but change something inside node_modules is very bad.

So, now I just use in package.json:

 "react-native-scrollable-tab-view": "git+https://github.com/ptomasroos/react-native-scrollable-tab-view.git",

until waiting new release

@oregano1201
Copy link

Hi I found solution to this.

Seems the npm package for the react-native-scrollable-tab-view also include node_modules folder where there is an exact copy of @react-native-community/viewpager.
image

Thus when you actually use other library that import '@react-native-community/viewpager'
this will trigger the "Tried to register two views with the same name RNCViewPager" error message.

My quick kill solution is to delete the entire node_modules folder under react-native-scrollable-tab-view and it runs well. Of course this would not be permanent solution as whenever npm install get the package it will have that folder again and I need to delete it again.

I am thinking of copying the entire source code of react-native-scrollable-tab-view into my project source folder instead of importing it as external node_modules library. Thus I will be able to npm uninstall react-native-scrollable-tab-view. At least until a new version released without carrying the @react-native-community/viewpager inside its node_modules directory.

Cheers,
Gerry

@JoaRiski
Copy link

Can someone elaborate why is the @react-native-community/viewpager module bundled in with this package in the first place? Wouldn't a more appropriate solution be to use dependencies?

@arlovip
Copy link

arlovip commented Jul 27, 2020

The same issue. Does someone know how to solve this?

@karanasthana
Copy link

Hey guys!
Any updates on this?

@lexoops
Copy link

lexoops commented Oct 15, 2020

it's work for me.
keep dependencies ,just add
"resolutions": {
"@react-native-community/viewpager": "^4.1.0"
},
to root dir in package.json

@oki-reval
Copy link

check youre viewpager versions inside scrollable-tab-view and reinstall viewpager with same version inside scrollable-tab-view

@AtaMuhiuldin
Copy link

I tried using "resolutions" but didn't work for me then, I clone the repo and modified the ViewManger Name and it worked fine for me you may try it.

past following, to roo dir in package.json and run command yarn install
"react-native-pager-view": "git://github.com/AtaMuhiuldin/react-native-view-pager.git"

@Moskaoud
Copy link

Moskaoud commented Feb 2, 2023

that woked for me use react-native-pager-view instead of @react-native-community/viewpager
import PagerView from 'react-native-pager-view';
when search in library @react-native-community/viewpager RNCViewPager there is two library use same key constant
rncviewpager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests