Struggling to set up nativebase in a React Expo project - react-native

I have tried so many different ways to set nativebase up with expo and am still having an issue. At the moment I'm using the
Getting Started documentation found on the nativebase website.
I first create a new app with expo using
expo init myapp
Then I install nativebase using
npm install native-base --save
Then I finally install the font
expo install expo-font
I even copy the App.js found in the getting started documentation, and after I start the app and try to run it on an emulator I face the below error
Unable to resolve "#expo/vector-icons/Fontisto" from "node_modules\native-base\dist\src\basic\IconNB.js"
Failed building JavaScript bundle.
What am I missing? Coming from .NET world this whole process with dependencies is so painful...
*Edit 1
I'm sure someone will make mention of the fact that the error message mentions #expo/vector-icons and I have not installed that. When running before I install this package I get that error, and after I install the mentioned package I still face the exact same error.

Please try with this version of native base :
npm i --save-exact native-base#2.13.8
Expo should release a version with that version .
Hope it helps. feel free for doubts

We can run the below command with Expo
npm i --save-exact native-base#2.13.8
Still this version is not available, but its working, really don't know why?

Related

Why can't I install the React Native Testing library?

I'm new to app testing and have started delving into this topic since yesterday. I wanted to write tests for my React Native app and tried to install React Native Testing Library with this command:
npm install --save-dev #testing-library/react-native #testing-library/jest-native
Then I ran into the following problem:
I tried to find a solution to this problem in Google, but I did not succeed. As far as I understand, the problem lies in the dependencies?
Please tell me what can I do in this case?
P.S. I tried to create a completely clean project with expo init, tried to install the library but got exactly the same error
Hit the same issue and didn't want to update everything at the moment so I solved the issue by running a suggestion on the npm error output:
npm install --save-dev #testing-library/react-native --legacy-peer-deps
It worked for me
it looks like you are running into a conflict with your react version dependencies. Please check the named modules for required packages they depend on.
Please have a look with: npm outdated and then maybe try to update your settings via npm update
also take a look here if you want: updating npm dependencies
you need to update react version after updating just install the latest version of testing-library

Warning: Invalid version react-native#0.64.2 for expo sdkVersion 43.0.0. Use react-native#0.64.3

I am working on an expo project and everything is working fine, but I began to get a warning message when android is building as
Warning: Invalid version react-native#0.64.2 for expo sdkVersion 43.0.0. Use react-native#0.64.3
The app is still running fine but I don't how to fix this error yet and I want to know if it won't cause an issue later.
I have tried to run npx react-native upgrade 0.64.3 but it didn't work, I got this error
info Fetching diff between v0.64.2 and v0.64.3... error Fetch request
failed with status 404: 404: Not Found. error Failed to fetch diff for
react-native#0.64.3. Maybe it's not released yet?
changing the version of react-native manually in the package.json and run expo install worked for me
I use the expo doctor command it allows diagnose issues with the project.
I would recommend using the expo upgrade command. It upgrades the project packages and config for the given SDK version.
More to find here.
I just faced the same issue. Basically it's telling you should use a higher version of your react-native. I solved it just by updating it to the specified version.
npx react-native upgrade 0.64.3
More info here.
Cheers,
If as in my case one need a specific version of react-native, let's say older because some legacy dependencies in a particular project that for some reason can't be upgrade, then change the version in the package.json won't work.
What worked as the cli suggested is to use:
expo doctor --fix-dependencies
That installed the correct lower version of react-native
To find out actual problems run this command :
expo doctor
To solve all problems regarding package conflicts run this command:
expo doctor --fix-dependencies
Use sudo on Unix based OS if you have permission issue to run those commands.
To solve the error, I used the below command:
npm install react-native-clean-project --save-dev
It is a library that allows us to resolve conflicts.
This library is added to your dependencies.
This handles the problem and if it is not the case add this command:
react-native clean-project-auto

Invariant Violation: Native module cannot be null

Hi I have an error when I am trying to install and import expo-notifications. I followed the documentation here: https://docs.expo.io/versions/v38.0.0/sdk/notifications/ and ran expo install expo-notifications but I am receiving this error when I try to import it. I know the error comes from this import as when i comment it out, my app loads normally. I am using the expo managed workflow. Appreciate if anyone can help me with this issue! Edit: tested it on android simulator and it works there so this seems to be an IOS issue.
Managed to get it working by upgrading from expo sdk 37 to expo sdk 38 by running expo upgrade
Looks like there is an open issue on Github. Try this:
1.delete node_modules & package-lock.json
2.npm cache clean --force
3.npm install --save #react-native-community/push-notification-ios
https://github.com/react-native-community/push-notification-ios/issues/43#issuecomment-625020674

Expo Developer Tools is disconnected from Expo CLI. Cannot find module './validators/Presets'

i'm new to react-native. i've been tryin to set up a new react-native project, but seems to have some problem. I saw many questions similar to this, but none of it is relevent to the issue i'm experiencing..
i've installed and created expo as per documentation.
npm i -g expo-cli
expo init testproject
cd testproject
but when i expo start, the above error occurs
npm: 6.9.0
node: 12.1.0
expo: 2.15.4
expo diagnostics:
as per guidance mentioned by
#AddWeb Solution Pvt Ltd
, i was able to fix the issue.
thanks..
for anyone stumbling with the same issue in future, i'm leaving the answer here.
The problem is with linux O.S. it's case-sensitive. so the fix is to manually edit
'Colors' to 'colors' and 'Presets' to 'presets' which is shown in the below image

react native doesn't recognize project

I've made a fresh clone of a react-native project which is 100% ok and working. Installed react-native-cli, trying to run react-native start in the project dir, but I get Command start unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
I tried to init a fresh project just to test, and it worked fine, I was able to run react native commands there and everything worked.
It's definitely not an issue with my project because other people work on it as well and it's 100% ok and valid. This is some issue with react native or some other lib, I suppose. What could that be?
I'm using mac os sierra and project's react native version is 0.40.0
So, I've resolved this issue finally, and, to whoever it may concern: the problem wasn't with react-native. The problem was with npm. I was using yarn, and had npm 5 installed on my system. Also I had a postinstall script, which called rn-nodeify. rn-nodeify, in turn, on the final stage called npm (not yarn), and since it was npm 5 I was experiencing an npm 5 bug, which wiped out my modules. The bug is described e.g. here. Downgrading to npm 4 solved this issue for me.