npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@react-native-drivekit/driver-data

v3.3.1

Published

React Native interface for DriveKit Driver Data

Downloads

262

Readme

@react-native-drivekit/driver-data

React Native interface for DriveKit Driver Data

Prerequisite

Before installing @react-native-drivekit/driver-data you must have installed @react-native-drivekit/core.


Installation

Install the library:

npm install @react-native-drivekit/driver-data

Install iOS pods:

cd ios && pod install

Initialization

Android setup

If you have disabled the DriveKit auto-initialization, call initialize method inside the onCreateMethod() of your Appplication class.

// MainApplication.java
import com.reactnativedrivekit.driverdata.DriveKitDriverDataModule;
import com.reactnativedrivekitcore.DriveKitCoreModule;
import com.reactnativedrivekittripanalysis.DriveKitTripAnalysisModule;

// ...
  @Override
  public void onCreate() {
    super.onCreate();
    DriveKitCoreModule.Companion.initialize(this);
    final RNTripNotification tripNotification = new RNTripNotification("Notification title", "Notification description", R.drawable.common_google_signin_btn_icon_dark)
    final RNHeadlessJSNotification headlessJSNotification = new RNHeadlessJSNotification("Notification title", "Notification description");
    DriveKitTripAnalysisModule.Companion.initialize(tripNotification, headlessJSNotification);

    DriveKitDriverDataModule.Companion.initialize(); // ADD THIS LINE
    (…)
  }

iOS setup

If you have disabled the DriveKit auto-initialization, call initialize method in your AppDelegate.mm.

// AppDelegate.mm
#import <RNDriveKitDriverData/react-native-drivekit-driver-data-umbrella.h>

// ...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [[RNDriveKitCoreWrapper.shared initialize];
  [RNDriveKitTripAnalysisWrapper.shared initializeWithLaunchOptions:launchOptions];
  [[RNDriveKitDriverDataWrapper.shared initialize]; // ADD THIS LINE
  (…)
}

Note: If you are using Swift, initialize method is also available.

API

| Method | Return Type | iOS | Android | | --------------------------------------------------------- | ------------------------------------------ | :-: | :-----: | | getTripsOrderByDateAsc() | Promise<GetTripsResponse \| null> | ✅ | ✅ | | getTripsOrderByDateDesc() | Promise<GetTripsResponse \| null> | ✅ | ✅ | | getTrip() | Promise<GetTripResponse \| null> | ✅ | ✅ | | getRoute() | Promise<Route \| null> | ✅ | ✅ | | deleteTrip() | Promise<void> | ✅ | ✅ | | updateDriverPassengerMode() | Promise<UpdateDriverPassengerModeStatus> | ✅ | ✅ |

getTripsOrderByDateAsc

getTripsOrderByDateDesc

getTripsOrderByDateAsc(
  synchronizationType: SynchronizationType = 'DEFAULT',
  transportationModes: TransportationMode[] = []
): Promise<GetTripsResponse | null>

or

getTripsOrderByDateDesc(
  synchronizationType: SynchronizationType = 'DEFAULT',
  transportationModes: TransportationMode[] = []
): Promise<GetTripsResponse | null>

| GetTripsResponse | Type | | ---------------- | ---------------- | | status | TripSyncStatus | | trips | [Trip] |

To get driver's trips, you have to call the following method:

const result = await getTripsOrderByDateAsc();

or

const result = await getTripsOrderByDateDesc();

getTrip

getTrip(itinId: string): Promise<GetTripResponse | null>

| GetTripResponse | Type | | --------------- | ---------------- | | status | TripSyncStatus | | trip | Trip |

To get a specific trip, you have to call the following method:

const result = await getTrip('TRIP_ID_HERE);

getRoute

To get road data of the trip (latitude, longitude), you have to call the following method::

getRoute(itinId: string): Promise<Route>

If route value in the callback is null, the synchronization has failed.

Example:

const route = await getRoute('TRIP_ID_HERE');

deleteTrip

To delete a trip, you have to call the following method:

deleteTrip(itinId: string): Promise<boolean>

The itinId parameter is the unique identifier for a trip.

await deleteTrip('TRIP_ID_HERE');

updateDriverPassengerMode

When a trip is analyzed and the detected transportation mode is car, truck, or motorcycle, it is by default attributed to the driver. However, in some cases, the data may come from a passenger's smartphone.

In such cases, it is possible to indicate that the analyzed trip was recorded by an occupant of the vehicle who was not the driver. This section describes the method used to declare a trip as having been made as a passenger.

With this method, you can add a feature to your application that allows the user to declare that they were not the driver of the vehicle.

When a user declares that a trip was made as a passenger, it will not modify any scores related to the trip.

To declare a trip as a passenger with a comment, use the following method:

updateDriverPassengerMode(
  itinId: string,
  mode: DriverPassengerMode,
  comment: string | null
)

The itinId parameter is the unique identifier for a trip. The mode parameter has the following possible values : DRIVER or PASSENGER The comment is an optional comment of up to 120 characters.

const result = await DriveKitDriverData.updateDriverPassengerMode(
  'TRIP_ID_HERE',
  'PASSENGER',
  'I was a passenger.'
);