UNPKG

@trycourier/courier-react-native

Version:

Inbox, Push Notifications, and Preferences for React Native

23 lines 1.07 kB
import { NativeModules, Platform, UIManager, requireNativeComponent } from "react-native"; export class Modules { static LINKING_ERROR = `The package '@trycourier/courier-react-native' 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'; static Client = Modules.getNativeModule(NativeModules.CourierClientModule); static Shared = Modules.getNativeModule(NativeModules.CourierSharedModule); static System = Modules.getNativeModule(NativeModules.CourierSystemModule); static getNativeModule(nativeModule) { return nativeModule ? nativeModule : new Proxy({}, { get() { throw new Error(Modules.LINKING_ERROR); } }); } static getNativeComponent(componentName) { return UIManager.getViewManagerConfig(componentName) != null ? requireNativeComponent(componentName) : () => { throw new Error(Modules.LINKING_ERROR); }; } } //# sourceMappingURL=Modules.js.map