We love your input! We want to make contributing to Clix React Native SDK as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
- Fork the repo and create your branch from
main. - If you've added code that should be tested, add tests.
- If you've changed APIs, update the documentation.
- Ensure the test suite passes.
- Make sure your code lints.
- Issue that pull request!
- Update the README.md with details of changes to the interface, if applicable.
- Update the documentation with details of any new environment variables, exposed ports, useful file locations and container parameters.
- The PR will be merged once you have the sign-off of at least one other developer.
In short, when you submit code changes, your submissions are understood to be under the same MIT License that covers the project. Feel free to contact the maintainers if that's a concern.
Report bugs using GitHub's issue tracker
We use GitHub issues to track public bugs. Report a bug by opening a new issue; it's that easy!
Great Bug Reports tend to have:
- A quick summary and/or background
- Steps to reproduce
- Be specific!
- Give sample code if you can.
- What you expected would happen
- What actually happens
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
This project uses ESLint and Prettier to enforce code style and maintain code quality. Please ensure your contributions adhere to these standards before submitting a pull request.
Prerequisites:
Make sure you have Node.js and npm/yarn installed. You can verify your installation:
node --version
npm --version
# or
yarn --versionRunning the Tools:
Use the following commands from the project root directory:
npm run lintoryarn lint: Lints the codebase using ESLint based on the project configuration. Reports warnings or errors.- Fix linting issues manually based on ESLint output.
- Use Prettier to format code (configured in project settings).
npm run typecheckoryarn typecheck: Runs TypeScript type checking.
Before Submitting:
Please run the following commands and ensure they pass without errors:
npm run lint
npm run typecheck
npm testResolve all issues before creating a pull request to ensure a smooth review process.
This React Native SDK maintains API parity with the Clix iOS and Android native SDKs. When contributing:
- Check Native Implementation: Verify behavior matches native SDKs
- Method Signatures: Use identical parameter names and types where possible
- Error Handling: Match native SDK error conditions and types
- Async API Pattern: Follow React Native best practices for async operations
Example of maintaining parity:
// Async version (standard React Native pattern)
static async setUserId(userId: string): Promise<void> {
await this.waitForInitialization();
await this.instance.deviceService.setUserId(userId);
}
// Error handling matching native pattern
static async setUserProperty(key: string, value: ClixUserProperty): Promise<void> {
if (!key || typeof key !== 'string') {
throw new ClixError('INVALID_PARAMETER', 'Property key must be a non-empty string');
}
await this.waitForInitialization();
await this.instance.deviceService.setUserProperty(key, value);
}All new features should include appropriate tests:
# Run all tests
npm test
# or
yarn test
# Run tests in watch mode
npm test -- --watch
# or
yarn test --watch
# Run tests with coverage
npm test -- --coverage
# or
yarn test --coverageEnsure test coverage remains above 80% for new code.
-
Clone the repository
git clone https://github.com/clix-so/clix-react-native-sdk.git cd clix-react-native-sdk -
Install dependencies
npm install # or yarn install -
Prepare the project
npm run prepare # or yarn prepare -
Run the sample app
cd samples/BasicApp npm install # iOS cd ios && pod install && cd .. npm run ios # Android npm run android
To get started with the project, run npm install in the root directory to install the required dependencies:
npm installWhile developing, you can run the example app to test your changes. Any changes you make in your library's JavaScript code will be reflected in the example app without a rebuild. If you change any native code, then you'll need to rebuild the example app.
To start the packager:
cd samples/BasicApp
npm startTo run the example app on Android:
cd samples/BasicApp
npm run androidTo run the example app on iOS:
cd samples/BasicApp
npm run iosWe follow the conventional commits specification for our commit messages:
fix: bug fixes, e.g. fix crash due to deprecated method.feat: new features, e.g. add new method to the module.refactor: code refactor, e.g. migrate from class components to hooks.docs: changes into documentation, e.g. add usage example for the module.test: adding or updating tests, e.g. add integration tests using detox.chore: tooling changes, e.g. change CI config.
Our pre-commit hooks verify that your commit message matches this format when committing.
The package.json file contains various scripts for common tasks:
npm run typecheck: type-check files with TypeScript.npm run lint: lint files with ESLint.npm run test: run unit tests with Jest.npm run prepare: prepare the library using bob build.
- Use strict TypeScript settings
- Provide proper type definitions for all public APIs
- Avoid using
anytype - Document complex types with JSDoc comments
- Export all public types from the main entry point
- Update README.md for any user-facing changes
- Add JSDoc comments for all public methods and classes
- Include code examples in documentation
- Keep the sample app updated with new features
By contributing, you agree that your contributions will be licensed under its MIT License.