ng-native README

README проекта с github.com/ng-native/ng-native. Одним файлом markdown: README.md.

Angular Native

All Contributors

Angular apps, rendered as real native iOS and Android views.

Angular Native renders Angular components straight onto React Native's Fabric renderer, so a <view> is a UIView on iOS and an android.view.View on Android, and React is never in the render path. You write standalone components, signals, Signal Forms and @angular/router routes as you would for the web, then create, run, hot reload and ship the app with Expo.

npx create-expo-app@latest my-app --template @ng-native/template
cd my-app && npx expo start

Scan the QR code with Expo Go, or press i or a for a simulator.

A component

import { Component, signal } from '@angular/core';
import { Pressable, SafeAreaProvider, SafeAreaView, Text } from '@ng-native/components';

@Component({
  selector: 'app-root',
  imports: [Pressable, SafeAreaProvider, SafeAreaView, Text],
  template: `
    <safe-area-provider>
      <safe-area-view class="screen">
        <text class="title">Angular, natively</text>
        <pressable accessibilityRole="button" class="button" (press)="count.set(count() + 1)">
          <text class="label">Tapped {{ count() }} times</text>
        </pressable>
      </safe-area-view>
    </safe-area-provider>
  `,
  styles: `
    :host {
      flex: 1;
    }
    .screen {
      flex: 1;
      justify-content: center;
      gap: 12px;
      padding: 24px;
    }
    .title {
      font-size: 28px;
      font-weight: 700;
    }
    .button {
      padding: 14px;
      border-radius: 10px;
      background-color: #3b6ef5;
      align-items: center;
    }
    .button:active {
      opacity: 0.8;
    }
    .label {
      color: white;
      font-weight: 600;
    }
  `,
})
export class App {
  protected readonly count = signal(0);
}

Elements are Angular components imported like any other, with lowercase names. Stylesheets compile to native styles at build time.

Features

Documentation

The examples are complete apps: a bank (wallet), a habit tracker (habits), a music player (music), a run tracker with maps (runs), a notes app (notes) and a showroom of Analog's file-based routing (analog).

Packages

Package What it provides
@ng-native/platform mount(), the Angular renderer, and HttpClient for React Native.
@ng-native/components The elements: views, text, images, lists, inputs, pressables, gestures, animation.
@ng-native/router Native stack and tab navigation over @angular/router.
@ng-native/device Keyboard, screen, color scheme, app state, accessibility, deep links and more.
@ng-native/expo Expo's modules as Angular services and directives.
@ng-native/firebase-messaging The Firebase Installation ID, registered with FCM for push.
@ng-native/icons <ng-icon> with the @ng-icons sets, drawn as native SVG.
@ng-native/analog Analog's file-based pages, routed on a native stack.
@ng-native/metro The Metro preset: the Angular compiler, the CSS compiler and hot reload.
@ng-native/tailwind The Tailwind preset and its platform variants.
@ng-native/nativescript Every iOS and Android API from TypeScript, and UIKit views, through NativeScript.
@ng-native/testing Testing Library for Angular Native, running in Node.
@ng-native/web A DOM renderer for the same components, with a Vite preset.
@ng-native/schematics ng add and ng generate for Angular CLI workspaces.
@ng-native/nx nx add and an app generator for Nx workspaces.
@ng-native/migrate The migrations that update an app to a new release.
@ng-native/fabric The framework-agnostic retained tree and commit engine the renderer is built on.

Requirements

Angular 22, and Expo SDK 57 or 58 (React Native 0.86 or 0.88) with the New Architecture, on Node 22.18 or later. The template starts on SDK 58.

Status

Angular Native is in alpha, so APIs can change between 0.x releases. The known limitations list every gap with its workaround.

Contributing

See CONTRIBUTING.md for setting up the workspace, running the tests and what a pull request needs. Report a vulnerability privately, as SECURITY.md describes. Everyone taking part is expected to follow the Code of Conduct.

License

MIT

Angular Native is an independent open-source project. It is not affiliated with or endorsed by Google, the Angular team or Expo. Angular is a trademark of Google LLC.

Contributors ✨

Thanks goes to these wonderful people:

Ashley Hunter
Ashley Hunter

💻 📖 🚧 🚇
erKam
erKam

💻
Chau Tran
Chau Tran

💻
Stavros Thalassinos
Stavros Thalassinos

💻
Luis David Lopera
Luis David Lopera

💻
Ajit Panigrahi
Ajit Panigrahi

💻
Anthony
Anthony

💻
Ola Boluwatife
Ola Boluwatife

💻
Hangell
Hangell

💻
lunar-me
lunar-me

📖
Gabriel Silva
Gabriel Silva

💻
Emanuel Hosu
Emanuel Hosu

💻
Wassim Aarab
Wassim Aarab

💻
Shahar Kazaz
Shahar Kazaz

💻
Nathan Walker
Nathan Walker

💻
Mohamed Ben Makhlouf
Mohamed Ben Makhlouf

📖
Dor Peled
Dor Peled

💻
Robin Genz
Robin Genz

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

ng-native (ng-native/ng-native)

Ищем в базе…

Что это?Angular Native рендерит Angular-приложения как настоящие нативные представления iOS и Android, компилируя Angular-компоненты прямо на рендерер Fabric из React Native, так что компонент становится UIView на iOS или android.view.View на Android — без React в пути рендеринга.
Это UI-библиотека для React Native или этот проект полностью заменяет React?Он заменяет React в пути рендеринга: вы пишете обычные Angular standalone-компоненты, signals, Signal Forms и маршруты @angular/router, а специальный рендерер передаёт их напрямую в движок Fabric из React Native вместо прохода через React.
Как создать и запустить приложение с его помощью?Создайте рабочее пространство через Angular CLI (ng add @ng-native/schematics) или Nx (nx add @ng-native/nx), затем запустите его через Expo, отсканировав QR-код в Expo Go или нажав i или a для открытия симулятора.
Какие версии Angular, Expo и React Native нужны?Нужны Angular 22, Expo SDK 57, React Native 0.86 с включённой New Architecture и Node 22.18 или новее.
Насколько это стабильно для продакшен-приложения?Пока недостаточно: проект явно находится в альфе, поэтому API могут меняться между релизами 0.x, а в документации ведётся список известных ограничений с обходными путями.
Те же Angular-компоненты могут работать и в браузере?Да, пакет @ng-native/web рендерит те же Angular-компоненты в DOM через пресет Vite, так что одна кодовая база может таргетировать и натив, и веб.
Можно ли из Angular-кода обращаться к функциям устройства вроде камеры или геолокации?Да, @ng-native/expo оборачивает модули Expo — камеру, геолокацию, уведомления, защищённое хранилище, SQLite, биометрию, карты и хаптику — в обычные инъектируемые Angular-сервисы.
Поддерживается ли Tailwind для стилизации нативных представлений?Да, поверх стилей компонентов, CSS-переменных, тёмной темы, переходов и @keyframes он поставляет пресет Tailwind с вариантами ios: и android:.
Можно тестировать компоненты без запуска симулятора?Да, @ng-native/testing предоставляет API в духе Testing Library, который монтирует компоненты в Node на фиктивном дереве Fabric — симулятор не нужен.
Автор
ng-native
Размер
29.8 MB
Звёзды
635
Возраст
2 мес
Коммиты · 90 дней