I forked a React Native npm library react-native-calendars
to make some changes to it. I now want to implement these changes in my project. I have installed it in my project using:
npm i git <my_forked_git_repo_url>
This successfully added the package to my node_modules, however I still get an error in my code when I try and import react-native-calendars
saying Cannot find module
. After doing some research I found (here) that I must create a build using npm run build
and add it to the forked repository.
However, when I run npm run build
it creates a build directory in my ios/
directory (since I am targeting iOS). Is this expected, or should I have a new build/
directory in the root directory? The contents of this build/
directory include a ...-buildRequest.json
, ...-desc.xcbuild
, ...-manifest.xcbuild
, ...-targetFile.txt
, and a BuildDescriptionCacheIndex-...
.
CodePudding user response:
You could:
- install the original package
- paste your changes into the package's code in node_modules
- install
patch-package
if you don't already have it (follow the instructions here) - run
npx patch-package react-native-calendars
This will create a diff between the original package and your changes. Then your changes will be applied every time you run yarn or npm.