hongyin163 / react-native-chart-android

react native chart modules come from mpandroidchart.
206 stars 81 forks source link

Doesn't works with react native 0.25 #17

Closed cablegunmaster closed 7 years ago

cablegunmaster commented 8 years ago

Tried to follow the installation of this plugin but the MainActivity is not the same as described. Could you test it , and check if its possible to run under v0.25?

app/src/main/java/com/app/MainActivity.java

package com.app;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import cn.mandata.react_native_mpchart.MPChartPackage;

import java.util.Arrays;
import java.util.List;

public class MainActivity extends ReactActivity {

/**
 * Returns the name of the main component registered from JavaScript.
 * This is used to schedule rendering of the component.
 */
@Override
protected String getMainComponentName() {
    return "App";
}

/**
 * Returns whether dev mode should be enabled.
 * This enables e.g. the dev menu.
 */
@Override
protected boolean getUseDeveloperSupport() {
    return BuildConfig.DEBUG;
}

/**
 * A list of packages used by the app. If the app uses additional views
 * or modules besides the default ones, add more packages here.
 */
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new MPChartPackage()
    );
  }
}

Update: added the line in getPackages() testing now if it works on v0.25

hongyin163 commented 8 years ago

It now work on 0.20,I will update to 0.25.

cablegunmaster commented 8 years ago

Awesome! :+1: Trying to get this working in my script and wondering how to use the import function.

Example says:

  var {
         BarChart,
         CombinedChart
     }=require('../index.android');

But in react-native you would more expect something like this:

import React, {
    Component,
    View,
    Text
} from 'react-native';

How can I import it like this?

hongyin163 commented 8 years ago

@cablegunmaster yes , web have to do this in 0.25,I will update it in this weekend。

hongyin163 commented 8 years ago

@cablegunmaster you can change it and test it and pull request

tuananhdn commented 8 years ago

did it work for 0.25 now? :(. I try to use it with sample data but nothing show.

hongyin163 commented 8 years ago

@tuananhdn no ,now support 0.20

eriksape commented 8 years ago

is still on 0.20?

lakeoffaith commented 8 years ago

you can use it edit or copy resouce to you project to make some simple chart work, you will find it work in the lastest version of react native,do it.

hongyin163 commented 8 years ago

@lakeoffaith thanks

jakobinn commented 8 years ago

Yes for the new version of react native you would do:

import { BarChart, CombinedChart, LineChart, } from 'react-native-chart-android';

The documentation hasn't been updated.