Nodejs Mobile React Native banner
Shopify Shopify

Nodejs Mobile React Native

Development community

Description

Node.js for Mobile Apps React Native plugin

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

The Node.js for Mobile Apps React Native plugin

Installation

`$ npm install nodejs-mobile-react-native --save`

For iOS, run `pod install` for linking the native code parts:

`$ cd iOS && pod install`

iOS

Universal binaries are included in the plugin, so you can run in both iOS simulators and devices.

`nodejs-mobile-react-native` supports iOS 11.0 or later. In order to archive the application, the deployment target needs to be `iOS 11.0` or later.

Android

You may need to open your app's `/android` folder in `Android Studio`, so that it detects, downloads and cofigures requirements that might be missing, like the `NDK` and `CMake` to build the native code part of the project.

You can also set the environment variable `ANDROID_NDK_HOME`, as in this example:

export ANDROID_NDK_HOME=/Users/username/Library/Android/sdk/ndk-bundle

Usage

`Node.js` project

When `nodejs-mobile-react-native` was installed through npm, it created a `nodejs-assets/nodejs-project/` path inside your application. This path will be packaged with your application and the background project will be started using the `main.js` file inside. It contains a `sample-main.js` and `sample-package.json` files under `nodejs-assets/nodejs-project/`.

The `sample-main.js` and `sample-package.json` files contain a sample echo project. We advise to rename `sample-main.js` to `main.js` and `sample-package.json` to `package.json` to get you started easily.

Attention: The `sample-main.js` and `sample-package.json` will be overwritten with installs/updates of `nodejs-mobile-react-native`.

The sample `main.js` contents:

var rn_bridge = require('rn-bridge');

// Echo every message received from react-native.
rn_bridge.channel.on('message', (msg) => {
  rn_bridge.channel.send(msg);
} );

// Inform react-native node is initialized.
rn_bridge.channel.send("Node was initialized.");

Recent versions of `react-native` (since 0.57) throw an error during the bundling of th