From 3a8c143a969efbff0b329c3d0ff0a3cc2aacb607 Mon Sep 17 00:00:00 2001 From: Martin Skec Date: Sun, 3 Jul 2016 03:04:31 +0200 Subject: [PATCH] README setup guide --- README.md | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a438ed3..d8f2863 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -# Work in progress - # React Native MPAndroidChart `react-native-mp-android-chart` is react native wrapper of popular android charting library [MPAndroidChart](https://github.com/PhilJay/MPAndroidChart). @@ -11,10 +9,42 @@ - [Example](#example-app) ## Setup -TODO +`npm i react-native-mp-android-chart --save` + +**android/settings.gradle** +``` +include ':reactNativeMPAndroidChart' +project(':reactNativeMPAndroidChart').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mp-android-chart/android') +``` + +**android/app/build.gradle** +``` +dependencies { + ... + compile project(':reactNativeMPAndroidChart') +} +``` + +**MainActivity.java** + +On top where imports are: +```java +import com.github.reactNativeMPAndroidChart.MPAndroidChartPackage; +``` + +Add package in `getPackages` method: +```java +protected List getPackages() { + return Arrays.asList( + new MainReactPackage(), + new MPAndroidChartPackage() // <----- Add this + ); +} +``` + ## Usage TODO ## Example app -Example app is available [here](https://github.com/mskec/react-native-mp-android-chart-example). +Example Android application with source code and `apk` is available [here](https://github.com/mskec/react-native-mp-android-chart-example).