A cross-platform AI-powered image classification application built with React Native Windows and TensorFlow.js. This repository contains two implementations demonstrating different React Native Windows architectures.
AIImageClassifierRNW/
βββ RNW0.79_Paper/ # React Native Windows 0.79 (Paper Architecture - UWP)
βββ RNW0.81_Fabric/ # React Native Windows 0.81 (Fabric Architecture - WinAppSDK)
βββ README.md
- AI Image Classification using TensorFlow.js and MobileNet
- Cross-platform support for Windows (ARM64/x64) β instructions use ARM64 by default; replace with
--arch x64for x64 builds - Offline Classification capability
- Two Architecture Examples: Paper (legacy) and Fabric (new)
- Node.js 18 or higher
- Visual Studio 2022 with:
- Desktop development with C++
- Universal Windows Platform development
- Windows 10/11 SDK (10.0.19041.0 or higher)
- Windows 10/11 (ARM64 or x64)
# For RNW0.79_Paper
cd RNW0.79_Paper
& ".\node_modules\react-native-windows\scripts\rnw-dependencies.ps1"
# For RNW0.81_Fabric
cd RNW0.81_Fabric
& ".\node_modules\react-native-windows\scripts\rnw-dependencies.ps1"git clone https://github.com/raorugan/AIImageClassifierRNW.git
cd AIImageClassifierRNWcd RNW0.79_Paper
npm install
npx react-native run-windows --arch ARM64cd RNW0.81_Fabric
npm install
npx react-native run-windows --arch ARM64| Feature | Paper (RNW 0.79) | Fabric (RNW 0.81) |
|---|---|---|
| Architecture | Legacy Bridge | New Fabric Renderer |
| App Type | UWP (Universal Windows Platform) | WinAppSDK (Win32) |
| Performance | Good | Better (synchronous) |
| Threading | Async bridge | Synchronous calls |
| Future Support | Maintenance mode | Active development |
| Template | old/uwp-cpp-app |
cpp-app |
{
"dependencies": {
"react": "19.1.0",
"react-native": "0.81.5",
"react-native-windows": "0.81.0"
},
"devDependencies": {
"@react-native/babel-preset": "0.81.0",
"@react-native/eslint-config": "0.81.0",
"@react-native/metro-config": "0.81.0",
"@react-native/typescript-config": "0.81.0"
}
}# Delete existing dependencies
rmdir /s /q node_modules
del package-lock.json
# Install new dependencies
npm install# Re-initialize Windows files (this will use Paper architecture by default for upgrade)
npx @react-native-community/cli init-windows --overwrite# Clean Windows build artifacts
cd windows
msbuild AIImageClassifierRNW.sln /t:Clean
cd ..
# Run the app
npx react-native run-windows --arch ARM64If you encounter ERESOLVE errors:
# Check peer dependency requirements
npm view react-native-windows@0.81.0 peerDependencies
# Force install (use cautiously)
npm install --legacy-peer-depsMigrating from Paper to Fabric involves:
- Updating the Windows project template
- Changing from UWP to WinAppSDK
- Updating native module configurations
# Copy your current project
xcopy /E /I RNW0.79_Paper RNW0.79_Paper_backupChange the react-native-windows configuration:
Before (Paper/UWP):
{
"react-native-windows": {
"init-windows": {
"name": "AIImageClassifierRNW",
"namespace": "AIImageClassifierRNW",
"template": "old/uwp-cpp-app"
}
}
}After (Fabric/WinAppSDK):
{
"react-native-windows": {
"init-windows": {
"name": "AIImageClassifierRNW",
"namespace": "AIImageClassifierRNW",
"template": "cpp-app"
}
}
}rmdir /s /q windowsnpx @react-native-community/cli init-windows --template cpp-app --overwriteEdit windows/ExperimentalFeatures.props:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Microsoft.ReactNative Experimental Features">
<UseFabric>true</UseFabric>
<UseHermes>true</UseHermes>
</PropertyGroup>
</Project>Ensure metro.config.js has proper configuration:
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const config = {
resolver: {
blockList: [/node_modules\/.*\/node_modules\/react-native\/.*/],
},
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);# Install dependencies
npm install
# Run the app
npx react-native run-windows --arch ARM64| Paper (UWP) | Fabric (WinAppSDK) |
|---|---|
Single .vcxproj |
.vcxproj + .wapproj (packaging) |
MainPage.xaml |
No XAML (Win32 window) |
Package.appxmanifest in project |
Package.appxmanifest in Package folder |
App.xaml + App.cpp |
AIImageClassifierRNW.cpp (Win32 entry) |
Paper (UWP) - App.cpp:
#include "App.xaml.h"
using namespace winrt::AIImageClassifierRNW::implementation;
App::App() {
// UWP initialization
}Fabric (WinAppSDK) - AIImageClassifierRNW.cpp:
#include "pch.h"
#include "resource.h"
// Win32 window creation and React Native host initializationBoth architectures use the same registration pattern in AutolinkedNativeModules.g.cpp, but Fabric supports TurboModules for better performance.
# Start Metro bundler
npm start
# Run on Windows (ARM64)
npx react-native run-windows --arch ARM64
# Run on Windows (x64)
npx react-native run-windows --arch x64
# Run release build
npx react-native run-windows --arch ARM64 --release
# Clean build
cd windows && msbuild /t:Clean && cd ..
# Check dependencies
npx @react-native-community/cli doctor# Run as Administrator
Set-ExecutionPolicy Unrestricted -Scope Process -Force
& ".\node_modules\react-native-windows\scripts\rnw-dependencies.ps1"# Clean everything
rmdir /s /q node_modules
rmdir /s /q windows\x64
rmdir /s /q windows\ARM64
del package-lock.json
# Reinstall
npm install
npx @react-native-community/cli init-windows --overwrite# Clear Metro cache
npx react-native start --reset-cacheSee TENSORFLOW_TROUBLESHOOTING.md for detailed troubleshooting.
- React Native Windows Documentation
- React Native Windows GitHub
- TensorFlow.js Documentation
- Fabric Architecture Overview
This project is licensed under the MIT License.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request