Coder Social home page Coder Social logo

Comments (8)

jonrh avatar jonrh commented on June 17, 2024 1

@fangjuncheng Hi again! I was playing around in a new project and I ran into a similar problem. The issue that I ran into was when the chart component had a parent component with a flex style attribute. Then the chart rendered as empty.

from react-native-highcharts.

fangjuncheng avatar fangjuncheng commented on June 17, 2024

AND I found that the package in node_modules is not the same as it in github.
Is there something wrong with npm package?
@Infinity0106

from react-native-highcharts.

Infinity0106 avatar Infinity0106 commented on June 17, 2024

I ran the command and paste your code in one of my projects and it works correctly and the node_module is the same in npm, you could try downloading it from git instead of npm, let me know if you could fix it

from react-native-highcharts.

jonrh avatar jonrh commented on June 17, 2024

Bernardo beat me to it! I tried with the given code and WebStorm and it worked okay for iOS. I created a demo repository here if you're curious: react-native-highcharts-demo. I also compared the react-native-highcharts.js file to the one in GitHub and they are identical.

The Default export is not declared in imported module warning message in WebStorm is because you are importing with ES2015 module but react-native-highcharts.js in react-native-highcharts uses CommonJS syntax module.exports = ChartWeb; in line 123;

screen shot 2017-03-31 at 16 51 43

I'm not 100% sure on how this interop between ES2015 modules and CommonJS works but for some reason it's able to resolve it. Even when the class names are actually wrong! In the demo code for this repository it's ChartView but in the latest version the class name is actually ChartWeb.

This may be a material for a separate issue/PR, but is there a reason for this inconsistency? And is there a reason why CommonJS is used instead of ES2015 modules since they are natively supported by React Native?

@fangjuncheng Back to your issue. Just to make sure, do you have a "react-native-highcharts": "^1.0.0" line in your package.json file?

from react-native-highcharts.

fangjuncheng avatar fangjuncheng commented on June 17, 2024

@jonrh YES,you have a "react-native-highcharts": "^1.0.0" line in your package.json file.
I use the component like THIS:--AND it did not work
<+View style={{flex:1,...}} +>
<Hcharts /+ >
<View+>
---SO i should run the chart component had a parent component without a flex style attribute
IF it works that use the component like THIS:?
<+View style={{flex:1,...}} +>
<View+><Hcharts /+ >
<View+>

from react-native-highcharts.

jonrh avatar jonrh commented on June 17, 2024

I tested this a bit more and it seems it's not the flex that is causing the issue. Wrapping it in another <View> does not help either. The problem seems to be the alignItems style attribute on a parent component. The chart is displayed as empty when alignItems is flex-start, center, or flex-end but it works for stretch . Source for the <Hcharts /> component.

export default class RNHighchartsDemo extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Begin</Text>
        <Hcharts />
        <Text>End</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center', // <- this seems to cause the issue
  }
});

With alignItems: 'center';:
does_not_work_small

Without:
works_small

At the moment I'm unfortunately not sure how to fix it. In my own app I don't have alignItems, didn't need it.

from react-native-highcharts.

fangjuncheng avatar fangjuncheng commented on June 17, 2024

OK, Thanks!

from react-native-highcharts.

Pradeep119 avatar Pradeep119 commented on June 17, 2024

use another device. for android , htc is better

from react-native-highcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.