I'm trying to use the React Native DateTimePicker library in my app and I get the following error when I attempt to pick a date:
Invariant Violation: Invariant Violation: requireNativeComponent: "RNDateTimePicker" was not
found in the UIManager.
Anyone else experiences this error? I have gone through other posts like the following but still can't seem to figure it out. Git repo
I am using expo - which may not be compatible with this library. If not, does anyone else have any other recommendations for a date/time library?
I also tried linking, but to no prevail
You cannot use react-native-dateTimepicker because it requires manual linking of native code. So its not possible with expo. You can use the expo date time picker which is exclusively made for expo : Check this out expo-picker . Hope it helps.
After library install.
Do pod install
Re-build your app by running
npx react-native run-ios
If you are not on Expo then
Update XCode.
Since version 3.0, RNDateTimePicker requires XCode 11.6 to build.
you need XCode 11.6 to build this version, and you need this version to properly support iOS 14 (for that you need XCode 12)
From:
https://github.com/react-native-community/datetimepicker/releases/tag/v3.0.0
******* it occurs in RN > .6 *******
first, run
npm i #react-native-community/datetimepicker: 2.1.0
it works correctly
after, run
npm i #react-native-community/datetimepicker
to get the last version
it works correctly again, without any issue
good luck
Related
I have React Native project and when I try to run using npx react-native run-android I found some errors that said like this
A problem occurred configuring project ':react-native-vector-icons'.
Currently, I'm using React Native 0.55.4 and React Native Vector Icons 4.3.0
I try to re-install using npm uninstall and npm install again but turns out it's not solving the error. How can I solve this error? at first, I can run my project successfully but suddenly out of nowhere I cannot run it again because of this error.
Upgrading your gradle version might fix this issue
I'm trying to implement React Native into an existing Android application. I follow the steps in the official documentation and I have ended with the following error when I compile the app (Although I receive an error the build is successful).
On my phone:
In Android Studio emulator:
Has someone faced the same issue?
Is the official React Native docs wrong?
Unless you are using the React context API yourself, this is likely to be related to a mismatch between your React version and the version of some other dependency like react-dom
Please check in your package.json if react-dom and react versions match.
You can upgrade the react version to solve the problem
yarn upgrade react react-dom
Also see these similar questions:
"React.createContext is not a function" - but I am not using it
_react.default.createContext is not a function when using react-redux
I am generating an apk of a project that I developed using React Native. But when I run the command ./gradlew assembleRelease The following error appears:
> Configure project :react-native-audio
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed in version 5.0 of the Android Gradle plugin.
For more information, see http://d.android.com/r/tools/update-dependency-configurations.html.
> Task :app:generatePackageList FAILED
FAILURE: Build failed with an exception.
* Where:
Script 'C:\Users\romer\ProjetoAP\Gravador\teste\Gravador_de_audio\node_modules\#react-native-community\cli-platform-android\native_modules.gradle' line: 131
* What went wrong:
Execution failed for task ':app:generatePackageList'.
> argument type mismatch
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 24s
1 actionable task: 1 executed
PS C:\users\romer\ProjetoAP\Gravador\teste\Gravador_de_audio\android>
How to solve this problem?
I just ran across the same problem and was able to track down why it was happening on my system. Using the --stacktrace flag helped to figure out what was going on, which ended up pointing to the react-native-community/cli package.
After scanning the issues and PRs in the react-native-community/cli repo, I found this PR https://github.com/react-native-community/cli/pull/1396 which adds support for Gradle 7.
I had Gradle 7 on my system and downgrading to Gradle 6, running gradle wrapper, then ./gradlew clean allowed me to move on.
Hope that solves your issue, or at least gives you some insight on how to track it down on your system!
Use Gradle Version 6.9
Here are the highlights of this release:
This is a small backport release.
Java 16 can be used to compile when used with Java toolchains
Dynamic versions can be used within plugin declarations
Native support for Apple Silicon processors
Use Gradle Wrapper to change the Version.
./gradlew wrapper --gradle-version 6.9
Instead of downgrading, I checked the reactNativeModule parameter mentioned at line 131.
It seems like ArrayList<HashMap<String, String>>[] packages = this.reactNativeModules, there is literally a mismatch.
Indeed reactNativeModule doesn't have brackets in his declaration.
So I changed :
ArrayList<HashMap<String, String>>[] packages = this.reactNativeModules
to
ArrayList<HashMap<String, String>> packages = this.reactNativeModules.
Upgrade your react-native version to the latest one with npx react-native upgrade
I had to upgrade from JDK 1.8 to 11 and this error occurred.
Thanks to J Myers answer I found that I had to upgrade the react native version: https://github.com/react-native-community/cli/pull/1396
Steps to solve it for React Native*
Find apply from: file("../../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) in your app -> build.gradle.
Check if this line of code is being repeated.
Comment out one of them.
This should solve your issue.
Replacing distributionUrl with https\://services.gradle.org/distributions/gradle-6.9-all.zip in gradle/wrapper/gradle-wrapper.properties fixed everything for me. Thank GOD
For me on react-native version 0.70.6
Issue is due to #react-native-community/cli-platform-android version so i just need to run
yarn add #react-native-community/cli-platform-android
As give here
Upgrading #react-native-community/cli as described here solved the issue for me: https://github.com/react-native-community/cli#updating-the-cli
If you use lock files (yarn.lock or package-lock.json) - find all the
#react-native-community/cli prefixed entries, remove them, run yarn
install / npm install once again.
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!
I've also faced this issue and if you've followed the setup instructions word by word, the solution should be:
Stop the Metro Bundler.
Stop the app on the simulator/physical device.
Run react-native-start.
Run react-native run-android or run the app on your physical device.
Done!
This is what fixed it for me for development on iOS. Hope this can be of help to you on Android as well!
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.
run command in vs code terminal
cd ios
pod install
cd ..
react-native run-ios
or
react-native android
I tried #Californium's method to stop the Metro Bundler, Simulator, and re-run everything, but that didn't work for me. I also tried to link Slider, but that even didn't work for me.
react-native link #react-native-community/slider
I think You need to just
Import Slider form 'react-native'
This worked for me.
You can try all the steps, provided and if those didn't work. Use the slider from react-native.
I've built an app, also published it already. Now I want to make a small change to the app, but after starting Expo I get an error:
"Error: React Native is not installed. Please run npm install in your project directory.
Couldn't start project. Please fix the errors and restart the project."
Starting Expo (expo start) worked in the past. But starting Expo keeps failing with this error, even after running 'npm install'.
I've also tried 'expo build:android', but that also doesn't work.
All these commands are failing, also with other Expo built apps. Also an app I worked on yesterday.
What can I do to fix this?
Thanks in advance!
[edit]
I am using Expo 2.6.8. (which was a just available update)
Try updating nodejs
https://nodejs.org/en/download/
worked for me