As I wrote before, I’m using Open Source Software extensively in the context of React XP. This post is about a very positive experience this time.

I’m using react-native-charts-wrapper in particular. I needed to customize this javascript library and the underlying Android and iOS ones.

I couldn’t wait for the Android library author to have a look at my pull request, So I looked for a way to use my forks as the actual source code to build my app.

The good news is that It is possible 🙂

Javascript (react-native-charts-wrapper)

Instead of using the official release, use a GitHub URL in your package.json and you’re done.

Android (MPAndroidChart)

I asked myself the following question before asking google : “How to add a GitHub dependency to an Android Studio project”.

The answer (use JitPack) came from StackOverflow of course.

JitPack

This is so easy to use, you paste you GitHub repo url in the lookup search box, the library is built on the fly, and you follow instructions to add your dependency to your build.gradle file.

I was surprised to see that react-native-charts-wrapper was already using this technique to pull the MPAndroidChart library. I only needed to update the URL to make it point to my fork/branch:

implementation 'com.github.omatrot:MPAndroidChart:radarchart_webinneralpha-SNAPSHOT'
/* implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' */

 

iOS (Charts)

Because I have installed the library manually, Charts is coming as a git submodule.

Again, I just needed to change the url in the .gitmodules file:

[submodule "ios/Charts"]
path = ios/Charts
url = https://github.com/omatrot/Charts.git
ignore = dirty
branch = radarchart_webAlphaInner

I Also had to make sure to update the main repo with the new state of the submodule.
That’s all folks. Happy coding.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.