I want to add a Card component to this module: https://snack.expo.io/@xcarpentier/gifted-chat (demo)
For example, if using onLongPress()
on the Bubble M
Although you are able to edit the file in your node_modules
folder, it is not a great long-term solution. Why not?
npm install
will overwrite your changesIf you would still like to go this route, the quickest way to go about it would be by linking it via npm. In the event this link is not available anymore, you can link a module following these steps:
npm link
npm link name-of-module
Again, this is not a permanent solution and should only be used for quickly testing modifications to a module.
Forking the repo is a good way to maintain the commits specific to that module, and you can share your modifications to the open-source community. Some reasons to fork are explained in the Github help wiki, but doing it is pretty straight-forward.
Fork
button in the top right cornernpm install git+your-forked-repo-url
in your project's root directory (don't forget to npm uninstall
the old one)Now, you can follow the process mentioned in the Bad Solution to locally test out changes to that package. After you're satisfied with them, you can copy those changes over to your forked repo and push them to Github (you'll want bump your version, but you may have some merge conflicts to resolve if you ever want to merge changes with the upstream repo). Then do another npm install
of your repo make those changes more permanent in your node_modules
folder.
If you would like to stay up-to-date with the repo you forked from, Github explains the process here.
Choose the Better Solution.