Fix graphs on new architecture with interop layer
BarChart don't working, LineChart work
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
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
}
Can someone merge this please? confirmed this PR works with the latest RN and Expo
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
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, [[]]);