import { NativeModules, NativeEventEmitter, Platform } from 'react-native'; import { PLATFORM_ANDROID } from './utils/constants'; const LINKING_ERROR = `The package '@caf.io/react-native-document-detector' doesn't seem to be linked. Make sure: \n\n${Platform.select( { ios: "- You have run 'pod install'\n", default: '' }, )}- You rebuilt the app after installing the package\n- You are not using Expo Go\n`; const module = NativeModules.CafDocumentDetector ? NativeModules.CafDocumentDetector : new Proxy( {}, { get() { throw new Error(LINKING_ERROR); }, }, ); const moduleEventEmitter = PLATFORM_ANDROID ? new NativeEventEmitter() : new NativeEventEmitter(module); export { module, moduleEventEmitter };