Test my library outside of example apps #785
Unanswered
Andrew-Paystack
asked this question in
Q&A
Replies: 2 comments 2 replies
-
|
Hey @atlj , |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
https://callstack.github.io/react-native-builder-bob/faq#how-to-test-the-library-in-an-app-locally |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
I'm currently stuck on exposing my library to external local apps.
I've done the
npx react-native-builder-bob@latest init, implemented Native changes in theexamplesfolder and both apps work.However, when I try using the library in an external application (i.e. another RN app, that's not the example) the library returns as
undefined.I did
yarn prepareand performed a symlink usingnpm linkbut still no luck. I can see the library in the appsnode_modulesbut it returns "unable to resolve module" errors. I've also tried importing the library viaNativeModulesas shown in RN Docs here.In the
src/index.tsxfile I've added an export to the library.export const myAwesomeLibrary = NativeModules.myAwesomeLibrary ? NativeModules.myAwesomeLibrary : new Proxy( {}, { get() { throw new Error(LINKING_ERROR); }, } );Any guide on what I'm missing would be really appreciated 🙏
Beta Was this translation helpful? Give feedback.
All reactions