Start a shoot from JavaScript

Wrap NativeModules.Spyne so the app fails loudly if the native side is not linked, then call start:

import { NativeModules } from 'react-native';

const Spyne = NativeModules.Spyne
  ? NativeModules.Spyne
  : new Proxy({}, { get() { throw new Error('NativeModules.Spyne is not linked. Rebuild the native app.'); } });

export const start = (userId, vin, stockNumber, registrationNumber, locale = 'en') =>
  Spyne.start(userId, vin, stockNumber, registrationNumber, locale);

The native side turns this into a SpyneAutomobileSDK.Builder(...).build().startShoot() call.

Provide userId and at least one of vin, stockNumber, or registrationNumber. startShoot() automatically resumes a draft, starts a reshoot, or begins a new shoot based on the identifiers — see Initiate a Shoot and Resume a Shoot.

Validate in JavaScript before sending:

RuleMessage
userId non-emptyUser ID is required
At least one identifierProvide a VIN, stock number, or registration number
VIN, if provided, is exactly 17 charactersVIN must be exactly 17 characters long
VIN excludes I, O, QVIN may only contain A–Z and 0–9 (excluding I, O, Q)

Did this page help you?