$ npm install react-native-demo-module --save
$ react-native link react-native-demo-module
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-demo-module
and addRNDemoModule.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNDemoModule.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNDemoModulePackage;
to the imports at the top of the file - Add
new RNDemoModulePackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-demo-module' project(':react-native-demo-module').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-demo-module/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-demo-module')
- In Visual Studio add the
RNDemoModule.sln
innode_modules/react-native-demo-module/windows/RNDemoModule.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Demo.Module.RNDemoModule;
to the usings at the top of the file - Add
new RNDemoModulePackage()
to theList<IReactPackage>
returned by thePackages
method
import RNDemoModule from 'react-native-demo-module';
// TODO: What to do with the module?
RNDemoModule;