UNPKG

instabug-reactnative

Version:

React Native plugin for integrating the Instabug SDK

35 lines (26 loc) 1.05 kB
import { NativeEventEmitter, NativeModule } from 'react-native'; import { NativeModules } from './NativePackage'; export interface Survey { title: string; } export interface SurveysNativeModule extends NativeModule { // Essential APIs // setEnabled(isEnabled: boolean): void; setAutoShowingEnabled(autoShowingSurveysEnabled: boolean): void; showSurvey(surveyToken: string): void; showSurveysIfAvailable(): void; getAvailableSurveys(): Promise<Survey[]>; hasRespondedToSurvey(surveyToken: string): Promise<boolean>; // Misc APIs // setShouldShowWelcomeScreen(shouldShowWelcomeScreen: boolean): void; setAppStoreURL(appStoreURL: string): void; // Callbacks // setOnShowHandler(onShowHandler: () => void): void; setOnDismissHandler(onDismissHandler: () => void): void; } export const NativeSurveys = NativeModules.IBGSurveys; export enum NativeEvents { WILL_SHOW_SURVEY_HANDLER = 'IBGWillShowSurvey', DID_DISMISS_SURVEY_HANDLER = 'IBGDidDismissSurvey', } export const emitter = new NativeEventEmitter(NativeSurveys);