Skip to content

Commit

Permalink
feat: module exports
Browse files Browse the repository at this point in the history
  • Loading branch information
kunalchavhan committed Apr 1, 2024
1 parent e4a3143 commit bb78cfe
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import { NativeModules, Platform } from 'react-native';
// import { NativeModules, Platform } from 'react-native';

const LINKING_ERROR =
`The package 'react-native-server-component' 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 LINKING_ERROR =
// `The package 'react-native-server-component' 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 ServerComponent = NativeModules.ServerComponent
? NativeModules.ServerComponent
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR);
},
}
);
// const ServerComponent = NativeModules.ServerComponent
// ? NativeModules.ServerComponent
// : new Proxy(
// {},
// {
// get() {
// throw new Error(LINKING_ERROR);
// },
// }
// );

export function multiply(a: number, b: number): Promise<number> {
return ServerComponent.multiply(a, b);
}
// export function multiply(a: number, b: number): Promise<number> {
// return ServerComponent.multiply(a, b);
// }

export * from './@types';
export * from './component';

0 comments on commit bb78cfe

Please sign in to comment.