Receive lifecycle callbacks

The native SDKs use different callback APIs: - iOS: SpyneShootDelegate protocol - Android: SpyneShootListener interface The method names differ between platforms. However, the bridge forwards both through a single, unified set of event names, so your JavaScript stays the same on both platforms.

import { NativeEventEmitter, NativeModules } from 'react-native';

const spyneEvents = new NativeEventEmitter(NativeModules.Spyne);

useEffect(() => {
  const subs = [
    spyneEvents.addListener('onShootInitiated', e => { /* shootData, dealerVinId, mediaId, status */ }),
    spyneEvents.addListener('onShootCompleted', e => { /* shootData, dealerVinId, mediaId, isReshoot */ }),
    spyneEvents.addListener('onShootExit',      e => { /* shootData, dealerVinId, mediaId */ }),
  ];
  return () => subs.forEach(s => s.remove());
}, []);
JS eventiOS — SpyneShootDelegateAndroid — SpyneShootListenerParameters
onShootInitiatedshootDidInitiate(...)onShootInitiated(...)shootData, dealerVinId, mediaId, status
onShootCompletedshootDidComplete(...)onShootCompleted(...)shootData, dealerVinId, mediaId, isReshoot
onShootExitshootDidExit(...)onShootExit(...)shootData, dealerVinId, mediaId

dealerVinId is the id used by the webhook / GET media APIs; mediaId tracks the shoot session. For full callback semantics, see the platform doc: iOS Callbacks · Android Callbacks.


Did this page help you?