[SOLVED] RNCSlider was not found in the UI Manager when trying to use @react-native-community/slider

Issue

I’m trying to create a slider in my react native Android App, and relatively new to React Native. The React Native documentation says their Slider component is deprecated (https://reactnative.dev/docs/slider.html) and directs us to use @react-native-community/slider instead (https://github.com/react-native-community/react-native-slider/blob/master/README.md).

I installed the library in my project directory using npm install @react-native-community/slider --save.

The install succeeded and my versions in my package.json are as follows:

"dependencies": {
    "@react-native-community/slider": "^3.0.3",
    "react": "16.13.1",
    "react-native": "0.63.0" },

I am including the Slider in my source file with import Slider from '@react-native-community/slider';, however when ever I try to actually create a slider in my code with the <Slider> ... </Slider> tags, I get the following compile error:

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

I’ve been banging my head against the wall and can’t figure out how to clear the error.
I am on Windows 10 x64 developing for Android.
Thanks in advance!

Solution

The solution for me was to just run "npx react-native run-android" in my project directory rather than trying to use "npx react-native start". I’m not sure why this works, but it launches the metro server in another console window (using cli.js) rather than in powershell itself. This seems to solve the problem.

Historically I had been launching the app directly from my emulated phone OS, but this didn’t work even if I had the metro server running in powershell.

Answered By – Deaner117

Answer Checked By – Willingham (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.