Created Library Does Not Work When Actually Imported In External React Native app
trevorwhealy opened this issue · comments
Description
Created a library like so:
npx create-react-native-library@latest awesome-library
Modified it slightly, re-build it in /example
, then yarn start
to serve the app.
It built, ran, and worked as expected. No warnings. No errors.
I ran yarn release
and it steps through the npm publishing and the Github release creation.
It successfully creates the npm package.
I then ran the following commands to scaffold a new project and install the packages:
npx react-native init AwesomeProject
cd AwesomeProject
yarn
yarn add my-custom-package
cd ios
pod install
I import and use the library I created and once I click on a button to interact it with it, I see this:
Error: The package 'my-custom-package' doesn't seem to be linked. Make sure:
- You have run 'pod install'
- You rebuilt the app after installing the package
- You are not using Expo Go
I've run pod install
- I've re-built the app - and I'm not using Expo Go.
My native module was an extremely simple extension of the original base project.
Not sure where to go from here. Appreciate any tips or suggestions. Thanks
Packages
- create-react-native-library
- react-native-builder-bob
Selected options
Native Module
Swift + Java
Link to repro
No response
Environment
info Fetching system and libraries information...
System:
OS: macOS 13.0
CPU: (10) arm64 Apple M1 Pro
Memory: 82.97 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.18.0/bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm
Watchman: 2022.11.28.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Hey I've got some questions:
- When you ran
pod install
, did you see your module's name listed? - Does it work on Android?
I suspect the files
field of package.json
here. The .podspec
file might not be published. Could you share this field without exposing sensitive information?
Same here. I could see the same issue.
@trinadhkoya Could you share more details? A reproducable repository would be awesome so we could take a look at the root cause.