Create npm package of my react native app - react-native

Right now I am working on npm package for my react native app,My app contain lots of things, like have a native modules, lots of dependencies,I am using this to create npm package for my app.
Question 1 - Above package (Mentioned as this) is good for create npm package for my react native app?
Question 2 - As I mentioned that my react native app contain native modules too how can I manage into npm package?
Many thanks in advance

Related

Why would a react native package ask you to install another package separately?

I'm using react-native-pdf in my React Native app, and it says you should install react-native-pdf and react-native-blob-util. Why would it ask us to install react-native-blob-util rather than its just being a dependency in react-native-pdf?

Using highcarts in react native and getting the error

I have installed npm install #highcharts/highcharts-react-native in my react native project and i also added the hcscript in metro.config.js file.
Iam getting the error of
Failed to fetch scripts or layout. The method or property expo-file-system.readDirectoryAsync is not available on android, are you sure you've linked all the native dependencies properly?
if you wanted to use this package: #highcharts/highcharts-react-native you should first install react-native-unimodules which is a set of native dependencies used at the core of #highcharts/highcharts-react-native as
they built the package on top of expo not bare react native.
it is going to require you to make heavy edits in the native ios and android files such as appDelegate.m in ios and more alike files.
However, you should notice this package is deprecated as per the official page, and there is no reliable alternative!

Is npm version 5 and above compatible with react native?

I am recently installing npm and react native
I heard from a 2years old tutorial that new npm versions don't support react native
has this issue been fixed or is npm#5 still incompatible with react native?
Try latest node modules and react-native package.It is better to use Node Version 10 or above for better development environment.

When to use react-native link?

I understand that react-native link (see post) is an automatic way to install native dependencies. The post above explain how to use the link command but lacking the detail of when to use it. Should it be used after adding a component, every code change or after introducing new module to the app?
Why we use react-native-link??
In this post, I will explain why we use react native link command and when we need to use this command or not?
First, we will understand what is native module??
Native Modules
Native modules are usually distributed as npm packages, apart from the typical javascript files and resources they will contain an Android and ios library project. 
React Native provides an impressive amount of native modules that give you direct access to core platform APIs on both Android and IOS.
For example react-native-maps, react-native-firebase, react-native-socketio etc.
These modules or packages contained both platform (Android and Ios) code.
Now coming on to the react native link
Those libraries which are use native code, in that case you'll have to add these files to your app. For linking those library with react native code need to run react-native-link
Here are the few steps to link your libraries that contain native code
Automatic linking
Step 1
Install a library with native dependencies:
$ npm install --save
Step 2
Link your native dependencies:
$ react-native link
Done! All libraries with native dependencies should be successfully linked to your iOS/Android project.
Where we don't use react-native-link??
Those components which are only written in javascript they are not using any native code (Android and Ios). There is no need to run react-native-link.
For example rn-modal-picker, react-native-check-box etc.
You should check out this other answer: The use of react-native-link command?
You only need to run react-native link NAME_OF_PACKAGE when you install a new package that has a native codebase, or without arguments if you want to do it for multiple of them.

React Native non-native library

I want to create a library in react-native that doesn't need any linking and any native code, namely, it is just a pure-javascript component.
Nowadays, I only found the react-native-create-library but it is oriented for native modules. I can create my library with this one but wouldn't be very "lean".
Do you know some library/article to create an full-javascript library for react-native ?
Thank you very much!
Here are the steps:
run npm init in cmd
give answers to all questions.
create components here
create index.js file and import your component in that
export you module in index.js file
login in npm by using npm login command
List item npm publish to publish it on npm.
here is the library which I created for TextInput https://github.com/shashinbhayani/rn-textfield/tree/master/src
you can check there how I created the library.