react-navigation icon indicating copy to clipboard operation
react-navigation copied to clipboard

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

Open JmarshTri opened this issue 1 year ago • 20 comments

Current behavior

I've tried anything from RN 73, Reanimated 2 and 3

import * as React from 'react' import { View, useWindowDimensions } from 'react-native' import { TabView, SceneMap } from 'react-native-tab-view'

const FirstRoute = () => ( <View style={{ flex: 1, backgroundColor: '#ff4081' }} /> )

const SecondRoute = () => ( <View style={{ flex: 1, backgroundColor: '#673ab7' }} /> )

const renderScene = SceneMap({ first: FirstRoute, second: SecondRoute, })

export default function TabViewExample() { const layout = useWindowDimensions()

const [index, setIndex] = React.useState(0) const [routes] = React.useState([ { key: 'first', title: 'First' }, { key: 'second', title: 'Second' }, ])

return ( <TabView navigationState={{ index, routes }} renderScene={renderScene} onIndexChange={setIndex} initialLayout={{ width: layout.width }} /> ) }

Expected behavior

Render the tab view without crashing

Reproduction

Can't produce

Platform

  • [ ] Android
  • [X] iOS
  • [ ] Web
  • [ ] Windows
  • [ ] MacOS

Packages

  • [ ] @react-navigation/bottom-tabs
  • [ ] @react-navigation/drawer
  • [ ] @react-navigation/material-top-tabs
  • [ ] @react-navigation/stack
  • [ ] @react-navigation/native-stack
  • [X] react-native-tab-view

Environment

  • [] I've removed the packages that I don't use
package version
"@react-navigation/bottom-tabs": "^6.5.20",
"@react-navigation/native": "^6.1.17",
"@react-navigation/stack": "^6.3.29",
"react-native-safe-area-context": "4.10.1",
"react-native-screens": "^3.31.1",
"react-native-gesture-handler": "^2.14.0",
"react-native-reanimated": "^3.11.0",
"react-native-tab-view": "3.5.2",
"react-native-pager-view": "^6.3.1",
"react-native": "0.74.1",
"yarn": "^1.22.4"

JmarshTri avatar May 21 '24 18:05 JmarshTri

Hey @JmarshTri! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

github-actions[bot] avatar May 21 '24 18:05 github-actions[bot]

@JmarshTri did you find any solution ??

arslan-Techno avatar May 22 '24 07:05 arslan-Techno

same problems

kaaaaaaaaaaai avatar May 22 '24 08:05 kaaaaaaaaaaai

npm i react-native-pager-view and cd ios && pod install worked for me

arslan-Techno avatar May 22 '24 09:05 arslan-Techno

installing it thru expo fixed it for me npx expo install react-native-pager-view

rodrigoAbril avatar May 22 '24 11:05 rodrigoAbril

I added react-native-pager-view via yarn and that does not work. I've also ran "rm -rf node_modules; rm -rf ios/build; rm -rf ios/Pods; rm -rf ios/Podfile.lock; yarn; yarn pods" after installing pager-view still getting the error.

I also tried npx expo install react-native-pager-view no success with that either

JmarshTri avatar May 22 '24 13:05 JmarshTri

i tried, me too

kaaaaaaaaaaai avatar May 22 '24 13:05 kaaaaaaaaaaai

installing it thru expo fixed it for me npx expo install react-native-pager-view

worked for me

SwanHub avatar May 30 '24 23:05 SwanHub

If you are using expo run: npx expo run:ios or npx expo run:android, after installing npx expo install react-native-pager-view Worked for me

jilvanx avatar Jun 03 '24 18:06 jilvanx

I'm not using expo and have yet to find a solution that works

JmarshTri avatar Jun 03 '24 18:06 JmarshTri

@JmarshTri, did you ever get it figured out? I was having problems after installing it and running pod install so I ran all my blowout everything and rebuild commands and it did the trick for me. I ran my first aliased command rm -rf node_modules/; rm package-lock.json; rm yarn.lock; cd ios; rm -rf Pods/; rm Podfile.lock; rm -rf build/; cd ..; yarn install; cd ios; bundle exec pod repo update; bundle exec pod install; cd .. and then my second aliased command bundle install; cd ios; bundle exec pod repo update; bundle exec pod install; cd .. followed by my reset cache command yarn start --reset-cache followed by my simulator run command yarn ios --simulator 'iPhone 15 Pro Max (iOS 17.4)' and it finally worked. Hopefully you've gotten it figured out by now though.

I also put in a PR to add the need for pod install to the docs when using react-native-tab-view without being tied to react navigation.

dowatugkins avatar Jun 14 '24 20:06 dowatugkins

after installing npx expo install react-native-pager-view worked for me. Remember that stop simulator then restart, it will work.

viquanghoa avatar Jun 29 '24 10:06 viquanghoa

npx expo install react-native-pager-view

That fix the problem for me 👌

franfernandez20 avatar Jul 22 '24 10:07 franfernandez20

Not working for React-native cli on ios device- "react": "18.2.0", "react-native": "0.74.2", "react-native-pager-view": "^6.3.3", "react-native-tab-view": "^3.5.2", "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/material-top-tabs": "^6.6.14", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@react-navigation/stack": "^6.4.0",

pratiksham28 avatar Jul 30 '24 20:07 pratiksham28

installing it thru expo fixed it for me npx expo install react-native-pager-view

Worked for me

bachvinh avatar Aug 20 '24 10:08 bachvinh

Not working for React-native cli on ios device- "react": "18.2.0", "react-native": "0.74.2", "react-native-pager-view": "^6.3.3", "react-native-tab-view": "^3.5.2", "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/material-top-tabs": "^6.6.14", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@react-navigation/stack": "^6.4.0",

install @6.3.1 version and run this cd ios, pod install

RutvinBhanderi avatar Aug 27 '24 08:08 RutvinBhanderi

installing it thru expo fixed it for me npx expo install react-native-pager-view

worked for me as well maybe try deleting the prev pack and installing this one if it doesnt work the first time.

parampreetsingh217 avatar Sep 18 '24 13:09 parampreetsingh217

installing it thru expo fixed it for me npx expo install react-native-pager-view

Worked for me! Thanks!

arielcorte avatar Sep 25 '24 15:09 arielcorte

installing it thru expo fixed it for me npx expo install react-native-pager-view

At first, I installed the package and removed the node_modules and installed it again and it worked for me.

Thanks

shuvajitmaitra avatar Sep 30 '24 17:09 shuvajitmaitra

I still have this issue and by running npx expo install react-native-pager-view it doesn't fix it. I tried to remove node_modules and package-lock.json, and I also tried to restart my simulator and i also tried to install different versions of this dependency (6.3.0, 6.3.1 and latest 6.4.1)

LorenzoCruccu avatar Oct 14 '24 09:10 LorenzoCruccu

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

github-actions[bot] avatar Nov 14 '24 01:11 github-actions[bot]

Also encountering this issue. Tried npx expo install as well

n3ps avatar May 09 '25 16:05 n3ps

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

github-actions[bot] avatar May 09 '25 16:05 github-actions[bot]