Thank you for your interest in contributing to NitroText! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Development Workflow
- Coding Standards
- Testing
- Submitting Changes
- Release Process
This project follows a code of conduct to ensure a welcoming environment for all contributors. Please be respectful and constructive in all interactions.
Before you begin, ensure you have the following installed:
- Node.js: 18+ (Node 20+ recommended)
- React Native: 0.78.0 or higher (Fabric/Nitro Views required)
- Bun: Latest version (package manager)
- Xcode: Latest version (for iOS development)
- Android Studio: Latest version (for Android development)
- CocoaPods: Latest version (for iOS dependencies)
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/your-username/react-native-nitro-text.git cd react-native-nitro-text - Add the upstream repository:
git remote add upstream https://github.com/patrickkabwe/react-native-nitro-text.git
# Install main dependencies
bun install
# Install example app dependencies
cd example
bun install
cd ..# Install iOS dependencies
cd example/ios
pod install
cd ../..# Type check and build the package
bun run build
# Regenerate codegen outputs
bun run codegen# Start Metro bundler
cd example
bun start
# In another terminal, run on iOS
bun run ios
# Or run on Android
bun run androidreact-native-nitro-text/
├── src/ # TypeScript source code
│ ├── index.ts # Main entry point
│ ├── nitro-text.tsx # Main NitroText component
│ ├── specs/ # Nitro module specifications
│ ├── types.ts # TypeScript type definitions
│ └── utils/ # Utility functions
├── ios/ # iOS native implementation
│ ├── NitroTextComponentDescriptor.hpp
│ ├── NitroTextComponentDescriptor.mm
│ ├── NitroTextImpl.swift # Main iOS implementation
│ ├── NitroTextImpl+*.swift # Feature-specific implementations
│ └── NitroTextView.swift # SwiftUI view wrapper
├── cpp/ # C++ shared code
│ ├── NitroTextShadowNode.hpp
│ └── NitroTextShadowNode.cpp
├── nitrogen/ # Generated Nitro module code
├── lib/ # Built output
├── example/ # Example React Native app
└── .github/ # GitHub templates and workflows
# Create a new branch for your feature/fix
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fix- Follow the coding standards
- Write tests for new functionality
- Update documentation as needed
- Ensure all existing tests pass
# Run type checking
bun run typecheck
# Build the project
bun run build
# Test in the example app
cd example
bun run ios # or bun run androidFollow conventional commit format:
git commit -m "feat: add support for text selection on Android"
git commit -m "fix: resolve layout issues with nested fragments"
git commit -m "docs: update README with new examples"- Use TypeScript for all new code
- Follow the existing ESLint configuration
- Use Prettier for code formatting
- Write meaningful variable and function names
- Add JSDoc comments for public APIs
- Follow Swift style guidelines
- Use meaningful variable and function names
- Add documentation comments for public methods
- Handle errors appropriately
- Follow C++ best practices
- Use meaningful variable and function names
- Add comments for complex logic
- Ensure proper memory management
The project uses:
- Prettier for code formatting
- ESLint for linting
- Single quotes for strings
- 2 spaces for indentation
- No semicolons (except where required)
- Test your changes in the example app
- Verify behavior on both iOS and Android
- Test with different text styles and layouts
- Test edge cases (empty text, very long text, etc.)
- Simple text rendering
- Rich text with nested styles
- Text selection functionality
- Performance with large amounts of text
- Layout with different font sizes and styles
- Platform-specific behavior
# Fetch latest changes from upstream
git fetch upstream
# Rebase your branch on the latest main
git rebase upstream/maingit push origin feature/your-feature-name- Go to your fork on GitHub
- Click "New Pull Request"
- Select your branch
- Fill out the PR template
- Request review from maintainers
- Title: Use conventional commit format
- Description: Clearly describe what changes you made and why
- Testing: Describe how you tested your changes
- Breaking Changes: Note any breaking changes
- Documentation: Update documentation if needed
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tested on iOS
- [ ] Tested on Android
- [ ] Added/updated tests
- [ ] Manual testing completed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or clearly documented)Releases are handled automatically using semantic-release. The process:
- Changes are merged to
main - Semantic-release analyzes commits
- Version is bumped automatically
- Changelog is generated
- Release is published to npm
Use conventional commits for automatic versioning:
feat:- New features (minor version bump)fix:- Bug fixes (patch version bump)BREAKING CHANGE:- Breaking changes (major version bump)docs:- Documentation changesstyle:- Code style changesrefactor:- Code refactoringtest:- Test changeschore:- Build/tooling changes
- Test on both iOS Simulator and physical devices
- Ensure proper handling of iOS-specific features (selection, accessibility)
- Follow iOS Human Interface Guidelines
- Test with different iOS versions
- Currently falls back to React Native Text component
- Future Android implementation should maintain API compatibility
- Test on different Android versions and screen sizes
# Clean and rebuild
bun run clean
bun install
bun run build# Clean iOS build
cd example/ios
rm -rf build
pod install
cd ../..# Regenerate codegen
bun run codegen- Issues: Use GitHub Issues for bug reports and feature requests
- Discussions: Use GitHub Discussions for questions and general discussion
- Documentation: Check the README and inline documentation
Contributors will be recognized in:
- Release notes
- README contributors section
- GitHub contributors page
Thank you for contributing to NitroText! 🚀