kony.reactNative Namespace
The kony.reactNative APIs namespace contains the following JavaScript APIs. The kony.reactNative APIs are available from V8 SP4 onwards.
Functions
The kony.reactNative namespace contains the following functions.

This API registers a callback/listener for the incoming request from the React Native app context. The callback that is set by using the kony.reactNative.setCallback API will be invoked while using the reactNative.invokeKonyCallback API from the React Native app.
NOTE: Calling the kony.reactNative.setCallback API two or more times with different callbacks will override the previously set callback with the recent one.
Syntax
kony.reactNative.setCallback(callback);
Input Parameters
Parameter | Description |
---|---|
callback |
This parameter registers a function with the following signature. function callback(id,args) |
The callback function does not have any return value and consists of the following parameters:
- id: Unique identifier of the React Native app's request. This identifier is used to bind a request with the response.
NOTE: While using the kony.reactNative.sendResult API, you must pass the id parameter to send the result to a particular request instance.
- args: Object with key-value pairs that is passed from the React Native app to the Quantum Visualizer app based on the contract of the Quantum Visualizer app.
Example
function callback(id, args) { ........ if (args != null & amp; & amp; args["operation"] == "fetchAccounts") { // fetchAccounts and store result account1 = { name: "kony1", accountNo: "0123456789", accountBalance: "xx"..... }; account2 = { name: "kony2", accountNo: "2345678901", accountBalance: "xx"..... }; resultData = { status: "success", data: [account1, account2].. }; kony.reactNative.sendResult(id, resultData); }; } kony.reactNative.setCallback(callback);
Return Value
None
Platform Availability
- iOS
- Android

This API is used to send a response (for the request) to the React Native app, if the React Native app registers a callback.
NOTE: This API must be called only once per request to send the result or response. Calling this API more than once per request leads to no operation from the second instance onwards.
Syntax
kony.reactNative.sendResult(id, resultData);
Input Parameters
Parameter | Description |
---|---|
id |
Unique identifier of the React Native app (this parameter is received in the callback function of kony.reactNative.setCallback API.) |
resultData |
Object with key–value pair elements with key as String and value as JavaScript native data types, such as Number, Boolean, String, Array, and Object. NOTE: The Quantum Visualizer app must publish the keys of the resultData parameter, in order to predict the resultData value by the React Native app. |
Example
var resultData = { status: "success", ... }; kony.reactNative.sendResult(id, resultData);
Return Value
None
Platform Availability
- iOS
- Android