Converting an Android Library to a Linked Node Module

John Shelley
In The Hudl
Published in
2 min readApr 30, 2018

We recently published a blog post detailing Hudl’s first open source project supporting React Native development. You can read about the introduction of the react-native-android-fragment here:

The project has been used internally for almost a year now and it has helped move our “brown-field” React Native application forward. It has helped us integrate our native code with our React Native features and allowed our teams to move faster.

However, we have also experienced some problems with this project. We had initially decided that react-native-android-fragment would carry with it the dependency for React Native itself. This meant:

  1. When we upgraded to a newer version of React Native we also had to create the .aar file for the React Native Android project.
  2. Once that file was created we had to add that artifact to the react-native-android-fragment project.
  3. We would then perform a full smoke test to ensure nothing broke.

For those unfamiliar with how the internals of React Native work, this might sound like a lot of work, and honestly it is!

We asked ourselves how we could solve this cumbersome problem and eventually realized we were fighting the node ecosystem.

That is why, as of today, react-native-android-fragment is available as a natively linked node module! 🎉

We no longer ship a specific version of react-native with this project, but instead declare it as a peer dependency. If there are breaking changes please submit a Github issue or pull request!

We hope this will allow React Native developers to move fast and incorporate crazy ideas such as a mixed native and React Native TabLayout.

Also a huge thank you to Johannes Stein and those that have worked on react-native-create-library 👏

--

--

John Shelley
In The Hudl

Mobile Developer @Square, Coffee Enthusiast, Iowa State Alum