diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7c2b214..0000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -dist -src/angular2 -*.swp diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4fdef00..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "angular"] - path = angular - url = https://github.com/angular/angular.git diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8f71f43..0000000 --- a/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/README.md b/README.md index bc9c394..f30a618 100644 --- a/README.md +++ b/README.md @@ -1,16 +1 @@ -Getting Started ---------------- - - npm install - -If you are having issues with tsd, run `tsd rate` to make sure you are not being rate limited by GitHub. If you see a 0/60, then you need to add a GitHub OAuth token with `tsd token`. More information can be found on the [tsd repo](https://github.com/DefinitelyTyped/tsd). - -Then build: - - gulp build - -Or, to continuously build, just: - - gulp - -Then open `dist/dist.xcodeproj` in XCode +This repository has moved to https://github.com/uber5001/react-native-renderer diff --git a/angular b/angular deleted file mode 160000 index 22f5925..0000000 --- a/angular +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 22f59252029a983b8ff73f106091c2a907f8e652 diff --git a/crypto/main.js b/crypto/main.js deleted file mode 100644 index a5d3020..0000000 --- a/crypto/main.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = false; diff --git a/crypto/package.json b/crypto/package.json deleted file mode 100644 index 74c349b..0000000 --- a/crypto/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "crypto", - "version": "0.0.1", - "dependencies": [], - "main": "main.js" -} diff --git a/gulpfile.js b/gulpfile.js deleted file mode 100644 index 32c573f..0000000 --- a/gulpfile.js +++ /dev/null @@ -1,61 +0,0 @@ -var gulp = require('gulp'); -var shell = require('gulp-shell'); - -gulp.task('default', ['build', 'watchbuild']); - -gulp.task('watchbuild', function() { - gulp.watch('src/**/*.ts', ['build']); -}); - -gulp.task('build', shell.task([ - './node_modules/.bin/tsc -p src', - "find dist -not \\( -path dist/node_modules -prune \\) -name '*.js' -type f -exec sed -i '' -e '$a\\' {} \\;", -])); - -gulp.task('init', ['initTypings', 'initFakeCrypto', 'initDistModules', 'initDistAngular'], shell.task([])); - -gulp.task('cleanDist', shell.task([ - "rm -rf dist" -])); - -gulp.task('cleanSrcAngularTypings', shell.task([ - "rm -rf src/angular2" -])); - -gulp.task('initSubmodule', shell.task([ - "git submodule update --init --recursive", - "./node_modules/.bin/tsd reinstall --config angular/modules/angular2/tsd.json", -])); - -gulp.task('initDist', ['cleanDist'], shell.task([ - "./node_modules/.bin/react-native init dist", -])); - -gulp.task('initFakeCrypto', ['initDist'], shell.task([ - "cp -r crypto/ dist/node_modules/crypto", -])); - -gulp.task('initDistModules', ['initDist'], shell.task([ - "cp src/package.json dist/package.json", - "cd dist && npm install", -])); - -gulp.task('initDistAngular', ['initDist', 'cleanSrcAngularTypings', 'initSubmodule', 'initDistModules'], shell.task([ - "cp -r angular/modules/angular2/ src/angular2/", - "./node_modules/.bin/tsc -p src", - "mv dist/node_modules/angular2/package.json tmp", - "rm -r dist/node_modules/angular2", - "mv dist/angular2 dist/node_modules/angular2", - "mv tmp dist/node_modules/angular2/package.json", - "rm -r src/angular2", -])); - -gulp.task('initDistNewlines', ['initDistModules', 'initDistAngular'], shell.task([ - "find dist -name '*.js' -print0 | xargs -0 -p -P 9 -n 1 -I {} sed -i '' -e '$a\\' {}" -])); - -gulp.task('initTypings', ['initDistAngular'], shell.task([ - "cp -r dist/node_modules/angular2 src/angular2", - "cp angular/modules/angular2/*.d.ts src/angular2", - "cp -r angular/modules/angular2/typings src/angular2/typings" -])); diff --git a/package.json b/package.json deleted file mode 100644 index 8266ff6..0000000 --- a/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "angular-react", - "version": "0.0.1", - "dependencies": { - }, - "devDependencies": { - "gulp": "^3.9.0", - "gulp-shell": "^0.4.2", - "react-native-cli": "^0.1.4", - "tsd": "^0.6.1", - "typescript": "alexeagle/TypeScript#error_is_class" - }, - "scripts": { - "postinstall": "./node_modules/.bin/gulp init" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/uber5001/angular-react.git" - }, - "bugs": { - "url": "https://github.com/uber5001/angular-react/issues" - }, - "homepage": "https://github.com/uber5001/angular-react#readme" -} diff --git a/src/BRIDGE.txt b/src/BRIDGE.txt deleted file mode 100644 index 4c78335..0000000 --- a/src/BRIDGE.txt +++ /dev/null @@ -1,136 +0,0 @@ -RCT_EXPORT_METHOD -================= - UIManager - /** - * A method to be called from JS, which takes a container ID and then releases - * all subviews for that container upon receipt. - */ - removeSubviewsFromContainerWithID - (NSNumber *)containerID - - removeRootView - (NSNumber *)rootReactTag - - replaceExistingNonRootView - (NSNumber *)reactTag withView - (NSNumber *)newReactTag - - manageChildren - (NSNumber *)containerReactTag - (NSArray *)moveFromIndices - (NSArray *)moveToIndices - (NSArray *)addChildReactTags - (NSArray *)addAtIndices - (NSArray *)removeAtIndices - - createView - (NSNumber *)reactTag - (NSString *)viewName - (NSDictionary *)props - - updateView - (NSNumber *)reactTag - (__unused NSString *)_ ###viewName - (NSDictionary *)props - - focus - (NSNumber *)reactTag - - blur - (NSNumber *)reactTag - - findSubviewIn - (NSNumber *)reactTag atPoint - (CGPoint)point callback - (RCTResponseSenderBlock)callback - - measure - (NSNumber *)reactTag - (RCTResponseSenderBlock)callback - - /** - * Returns the computed recursive offset layout in a dictionary form. The - * returned values are relative to the `ancestor` shadow view. Returns `nil`, if - * the `ancestor` shadow view is not actually an `ancestor`. Does not touch - * anything on the main UI thread. Invokes supplied callback with (x, y, width, - * height). - */ - measureLayout - (NSNumber *)reactTag - (NSNumber *)ancestorReactTag - (RCTResponseSenderBlock)errorCallback - (RCTResponseSenderBlock)callback - - /** - * Returns the computed recursive offset layout in a dictionary form. The - * returned values are relative to the `ancestor` shadow view. Returns `nil`, if - * the `ancestor` shadow view is not actually an `ancestor`. Does not touch - * anything on the main UI thread. Invokes supplied callback with (x, y, width, - * height). - */ - measureLayoutRelativeToParent - (NSNumber *)reactTag - (RCTResponseSenderBlock)errorCallback - (RCTResponseSenderBlock)callback - - /** - * Returns an array of computed offset layouts in a dictionary form. The layouts are of any React subviews - * that are immediate descendants to the parent view found within a specified rect. The dictionary result - * contains left, top, width, height and an index. The index specifies the position among the other subviews. - * Only layouts for views that are within the rect passed in are returned. Invokes the error callback if the - * passed in parent view does not exist. Invokes the supplied callback with the array of computed layouts. - */ - measureViewsInRect - (CGRect)rect - (NSNumber *)reactTag - (RCTResponseSenderBlock)errorCallback - (RCTResponseSenderBlock)callback - - setMainScrollViewTag - (NSNumber *)reactTag - - scrollTo - (NSNumber *)reactTag - (CGFloat)offsetX - (CGFloat)offsetY - - scrollWithoutAnimationTo - (NSNumber *)reactTag - (CGFloat)offsetX - (CGFloat)offsetY - - zoomToRect - (NSNumber *)reactTag - (CGRect)rect - - /** - * JS sets what *it* considers to be the responder. Later, scroll views can use - * this in order to determine if scrolling is appropriate. - */ - setJSResponder - (NSNumber *)reactTag - - clearJSResponder - - configureNextLayoutAnimation - (NSDictionary *)config - (RCTResponseSenderBlock)callback - (RCTResponseSenderBlock)errorCallback - - Timing - createTimer - (NSNumber *)callbackID - (NSTimeInterval)jsDuration - (NSDate *)jsSchedulingTime - (BOOL)repeats - -RCT_IMPORT_METHOD -================= - - RCT_IMPORT_METHOD(RCTNativeAppEventEmitter, emit); - RCT_IMPORT_METHOD(RCTDeviceEventEmitter, emit); - RCT_IMPORT_METHOD(RCTEventEmitter, receiveEvent); - RCT_IMPORT_METHOD(AppRegistry, runApplication) - RCT_IMPORT_METHOD(ReactNative, unmountComponentAtNodeAndRemoveContainer) - RCT_IMPORT_METHOD(RCTEventEmitter, receiveTouches); - RCT_IMPORT_METHOD(RCTJSTimers, callTimers) diff --git a/src/angular_reactnative.ts b/src/angular_reactnative.ts deleted file mode 100644 index dc1d3d6..0000000 --- a/src/angular_reactnative.ts +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; - -import {tagElementMap} from "./native_element"; - -var AppRegistry = require('AppRegistry'); -var ReactNativeEventEmitter = require('ReactNativeEventEmitter'); - -// required for angular: -var parse5Adapter = require('angular2/src/dom/parse5_adapter.js'); -require('traceur/bin/traceur-runtime.js'); -require('reflect-metadata/Reflect.js'); - -require('./reactnative_zone') - -// intentionlly overriding here because this is the easiest way to intercept events from React Native -ReactNativeEventEmitter.receiveEvent = function( - tag: number, - topLevelType: string, - nativeEventParam -) { - if (!nativeEventParam.target) { - throw "Expected all events to have a target!"; - } - var element = tagElementMap[tag]; - nativeEventParam.target = element; - console.log(tag, topLevelType.toLowerCase(), nativeEventParam); - element.fireEvent(topLevelType.toLowerCase(), nativeEventParam); - // TODO: Don't call detectChanges on events that are not listened to. -} - -// intentionlly overriding here because this is the easiest way to intercept events from React Native -ReactNativeEventEmitter.receiveTouches = function( - eventTopLevelType: string, - touches: Array, - changedIndices: Array -) { - console.log(eventTopLevelType, touches, changedIndices) -}; - -import {bind, Renderer, appComponentRefToken, bootstrap} from "angular2/angular2"; -import {internalView} from 'angular2/src/core/compiler/view_ref'; -import {ReactNativeRenderer} from './renderer' - -export function reactNativeBootstrap(component, bindings = []) { - AppRegistry.registerRunnable("dist", function() { - parse5Adapter.Parse5DomAdapter.makeCurrent(); - - bootstrap(component, [ - ReactNativeRenderer, - bind(Renderer).toAlias(ReactNativeRenderer) - ].concat(bindings)) - }); -} \ No newline at end of file diff --git a/src/index.ios.ts b/src/index.ios.ts deleted file mode 100644 index 8fa132e..0000000 --- a/src/index.ios.ts +++ /dev/null @@ -1,64 +0,0 @@ -import {reactNativeBootstrap} from './angular_reactnative' -import {Component, View, Directive, NgFor} from 'angular2/angular2'; - -@Component({ - selector: 'todo-app', - hostAttributes: { - "position": "absolute", - "top": 0, - "bottom": 0, - "left": 0, - "right": 0, - "padding": 5, - "paddingTop": 15 - } -}) -@View({ - template: - "" + - "" + - "" + - "" + - "{{item.label}}" + - "" + - "", - directives: [NgFor] -}) -class TodoAppComponent { - - items = parksToVisit; - - submit(event) { - this.items.push({"label": event.text}); - event.target.setProperty("text", ""); - event.target.focus(); - } - remove(item) { - this.items.splice(this.items.indexOf(item), 1) - } -} - -var parksToVisit = [ - {"label": 'Bryce Canyon'}, - {"label": 'Crater Lake'}, - {"label": 'Death Valley'}, - {"label": 'Denali'}, - {"label": 'Everglades'}, - {"label": 'Glacier Bay'}, - {"label": 'Grand Canyon'}, - {"label": 'Grand Teton'}, - {"label": 'Great Basin'}, - {"label": 'Haleakalā'}, - {"label": 'Joshua Tree'}, - {"label": 'Kings Canyon'}, - {"label": 'Lassen Volcanic'}, - {"label": 'Mount Rainier'}, - {"label": 'Redwood'}, - {"label": 'Rocky Mountain'}, - {"label": 'Sequoia'}, - {"label": 'Yellowstone'}, - {"label": 'Zion'} -]; - - -reactNativeBootstrap(TodoAppComponent); \ No newline at end of file diff --git a/src/native_element.ts b/src/native_element.ts deleted file mode 100644 index 8f27cdd..0000000 --- a/src/native_element.ts +++ /dev/null @@ -1,307 +0,0 @@ -var NativeModules = require('NativeModules'); -var ReactNativeTagHandles = require('ReactNativeTagHandles'); - -const RCT_VIEW_NAMES = { - "actionsheet": "RCTActionSheet", - "activityindicatorview": "RCTActivityIndicatorView", - "alert": "RCTAlert", - "animationexperimental": "RCTAnimationExperimental", - "cameraroll": "RCTCameraRoll", - "data": "RCTData", - "datepicker": "RCTDatePicker", - "exceptions": "RCTExceptions", - "linking": "RCTLinking", - "map": "RCTMap", - "navigator": "RCTNavigator", - "navitem": "RCTNavItem", - "networkimageview": "RCTNetworkImageView", - "picker": "RCTPicker", - "progressview": "RCTProgressView", - "pushnotification": "RCTPushNotification", - "rawtext": "RCTRawText", - "scrollview": "RCTScrollView", - "segmentedcontrol": "RCTSegmentedControl", - "settings": "RCTSettings", - "slider": "RCTSlider", - "staticimage": "RCTStaticImage", - "statusbar": "RCTStatusBar", - "switch": "RCTSwitch", - "tabbar": "RCTTabBar", - "tabbaritem": "RCTTabBarItem", - "text": "RCTText", - "textfield": "RCTTextField", - "textview": "RCTTextView", - "ui": "RCTUI", - "view": "RCTView", - "websocket": "RCTWebSocket", - "webview": "RCTWebView" -} - -const RCT_PROPERTY_NAMES = { - "accessibilitylabel": "accessibilityLabel", - "accessibilitytraits": "accessibilityTraits", - "accessible": "accessible", - "alignitems": "alignItems", - "alignment": "alignment", - "alignself": "alignSelf", - "alwaysbouncehorizontal": "alwaysBounceHorizontal", - "alwaysbouncevertical": "alwaysBounceVertical", - "animating": "animating", - "annotations": "annotations", - "autocapitalize": "autoCapitalize", - "autocorrect": "autoCorrect", - "automaticallyadjustcontentinsets": "automaticallyAdjustContentInsets", - "backbuttonicon": "backButtonIcon", - "backbuttontitle": "backButtonTitle", - "backgroundcolor": "backgroundColor", - "badge": "badge", - "bartintcolor": "barTintColor", - "border": "border", - "borderbottomwidth": "borderBottomWidth", - "bordercolor": "borderColor", - "borderleftwidth": "borderLeftWidth", - "borderradius": "borderRadius", - "borderrightwidth": "borderRightWidth", - "bordertopwidth": "borderTopWidth", - "borderwidth": "borderWidth", - "bottom": "bottom", - "bounces": "bounces", - "bounceszoom": "bouncesZoom", - "cancancelcontenttouches": "canCancelContentTouches", - "capinsets": "capInsets", - "carethidden": "caretHidden", - "centercontent": "centerContent", - "clearbuttonmode": "clearButtonMode", - "cleartextonfocus": "clearTextOnFocus", - "color": "color", - "containerbackgroundcolor": "containerBackgroundColor", - "contentinset": "contentInset", - "contentoffset": "contentOffset", - "d": "d", - "date": "date", - "decelerationrate": "decelerationRate", - "defaultimagesrc": "defaultImageSrc", - "directionallockenabled": "directionalLockEnabled", - "disabled": "disabled", - "editable": "editable", - "enabled": "enabled", - "enablesreturnkeyautomatically": "enablesReturnKeyAutomatically", - "fill": "fill", - "flex": "flex", - "flexdirection": "flexDirection", - "flexwrap": "flexWrap", - "fontfamily": "fontFamily", - "fontsize": "fontSize", - "fontstyle": "fontStyle", - "fontweight": "fontWeight", - "frame": "frame", - "height": "height", - "hideswhenstopped": "hidesWhenStopped", - "html": "html", - "icon": "icon", - "imagetag": "imageTag", - "ishighlighted": "isHighlighted", - "items": "items", - "justifycontent": "justifyContent", - "keyboarddismissmode": "keyboardDismissMode", - "keyboardtype": "keyboardType", - "left": "left", - "leftbuttonicon": "leftButtonIcon", - "leftbuttontitle": "leftButtonTitle", - "legallabelinsets": "legalLabelInsets", - "letterspacing": "letterSpacing", - "lineheight": "lineHeight", - "margin": "margin", - "marginbottom": "marginBottom", - "marginhorizontal": "marginHorizontal", - "marginleft": "marginLeft", - "marginright": "marginRight", - "margintop": "marginTop", - "marginvertical": "marginVertical", - "maxdelta": "maxDelta", - "maximumdate": "maximumDate", - "maximumtracktintcolor": "maximumTrackTintColor", - "maximumvalue": "maximumValue", - "maximumzoomscale": "maximumZoomScale", - "mindelta": "minDelta", - "minimumdate": "minimumDate", - "minimumtracktintcolor": "minimumTrackTintColor", - "minimumvalue": "minimumValue", - "minimumzoomscale": "minimumZoomScale", - "minuteinterval": "minuteInterval", - "mode": "mode", - "momentary": "momentary", - "mycustomproperty": "myCustomProperty", - "name": "name", - "navigationbarhidden": "navigationBarHidden", - "numberoflines": "numberOfLines", - "oldname": "oldName", - "onaccessibilitytap": "onAccessibilityTap", - "onlayout": "onLayout", - "onmagictap": "onMagicTap", - "ontintcolor": "onTintColor", - "opacity": "opacity", - "overflow": "overflow", - "padding": "padding", - "paddingbottom": "paddingBottom", - "paddinghorizontal": "paddingHorizontal", - "paddingleft": "paddingLeft", - "paddingright": "paddingRight", - "paddingtop": "paddingTop", - "paddingvertical": "paddingVertical", - "pagingenabled": "pagingEnabled", - "password": "password", - "pitchenabled": "pitchEnabled", - "placeholder": "placeholder", - "placeholdertextcolor": "placeholderTextColor", - "pointerevents": "pointerEvents", - "position": "position", - "progress": "progress", - "progressimage": "progressImage", - "progresstintcolor": "progressTintColor", - "progressviewstyle": "progressViewStyle", - "region": "region", - "removeclippedsubviews": "removeClippedSubviews", - "requestedtopofstack": "requestedTopOfStack", - "resizemode": "resizeMode", - "returnkeytype": "returnKeyType", - "right": "right", - "rightbuttonicon": "rightButtonIcon", - "rightbuttontitle": "rightButtonTitle", - "rotateenabled": "rotateEnabled", - "scrollenabled": "scrollEnabled", - "scrolleventthrottle": "scrollEventThrottle", - "scrollindicatorinsets": "scrollIndicatorInsets", - "scrollstotop": "scrollsToTop", - "securetextentry": "secureTextEntry", - "selected": "selected", - "selectedicon": "selectedIcon", - "selectedindex": "selectedIndex", - "selecttextonfocus": "selectTextOnFocus", - "shadowcolor": "shadowColor", - "shadowoffset": "shadowOffset", - "shadowopacity": "shadowOpacity", - "shadowradius": "shadowRadius", - "shouldinjectajaxhandler": "shouldInjectAJAXHandler", - "showshorizontalscrollindicator": "showsHorizontalScrollIndicator", - "showsuserlocation": "showsUserLocation", - "showsverticalscrollindicator": "showsVerticalScrollIndicator", - "size": "size", - "src": "src", - "stickyheaderindices": "stickyHeaderIndices", - "stroke": "stroke", - "strokecap": "strokeCap", - "strokedash": "strokeDash", - "strokejoin": "strokeJoin", - "strokewidth": "strokeWidth", - "testid": "testID", - "text": "text", - "textalign": "textAlign", - "throttlescrollcallbackms": "throttleScrollCallbackMS", - "thumbtintcolor": "thumbTintColor", - "timezoneoffsetinminutes": "timeZoneOffsetInMinutes", - "tintcolor": "tintColor", - "title": "title", - "titletextcolor": "titleTextColor", - "top": "top", - "trackimage": "trackImage", - "tracktintcolor": "trackTintColor", - "transform": "transform", - "transformmatrix": "transformMatrix", - "url": "url", - "value": "value", - "values": "values", - "width": "width", - "writingdirection": "writingDirection", - "zoomenabled": "zoomEnabled", - "zoomscale": "zoomScale", -} - -export var tagElementMap = {}; - -export class ReactNativeElement { - tag; - viewName; - parent: ReactNativeElement; - children:Array = []; - listenerCallback = (name, event) => {}; - //Keeping track of native properties so that we can re-create - //the element when re-attaching it. - props = {}; - _created = false; - constructor(viewName: string, properties = {}) { - var nativeViewName = RCT_VIEW_NAMES[viewName]; - if (nativeViewName == undefined) { - console.log("%cNode viewName invalid: " + viewName + ". defaulting to RCTView", "background: #FFFF00"); - nativeViewName = RCT_VIEW_NAMES["view"]; - } - this.viewName = nativeViewName; - - this.tag = ReactNativeTagHandles.allocateTag(); - - this._mergeInProps(properties); - - this._createIfNeeded(); - tagElementMap[this.tag] = this; - } - - insertChildAtIndex(node: ReactNativeElement, index: number) { - this.children.splice(index, 0, node); - node.parent = this; - node._createIfNeeded(); - NativeModules.UIManager.manageChildren(this.tag, null, null, [node.tag], [index], null); - } - - removeAtIndex(index: number) { - var removedElement = this.children.splice(index, 1)[0]; - NativeModules.UIManager.manageChildren(this.tag, null, null, null, null, [index]) - removedElement.parent = null; - removedElement._destroy(); - } - - setProperty(prop, value) { - this.props[RCT_PROPERTY_NAMES[prop] || prop] = value; - NativeModules.UIManager.updateView(this.tag, this.viewName, this.props); - } - - attachToNative() { - NativeModules.UIManager.manageChildren(1, null, null, [this.tag], [0], null); - } - - focus() { - NativeModules.UIManager.focus(this.tag); - } - - setEventListener(listener) { - this.listenerCallback = listener; - } - - fireEvent(name, event) { - this.listenerCallback(name, event); - } - - _mergeInProps(properties) { - for (var i in properties) { - this.props[RCT_PROPERTY_NAMES[i] || i] = properties[i]; - } - } - - _createIfNeeded() { - if (!this._created) { - NativeModules.UIManager.createView(this.tag, this.viewName, this.props); - for (var i = 0; i < this.children.length; i++) { - var node = this.children[i]; - node._createIfNeeded(); - NativeModules.UIManager.manageChildren(this.tag, null, null, [node.tag], [i], null); - } - this._created = true; - } - } - - _destroy() { - this._created = false; - for (var i = 0; i < this.children.length; i++) { - this.children[i]._destroy(); - } - } -} \ No newline at end of file diff --git a/src/package.json b/src/package.json deleted file mode 100644 index f9c0e7e..0000000 --- a/src/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "dist", - "version": "0.0.1", - "private": true, - "scripts": { - "start": "node_modules/react-native/packager/packager.sh" - }, - "dependencies": { - "angular2": "^2.0.0-alpha.25", - "css": "^2.2.0", - "parse5": "^1.4.2", - "react-native": "^0.6.0-rc", - "reflect-metadata": "^0.1.0", - "rtts_assert": "^2.0.0-alpha.25", - "rx": "^2.5.3", - "traceur": "0.0.89", - "url": "^0.10.3", - "zone.js": "^0.5.0" - } -} diff --git a/src/reactnative_zone.ts b/src/reactnative_zone.ts deleted file mode 100644 index 55dabf6..0000000 --- a/src/reactnative_zone.ts +++ /dev/null @@ -1,7 +0,0 @@ -import ReactNativePatch from "./reactnative_zone_patch" - -var core = require('zone.js/lib/core.js'); - -var zone = global.zone = new core.Zone() - -ReactNativePatch.apply(); \ No newline at end of file diff --git a/src/reactnative_zone_patch.ts b/src/reactnative_zone_patch.ts deleted file mode 100644 index 57cce98..0000000 --- a/src/reactnative_zone_patch.ts +++ /dev/null @@ -1,16 +0,0 @@ - - -var patchSetClearFunction = require('zone.js/lib/patch/functions').patchSetClearFunction; -var patchSetFunction = require('zone.js/lib/patch/functions').patchSetFunction; -var promisePatch = require('zone.js/lib/patch/promise'); - -function apply() { - patchSetClearFunction(global, ['timeout', 'interval', 'immediate']); - patchSetFunction(global, ['requestAnimationFrame']); - - promisePatch.apply(); -} - -export default { - apply: apply -} \ No newline at end of file diff --git a/src/renderer.ts b/src/renderer.ts deleted file mode 100644 index eed0eb0..0000000 --- a/src/renderer.ts +++ /dev/null @@ -1,191 +0,0 @@ -import {MapWrapper} from 'angular2/src/facade/collection'; -import {DomProtoView, resolveInternalDomProtoView} from 'angular2/src/render/dom/view/proto_view'; -import {Renderer, RenderProtoViewRef, RenderViewRef, EventDispatcher} from 'angular2/src/render/api'; -import {NG_BINDING_CLASS} from 'angular2/src/render/dom/util'; -import {DOM} from 'angular2/src/dom/dom_adapter'; - -import {resolveInternalReactNativeView, ReactNativeViewRef, ReactNativeView} from './view'; -import {ReactNativeElement} from './native_element'; - -//Taken from a search of react-native for file names that match: /(RCT[^/]*)Manager\.m - -export class ReactNativeRenderer extends Renderer { - - constructor() { - super(); - console.log("constructor", arguments); - } - - createRootHostView(hostProtoViewRef: RenderProtoViewRef): RenderViewRef { - console.log("createRootHostView", arguments); - var hostProtoView = resolveInternalDomProtoView(hostProtoViewRef); - return new ReactNativeViewRef(this._createView(hostProtoView, true)); - } - detachFreeHostView(parentHostViewRef: RenderViewRef, hostViewRef: RenderViewRef) { - console.log("detachFreeHostView", arguments); - } - - createView(protoViewRef: RenderProtoViewRef): RenderViewRef { - console.log("createView", arguments); - var protoView = resolveInternalDomProtoView(protoViewRef); - return new ReactNativeViewRef(this._createView(protoView)); - } - - destroyView(viewRef: RenderViewRef) { - console.log("destroyView", arguments); - } - - attachComponentView(hostViewRef: RenderViewRef, elementIndex: number, - componentViewRef: RenderViewRef) { - console.log("attachComponentView", arguments); - var hostView = resolveInternalReactNativeView(hostViewRef); - var componentView = resolveInternalReactNativeView(componentViewRef); - var parent = hostView.boundElements[elementIndex]; - var children = componentView.rootChildElements; - for (var i = 0; i < children.length; i++) { - var child = children[i]; - parent.insertChildAtIndex(child, i); - } - } - - detachComponentView(hostViewRef: RenderViewRef, boundElementIndex: number, componentViewRef: RenderViewRef) { - console.log("detachComponentView", arguments); - } - - attachViewInContainer(parentViewRef: RenderViewRef, boundElementIndex: number, atIndex: number, viewRef: RenderViewRef) { - console.log("attachViewInContainer", arguments); - var parentView = resolveInternalReactNativeView(parentViewRef); - var view = resolveInternalReactNativeView(viewRef); - var siblingElement = parentView.boundElements[boundElementIndex]; - var siblingIndex = siblingElement.parent.children.indexOf(siblingElement); - var desiredIndex = (siblingIndex + 1) + atIndex; - if (view.rootChildElements.length != 1) { - console.log("%cExpected one element, got " + view.rootChildElements.length, "color: #FF0000"); - } - var elementToInsert = view.rootChildElements[0]; - siblingElement.parent.insertChildAtIndex(elementToInsert, desiredIndex); - } - - detachViewInContainer(parentViewRef: RenderViewRef, boundElementIndex: number, atIndex: number, viewRef: RenderViewRef) { - console.log("detachViewInContainer", arguments); - var parentView = resolveInternalReactNativeView(parentViewRef); - var view = resolveInternalReactNativeView(viewRef); - var siblingElement = parentView.boundElements[boundElementIndex]; - var siblingIndex = siblingElement.parent.children.indexOf(siblingElement); - var desiredIndex = (siblingIndex + 1) + atIndex; - siblingElement.parent.removeAtIndex(desiredIndex); - } - - hydrateView(viewRef: RenderViewRef) { - console.log("hydrateView", arguments); - var view = resolveInternalReactNativeView(viewRef); - if (view.hydrated) throw 'The view is already hydrated.'; - view.hydrated = true; - //TODO: actually hydrate anything. - } - - dehydrateView(viewRef: RenderViewRef) { - console.log("dehydrateView", arguments); - var view = resolveInternalReactNativeView(viewRef); - view.hydrated = false; - //TODO: actually dehydrate anything. - } - - setElementProperty(viewRef: RenderViewRef, elementIndex: number, propertyName: string, propertyValue: any) { - console.log("setElementProperty", arguments); - var view = resolveInternalReactNativeView(viewRef); - var element = view.boundElements[elementIndex]; - element.setProperty(propertyName, propertyValue); - } - - callAction(viewRef: RenderViewRef, elementIndex: number, actionExpression: string, actionArgs: any) { - console.log("callAction", arguments); - } - - setText(viewRef: RenderViewRef, textNodeIndex: number, text: string) { - console.log("setText", arguments); - var view = resolveInternalReactNativeView(viewRef); - view.boundTextNodes[textNodeIndex].setProperty("text", text); - } - - setEventDispatcher(viewRef: RenderViewRef, dispatcher: EventDispatcher) { - console.log("setEventDispatcher", arguments); - var view = resolveInternalReactNativeView(viewRef); - view.eventDispatcher = dispatcher; - } - - _createView(proto: DomProtoView, isRoot = false): ReactNativeView { - console.log(proto); - var nativeElements; - var boundElements = []; - if (proto.element.name == "template") { - nativeElements = this._dfsAndCreateNativeElements(proto.element.children[0].children, boundElements); - } else { - nativeElements = this._dfsAndCreateNativeElements([proto.element], boundElements); - } - - if (isRoot) { - nativeElements[0].attachToNative(); - } - var boundTextNodes = this._createBoundTextNodes(proto, boundElements); - var view = new ReactNativeView(proto, nativeElements, boundElements, boundTextNodes); - - for (var i = 0; i < view.boundElements.length; i++) { - this._initElementEventListener(i, view.boundElements[i], view); - } - - return view; - } - - _dfsAndCreateNativeElements(childrenParam, boundElements) { - var resultingNativeChildren = []; - for (var i = 0; i < childrenParam.length; i++) { - var node = childrenParam[i]; - var nativeElement; - if (node.type == "tag") { - nativeElement = new ReactNativeElement(node.name, node.attribs); - } else if (node.type == "text") { - nativeElement = new ReactNativeElement("rawtext", {text:node.data}); - } - - if (DOM.hasClass(node, NG_BINDING_CLASS)) { - boundElements.push(nativeElement); - } - - //create and then attach children - if (node.children && node.name != "template") { - var children = this._dfsAndCreateNativeElements(node.children, boundElements); - for (var j = 0; j < children.length; j++) { - var child = children[j]; - nativeElement.insertChildAtIndex(child, j); - } - } - resultingNativeChildren.push(nativeElement) - } - return resultingNativeChildren; - } - - _initElementEventListener(bindingIndex: number, element: ReactNativeElement, view: ReactNativeView) { - element.setEventListener(global.zone.bind(function(name, event) { - var locals = MapWrapper.create(); - MapWrapper.set(locals, '$event', event); - view.eventDispatcher.dispatchEvent(bindingIndex, name, locals); - console.log("%cEvent dispatched: ", "color: #22dd22", name, locals); - })); - } - - _createBoundTextNodes(proto: DomProtoView, boundElements) { - //expecting boundElements to already be filled out, and be an array of ReactNativeElements - var boundTextNodes = []; - var elementBinders = proto.elementBinders; - for (var i = 0; i < elementBinders.length; i++) { - var indicies = elementBinders[i].textNodeIndices; - var nativeNodes = boundElements[i].children; - for (var j = 0; j < indicies.length; j++) { - var index = indicies[j]; - boundTextNodes.push(nativeNodes[index]); - } - } - return boundTextNodes; - } -} \ No newline at end of file diff --git a/src/tsconfig.json b/src/tsconfig.json deleted file mode 100644 index 8b6eb72..0000000 --- a/src/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "emitDecoratorMetadata": true, - "declaration": true, - "module": "commonjs", - "rootDir": ".", - "sourceMap": true, - "sourceRoot": ".", - "target": "ES5", - "outDir": "../dist" - } -} diff --git a/src/view.ts b/src/view.ts deleted file mode 100644 index da59bf9..0000000 --- a/src/view.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {DomProtoView} from 'angular2/src/render/dom/view/proto_view'; -import {RenderViewRef, EventDispatcher} from 'angular2/src/render/api'; -import {NG_BINDING_CLASS} from 'angular2/src/render/dom/util'; -import {ReactNativeElement} from './native_element'; - -export function resolveInternalReactNativeView(viewRef: RenderViewRef) { - return (viewRef)._view; -} - -export class ReactNativeViewRef extends RenderViewRef { - _view: ReactNativeView; - constructor(view: ReactNativeView) { - super(); - this._view = view; - } -} - -export class ReactNativeView { - hydrated: boolean; - eventDispatcher: EventDispatcher; - - renderTree; - - constructor(public proto: DomProtoView, public rootChildElements, public boundElements: Array, public boundTextNodes) { - this.hydrated = false; - } -} \ No newline at end of file