Tips on using React Native modules
Tutorial by Neil Harlow
11.01.2016
At the moment, over 3000 open source react native modules exist on npm. These modules provide features/functionality beyond the core React Native framework. For example, a module we often use is `react-native-fs`, which provides us with a useful File System interface. Unfortunately, with how new the entire React Native ecosystem is, it may be hard deciding whether or not to use a given package, especially in a production environment.
Are you building for both Android and iOS? If so, the first thing I do when adding react native modules through npm is check for cross platform support. If the project is on github, a quick way to check is to click the colored bar right below the number of commits, branches, etc.. This reveals the coding language breakdown.
If you see both Objective-C and Java then there is likely support for both platforms. Don’t rely on this alone however, check the documentation and issues to confirm.
Will you be using react native modules in a production environment? If so, check the open issues on Github. If any of the issues appear to be major or unstable, look into them. If a feature exists on iOS but has not yet been implemented on Android, you might want to check the pull requests!
It is also important to consider how active the repository is. When was the last commit? When was the last pull request processed? How often are changes published to NPM? As we have discovered, many repositories are no longer maintained, out of date, or just do not keep up with the quickly moving React Native ecosystem.
Want to modify existing react native modules? Sometimes a module is missing a feature you might need, or contains a bug you do not need. I would first recommend that you clone the repository, make the necessary changes, and submit a pull request. Chances are someone else has the same needs/requests. If you would like to keep your changes private, you can just as easily clone the repository, commit your changes, and reference the commit in your package.json.