I am trying to use mpandroidchart's IOS version package in RN native IOS, This is how I tried to implement it.
ChartManager.m
#import "React/RCTViewManager.h"
@interface RCT_EXTERN_MODULE(RNTChartManager, RCTViewManager)
@end
ChartManager.swift
import Foundation
import UIKit
import React
@objc(RNTChartManager)
class RNTChartManager: RCTViewManager {
override func view() -> UIView! {
let label = UILabel()
label.text = "Hello world"
label.textAlignment = .center
return label
}
}
ChartViewController.swift
import Foundation
import UIKit
import Charts
import React
class BarChartViewController: UIViewController {
@IBOutlet weak var barChartView: BarChartView!
override func viewDidLoad() {
super.viewDidLoad()
barChartView.noDataText = "You need to provide data for the chart."
}
}
AppName-Bridging-Header.h
#ifndef Investor_Bridging_Header_h
#define Investor_Bridging_Header_h
#import "React/RCTBridgeModule.h"
#import "React/RCTViewManager.h"
#import "React/RCTBundleURLProvider.h"
#endif
How would I do this in React Native? I can't write a bridged UI component since it's a UIViewController, not a UIView. Thanks in advance