Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank Chart on IOS #1008

Open
HasanElfalt opened this issue Nov 28, 2024 · 9 comments
Open

Blank Chart on IOS #1008

HasanElfalt opened this issue Nov 28, 2024 · 9 comments

Comments

@HasanElfalt
Copy link

Hello everyone,
I am trying to generate charts (Line, Pie, and MultiLine Charts), and they all appear blank (the chart place is empty just on IOS, and it is working fine on Android after updating React native to 0.76 or above.

Screenshots

Screenshot 2024-11-28 at 11 07 37 PM

Steps to Reproduce the Problem

  • Create React Native with a version of 0.76 or above, or if you have an existing project, update your React Native project to a version equal to 0.76 or above.
  • Install this library

Specifications

  • Version: [v0.6.0] latest version of this library now
  • Platform: IOS
  • React Native version: 0.76 or above
@gigby
Copy link

gigby commented Dec 20, 2024

I have the same issue with RN0.76: Android works fine but iOS shows empty space

@NikldjOne
Copy link

I have the same problem with 0.76 version. LineСhart and BarChart don't work

@NikldjOne
Copy link

NikldjOne commented Dec 28, 2024

there is this solution, but the BarChart does not work. Linear graph worked for me
https://github.com/wuxudong/react-native-charts-wrapper/pull/1007/files

@NikldjOne
Copy link

added in node_modules/react-native-charts-wrapper/ios/ReactNativeCharts/bar/RNBarChartView.swift

   override func layoutSubviews() {
        super.layoutSubviews()
        _chart.frame = self.bounds // Adjust the chart's frame to fill the entire component's bounds
    }

It's work for me, for BarChart

@HasanElfalt
Copy link
Author

@NikldjOne If it is solved using this PR, why hasn't it been merged until now?

@HasanElfalt
Copy link
Author

HasanElfalt commented Dec 30, 2024

@wuxudong

https://github.com/wuxudong/react-native-charts-wrapper/pull/1007/files
This PR resolves this problem, so it is highly recommended that it be reviewed and merged, and it needs to be done to all kinds of charts.

    override func layoutSubviews() {
        super.layoutSubviews()
        _chart.frame = self.bounds // Adjust the chart's frame to fill the entire component's bounds
    }

and as @NikldjOne mentioned using the above lines in each chart kind will resolve the problem

@eugen-vg
Copy link

eugen-vg commented Feb 8, 2025

The same problem for me. I've just tried to run the example. On Android, it works when iOS shows a blank screen.

@HasanElfalt
Copy link
Author

@eugen-vg
check this PR solves the problem
https://github.com/wuxudong/react-native-charts-wrapper/pull/1007/files

you will find that the piece of code added to the chart type you implement in node modules will solve the problem

override func layoutSubviews() {
       super.layoutSubviews()
       _chart.frame = self.bounds // Adjust the chart's frame to fill the entire component's bounds
   }

Example:

  • if you use a Line chart, you can solve the problem by using the previous piece of code and adding it to this file
    node_modules/react-native-charts-wrapper/ios/ReactNativeCharts/line/RNLineChartView.swift

  • if you use a Pie chart, you can solve the problem by using the previous piece of code and adding it to this file
    node_modules/react-native-charts-wrapper/ios/ReactNativeCharts/pie/RNPieChartView.swift

...etc

@eugen-vg
Copy link

eugen-vg commented Feb 8, 2025

Thank you @HasanElfalt . It works. I am still concerned about the approach to wrapping the native iOS/Android layers under one library. The history of this one says that Android drove it, and an unworking example doesn't add trust that iOS would work robustly. How do people use it in production? Is there another workaround that does not change the core code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants