react-native-windows-samples
Copilot instructions544 starsChanged 15 months agoMITView on GitHub
This repository contains React Native samples, components, and templates for Windows, macOS, and Duo. It serves as a companion to the main React Native for Windows and React Native for macOS repositories. Setup a sample: Build and run: For native modules:
- Installs packages
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
23 rules. About 0 are common, 20 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈20
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Follow React Native Windows System Requirements
- Distinctive: line 110
TypeScript/JavaScript: Use ESLint and Prettier configurations from sample projects
- Distinctive: line 111
C++: Follow Microsoft C++ coding standards
- Distinctive: line 112
C#: Follow .NET coding conventions
- Distinctive: line 123
Follow platform-specific testing practices
- Very specific: line 130
Create folder in samples/ with PascalCase name
- Distinctive: line 132
Add README.md with setup/run instructions
- Distinctive: line 133
Update root README.md sample table
- Distinctive: line 134
Add to CI workflows if appropriate
- Very specific: line 137
Update React Native and RNW versions in package.json
- Distinctive: line 140
Test across all supported platforms
- Distinctive: line 144
C++/WinRT: Use Visual Studio for IntelliSense and debugging
- Distinctive: line 146
Bridge Integration: Test JS-native communication thoroughly
- Distinctive: line 159
Ensure Windows SDK and Visual Studio components are installed
- Distinctive: line 160
Check React Native and RNW version compatibility
- Very specific: line 161
Verify platform target (x86/x64/ARM64) matches your system
- Distinctive: line 166
Ensure all dependencies are properly installed
- Distinctive: line 170
Verify module registration in native code
- Distinctive: line 172
Ensure proper export from native modules
- Distinctive: line 177
Cross-platform compatibility: Test on multiple platforms when applicable
- Distinctive: line 179
Dependencies: Use stable, widely-supported packages
- Distinctive: line 180
Performance: Consider Windows-specific performance implications
- Distinctive: line 181
Accessibility: Follow Windows accessibility guidelines
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions for React Native Windows Samples
Repository Overview
This repository contains React Native samples, components, and templates for Windows, macOS, and Duo. It serves as a companion to the main React Native for Windows and React Native for macOS repositories.
Repository Structure
├── samples/ # Current React Native Windows samples
│ ├── Calculator/ # Calculator sample with C++/WinRT, C#, and Fabric implementations
│ ├── NativeModuleSample/ # Native module and component examples
│ └── ContinuousIntegration/ # CI/CD pipeline configurations
├── samples-old/ # Legacy samples for older RN versions
├── website/ # Documentation website (Docusaurus)
├── docs/ # Additional documentation
└── .github/ # GitHub workflows and templatesTechnology Stack
- React Native for Windows (RNW): Target version 0.79+
- Languages: TypeScript/JavaScript, C++/WinRT, C#
- Build Tools: MSBuild, npm/yarn, React Native CLI
- Platforms: Windows (x86, x64, ARM64), macOS, Android Emulator (Duo)
- Testing: Jest, React Native testing tools
- CI/CD: GitHub Actions with cross-platform builds
Development Environment
Prerequisites
- Follow React Native Windows System Requirements
- Node.js and npm/yarn
- Visual Studio with C++ and Windows development workloads
- Windows SDK
- React Native CLI:
@react-native-community/cli
Common Commands
Setup a sample:
cd samples/[SampleName]/[Implementation]
npm install # or yarn installBuild and run:
npx @react-native-community/cli@latest run-windowsFor native modules:
npx @react-native-community/cli@latest run-windows --no-autolink --no-deploySample Projects
Calculator
- Location:
samples/Calculator/ - Implementations:
cppwinrt/- C++/WinRT implementationcsharp/- C# implementationfabric/- New Architecture (Fabric) implementation
- Purpose: Demonstrates basic RNW app structure and platform-specific implementations
NativeModuleSample
- Location:
samples/NativeModuleSample/ - Purpose: Shows how to create native modules and components
- Key Features: C++ native module examples, platform-specific APIs
ContinuousIntegration
- Location:
samples/ContinuousIntegration/ - Purpose: Provides CI/CD pipeline templates for different RNW versions
- Includes: GitHub Actions workflows, Azure DevOps pipelines
Build System
GitHub Actions Workflows
- CI (ci.yml): Builds all samples across platforms weekly
- CI Upgrade (ci-upgrade.yml): Tests sample upgrades
- PR (pr.yml): Validates pull request changes
- Website Publish: Deploys documentation website
Build Matrix
- Configurations: Debug, Release
- Platforms: x86, x64, ARM64
- Sample Types: Apps, Native Modules
Code Patterns and Conventions
File Structure (Typical RNW Project)
├── android/ # Android platform files
├── ios/ # iOS platform files
├── windows/ # Windows platform files
├── App.tsx # Main app component
├── index.js # Entry point
├── package.json # Dependencies and scripts
├── metro.config.js # Metro bundler configuration
└── tsconfig.json # TypeScript configurationNaming Conventions
- Sample folders: PascalCase (e.g.,
Calculator,NativeModuleSample) - Implementation subfolders: lowercase (e.g.,
cppwinrt,csharp,fabric) - React components: PascalCase with
.tsxextension - Native files: Follow platform conventions (C++:
.cpp/.h, C#:.cs)
Code Style
- TypeScript/JavaScript: Use ESLint and Prettier configurations from sample projects
- C++: Follow Microsoft C++ coding standards
- C#: Follow .NET coding conventions
- Indentation: 2 spaces for JS/TS, 4 spaces for C++/C#
Testing Approach
JavaScript/TypeScript Testing
- Framework: Jest with React Native testing utilities
- Location:
__tests__/directories in each sample - Run:
npm testoryarn test
Native Code Testing
- Follow platform-specific testing practices
- Integration tests through React Native bridge
- Manual testing via sample applications
Common Development Tasks
Adding a New Sample
- Create folder in
samples/with PascalCase name - Include implementations in subfolders (cppwinrt, csharp, etc.)
- Add README.md with setup/run instructions
- Update root README.md sample table
- Add to CI workflows if appropriate
Upgrading Samples
- Update React Native and RNW versions in package.json
- Run
npx @react-native-community/cli@latest init --template react-native@latest - Merge changes carefully, preserving sample-specific code
- Test across all supported platforms
- Update documentation
Working with Native Code
- C++/WinRT: Use Visual Studio for IntelliSense and debugging
- C#: Leverage Visual Studio's C# tools
- Bridge Integration: Test JS-native communication thoroughly
- Platform APIs: Reference WinRT documentation for Windows-specific features
Documentation
- Main docs:
docs/directory and website - Sample docs: Individual README.md files
- API references: Link to main RNW repository docs
- Contributing: See CONTRIBUTING.md for guidelines
Troubleshooting Common Issues
Build Failures
- Ensure Windows SDK and Visual Studio components are installed
- Check React Native and RNW version compatibility
- Verify platform target (x86/x64/ARM64) matches your system
- Clear Metro cache:
npx react-native start --reset-cache
Metro Bundle Issues
- Check metro.config.js configuration
- Ensure all dependencies are properly installed
- Restart Metro server with cache reset
Native Module Loading
- Verify module registration in native code
- Check autolink configuration
- Ensure proper export from native modules
Best Practices for Contributors
- Follow existing patterns: Match the structure and style of existing samples
- Cross-platform compatibility: Test on multiple platforms when applicable
- Documentation: Include clear README files and inline comments
- Dependencies: Use stable, widely-supported packages
- Performance: Consider Windows-specific performance implications
- Accessibility: Follow Windows accessibility guidelines
- Testing: Include both unit tests and integration examples
Related Resources
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

