Thank you for your interest in contributing! This guide will help you get started.
- Node.js ≥ 18
- npm ≥ 9
# Fork on GitHub, then:
git clone https://github.com/<your-username>/react-webcam-pro.git
cd react-webcam-pronpm installnpm run buildThis runs Rollup to compile TypeScript → dist/.
npm testAll 69 tests must pass before submitting a PR.
npx tsc --noEmitsrc/
index.ts # Public API — exports Camera, CameraRef, etc.
components/
Camera/
Camera.tsx # Main component (forwardRef)
types.ts # TypeScript interfaces
styles.ts # styled-components
test/
setup.ts # Mock MediaDevices for jsdom
Camera.test.tsx # Unit tests
backward-compat.test.tsx # Backward compatibility tests
example/ # Vite + React demo app
docs/ # Docusaurus documentation site
cd example
npm install
npm run devOpens at http://localhost:5173. The example app uses the published npm package, so for local development you may want to temporarily change react-webcam-pro in example/package.json to "file:.." and rebuild.
cd docs
npm install
npm startOpens at http://localhost:3000.
- All tests pass:
npm test - TypeScript compiles:
npx tsc --noEmit - Build succeeds:
npm run build - No lint errors:
npm run lint(if available) - Write tests for any new features or bug fixes
- Keep changes focused — one feature or fix per PR
We use conventional-style commit messages:
feat: add videoConstraints prop for resolution control
fix: wrap getCapabilities in try/catch for Firefox/iOS 15
test: add tests for mirrored photo capture
docs: update README with new takePhoto options
chore: bump version to 1.1.0
Use the Bug Report template and include:
- Browser & version
- Device (desktop/mobile, OS)
- Steps to reproduce
- Expected vs actual behavior
- Console errors (if any)
Use the Feature Request template.
- TypeScript strict mode
- Functional components with hooks
- styled-components with
$prefix for transient props (avoids DOM warnings) - Keep the public API minimal and backward-compatible
By contributing, you agree that your contributions will be licensed under the MIT License.