@ng-native/platform
v0.7.0
Published
Angular Native's Renderer2 and bootstrap: mounts an Angular application onto React Native's Fabric.
Maintainers
Readme
@ng-native/platform
The only Angular-aware file in the rendering stack: a Renderer2/RendererFactory2 pair that
turns Angular's renderer calls into mutations on @ng-native/fabric's retained tree, and mount(),
which stands in for bootstrapApplication plus @angular/platform-browser.
Alpha: APIs may change before 1.0.
Install
Most apps start from npx create-expo-app@latest my-app --template @ng-native/template, which
already calls mount() in src/main.ts. Otherwise:
npm install @ng-native/platform
npm install @angular/core react-native@angular/common is an optional peer, needed only for provideNativeHttpClient.
Example
// src/main.ts
import { AppRegistry, Image, Platform, processColor } from 'react-native';
import { mount } from '@ng-native/platform';
import { getFabricUIManager, registerPlatformComponents } from '@ng-native/fabric';
import { App } from './app/app.ts';
registerPlatformComponents(Platform.OS);
AppRegistry.registerRunnable('main', ({ rootTag }) => {
mount(Number(rootTag), App, getFabricUIManager(), {
processColor,
resolveAssetSource: (value) => Image.resolveAssetSource(value as never),
});
});What's in the package
.-mount(),NativeRendererFactory,PLATFORM_NATIVE_ID,isPlatformNative()../http-provideNativeHttpClient(), anHttpClientbackend over React Native'sXMLHttpRequest(Angular's defaultfetchbackend cannot read the body of React Native's ownfetchresponse). Use it in place ofprovideHttpClient().
Docs
License
MIT
