I'm new to ReactNative and I'm trying Integrate React Native to my current project.
In my ViewController contain RCTRootView and the code implemented like:
ViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
.....
let bridge = RCTBridge(bundleURL: jsCodeLocation, moduleProvider: nil, launchOptions: nil)
let reactRootView = RCTRootView(bridge: bridge, moduleName: "Index", initialProperties: props)
self.view.addSubview(reactRootView);
reactRootView.frame = self.view.bounds
reactRootView.delegate = self;
....
}
func onReactEvent(event :NSDictionary , callback: RCTResponseSenderBlock) {}
ReactNativeManager.swift
@objc func sendCustomEventToHost(event: NSDictionary, callback: RCTResponseSenderBlock) -> Void {}
So how can I call onReactEvent() function in my ViewController from function sendCustomEventToHost() in ReactNativeManager. Thanks