user10766404
user10766404

Reputation:

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

i am currently working a small app i have just started working on and i keep getting this error:

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 View.js:45)

I am using import ScrollableTabView, { DefaultTabBar } from 'react-native-scrollable-tab-view'; and i guess this is where the error is getting from, i have searched on stackoverflow and found that i have to install @react-native-community/viewpager which i did, but still getting the same error in the Android emulator (the Ios emulator works)

here is my code:

import React from 'react';
import {
  Text
} from 'react-native';

import ScrollableTabView, { DefaultTabBar } from 'react-native-scrollable-tab-view';
//import ViewPager from '@react-native-community/viewpager'
export default () => {
  return <ScrollableTabView
    style={{ marginTop: 20 }}
    initialPage={1}
    renderTabBar={() => <DefaultTabBar />}
  >
    <Text tabLabel='Tab #1'>

    </Text>
    <Text tabLabel='Tab #2'>favorite</Text>
    <Text tabLabel='Tab #3'>project</Text>
  </ScrollableTabView>;
}

Thank you !

Upvotes: 18

Views: 39514

Answers (7)

Justice Otuya
Justice Otuya

Reputation: 11

if you are using expo just use this command npx expo install react-native-pager-view

Upvotes: 0

Daniel Tuneev
Daniel Tuneev

Reputation: 11

Only if other answers didn't work for you, as they didn't work for me, try downgrading 'react-native-tab-view'

"react-native-tab-view": "^2.16.0",

or

npm i react-native-tab-view@^2.16.0

then restart your project.

Upvotes: 1

Omar Bakr
Omar Bakr

Reputation: 51

Kindly install this package first

npm i react-native-pager-view

You need to make sure of your node & npm version. In my case, I used node v.16.13.0 (npm v.8.1.0). If npm didn't work, try using yarn

yarn add react-native-pager-view

after that. cd ios && pod install

Then you need to rebuild the app on android. If the issue still exists, then try deleting node_modules & pods, then reinstall them again.

Upvotes: 5

if you use yarn

yarn add react-native-pager-view

if not, then

npm i react-native-pager-view

then you have to do

pod install

yarn ios or npx react-native run-ios

Upvotes: 17

Ali Raza
Ali Raza

Reputation: 615

Install the following package

npm i react-native-pager-view

After that open the ios folder in the terminal and run pod install. After the installation restart your project with npx react-native start.

Upvotes: 6

Sushil
Sushil

Reputation: 2490

Install the below NPM library

npm i react-native-pager-view

Because, "@react-native-community/viewpager" is Deprecated.

Upvotes: 13

user12478310
user12478310

Reputation:

Please run the following command in your terminal

=> npm i @react-native-community/viewpager

Upvotes: 6

Related Questions