diff --git a/android/.npmignore b/android/.npmignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/android/.npmignore @@ -0,0 +1 @@ +/build diff --git a/android/build.gradle b/android/build.gradle index efc45ac..5c04617 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,6 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:design:23.0.1' - compile 'com.facebook.react:react-native:0.16.+' + compile 'com.facebook.react:react-native:0.20.+' compile 'com.android.support:appcompat-v7:23.0.1' } diff --git a/android/react-native-chart-android.iml b/android/react-native-chart-android.iml new file mode 100644 index 0000000..05bc968 --- /dev/null +++ b/android/react-native-chart-android.iml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/ChartViewManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/ChartViewManager.java index 5728dec..01b5502 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/ChartViewManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/ChartViewManager.java @@ -2,7 +2,7 @@ import android.support.annotation.Nullable; -import com.facebook.react.uimanager.ReactProp; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java index 5de8e7b..5c67f27 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarChartManager.java @@ -4,7 +4,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ReactProp; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.github.mikephil.charting.charts.BarChart; @@ -34,7 +34,7 @@ public String getName() { @Override protected BarChart createViewInstance(ThemedReactContext reactContext) { BarChart chart=new BarChart(reactContext); - chart.setOnChartGestureListener(new MPChartEventListener()); + return chart; } diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java index 31b528f..6f8d352 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPBarLineChartManager.java @@ -4,7 +4,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ReactProp; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.github.mikephil.charting.charts.BarChart; @@ -43,7 +43,6 @@ public String getName() { @Override protected BarLineChartBase createViewInstance(ThemedReactContext reactContext) { BarChart chart=new BarChart(reactContext); - //com.facebook.react.uimanager.ViewGroupManager /* *//**图表具体设置*//* ArrayList entries = new ArrayList<>();//显示条目 diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPCandleStickChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPCandleStickChartManager.java index f348c10..d672e2e 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPCandleStickChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPCandleStickChartManager.java @@ -5,7 +5,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ReactProp; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.github.mikephil.charting.charts.BarChart; diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPCombinedChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPCombinedChartManager.java index de69db4..eff6ac9 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPCombinedChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPCombinedChartManager.java @@ -6,7 +6,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ReactProp; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.ReactPropGroup; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; @@ -53,7 +53,6 @@ public String getName() { @Override protected CombinedChart createViewInstance(ThemedReactContext reactContext) { CombinedChart mChart=new CombinedChart(reactContext); - mChart.setOnChartGestureListener(new MPChartEventListener(mChart)); // return chart; /* mChart.setDescription(""); diff --git a/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java b/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java index 90cd4f1..04a4feb 100644 --- a/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java +++ b/android/src/main/java/cn/mandata/react_native_mpchart/MPLineChartManager.java @@ -4,7 +4,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; -import com.facebook.react.uimanager.ReactProp; +import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.SimpleViewManager; import com.facebook.react.uimanager.ThemedReactContext; import com.github.mikephil.charting.charts.BarChart; @@ -43,7 +43,6 @@ public String getName() { @Override protected LineChart createViewInstance(ThemedReactContext reactContext) { LineChart chart=new LineChart(reactContext); - chart.setOnChartGestureListener(new MPChartEventListener()); return chart; } @@ -80,9 +79,9 @@ public void setData(LineChart chart,ReadableMap rm){ int[] colors=new int[]{Color.parseColor(config.getString("color"))}; dataSet.setColors(colors); } - if(config.hasKey("lineWidth")) dataSet.setLineWidth((float) config.getDouble("lineWidth")); chartData.addDataSet(dataSet); } + chart.setBackgroundColor(Color.WHITE); chart.setData(chartData); } }