Skip to content

Dev setup for contributing to the library

Vishal Narkhede edited this page Apr 6, 2021 · 3 revisions

>= 3.0.0

If you are looking to contribute to this repository, you will first want to test your changes locally. Here is how you can do it:

  1. Fork the repository (ref)
  2. Clone your forked repository on your machine
git clone https://github.com/{github-user-id}/stream-chat-react-native.git
  1. Open example app
cd stream-chat-react-native;
yarn link;
cd examples/TypescriptMessaging;
yarn link stream-chat-react-native;
yarn;
npx pod-install;
npx react-native run-ios # npx react-native run-android

< 3.0.0

If you are looking to contribute to this repository, you will first want to test your changes locally. Here is how you can do it:

  1. Fork the repository (ref)
  2. Clone your forked repository on your machine
git clone https://github.com/{github-user-id}/stream-chat-react-native.git
  1. If you don't have react-native app setup yet, please do so using the instructions mentioned here - https://github.com/GetStream/stream-chat-react-native#for-react-native--060-1. Make sure your app runs with stream-chat-react-native dependency (latest version)

  2. Next step is to link stream-chat-react-native dependency to locally cloned repo. Replace the stream-chat-react-native dependency with following:

    "stream-chat-react-native": "link:../stream-chat-react-native/native-package",
    "stream-chat-react-native-core": "link:../stream-chat-react-native",

Here I am assuming that the clone of stream-chat-react-native and your app are under common directory. e.g.,

-- project-dir
    -- stream-chat-react-native
    -- my-chat-app
  1. If you run your app at this point, you will run into some issues related to dependency collision. Since metro bundler will have node_module dependencies from your app folder, stream-chat-react-native folder and stream-chat-react-native/native-package folder. And it doesn't know how to resolve those dependencies.

So you need to modify metro.config.js. You can copy paste the config from this gist - https://gist.github.com/vishalnarkhede/562d3cba77b7340c49a553bbd1a31e11 Please note on line 159, we are creating a list of directories to blacklist. Following path will work if both app and stream-chat-react-native are under common parent directory:

repoDir + '/stream-chat-react-native/examples/NativeMessaging/.*',

If they are not, please do the necessary changes here.

  1. Next clean install your app
rm -rf node_modules
rm yarn.lock
yarn install
watchman watch-del-all
yarn start --reset-cache

And thats all!! If you make code changes in stream-chat-react-native, they should reflect in your app now :)

Clone this wiki locally