React Native APIs
The following React Native APIs are utilized for the communication between the React Native app framework and the Quantum Visualizer Framework. These React Native APIs are available from V8 SP4 onwards.

This API invokes the Quantum Visualizer callback, which is registered in the Quantum Visualizer app by using the kony.reactNative.setCallback API.
Syntax
reactNative.invokeKonyCallback(id, args);
NOTE: You must prefix NativeModules while calling this API, if NativeModules.reactNative is not exported from the React Native module and if the same is not imported in the module file where this API is used.
Input Parameters
Parameter | Description |
---|---|
id |
Request identifier of the ReactNative app. This parameter is used to bind the request with the response. NOTE: If a request has to listen for a response, you must register the listener/callback for the request by using the reactNative.setCallback API and leveraging the same id parameter as of the reactNative.invokeKonyCallback API. NOTE: The value of the id parameter must follow this format: ReactNativeAppName + unique string. |
args | Object with key–value pair elements with key as String and value as Object, such as Number, Boolean, String, Array, and Object. This parameter is used to pass data from the React Native app to the Quantum Visualizer app context. |
reactNativeCallback registers a React Native callback function. This callback will be invoked by using the kony.reactNative.sendResult API from the Quantum Visualizer app context.
Example
args = { operation:"fetchAccounts" }; NativeModules.reactNative.invokeKonyCallback(<id>, args);
//You can omit the NativeModules prefix if NativeModules.reactNative is exported from the React Native module
//and the same is imported in the module file where this API is used.
Return Value
None
Platform Availability
- iOS
- Android

This API is used to register a callback/listener to receive the result/response from the Quantum Visualizer app context. The registered callback will be invoked while using the kony.reactNative.sendResult API from the Quantum Visualizer app context.
Syntax
reactNative.setCallback(id, Callback);
Input Parameters
Parameter | Description |
---|---|
id |
Request identifier for the React Native app. Since there can be multiple React Native apps integrated in to a Quantum Visualizer app, the id parameter is used to distinguish between the different React Native apps as well as to differentiate different invocations from the same app. NOTE: The value of the id parameter must follow this format: ReactNativeAppName + unique string. |
Callback | JavaScript function. Callbacks are internally maintained as a dictionary of this API's id and Callback parameters. The callback will be removed from the dictionary once the result is sent (by using the kony.reactNative.sendResult API) to avoid an exception of the React Native framework. This exception occurs when the kony.reactNative.sendResult API is called more than once per request. |
Example
function reactNativeCallback(resultData){ .......... }; NativeModules.reactNative.setCallback(<id>, reactNativeCallback);
//You can omit the NativeModules prefix if NativeModules.reactNative is exported from the React Native module
//and the same is imported in the module file where this API is used.
Return Value
None
Platform Availability
- iOS
- Android