react-native-charts-wrapper icon indicating copy to clipboard operation
react-native-charts-wrapper copied to clipboard

Fix graphs on new architecture with interop layer

Open MaxToyberman opened this issue 1 year ago • 6 comments

MaxToyberman avatar Nov 05 '24 07:11 MaxToyberman

BarChart don't working, LineChart work

NikldjOne avatar Dec 28 '24 07:12 NikldjOne

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

NikldjOne avatar Dec 28 '24 09:12 NikldjOne

we need to add these lines to each chart kind (Line, bar, pie... etc) I am using this Repo for the Line and Pie chart, and after adding these lines to the line and pie chart, it works well

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

HasanElfalt avatar Dec 30 '24 10:12 HasanElfalt

Can someone merge this please? confirmed this PR works with the latest RN and Expo

longprao avatar Jan 20 '25 04:01 longprao

This is just for iOS. we are facing issue of Warning: TypeError: Cannot read property 'bubblingEventTypes' of null in Android. so do you have any idea on it. @MaxToyberman

urvish-procare avatar Jan 26 '25 15:01 urvish-procare

What also stopped working is this for cleaning highlights:

chartRef.current.highlights([])

Had to fix it by:

    func _highlights(_ reactTag: NSNumber, config: NSArray) {
        _bridge?.uiManager.addUIBlock { (uiManager: RCTUIManager?, _) in
            guard let view = uiManager?.view(forReactTag: reactTag) as? RNBarLineChartViewBase,
                  let barLineChart = view.chart as? BarLineChartViewBase
            else {
                return
            }

            barLineChart.highlightValues(HighlightUtils.getHighlights(config))
        }
    }

And:

   const node = findNodeHandle(chartRef.current);
   if (!node) {
     return;
   }
   const { Commands } = UIManager.getViewManagerConfig('RNLineChart');
   if (isNil(Commands.highlights)) {
     return;
   }
   UIManager.dispatchViewManagerCommand(node, Commands.highlights, [[]]);

ferrannp avatar Nov 29 '25 15:11 ferrannp