There are two ways to write a native module for your React Native application:
- Directly within your React Native application’s iOS/Android projects
- As a NPM package that can be installed as a dependency by your/other React Native applications
This guide will first walk you through implementing a native module directly within a React Native application. However the native module you build in the following guide can be distributed as an NPM package. Check out the Setting Up a Native Module as a NPM Package guide if you are interested in doing so.
In the following sections we will walk you through guides on how to build a native module directly within a React Native application. As a prerequisite, you will need a React Native application to work within. You can follow the steps here to setup a React Native application if you do not already have one.