react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

InvariantViolation : requireNativeComponent RNCViewpager was not found in the UI manager

Open sharief-edv opened this issue 7 years ago • 32 comments

image

sharief-edv avatar Mar 18 '19 09:03 sharief-edv

It looks like you did not run react-native link @react-native-community/viewpager ?

ferrannp avatar Mar 18 '19 11:03 ferrannp

I do ran that , But the mistake i have done before was (I DID NOT MENTION IT FIRST ) , i didn't run yarn add @react-native-community/viewpager at first instead i have ran the npm install --save @react-native-community/viewpager as i thought i have to do npm not yarn . After i realized and ran yarn command followed by link command , i am getting the same error.

sharief-edv avatar Mar 18 '19 15:03 sharief-edv

Is the example in this repository working for you?

ferrannp avatar Mar 18 '19 16:03 ferrannp

No @ferrannp , I am getting error

sharief-edv avatar Mar 18 '19 17:03 sharief-edv

I am also getting this error, so what is the solution ?

ss-southernsun-982 avatar Apr 18 '19 05:04 ss-southernsun-982

What about not linking / using it in iOS for now? It is not implemented on iOS anyway.

ferrannp avatar Apr 18 '19 14:04 ferrannp

Still get the same error without linking

ss-southernsun-982 avatar Apr 20 '19 08:04 ss-southernsun-982

@SSWeedie can I see some code? You should only link it on Android but specially on JS, you should only require it for Android.

ferrannp avatar Apr 30 '19 09:04 ferrannp

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

I run both the commands

  1. For installation
     npm install @react-native-community/viewpager
    
  2. For linking the library
     react-native link @react-native-community/viewpager
    

System configuration : System: OS: Linux 4.15 Ubuntu 18.04.2 LTS CPU: (6) x64 AMD FX(tm)-6300 Six-Core Processor Memory: 920.17 MB / 3.59 GB

Binaries:
  Node: 8.16.0
  npm: 6.4.1
npmPackages:
  react: 16.8.3 => 16.8.3 
  react-native: 0.59.5 => 0.59.5 
npmGlobalPackages:
  react-native-cli: 2.0.1

renishdeveloper avatar Apr 30 '19 10:04 renishdeveloper

Can someone post a repo where this can be reproduced?

ferrannp avatar Apr 30 '19 12:04 ferrannp

@ferrannp Here is the complete code with the implementation steps :

For installation npm install @react-native-community/viewpager

For linking the library react-native link @react-native-community/viewpager

Not followed the manual steps as the react-native link @react-native-community/viewpager command does it for me.

Import view pager import ViewPager from "@react-native-community/viewpager";

ViewPager component

<ViewPager style={styles.viewPager} initialPage={0}> <View key="1"> <Text>First page</Text> </View> <View key="2"> <Text>Second page</Text> </View> </ViewPager>

Let comment if works for anyone

renishdeveloper avatar May 06 '19 09:05 renishdeveloper

Add the RNCViewPagerPackage class to your list of exported packages.

AppUU avatar May 10 '19 09:05 AppUU

@renishdeveloper that works for me. Do you have a repository I can try?

ferrannp avatar May 10 '19 12:05 ferrannp

image

Same error here for ViewPager on Android.

I am also struggling with a similar error stating RNCWebview not found in UIManager for WebView as well for Android and reported here. Everything works well for iOS. Its very frustrating.

I did npm install and than react-native link. Then checked if the ViewPager is linked properly in Android by looking at Application.java, build.gradle(for app) and settngs.gradle files and ViewPager has appropriate entries in all the files mentioned above.

Why UIManager has so many missing reactNativeComponent?

sangyakhare avatar Jun 04 '19 20:06 sangyakhare

I don't know if this is useful or not, but I was also getting this issue with a fresh new project. I tried manually linking but that didn't seem to fix the problem. Again, since it was a new project I decided to delete the project and tried again. But this time adding and linking viewpager before running the app on android and creating a component making use of viewpager. It works now thankfully though I'm not fully sure why

AA25 avatar Jun 07 '19 18:06 AA25

I checked examples and work. I also tested a fresh project and I ran below commands

mkdir toDelete
cd toDelete/
react-native init AwesomeProjectToDelete
cd AwesomeProjectToDelete/
yarn 
yarn add @react-native-community/viewpager
react-native link @react-native-community/viewpager
react-native run-ios
react-native run-android

Both commands react-native run-ios and react-native run-android work with no errors. My configuration:

  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
      Memory: 1.74 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.14.0 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    IDEs:
      Android Studio: 3.4 AI-183.5429.30.34.5452501
      Xcode: 10.2/10E125 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.9 => 0.59.9 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-create-library: 3.1.2

Did you linked this lib manually or used above commands ? @AA25 If you want to link lib manually, checkout example dir.

troZee avatar Jun 10 '19 16:06 troZee

I've linked the react-native-viewpager using the command in Android, but it doesn't link in following file:

android/app/src/main/.../MainApplication.java

After I linked manually, it works for me.

For full manually link: https://github.com/react-native-community/react-native-viewpager/blob/master/README.md#android

DanielVenturini avatar Jun 23 '19 17:06 DanielVenturini

How i can use https://github.com/react-native-community/react-native-viewpager/blob/master/README.md#android if i use expo? I have't 'android' folder

DrobyshevAlex avatar Aug 19 '19 09:08 DrobyshevAlex

@DrobyshevAlex you cannot as this library is not supported by Expo. You would have to eject your project.

I am closing this issue as there is no reproducible repro and it is working fine for me in the example and in a new project created with `react-native init.

ferrannp avatar Sep 01 '19 12:09 ferrannp

@ferrannp, I have installed "yarn add @react-native-community/viewpager" and then follow the steps but It not run in expo.

jaythakkar2807 avatar Oct 09 '19 07:10 jaythakkar2807