@nevis-security/nevis-mobile-authentication-sdk-react
Version:
React Native plugin for Nevis Mobile Authentication SDK. Supports only mobile.
34 lines (27 loc) • 1.08 kB
text/typescript
/**
* Copyright © 2023 Nevis Security AG. All rights reserved.
*/
import { NativeModules, Platform } from 'react-native';
const LINKING_ERROR =
`The package 'nevis-mobile-authentication-sdk-react' 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';
// @ts-expect-error error
const isTurboModuleEnabled = global.__turboModuleProxy != null;
/* eslint-disable @typescript-eslint/no-require-imports */
const NevisMobileAuthenticationSdkReactModule = isTurboModuleEnabled
? require('./NativeNevisMobileAuthenticationSdkReact').default
: NativeModules.NevisMobileAuthenticationSdkReact;
/* eslint-enable @typescript-eslint/no-require-imports */
const NevisMobileAuthenticationSdkReact = NevisMobileAuthenticationSdkReactModule
? NevisMobileAuthenticationSdkReactModule
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR);
},
}
);
export default NevisMobileAuthenticationSdkReact;