Skip to content

Commit

Permalink
fix: make import on other platforms noop
Browse files Browse the repository at this point in the history
  • Loading branch information
jd1378 committed Apr 12, 2022
1 parent fc9901b commit c3e8253
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,25 @@ const LINKING_ERROR =
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo managed workflow\n';

const SafX = (
NativeModules.SafX
? NativeModules.SafX
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR);
let SafX: SafXInterface;

if (Platform.OS === 'android') {
SafX = (
NativeModules.SafX
? NativeModules.SafX
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR);
},
},
},
)
) as SafXInterface;
)
) as SafXInterface;
} else {
// @ts-ignore
SafX = {};
}

export type Encoding = 'utf8' | 'base64' | 'ascii';

Expand Down

0 comments on commit c3e8253

Please sign in to comment.