Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 021896a

Browse files
committed
chore(deps): update Angular2 to beta.12, remove es6-shim
1 parent 99a778e commit 021896a

File tree

10 files changed

+27
-35
lines changed

10 files changed

+27
-35
lines changed

gulpfile.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jasmine-test-shim.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ var glob = require('glob');
44
var JasmineRunner = require('jasmine');
55
var path = require('path');
66

7-
require('zone.js/dist/zone-microtask.js');
8-
require('es6-shim/es6-shim.js');
7+
require('zone.js/dist/zone.js');
98
require('reflect-metadata/Reflect');
109

1110
global.angularDevMode = true;

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@
3535
"marked": "^0.3.5",
3636
"parse5": "1.5.0",
3737
"run-sequence": "~1.1.2",
38+
"systemjs": "^0.19.9",
3839
"through2": "~0.6.3"
3940
},
4041
"dependencies": {
41-
"angular2": "2.0.0-beta.9",
42+
"angular2": "2.0.0-beta.12",
4243
"hammerjs": "2.0.6",
4344
"react-native": "0.22.2",
4445
"reflect-metadata": "0.1.2",
4546
"rxjs": "5.0.0-beta.2",
46-
"zone.js": "0.5.15",
47-
"es6-shim": "^0.33.13",
48-
"systemjs": "^0.19.9"
47+
"zone.js": "^0.6.6"
4948
}
5049
}

src/renderer/bootstrap.ts

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
//React Native wrapper
2-
import {ReactNativeWrapper} from "./../wrapper/wrapper";
32
import {ReactNativeWrapperImpl} from './../wrapper/wrapper_impl';
43

54
//Dependencies
6-
import 'reflect-metadata';
7-
// Zone.js
8-
import {Zone} from 'zone.js/build/lib/core';
9-
global.Zone = Zone;
10-
global.zone = new Zone();
11-
import {patchSetClearFunction} from 'zone.js/build/lib/patch/functions';
12-
import {apply} from 'zone.js/build/lib/patch/promise';
13-
patchSetClearFunction(global, global.Zone,
14-
[['setTimeout', 'clearTimeout', false, false],
15-
['setInterval', 'clearInterval', true, false],
16-
['setImmediate', 'clearImmediate', false, false]]);
5+
import 'reflect-metadata'
176

18-
//Needed for Android or iOS, but to be imported after zone.js, and
19-
var originalIsExtensible = Object.isExtensible;
20-
import 'es6-shim';
21-
Object.isExtensible = originalIsExtensible;
22-
//Patch promises after es6-shim overrides them
23-
apply();
7+
//Zone.js, patching RN's polyfill of XMLHttpRequest is needed to make it compatible with Zone.js
8+
var onreadystatechangeGetter = function() {return this._onreadystatechange;};
9+
var onreadystatechangeSetter = function(v: any) {this._onreadystatechange = v;};
10+
Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', {
11+
get: onreadystatechangeGetter,
12+
set: onreadystatechangeSetter,
13+
configurable: true
14+
});
15+
import 'zone.js/dist/zone.js';
16+
Object.defineProperty(XMLHttpRequest.prototype, 'onreadystatechange', {
17+
get: onreadystatechangeGetter,
18+
});
2419

2520
// Finally, define the bootstrap
2621
import {RootRenderer, Renderer, provide, NgZone, Provider, enableProdMode, PLATFORM_DIRECTIVES} from 'angular2/core';
@@ -51,7 +46,7 @@ import {MapView} from "../components/ios/map_view";
5146
import {TabBar} from "../components/ios/tabbar";
5247
import {TabBarItem} from "../components/ios/tabbar_item";
5348

54-
export function bootstrapReactNative(appName:string, cpt: any, customProviders?: Array<any> = []) {
49+
export function bootstrapReactNative(appName:string, cpt: any, customProviders?: Array<any>) {
5550
ReactNativeWrapperImpl.registerApp(appName, function() {
5651
enableProdMode();
5752
bootstrap(cpt, [
@@ -89,11 +84,11 @@ export function bootstrapReactNative(appName:string, cpt: any, customProviders?:
8984
provide(ElementSchemaRegistry, {useExisting: ReactNativeElementSchemaRegistry}),
9085
provide(ReactNativeRootRenderer, {useClass: ReactNativeRootRenderer_}),
9186
provide(RootRenderer, {useExisting: ReactNativeRootRenderer})
92-
].concat(customProviders)).then(function(appRef) {
87+
].concat(customProviders || [])).then(function(appRef) {
9388
var zone = appRef.injector.get(NgZone);
9489
var rootRenderer = appRef.injector.get(RootRenderer);
95-
zone.onTurnDone.subscribe(() => { rootRenderer.executeCommands(); });
96-
appRef.injector.get(ReactNativeWrapperImpl).patchReactUpdates(zone._innerZone);
90+
zone.onStable.subscribe(() => { rootRenderer.executeCommands(); });
91+
appRef.injector.get(ReactNativeWrapperImpl).patchReactUpdates(zone);
9792
});
9893
});
9994
}

src/wrapper/wrapper_impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class ReactNativeWrapperImpl extends ReactNativeWrapper {
141141
}
142142

143143
patchReactUpdates(zone: any): void {
144-
ReactNative.addons.batchedUpdates = zone.bind(ReactNative.addons.batchedUpdates);
144+
//ReactNative.addons.batchedUpdates = zone.bind(ReactNative.addons.batchedUpdates);
145145
}
146146

147147
patchReactNativeEventEmitter(nodeMap: Map<number, any>): void {

test/components/android/toolbar_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('Toolbar component (Android)', () => {
8181
rootRenderer.executeCommands();
8282
expect(fixture.componentInstance.log.join(',')).toEqual('1');
8383
resolve();
84-
}, 30);
84+
}, 100);
8585
});
8686

8787
});

test/components/ios/map_view_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('DatePicker component (iOS)', () => {
8484
setTimeout(() => {
8585
expect(fixture.componentInstance.log.join(',')).toEqual('click');
8686
resolve();
87-
}, 30);
87+
}, 100);
8888
});
8989

9090
});

test/components/ios/slider_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ describe('Slider component (iOS)', () => {
8080
setTimeout(() => {
8181
expect(fixture.componentInstance.log.join(',')).toEqual('0.55');
8282
resolve();
83-
}, 30);
83+
}, 50);
8484
});
8585

8686
});

test/components/scrollview_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe('ScrollView component', () => {
112112
rootRenderer.executeCommands();
113113
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
114114
resolve();
115-
}, 30);
115+
}, 100);
116116
});
117117

118118
});

test/components/textinput_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ describe('Input component', () => {
8484
expect(fixture.componentInstance.log.join(',')).toEqual('foo');
8585
expect(mock.commandLogs.toString()).toEqual('UPDATE+3+native-textinput+{"text":"bar"}');
8686
resolve();
87-
}, 30);
87+
}, 50);
8888
});
8989

9090
});

0 commit comments

Comments
 (0)