question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to make a React Native package?

See original GitHub issue

I have written some codes that bridge native code to react native, and I want to make it to a package. The project name is RCTRating. RCTRating/package.json is like

{
  "name": "react-native-rating",
  "version": "0.0.1",
  "nativePackage": true,
  "scripts": {},
  "dependencies": {
    "react-native": "^0.11.2"
  }
}

And I create a new project “TestRating”, and modify package.json to

  ...
  "dependencies": {
    "react-native": "^0.11.2",
    "react-native-rating": "file:../RCTRating"
  }

And run npm install, the files is coped to node_modules/react-native-rating. Then, I run the code. In the TestRating/node_modules/react-native-rating/index.ios.js, I have

var RCTRatingManager = require('react-native').NativeModules.RCTRatingManager;

RCTRatingManager is undefined I have a file in TestRating/node_modules/react-native-rating/ios/RCTRatingManager.h, so it should not be undefined. Why? Please help me.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
keshavkaulcommented, Mar 21, 2017

@rebeccahughes I’m looking for some official documentation specifying correct way to create a native module library. I have come across this repo https://github.com/frostney/react-native-create-library but I’m not sure if that’s the best way to go about creating a native react native library. Any help would be appreciated. Thanks

0reactions
oneycommented, Oct 1, 2015

Thanks! It’s helpful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Native Modules NPM Package Setup
Native modules are usually distributed as npm packages, ... native module we will use the community tool called create-react-native-library.
Read more >
How to create your own react native npm package - Medium
In this post I will discuss how I created my first react native npm package and how can anyone build their own package....
Read more >
How To Create NPM Package For React Native? - MindBowser
We will add one method Ex. · Update example in a custom package · Update version in package. · Update README.md file based...
Read more >
How to publish a React Native component to NPM
Publishing is very quick and easy. Just log into your NPM account from the terminal using npm login then publish using npm publish...
Read more >
How to develop and publish your react native package to NPM
First, let's create a folder where our React Native component will live. ... Once inside the folder, we need to initialize a new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found