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

[3.18.1] requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager #1614

Closed
efstathiosntonas opened this issue Oct 12, 2022 · 51 comments · Fixed by #1615
Assignees
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS

Comments

@efstathiosntonas
Copy link

Description

After upgrading to 3.18.1 it throwed:

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

it seems that the introduction of react-native-config.js won't allow the package to be bundled sincemetro throws:

warn Package react-native-screens has been ignored because it contains invalid configuration. Reason: "dependency.platforms.android.componentDescriptors" is not allowed

ps. I'm using yarn 3.2.4

Steps to reproduce

  1. Install/Upgrade to 3.18.1
  2. pod install
  3. build app

Snack or a link to a repository

no snack

Screens version

3.18.1

React Native version

0.68.3

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Real device

Device model

iPhone 13

Acknowledgements

Yes

@github-actions
Copy link

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

@github-actions github-actions bot added Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS labels Oct 12, 2022
@Stackerr
Copy link

Stackerr commented Oct 12, 2022

same issue

after "react-native start --reset-cache"
i find the warn message below
Package react-native-screens has been ignored because it contains invalid configuration. Reason: "dependency.platforms.android.componentDescriptors

also, i can't build android

@n3tflex
Copy link

n3tflex commented Oct 12, 2022

same here. But using npm.

Screens version

3.18.1

React Native version

0.66.4

Platforms

iOS

Workflow

React Native (without Expo)

Build type

Debug mode

Device

Simulator

Device model

iPhone 13

@efstathiosntonas
Copy link
Author

efstathiosntonas commented Oct 12, 2022

Since the react-native-safe-area-context was bumped to 4.4.1 I think 3.18.1 is no longer supported on react-native < 0.70.

downgrading to 3.18.0 works just fine.

@Letty
Copy link

Letty commented Oct 12, 2022

Same issue for me.

It does not install RNScreens on pod install

Downgrading to v3.18.0 works.

@kkafar kkafar self-assigned this Oct 12, 2022
@n3tflex
Copy link

n3tflex commented Oct 12, 2022

On my project downgrading to v3.18.0 does not work. Still get the

Package react-native-screens has been ignored because it contains invalid configuration. Reason: "dependency.platforms.android.componentDescriptors" is not allowed

message when building the app.

@efstathiosntonas
Copy link
Author

efstathiosntonas commented Oct 12, 2022

@n3tflex did you try to run metro with --reset-cache? Removing the node_modules prior doing so might help too.

@Letty
Copy link

Letty commented Oct 12, 2022

@n3tflex Maybe check your yarn.lock file for the version there. I often delete the lockfile to make sure to have the needed versions.

@kkafar
Copy link
Member

kkafar commented Oct 12, 2022

Hi all, only change 3.18.1 introduced was to add react-native.config.js file which is required for the library to run on new architecture, there were no changes to any dependency versions.

I'll dive into the problem and let you know asap whats going on

Since the react-native-safe-area-context was bumped to 4.4.1 I think 3.18.1 is no longer supported on react-native < 0.70.

It was only bumped in FabricTestExample application and should have no impact on library usage.

@efstathiosntonas
Copy link
Author

@kkafar thanks, you're right about the react-native-safe-area-context I misread the file name at the diff.

@n3tflex
Copy link

n3tflex commented Oct 12, 2022

@n3tflex did you try to run metro with --reset-cache? Removing the node_modules prior doing so might help too.

yes, I have deleted the node_modules folder and the package-lock.json file before npm install, pod install and building the app, still the same warning.

@efstathiosntonas
Copy link
Author

@n3tflex as a last measure, delete the cache of npm, sorry to ask again since it was not clear on your response, did you run the metro bunder with --reset-cache flag?

@n3tflex
Copy link

n3tflex commented Oct 12, 2022

Steps I have done:

  1. edited package.json to "react-native-screens": "^3.18.0"
  2. deleted node_modules & package-lock.json
  3. deleted Pods & Podfile.lock
  4. npm cache clean --force
  5. npm install
  6. pod install
  7. react-native run-ios --reset-cache

And I still get same warning.

Thanks for your help!

@Letty
Copy link

Letty commented Oct 12, 2022

Steps I have done:

1. edited `package.json to` `"react-native-screens": "^3.18.0"`

2. deleted `node_modules` & `package-lock.json`

3. deleted `Pods` & `Podfile.lock`

4. `npm cache clean --force  `

5. `npm install`

6. `pod install`

7. `react-native run-ios --reset-cache`

And I still get same warning.

Thanks for your help!

You have to pin this version
"react-native-screens": "3.18.0"

In case you are wondering what the signs mean:
https://stackoverflow.com/questions/22137778/what-does-mean-in-package-json-versioning

@kkafar
Copy link
Member

kkafar commented Oct 12, 2022

I'm testing fix by my self now, but would appreciate if any of you would confirm, that this resolves the issue: #1615

Install react-native-screens as follows in your package.json:

"react-native-screens": "software-mansion/react-native-screens#49cc61e1fa9926a671d32bbb634a2c43c999e122"

Update: the branch was deleted, before 3.18.2 is released please use current main:

"react-native-screens": "software-mansion/react-native-screens#0f684a76276709df927dab116f7addcb9b8c2a6b"

@Letty
Copy link

Letty commented Oct 12, 2022

I'm testing fix by my self now, but would appreciate if any of you would confirm, that this resolves the issue: #1615

Install react-native-screens as follows in your package.json:

"react-native-screens": "software-mansion/react-native-screens#49cc61e1fa9926a671d32bbb634a2c43c999e122"

I tried it in my project at it works like charm! Thank you for the quick reaction on this.
(My RN version is 0.68.4)

@n3tflex
Copy link

n3tflex commented Oct 12, 2022

Steps I have done:

1. edited `package.json to` `"react-native-screens": "^3.18.0"`

2. deleted `node_modules` & `package-lock.json`

3. deleted `Pods` & `Podfile.lock`

4. `npm cache clean --force  `

5. `npm install`

6. `pod install`

7. `react-native run-ios --reset-cache`

And I still get same warning.
Thanks for your help!

You have to pin this version "react-native-screens": "3.18.0"

In case you are wondering what the signs mean: https://stackoverflow.com/questions/22137778/what-does-mean-in-package-json-versioning

Sorry my fault. After pinning the package the warning ist finally gone! Thanks!

@kkafar
Copy link
Member

kkafar commented Oct 12, 2022

Thank you @Letty! I'll have 3.18.2 released with this patch soon!

kkafar added a commit that referenced this issue Oct 12, 2022
## Description

Fixes #1614

#1611 added `react-native.config.js` file to the library which uses
features supported since `@react-native-cli@9.0.0` thus causing library
fail to link while on Paper with React Native < 0.70.

This fix is borrowed from `react-native-safe-area-context`.

## Changes

Added check for `@react-native-community/cli-platform-android` version
in `react-native.config.js`.

## Test code and steps to reproduce

--

## Checklist

- [x] Ensured that CI passes
@kkafar kkafar pinned this issue Oct 12, 2022
@irfankhanktk
Copy link

I also fixed this issue using "react-native-screens": "3.18.0",

@ToniNikolaev23
Copy link

Same error with react-native 0.64.3 .. downgrade to 3.18.0 and works :) Waiting for new release 💯

@kkafar
Copy link
Member

kkafar commented Oct 13, 2022

@ToniNikolaev23,
#1615 (solution to this issue) causes issues with Example applications in the repository so it is holding release for now, but I'm working on it.

@mikehardy
Copy link
Contributor

@kkafar no good deed unpunished ;-). Thanks for react-native-screens and we have 3.18.0 until things are sorted. Cheers

@SanjanaTailor
Copy link

I'm testing fix by my self now, but would appreciate if any of you would confirm, that this resolves the issue: #1615

Install react-native-screens as follows in your package.json:

"react-native-screens": "software-mansion/react-native-screens#49cc61e1fa9926a671d32bbb634a2c43c999e122"

Update: the branch was deleted, before 3.18.2 is released please use current main:

"react-native-screens": "software-mansion/react-native-screens#0f684a76276709df927dab116f7addcb9b8c2a6b"

Both are working for me Thank you @kkafar

@SanjanaTailor
Copy link

3.18.2 is released, the issue should be resolved.

In case of any problems just tag me here

It is not working for me ^3.18.2 is not working.

@kkafar
Copy link
Member

kkafar commented Oct 25, 2022

Hi @SanjanaTailor,
My first impression is that it is rather strange, as 3.18.2 was cut of exactly this commit: 0f684a76276709df927dab116f7addcb9b8c2a6b, thus I rather expect that fixing the version to "3.18.2" (not "^3.18.2") and running rm -fr node_modules && yarn install should resolve the issue.

I would love you confirmed this, because if it is not the case (id does not work for you on 3.18.2), it implies that there are some additional issues in release configuration.

@SanjanaTailor
Copy link

Hi @SanjanaTailor, My first impression is that it is rather strange, as 3.18.2 was cut of exactly this commit: 0f684a76276709df927dab116f7addcb9b8c2a6b, thus I rather expect that fixing the version to "3.18.2" (not "^3.18.2") and running rm -fr node_modules && yarn install should resolve the issue.

I would love you confirmed this, because if it is not the case (id does not work for you on 3.18.2), it implies that there are some additional issues in release configuration.

@kkafar - I think I have tried it but did not resolve the issue. what can be additional release configuration. Anything required from my end please let me know.

@SanjanaTailor
Copy link

Hi @SanjanaTailor, My first impression is that it is rather strange, as 3.18.2 was cut of exactly this commit: 0f684a76276709df927dab116f7addcb9b8c2a6b, thus I rather expect that fixing the version to "3.18.2" (not "^3.18.2") and running rm -fr node_modules && yarn install should resolve the issue.

I would love you confirmed this, because if it is not the case (id does not work for you on 3.18.2), it implies that there are some additional issues in release configuration.

@kkafar - npm ERR! notarget No matching version found for react-native-screens@3.18.2. this issue is happening.

@Breyner-Parada
Copy link

Breyner-Parada commented Dec 6, 2022

I have the same problem, these are my dependencies:
"dependencies": {
"@react-navigation/native": "^6.0.16",
"@react-navigation/native-stack": "^6.9.4",
"nativewind": "^2.0.11",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "3.18.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0",
"tailwindcss": "^3.2.4"
},

Should I remove the caret sign "^"on every dependency
I appreciate any info, thanks in advance

@Breyner-Parada
Copy link

I have the same problem, these are my dependencies: "dependencies": { "@react-navigation/native": "^6.0.16", "@react-navigation/native-stack": "^6.9.4", "nativewind": "^2.0.11", "react": "18.1.0", "react-native": "0.70.6", "react-native-safe-area-context": "^4.4.1", "react-native-screens": "3.18.0" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/runtime": "^7.12.5", "@react-native-community/eslint-config": "^2.0.0", "babel-jest": "^26.6.3", "eslint": "^7.32.0", "jest": "^26.6.3", "metro-react-native-babel-preset": "0.72.3", "react-test-renderer": "18.1.0", "tailwindcss": "^3.2.4" },

Should I remove the caret sign "^"on every dependency I appreciate any info, thanks in advance

I just find other way to solve it

  1. Close metro
  2. Go into android folder
  3. Run in a terminal ".\gradlew clean"
  4. Delete the build app on your emulator or physical device
  5. Finally run again metro and then run android

Note: I just try it in an android environment and it's worked

@harishpalsande9
Copy link

i also got it same error but I did it

npm i then is working fine

and another thing is check internet conection

@Desintegrator
Copy link

Desintegrator commented May 21, 2023

same issue on Android, using expo and npm in eas release build. dev works fine.
tried different suggested solutions. no luck

@rohitkatare54
Copy link

I'm still facing same error. How to resolve it ?

@Breyner-Parada
Copy link

For that error

  1. Delete both build app folder on android and ios
  2. Uninstall the dev app from your phone (android or ios)
    2.1. This step is special for ios verify your cocoapods, package.json and all gems should be installed
    2.2. This step is special or android just verify the package.json
  3. Finally run the commands to install the app on yur phone

I hope this help you 👍

@dansau84
Copy link

dansau84 commented Jul 4, 2023

guys why there´s no any clear fix for this ? it looks like all are trowing stuff against the wall to see if it sticks.. the feature owner should come up with a solution asap! i´m using expo native react and same error here!

@ramit-mitra
Copy link

ramit-mitra commented Jul 7, 2023

guys why there´s no any clear fix for this ? it looks like all are trowing stuff against the wall to see if it sticks.. the feature owner should come up with a solution asap! i´m using expo native react and same error here!

Same here!

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

@bogdan2510
Copy link

bogdan2510 commented Jul 21, 2023

guys why there´s no any clear fix for this ? it looks like all are trowing stuff against the wall to see if it sticks.. the feature owner should come up with a solution asap! i´m using expo native react and same error here!

ASAP is a very hard word. Please remember this is open source work. So people are investing time doing cool stuff mostly for free. :). I'm sure a better word choice goes a long way. Thanks

@AbdullahAgsar
Copy link

pod install

npm run ios --reset-cache
worked for me

@mianaamirshehzad
Copy link

This error happens while installing react-native-screen & react-native-safe-area-view packages. I suggest installing them one by one rather than with a single command. Also, the possible solution is already mentioned above. I'm just modifying it as:

  • Delete node_modules and package-lock.json file.
  • Run npm cache clean --force.
  • Then move to android folder using cd android and run ./gradlew clean, again jump back to the project folder with cd ..
  • Install the packages using npm install
  • Rebuild your project.

Hope this will be help you all.

@moominshera
Copy link

i encountered the same issue ater Editing MainActivity.java file which is located in android/app/src/main/java//MainActivity.java while following react-navigation-getting-started-guide

you need to stop the metro-server

and then, run react-native run-android

@moominshera
Copy link

I solved this error by changing the version to 3.3.2 and using yarn instead of npm.

Here are the commands I followed:

yarn add nativewind
yarn add --dev tailwindcss@3.3.2

then restart the app

@Mary-Grigoryan
Copy link

Anyone have other solutions? I have tried all of the above steps and nothing has worked for me :( I am doing it on iOS.

Here is my package.json;

{
"name": "ReactNativeApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@react-native-firebase/app": "^18.9.0",
"@react-native-firebase/auth": "^18.9.0",
"@react-navigation/native": "^6.1.12",
"@react-navigation/native-stack": "^6.9.20",
"firebase": "^10.6.0",
"react": "18.2.0",
"react-native": "0.73.4",
"react-native-gesture-handler": "^2.15.0",
"react-native-safe-area-context": "^4.9.0",
"react-native-screens": "^3.29.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.73.21",
"@react-native/eslint-config": "0.73.2",
"@react-native/metro-config": "0.73.5",
"@react-native/typescript-config": "0.73.1",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}

@Mary-Grigoryan
Copy link

I fixed this, turned out I was using Native Stack Navigator instead of Stack Navigator which was causing the issue.

Steps - also found at https://reactnavigation.org/docs/stack-navigator/#installation:

  1. in terminal run npm install @react-navigation/stack
  2. in terminal run npm install react-native-gesture-handler
  3. as im using it for iOS -> cd ios -> pod install

In my AppNavigator.js I changed my import from
import { createNativeStackNavigator } from '@react-navigation/native-stack'; to import { createStackNavigator } from '@react-navigation/stack';
and my const Stack = createNativeStackNavigator(); to const Stack = createStackNavigator();.

@Horlard1
Copy link

I fixed this by adding react-native-screens

I run the command npx expo install react-native-screens

then rebuild the apk using eas

@tboba
Copy link
Member

tboba commented Feb 26, 2024

Hi @Mary-Grigoryan, I think this is not right solution, as the Stack Navigator does not fully embrace functionalities of react-native-screens (in particular, Stack is not being generated on the native side).

Have you tried to reset cache of Metro Bundler when this error has occurred (yarn start --reset-cache / npm run start -- --reset-cache)? Also, is your project using Expo, or it is bare React Native environment?

@markendy
Copy link

markendy commented Mar 5, 2024

Try DOWNGRADE Node version. In my case, I use RN 0.68.2, and when run app i have this crush "[requireNativeComponent: "RNSScreenStackHeaderConfig" was not found in the UIManager]" on both platform (android, ios).
I downgrade Node to 16.x (with nvm) and its work.
If will problem with "yarn" after this, i write answer on strange error in https://stackoverflow.com/a/78107361/22993978

@Gowtham1802
Copy link

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

This error is located at:
in RNSScreenStackHeaderConfig (created by HeaderConfig)
in HeaderConfig (created by SceneView)
in RNSScreen
in Unknown (created by InnerScreen)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze (created by InnerScreen)
in InnerScreen (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze (created by ScreenStack)
in RNSScreenStack (created by ScreenStack)
in ScreenStack (created by NativeStackViewInner)
in NativeStackViewInner (created by NativeStackView)
in RNCSafeAreaProvider (created by SafeAreaProvider)
in SafeAreaProvider (created by SafeAreaProviderCompat)
in SafeAreaProviderCompat (created by NativeStackView)
in NativeStackView (created by NativeStackNavigator)
in PreventRemoveProvider (created by NavigationContent)
in NavigationContent
in Unknown (created by NativeStackNavigator)
in NativeStackNavigator (created by App)
in EnsureSingleNavigator
in BaseNavigationContainer
in ThemeProvider
in NavigationContainerInner (created by App)
in App
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer
in FirstApp(RootComponent), js engine: hermes

I am faced this type of error please give me a correct solution for the above error.

@Mary-Grigoryan
Copy link

Mary

Hi @tboba, I suspected too that it wouldnt be the right solution. I have changed it back anyway too Native Stack Navigator instead of Stack Navigator. I still have that error anyway.

Also it is a bare React project yes. And i have ran npm run start -- --reset-cache and still no fix.

@AmbassEugene
Copy link

AmbassEugene commented Apr 16, 2024

So this is how I effectively tackled this:

  1. Run ./gradlew build in android folder to identify the root cause of the error (Mine was a missing file in the NDK folder)
  2. Delete the NDK version folder mentioned in the error message (e.g., ~/Library/Android/sdk/ndk/25.1.8937393).
  3. Run ./gradlew clean followed by ./gradlew build to clean and rebuild with a corrected NDK setup.

The full piece can be found here: https://dev.to/ambasseugene/how-to-resolve-requirenativecomponent-rnsscreenstackheaderconfig-was-not-found-in-the-uimanager-in-react-native-17dh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing repro This issue need minimum repro scenario Platform: iOS This issue is specific to iOS
Projects
None yet