Skip to content
A high-level wrapper interface to Node.js for React Native.
Branch: master
Clone or download
Latest commit 7de397b Oct 4, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin 0.0.6 Oct 4, 2019
.gitignore Initial commit Sep 27, 2019
LICENSE Initial commit Sep 27, 2019 Update Sep 29, 2019
index.js Basic project structure. Sep 27, 2019
package.json 0.0.6 Oct 4, 2019


A high-level wrapper interface to Node.js for React Native.

🤔 So... what is this?

When running intensive computation in your JavaScript thread, you run the risk of dropping render frames, which causes your app to respond slowly, animate poorly and feel sluggish. This happens because execessive computational overhead can diminish your ability to reach the next render frame, which ideally should operate at a rate of 60fps.

Luckily, JaneaSystems have open sourced a native mobile execution container for Node.js which operates concurrently to your traditional JavaScript render thread. This library is available for both iOS and Android, and provides implementors with the ability to diversify their execution logic by delegating stateless computation for parallel execution. This helps promote more advantageous utilisation of the runtime hardware, whilst simultaneously unburdening your render thread.

The mobile Node.js environment can be interacted with using a simple bidirectional protocol, sendMessage and onMessage, which communicates from React to the native container and vice-versa. However, this mechanism for communication often proves to be too low level, can easily swallow exceptions, requires manual synchronization and normally demands the implementation of a bespoke protocol.

This library serves as an abstraction layer to avoid these concerns, by defining an interface which mirrors the functions exported by the native module. These functions are promisified and mapped to a native bridge object, which manages lower level synchronization. This approach helps treat the remote Node.js runtime as if it were just another part of your application.

🚀 Getting Started

Using npm:

npm install --save nodejs-react-native-bridge

Using yarn:

yarn add nodejs-mobile-react-native-bridge

This will install the file nodejs-mobile-react-native-bridge.js to your nodejs-assets/nodejs-projectdirectory installed by nodejs-mobile-react-native.

✍️ Example


import React from 'react';
import NodeJsBridge from 'nodejs-mobile-react-native-bridge';

export default () => (
    onHandleBridge={({ hello }) => hello('world')
      .then(console.log) // "hello, world!"


module.exports = {
  hello: str => `hello, ${str}!`,

This file serves as the entry-point to your decoupled logic. Each function exported by the file becomes available as promisified function via the bridge object returned via the onHandleBridge callback prop, which allows you to easily interact with your threaded Node.js project.

✌️ License


You can’t perform that action at this time.