How do I exclude a package from react native link? - javascript

I currently add a module using : npm i --save <package_name>
and once done, I use : react-native link instead of react-native link <package_name>, there by linking all possible react native libraries present in my package.json .
The problem arrives when one of the packages I am about to use requires me to NOT USE react-native link
package : react-community/react-native-maps; https://github.com/react-community/react-native-maps
Note mentioned in the library :
IMPORTANT!!
!! DO NOT USE !! react-native link
Link to the note
I want this so that whoever working on my project after me doesn't make the mistake of doing react-native link Please help.

For react-native-maps you shouldn't use react-native link as per their latest documentation. And there are no much workaround for this.
The temporary fix can be this:
After 'npm install', goto node_modules folder and open the following js file.
RootProject/node_modules/react-native/local-cli/link
In link.js file, linkDependency() method add the following code:
if (dependency.name === 'react-native-maps'){
log.info(linking loop break as the library is'${dependency.name}');
return
}
Now run, 'react-native link'. The react-native link command will link all libraries but not the maps.
PS: Actually, we shouldn't touch any of node_modules package, but for the maps library we don't have much options to solve the issue.
Any other answers are too welcome.

Related

How to use create-react-app to install previous react.js versions?

I want to use one previous version of react (16.0.0) but couldn't find any way to install previous version by using "create react app".
One answer on this topic was posted in stackoverflow that says that I need to install the latest version by using "create react app" then I need to edit package.json file and specify my desired version (react & react-dom) and run npm install command.
But couldn't get my desired version. It's still the current version (17.0.2). Can anyone fix the issue please?
delete .lock file and then try installing packages

How to edit build.gradle for required OS platform in React native created with expo?

I created a React Native project with Expo. I am able to locate build.gradle file in created project. I need to add some configurations for the module installed. How can I solve this in another appropriate way?
Your help would be appreciated.
when using expo-managed workflow you can't access native platform code (Objective-C or Java) unless you eject using expo eject command

Newbie in React: how to edit a component that was installed via npm?

I've followed the instructions in this URL (https://github.com/react-component/calendar) to install a component app in my dependencies. I have succesfully installed it, imported it and it is visible and usable in my web app.
npm install rc-calendar
import Calendar from 'rc-calendar';
<Calendar />
However, I can't seem to edit it or find a 'Calendar.js' file to make changes to it? I'm able to see it in my package.json file but not more than that
You'll find the source files in your node_modules folder in your project. But I would not edit them there. If you want to use that plugin as a starting point and edit it from there, I recommend downloading the source files from the github repo and including it in your project as a regular .js file / regular component. Then you can edit from there. It looks like that plugin has many files that are written in typescript.
TL;DR You can, but you shouldn't.
When you use npm it's supposed that you don't change those packages, what you can do is create your own version. If you want to find the source code, some packages come with it, you'll find it in: <project folder>/node_modules/rc-calendar.
The typical convention is to not edit packages installed via npm . However, you can clone the package repo and include it in your project. There, you can do what ever you want.

React Native this._lazyCallableModules[name] is not a function

I had a fully functioning react native app, and I tried to install the Facebook Login button. I followed these instructions:
https://developers.facebook.com/docs/react-native/login
and
https://developers.facebook.com/docs/react-native/configure-ios
There is a known issue using react-native link to connect the Facebook SDK to the project, and so I tried linking it manually. I could not get the Facebook Login to work, and now when I use react-native run-ios, my app just shows a black screen!
As a test, I used create-react-native-app to create a new app, and I launched it, and I'm getting this error:
this._lazyCallableModules[name] is not a function (MessageQueue.js 155:11)
Since I'm not sure what MessageQueue is and this is a brand new app, I'm not sure how to undo the damage I've done.
Has anyone experienced this, or do you at least have some idea of how I can go about resetting my react setup?
If I haven't given enough relevant information, please let me know.
Followed the answer given here and it's working well so far.
Downgrade the babel-preset-react-native package from 2.0.1 to 2.0.0. The command is npm install babel-preset-react-native#2.0.0. Use the --save flag if you want to store it to your package.json.
Updating to the latest React Native, clean & build solved it for me.

LiveScript with Meteor.js

I wonder if there is an easy way to get LiveScript files compiled to js in Meteor.js app. Found this mrt extension:
https://atmosphere.meteor.com/package/livescript-latest
But doing mrt add livescript-latest only gives error:
While building package `livescript-latest`:
package.js:3:9: Package.register_extension() is no longer supported. Use Package._transitional_registerBuildPlugin instead.
In the git repo of this extension the error is already fixed. So I can this directly to smart.json:
"livescript-latest": {
"git": "https://github.com/Whoaa512/meteor-livescript.git",
"branch": "master"
}
This seems to be installed fine, but when I try adding .ls files to the project, they are not seems to be compiled.
Anyone else tried LiveScripting with Meteor.js apps?
Try using the other livescript package. I'm not sure why someone created the livescript-latest package - both seem to be using version 1.2.0 of livescript.
mrt add livescript
This worked for me back when I was using LiveScript.
meteor add vasaka:livescript-compiler
https://atmospherejs.com/vasaka/livescript-compiler

Categories