Skip to main content

UIMgr (React Native)

Contents

Note: All React Native methods are async functions.

MapDrawer

A native module containing methods that allow drawing on the map.
React Native
>=10.14
Type
Native Module

Methods

Method Name Return Type Description
getMapView() MapViewType CPIK libraries allows the end user to view the map in a number of different views. This API will return the view that is current in use. The different options include viewing the navigation dialogue in either 2D or 3D as well as Safety or itinerary view. To set the desired view within CoPilot MapDrawer.setMapView should be used.
setMapView()
Void
Sets the current CoPilot navigation view to the given MapViewType
getZoomLevel MapZoomLevel Returns the current map zoom level present within CoPilot.
setMapZoomLevel MapZoomLevelChangeResult Adjusts the map to a defined zoom level.
setMapFrame()
Void
Redraws the guidance map so that the specified points are included in the frame.

MapDrawer.setMapZoomLevel

This API will adjust the map to a defined zoom level. This function is only available when CoPilot is showing in navigation mode with the map view in one of the 2D modes.
If this API is used when 3D map is in use an exception will be returned.
React Native
>=10.14
Type
Method

Syntax

MapZoomLevelChangeResult setMapZoomLevel(MapZoomLevel level)

Parameters

MapZoomLevel - The zoom level user wants the map to zoom to.

Return Values

MapZoomLevelChangeResult

Sample Code

const MapZoomLevel = NativeModules.MapZoomLevel;
var res = await MapDrawer.setMapZoomLevel(MapZoomLevel.LEVEL_4);

MapDrawer.getZoomLevel

Returns the current map zoom level present within CoPilot. This will return a value from the MapDrawer.MapZoomLevel native module. Level 1 denotes the highest zoomed out setting and Level 20 the most zoomed in possible.

Note: This method should only be called once the onZoomAnimationCompleted callback has been received.

React Native
>=10.14
Type
Method

Syntax

constant getZoomLevel()

Parameters

None

Return Values

MapZoomLevel representing the current zoom level

Sample Code

const MapDrawer = NativeModules.MapDrawer;
var level = await MapDrawer.getZoomLevel();

MapDrawer.setMapFrame

Redraws the guidance map so that specified points are included in the frame.
React Native
>=10.14
Type
Method

Syntax

void setMapFrame(Coordinate pointA, Coordinate pointB)

Parameters

pointA - Coordinate object that will be used to frame the map.

pointB - Coordinate object that will be used to frame the map.

Sample Code

var pointA = {};
var pointB = {};
pointA.latitude = 33.406163;
pointA.longitude = -104.466292;
pointB.latitude = 33.412026;
pointB.longitude = -104.206460;
MapDrawer.setMapFrame(pointA, pointB);

MapDrawer.getMapView

CPIK libraries allows the end user to view the map in a number of different views. This API will return the view that is current in use. The different options include viewing the navigation dialog in either 2D or 3D as well as Safety or Itinerary view.

To set the desired view within CoPilot, MapDrawer.setMapView should be used.

React Native
>=10.14
Type
Method

Syntax

constant getMapView()

Parameters

None

Return Value

MapViewType value indicating the map view type that is currently visible.

Sample Code

const MapDrawer = NativeModules.MapDrawer;
var viewType = await MapDrawer.getMapView();

MapDrawer.setMapView

The CoPilot navigation view can be set to a number of different options. By using this method, you can set the navigation view in CoPilot including 2D, 3D or Itinerary. For a full list of the available views, see MapViewType.
CPIK also allows for the navigation to be shown as a map only view, without any of the standard CoPilot menu widgets present. This allows a custom overlay to be drawn over CPIK libraries. These views are referred to as 2D No Widget and 3D No Widget and noted as Two_Dimensional_No_Widgets and Three_Dimensional_No_Widgets. Further examples of these views can be found within the CPIK libraries sample application.
React Native
>=10.14
Type
Method

Syntax

void setMapView(constant)

Parameters

MapViewType indicating the map view to set.

Return Value

None

Sample Code

const MapDrawer = NativeModules.MapDrawer;
const MapViewType = NativeModules.MapViewType;

MapDrawer.setMapView(MapViewType.SAFETY);

Legal: Before using the view 2D with no widgets or 2D with no widgets please be aware this can have implications to the End User License Agreement that is referenced in your contract.


UIMgr

A native module with a method to open a requested CoPilot dialog (ex: the map).
React Native
>=10.14
Type
Native Module

Methods

Method Name Return Type Description
showDialog(Dialog)
Void
Shows any of the dialogs given by Dialog.

Hooks and Callbacks

Hooks and Callbacks related to the UI can be found below. For further details on these Hooks or Callbacks please refer to the Hooks and Callbacks section of this document.

UIListener
onShowNavigationScreen
onLeaveNavigationScreen
onStartingPoiWizard
onMapImageTouchEvent
onMapImageImportStatusUpdate

UIMgr.showDialog

It is possible to call certain dialogs to the forefront of the CPIK libraries application. This API shows any of the dialogs given by the Dialog native module. When this call is made, CoPilot will close any currently open dialogs to the navigation screen, then open the selected dialog. When the back button is used following this request, CoPilot will go to the navigation dialog.
React Native
>=10.14
Type
Method

Syntax

void showDialog(dialog)

Parameters

dialog - The dialog to display

Sample Code

const UIMgr = NativeModules.UIMgr;
const Dialog = NativeModules.Dialog;

UIMgr.showDialog(Dialog.MAIN_MENU);
Last updated January 10, 2024.
Contents