Thank you for your interest in contributing to pretext-native! This guide will help you get started.
- Node.js >= 18
- Yarn 4 (Corepack)
- Xcode 15+ (for iOS development)
- Android Studio (for Android development)
- Ruby (for CocoaPods)
git clone https://github.com/hexdrinker/pretext-native.git
cd pretext-native
corepack enable
yarn installyarn buildyarn testyarn typecheckyarn lintpretext-native/
├── packages/
│ ├── core/ # Platform-independent layout engine (@hexdrinker/pretext-native-core)
│ │ ├── src/
│ │ │ ├── tokenizer.ts # Text tokenization (words, CJK, emoji)
│ │ │ ├── lineBreaker.ts # Line breaking
│ │ │ ├── layoutCalc.ts # Layout calculation
│ │ │ └── cache.ts # Two-tier LRU cache
│ │ └── __tests__/
│ ├── pretext-native/ # React Native bindings (pretext-native)
│ │ ├── src/
│ │ │ ├── measureText.ts # Native measurement API
│ │ │ ├── useTextLayout.ts # React hook
│ │ │ └── jsAdapter.ts # JS fallback adapter
│ │ ├── ios/ # iOS native module (CoreText)
│ │ └── android/ # Android native module (StaticLayout)
│ └── example/ # Demo app
└── turbo.json
- Bug reports, feature requests, and questions are all welcome.
- For bug reports, please include reproduction steps and environment details (OS, RN version, etc.).
- Fork this repository.
- Create a feature branch.
git checkout -b feat/my-feature- Commit your changes.
git commit -m "feat: add my feature"- Push the branch and create a Pull Request.
git push origin feat/my-featureWe follow Conventional Commits.
| Prefix | Purpose |
|---|---|
feat |
New feature |
fix |
Bug fix |
docs |
Documentation changes |
refactor |
Refactoring (no behavior change) |
test |
Add or update tests |
chore |
Build, CI, packages, and other tasks |
perf |
Performance improvements |
Examples:
feat: add batch measurement API
fix: resolve iOS crash on TurboModule input parsing
docs: update contributing guide
feat/feature-name
fix/bug-description
docs/doc-description
refactor/target
cd example
yarn install
cd ios && bundle install && bundle exec pod install && cd ..
yarn ioscd example
yarn install
yarn android- TypeScript strict mode
- Prettier for formatting (auto-format on save recommended)
- Naming: camelCase (variables/functions), PascalCase (types/components)
- Please include tests with new features.
packages/core/__tests__/— Core engine testspackages/pretext-native/__tests__/— RN binding tests- Make sure
yarn testpasses before submitting a PR.
- Add changes to
CHANGELOG.md - Update version in
package.json - Create and push a git tag in
v*format
git tag v0.1.0
git push origin v0.1.0- GitHub Actions will automatically publish to npm and create a GitHub Release.
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.