|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is `@react-native-community/progress-view`, a React Native library providing a cross-platform ProgressView component. The library supports iOS (UIProgressView), Android, macOS, and Windows platforms with both legacy and new React Native architecture (Fabric). |
| 8 | + |
| 9 | +## Development Commands |
| 10 | + |
| 11 | +### Essential Commands |
| 12 | +- `yarn lint` - Run ESLint on the codebase |
| 13 | +- `yarn test` - Run Jest tests for JavaScript components |
| 14 | +- `yarn test:windows` - Run Windows-specific tests |
| 15 | +- `yarn type-check` - Run TypeScript type checking |
| 16 | +- `yarn flow` - Run Flow type checking |
| 17 | + |
| 18 | +### Platform-Specific Development |
| 19 | +- `yarn ios` - Run iOS example app |
| 20 | +- `yarn android` - Run Android example app |
| 21 | +- `yarn windows` - Run Windows example app |
| 22 | +- `yarn start` - Start Metro bundler |
| 23 | +- `yarn start:macos` - Start Metro for macOS |
| 24 | +- `yarn start:windows` - Start Metro for Windows |
| 25 | + |
| 26 | +### Testing Individual Components |
| 27 | +- `yarn test js/__tests__/*` - Run specific test files |
| 28 | +- Tests are located in `js/__tests__/` and use Jest with React Native preset |
| 29 | + |
| 30 | +## Architecture Overview |
| 31 | + |
| 32 | +### Multi-Platform Native Module Structure |
| 33 | +The library implements platform-specific components that all expose the same JavaScript interface: |
| 34 | + |
| 35 | +**JavaScript Layer** (`js/` directory): |
| 36 | +- `index.js` - Main entry point exporting ProgressView |
| 37 | +- `index.d.ts` - TypeScript definitions |
| 38 | +- Platform-specific implementations: |
| 39 | + - `ProgressView.ios.js` - iOS implementation using UIProgressView |
| 40 | + - `ProgressView.android.js` - Android implementation |
| 41 | + - `ProgressView.macos.js` - macOS implementation |
| 42 | + - `ProgressView.windows.js` - Windows implementation |
| 43 | + |
| 44 | +**Native Component Generation**: |
| 45 | +- Uses React Native's codegen system for type-safe native components |
| 46 | +- `RNCProgressViewNativeComponent.js` - iOS/macOS native component spec |
| 47 | +- `RNCProgressViewNativeComponentAndroid.js` - Android native component spec |
| 48 | +- `RNCProgressViewNativeComponentWindows.js` - Windows native component spec |
| 49 | + |
| 50 | +### Native Platform Implementations |
| 51 | + |
| 52 | +**iOS/macOS** (`ios/` and `macos/` directories): |
| 53 | +- Objective-C implementation wrapping UIProgressView |
| 54 | +- Supports both old and new architecture (Fabric) |
| 55 | +- Fabric implementation in `ios/Fabric/` uses C++ and the new renderer |
| 56 | + |
| 57 | +**Android** (`android/` directory): |
| 58 | +- Java implementation with separate Paper and Fabric managers |
| 59 | +- `src/paper/` - Legacy architecture implementation |
| 60 | +- `src/fabric/` - New architecture implementation |
| 61 | + |
| 62 | +**Windows** (`windows/` directory): |
| 63 | +- C++/WinRT implementation |
| 64 | +- Uses Visual Studio project structure |
| 65 | + |
| 66 | +### Build System Integration |
| 67 | +- **React Native Config**: `react-native.config.js` defines platform-specific dependencies |
| 68 | +- **CocoaPods**: `react-native-progress-view.podspec` handles iOS/macOS dependencies |
| 69 | +- **Android Gradle**: `android/build.gradle` handles Android dependencies |
| 70 | +- **Codegen**: `package.json` contains `codegenConfig` for automatic native component generation |
| 71 | + |
| 72 | +### Key Files to Understand |
| 73 | +- `js/index.js:3` - Main component export |
| 74 | +- `js/index.d.ts:4-40` - TypeScript interface definitions |
| 75 | +- `package.json:81-88` - Codegen configuration for native components |
| 76 | +- `react-native-progress-view.podspec:22-49` - Fabric/Paper conditional compilation |
| 77 | + |
| 78 | +## Development Notes |
| 79 | + |
| 80 | +### Dual Architecture Support |
| 81 | +The library supports both the old React Native architecture (Paper) and the new architecture (Fabric). The build system automatically selects the appropriate implementation based on the `RCT_NEW_ARCH_ENABLED` environment variable. |
| 82 | + |
| 83 | +### Cross-Platform Considerations |
| 84 | +Each platform has slightly different prop support: |
| 85 | +- `isIndeterminate` prop is Windows-only |
| 86 | +- Image props (`progressImage`, `trackImage`) work differently across platforms |
| 87 | +- Default styling varies by platform (iOS: 2px height, Android: 20px height) |
| 88 | + |
| 89 | +### Testing Strategy |
| 90 | +- Unit tests focus on component rendering and prop validation |
| 91 | +- Platform-specific test setups in `jest-setups/` |
| 92 | +- Example apps in `example/` and `fabric-example/` for manual testing |
0 commit comments