The process I've taken thus far (for a UIView-based component) is:

  1. react-native init project_name
  2. Write my custom component as part of the project_name xcodeproj
  3. Implement RCTViewManager.h
  4. Implement the corresponding Component_Name.js file

I can follow the steps to get this working locally, however, the React Native docs for components and modules makes no mention of how the npm package should be setup -- or if npm is the tool for the job instead of cocoapods. Furthermore, how much of the generated project from react-native init project_name is to be distributed with the component is not mentioned.

Does anyone know of any guiding principles or best practices (ha!) for this process?

1

There are 1 answers

0
Colin Ramsay On

You'll probably want to follow this discussion on github, in which contributors are talking about a packaging solution for React Native.

https://github.com/facebook/react-native/issues/235

They mention a combination of CocoaPods and npm, but nothing's really been decided yet. Now would be the time to speak up!

Brett Vatne also has a blog article on how to do this at the moment:

http://brentvatne.ca/packaging-react-native-component/