Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dist
typings
*.log
.idea
.DS_Store
.DS_Store
*.ngfactory.ts
es6
22 changes: 19 additions & 3 deletions doc/pages/bootstrap.jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,31 @@ block content

:marked
# bootstrap
To bootstrap an application, you must use the special method `bootstrapReactNative`.

## JIT compilation

To bootstrap an application with JIT compilation, you must use the special methods `bootstrapReactNativeJIT`.

```
import {bootstrapReactNative} from 'angular2-react-native';
import {bootstrapReactNativeJIT} from 'angular2-react-native/jit';
import {MyAppModule} from "./app/module";

bootstrapReactNative('myApp', MyAppModule);
bootstrapReactNativeJIT('myApp', MyAppModule);
```

## AOT compilation

To bootstrap an application with AOT compilation, you must use the special methods `bootstrapReactNativeAOT`.

```
import {bootstrapReactNativeAOT} from 'angular2-react-native/aot';
import {MyAppModuleNgFactory} from "./app/module.ngfactory";

bootstrapReactNativeAOT('myApp', MyAppModule);
```

## Main module

The main module must import `ReactNativeAndroidModule` or `ReactNativeiOSModule` depending on the platform targetted:
```
@NgModule({
Expand Down
8 changes: 6 additions & 2 deletions doc/pages/router.jade
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ block content
# Router

The rooter module of Angular 2 can be used as is in applications.
The only thing to be done is to import `ReactNativeRouterModule` in the main module of the application (see below), and use the static `forRoot` method to configure routes.
The only thing to be done is to import `ReactNativeRouterModule` in the main module of the application (see below),
and use the static `RouterModule.forRoot` method to configure routes.

It uses a mock of `LocationStrategy`. Manipulating the location triggers a navigation of the router.

Expand All @@ -19,9 +20,12 @@ block content
{ path: 'b', component: CompB }
];

export const providers: Provider[] = RouterModule.forRoot(appRoutes)['providers'];

@NgModule({
declarations: [Example, CompA, CompB, ...],
imports: [ReactNativeAndroidModule, CommonModule, ReactNativeRouterModule.forRoot(appRoutes)],
imports: [ReactNativeAndroidModule, CommonModule, ReactNativeRouterModule],
providers: [providers, {provide: LocationStrategy, useClass: ReactNativeLocationStrategy}],
bootstrap: [Example]
})
export class MyAppModule {}
Expand Down
17 changes: 17 additions & 0 deletions factory.tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"baseUrl": ".",
"declaration": true,
"stripInternal": true,
"experimentalDecorators": true,
"module": "es2015",
"moduleResolution": "node",
"outDir": "../factories_out",
"rootDir": ".",
"sourceMap": true,
"inlineSources": true,
"target": "es5",
"skipLibCheck": true,
"lib": [ "es2015", "dom" ]
}
}
23 changes: 23 additions & 0 deletions fake-react-native.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//TODO: switch to react-native.d.ts form typings

declare module "react-native" {
export var StyleSheet: any;
export var Alert: any;
export var Linking: any;
export var Clipboard: any
export var Platform: any;
export var PixelRatio: any;
export var NetInfo: any;
export var AppState: any;
export var NativeModules: any;
export var processColor: any;
export var AsyncStorage: any;

export var DatePickerAndroid: any;
export var TimePickerAndroid: any;
export var BackAndroid: any;
export var ToastAndroid: any;

export var ActionSheetIOS: any;
export var AlertIOS: any;
}
Loading