React Native Create Custom Component/Library
Take a look at the official Facebook guide Native Modules Setup. It explains how to start:
$ yarn global add create-react-native-module
$ create-react-native-module MyLibrary
This will generate a README.md
with next steps as follows:
react-native-my-library
Getting started
$ npm install react-native-my-library --save
Mostly automatic installation
$ react-native link react-native-my-library
Usage
import my-library from 'react-native-my-library'; // TODO: What to do with the module? my-library;
1. Command: new-library
React-native-cli offers the new-library command:
react-native new-library --name <YourNewLibraryName>
Calling this will generate a sample library in your Libraries
directory by copying sample file over from the react-native library.
2. Developing
React Native has a couple docs specifically for writing Native Modules and Native UI Components, depending on what you want to achieve.
3. Link component
Link your component once you're done by following the instructions you already mentioned.
Using the react-native Module setup
$ yarn global add create-react-native-module
$ create-react-native-module NameOfLibrary
A template would be generated for you, you can write your custom UI code in the index.js and expand on it as deemed fit.