├── .gitattributes
├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── DOCUMENTATION.md
├── LICENSE
├── README.md
├── SETUP.md
├── android
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── reactlibrary
│ ├── RNReactArkitModule.java
│ └── RNReactArkitPackage.java
├── index.js
├── ios
├── Foundation
│ ├── ARKitDelegate.swift
│ ├── RNReactArkit-Bridging-Header.h
│ ├── RNReactArkit.h
│ ├── RNReactArkit.m
│ └── SCNNode+Reactive.swift
├── RNReactArkit.podspec
├── RNReactArkit.xcodeproj
│ └── project.pbxproj
└── Views
│ ├── ARBoxNodeView.swift
│ ├── ARBoxNodeViewManager.m
│ ├── ARNodeView.swift
│ ├── ARNodeViewManager.m
│ ├── ARSceneView.swift
│ ├── ARSceneViewManager.m
│ ├── ARSphereNodeView.swift
│ ├── ARSphereNodeViewManager.m
│ ├── ARTextNodeView.swift
│ ├── ARTextNodeViewManager.m
│ ├── RCTNodeViewManager.h
│ └── RCTNodeViewManager.m
├── package.json
└── windows
├── .gitignore
├── RNReactArkit.sln
└── RNReactArkit
├── Properties
├── AssemblyInfo.cs
└── RNReactArkit.rd.xml
├── RNReactArkit.csproj
├── RNReactArkitModule.cs
├── RNReactArkitPackage.cs
└── project.json
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.pbxproj -text
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # OSX
3 | #
4 | .DS_Store
5 |
6 | # node.js
7 | #
8 | node_modules/
9 | npm-debug.log
10 | yarn-error.log
11 |
12 |
13 | # Xcode
14 | #
15 | build/
16 | *.pbxuser
17 | !default.pbxuser
18 | *.mode1v3
19 | !default.mode1v3
20 | *.mode2v3
21 | !default.mode2v3
22 | *.perspectivev3
23 | !default.perspectivev3
24 | xcuserdata
25 | *.xccheckout
26 | *.moved-aside
27 | DerivedData
28 | *.hmap
29 | *.ipa
30 | *.xcuserstate
31 | project.xcworkspace
32 |
33 |
34 | # Android/IntelliJ
35 | #
36 | build/
37 | .idea
38 | .gradle
39 | local.properties
40 | *.iml
41 |
42 | # BUCK
43 | buck-out/
44 | \.buckd/
45 | *.keystore
46 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 |
3 | osx_image: xcode8.3
4 |
5 | install:
6 | - nvm install 7
7 | - rm -Rf "${TMPDIR}/jest_preprocess_cache"
8 | - brew install yarn --ignore-dependencies
9 | - brew install watchman
10 | - yarn install
11 |
12 | xcode_project: RNReactArkit.xcodeproj # path to your xcodeproj folder
13 | xcode_scheme: RNReactArkit
14 |
15 | matrix:
16 | - fast_finish: true # Fail the whole build as soon as one test type fails. Should help with Travis capacity issues (very long queues).
17 |
18 | # The order of these tests says which are more likely to run first and fail the whole build fast.
19 | env:
20 | - TEST_TYPE=objc-ios
21 | - TEST_TYPE=podspecs
22 |
23 | branches:
24 | only:
25 | - master
26 | - /^.*-stable$/
27 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | WIP.
--------------------------------------------------------------------------------
/DOCUMENTATION.md:
--------------------------------------------------------------------------------
1 | # React ARKit Documentation
2 |
3 |
4 |
5 | ## ARScene
6 |
7 | Parent object that represents object represents a three-dimensional scene and its contents. All the ARNodes must be wrapped around by an ARScene.
8 |
9 | ### Props
10 |
11 | | Prop | Type | Default | Description |
12 | |---|---|---|---|
13 | | `debugEnabled` | `Boolean` | `false` | Debug modes show useful information such as the feature points.
14 | | `run` | `Boolean` | `true` | Whether the session is running. Session can be paused by setting this property to false.
15 |
16 |
17 | ### Instance methods
18 |
19 | | Method Name | Arguments | Notes
20 | |---|---|---|
21 | |`onPlaneDetected`| Object
{ alignment\, center:{x,y,z}, extent: {x,y,z},node:{x,y,z}, target \ } | Returns the details when a new plane is detected |
22 | |`onPlaneUpdated`| Object
{ alignment\, center:{x,y,z}, extent: {x,y,z},node:{x,y,z}, target \ } | Returns the details when a detected plane is updated|
23 |
24 |
25 | ## ARNode
26 |
27 | A structural element of in the 3D coordinate space, representing a position and transform in based on the parent node\scene. Can also represent custom 3d models as well as basic geometric shapes.
28 |
29 | ### Props
30 |
31 | | Prop | Type | Default | Description |
32 | |---|---|---|---|
33 | | `geoposition` | `Object` | _Required_ | Position of the object in 3D space.
e.g _{x: 0.1, y: 0.1, z: -0.1}_
34 | | `color` | `String` | `#FF0000` | Color of the object in HEX.
35 | | `modelAssetPath` | `String` | _None_ | Path to the custom asset. [See details.](SETUP.md#adding-custom-models)
36 |
37 |
38 |
39 |
40 | ## ARBoxNode
41 |
42 | A structural element with *box* geometry. Very similar to ARNode but with custom size/geometry.
43 |
44 | ### Props
45 |
46 | | Prop | Type | Default | Description |
47 | |---|---|---|---|
48 | | `size` | `Object` | _Required_ | Geometry of the box node.
_{}_
49 | | `geoposition` | `Object` | _Required_ | Position of the object in 3D space.
e.g _{x: 0.1, y: 0.1, z: -0.1}_
50 | | `color` | `String` | `#FF0000` | Color of the object in HEX.
51 |
52 |
53 |
54 | ## ARSpherenode
55 |
56 | A structural element with *sphere* geometry. Very similar to ARNode but with custom size/geometry.
57 |
58 | ### Props
59 |
60 | | Prop | Type | Default | Description |
61 | |---|---|---|---|
62 | | `size` | `Object` | _Required_ | Geometry of the box node.
_{radius: 0.2}_
63 | | `geoposition` | `Object` | _Required_ | Position of the object in 3D space.
e.g _{x: 0.1, y: 0.1, z: -0.1}_
64 | | `color` | `String` | `#FF0000` | Color of the object in HEX.
65 |
66 |
67 |
68 |
69 | ## ARTextNode
70 |
71 | A structural element with Box geometry. Very similar to ARNode but with custom size/geometry.
72 |
73 | ### Props
74 |
75 | | Prop | Type | Default | Description |
76 | |---|---|---|---|
77 | | `size` | `Object` | _Required_ | Geometry of text.
_{fontSize: 0.2, depth: 0.2}_
78 | | `text` | `String` | _Required_ | Text to be displayed
79 | | `geoposition` | `Object` | _Required_ | Position of the object in 3D space.
e.g _{x: 0.1, y: 0.1, z: -0.1}_
80 | | `color` | `String` | `#FF0000` | Color of the object in HEX.
81 |
82 |
83 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Ilter
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React ARKit
2 |
3 | AR library for React-Native, based on ARKit. Makes it super easy to use all the augmented reality features of iOS 11.
4 |
5 | ##### [Check out the example app using react-arkit](https://github.com/icanb/react-arkit-example)
6 |
7 |
8 |
9 |
10 | _iOS Only, until Android comes up with their version of ARKit_
11 |
12 | [](https://www.npmjs.com/package/react-arkit)
13 | [](https://www.npmjs.com/package/react-arkit)
14 |
15 | Library for create augmented reality applications with JavaScript, using declarative UI components in ReactJS. Allows for any geometric shape, as well as custom 3D models.
16 |
17 |
18 | ## Install
19 |
20 | Install the package, inside your React-Native app:
21 |
22 | ```bash
23 | $ npm install react-arkit --save
24 | ```
25 |
26 | Link the package to the existing app
27 |
28 | ```bash
29 | react-native link react-native-arkit
30 | ```
31 |
32 | Make sure that your app allows camera usage. ([How?](https://github.com/icanb/react-arkit/blob/master/SETUP.md#camera-permissions))
33 | Make sure that your app supports Swift runtime. ([How?](https://github.com/icanb/react-arkit/blob/master/SETUP.md#making-the-project-swift-compatible))
34 |
35 | Or just clone the [example app](https://github.com/icanb/react-arkit-example) and make edits on it.
36 |
37 | ## Usage
38 |
39 | Import the ``ARScene`` component, and other node types that you need:
40 |
41 | ```javascript
42 | import ARScene, { ARBoxNode, ARTextNode, ARNode } from 'react-arkit';
43 | ```
44 |
45 | Define a scene:
46 |
47 | ```javascript
48 |
49 | {`Other AR nodes`}
50 |
51 | ```
52 |
53 | Add any node in it and manipulate freely:
54 |
55 | ```javascript
56 | {
59 | console.log("Detected plane:", id);
60 | }}
61 | onPlaneUpdated={({id, alignment, node, center, extent}) => {
62 | console.log("Updated plane:", id);
63 | }}>
64 |
71 |
74 |
79 |
80 | ```
81 |
82 | Refer to the [example app](https://github.com/icanb/react-arkit-example/blob/master/index.ios.js) for more detailed sample implementations.
83 |
84 | ## [Documentation](DOCUMENTATION.md)
85 |
86 |
87 | * #### [ARScene](DOCUMENTATION.md#arscene)
88 | Parent object that represents object represents a three-dimensional scene and its contents. (Props: `debugEnabled`, `run`)
89 |
90 | * #### [ARNode](DOCUMENTATION.md#arnode)
91 | A structural element of in the 3D coordinate space, representing a position and transform in based on the parent node\scene. Can also represent custom 3d models as well as basic geometric shapes. (Props: `geoposition`, `size`, `color`, `modelAssetPath`)
92 |
93 | * ##### [ARBoxNode](DOCUMENTATION.md#arboxnode)
94 | Node that has the box geometry. Subclass of ARNode.
95 |
96 | * ##### [ARSphereNode](DOCUMENTATION.md#arspherenode)
97 | Node that has the sphere geometry. Subclass of ARNode.
98 |
99 | * ##### [ARTextNode](DOCUMENTATION.md#artextnode)
100 | Node that has the shape of a given text. Subclass of ARNode. (Additional prop: `text`)
101 |
102 |
103 | ## Contributing
104 |
105 | Any kind of contributions are very welcome. This library is still very bare-bones and has a lot of room for improvement. Please make sure to read the [Contributing Guide](CONTRIBUTING.md) and feel free to make pull-requests!
106 |
107 | For issues or feedback, please create an [Issue](https://github.com/icanb/react-arkit/issues/new). For questions, or help, please get in touch with @icanb.
108 |
--------------------------------------------------------------------------------
/SETUP.md:
--------------------------------------------------------------------------------
1 |
2 | # React ARKit SETUP
3 |
4 | ## Getting started
5 |
6 | `$ npm install react-native-react-arkit --save`
7 |
8 | ### Mostly automatic installation
9 |
10 | `$ react-native link react-native-react-arkit`
11 |
12 | ### Manual installation
13 |
14 |
15 | #### iOS
16 |
17 | 1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
18 | 2. Go to `node_modules` ➜ `react-native-react-arkit` and add `RNReactArkit.xcodeproj`
19 | 3. In XCode, in the project navigator, select your project. Add `libRNReactArkit.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
20 | 4. Run your project (`Cmd+R`)<
21 |
22 |
23 | ## Configuring iOS Platform
24 |
25 | ie. How to deal with Xcode stuff...
26 |
27 | ### Camera Permissions
28 |
29 | For our app to be able to launch the AR Scene, we need to ask the user for the permission to the phone camera. Before starting the following steps, launch your project on Xcode.
30 |
31 | You can do this by, doing the following within the root of your project directory
32 | ```bash
33 | open ios/.xcodeproj/
34 | ```
35 |
36 | Once the project is open on Xcode, find the `Info.plist` file:
37 |
38 |
39 |
40 | Click on one of the `+` signs that appear when you hover over a row. Add `Privacy - Camera Usage Description` as the key, and `This application will use the camera for Augmented Reality.` as the value.
41 |
42 |
43 |
44 | You should be good to go!
45 |
46 | ### Making the project Swift compatible
47 |
48 | Since React-Native apps are by default Obj-c apps, we need to tell Xcode what Swift compiler to use for our Swift files. The easiest way to do this is to simply add a blank `.swift` file into the project.
49 |
50 | `File > New > File... >`
51 |
52 | This prompt should show up:
53 |
54 |
55 |
56 | Make sure Swift File is selected. Press Next. Give the file an arbitrary name, or keep the default `File.swift`. In the next prompt you can choose not to create the Bridging Header file.
57 |
58 | That's it!
59 |
60 |
61 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.1'
9 | }
10 | }
11 |
12 | apply plugin: 'com.android.library'
13 |
14 | android {
15 | compileSdkVersion 23
16 | buildToolsVersion "23.0.1"
17 |
18 | defaultConfig {
19 | minSdkVersion 16
20 | targetSdkVersion 22
21 | versionCode 1
22 | versionName "1.0"
23 | }
24 | lintOptions {
25 | abortOnError false
26 | }
27 | }
28 |
29 | repositories {
30 | mavenCentral()
31 | }
32 |
33 | dependencies {
34 | compile 'com.facebook.react:react-native:+'
35 | }
36 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android/src/main/java/com/reactlibrary/RNReactArkitModule.java:
--------------------------------------------------------------------------------
1 |
2 | package com.reactlibrary;
3 |
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
6 | import com.facebook.react.bridge.ReactMethod;
7 | import com.facebook.react.bridge.Callback;
8 |
9 | public class RNReactArkitModule extends ReactContextBaseJavaModule {
10 |
11 | private final ReactApplicationContext reactContext;
12 |
13 | public RNReactArkitModule(ReactApplicationContext reactContext) {
14 | super(reactContext);
15 | this.reactContext = reactContext;
16 | }
17 |
18 | @Override
19 | public String getName() {
20 | return "RNReactArkit";
21 | }
22 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/reactlibrary/RNReactArkitPackage.java:
--------------------------------------------------------------------------------
1 |
2 | package com.reactlibrary;
3 |
4 | import java.util.Arrays;
5 | import java.util.Collections;
6 | import java.util.List;
7 |
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.react.bridge.NativeModule;
10 | import com.facebook.react.bridge.ReactApplicationContext;
11 | import com.facebook.react.uimanager.ViewManager;
12 | import com.facebook.react.bridge.JavaScriptModule;
13 | public class RNReactArkitPackage implements ReactPackage {
14 | @Override
15 | public List createNativeModules(ReactApplicationContext reactContext) {
16 | return Arrays.asList(new RNReactArkitModule(reactContext));
17 | }
18 |
19 | @Override
20 | public List> createJSModules() {
21 | return Collections.emptyList();
22 | }
23 |
24 | @Override
25 | public List createViewManagers(ReactApplicationContext reactContext) {
26 | return Collections.emptyList();
27 | }
28 | }
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | import { requireNativeComponent } from 'react-native';
2 | import React, { PropTypes } from 'react';
3 |
4 | var ARSceneView = requireNativeComponent('ARSceneView', ARSceneView);
5 | var ARNodeView = requireNativeComponent('ARNodeView', ARNode);
6 | var ARBoxNodeVew = requireNativeComponent('ARBoxNodeView', ARBoxNodeVew);
7 | var ARSphereNodeView = requireNativeComponent('ARSphereNodeView', ARSphereNodeView);
8 | var ARTextNodeView = requireNativeComponent('ARTextNodeView', ARTextNodeView);
9 |
10 |
11 | class ARScene extends React.Component {
12 | constructor(props) {
13 | super(props)
14 | this._onPlaneDetected = this._onPlaneDetected.bind(this);
15 | this._onPlaneUpdated = this._onPlaneUpdated.bind(this);
16 | }
17 |
18 | _onPlaneDetected(event) {
19 | if (!this.props.onPlaneDetected) { return; }
20 | this.props.onPlaneDetected(event.nativeEvent);
21 | }
22 |
23 | _onPlaneUpdated(event) {
24 | if (!this.props.onPlaneUpdated) { return; }
25 | this.props.onPlaneUpdated(event.nativeEvent);
26 | }
27 |
28 | render() {
29 | return ;
33 | }
34 | }
35 |
36 | class ARNode extends React.Component {
37 | render() {
38 | return ;
39 | }
40 | }
41 |
42 | class ARBoxNode extends React.Component {
43 | render() {
44 | return ;
45 | }
46 | }
47 |
48 | class ARSphereNode extends React.Component {
49 | render() {
50 | return ;
51 | }
52 | }
53 |
54 | class ARTextNode extends React.Component {
55 | render() {
56 | return ;
57 | }
58 | }
59 |
60 |
61 | ARScene.propTypes = {
62 | debugEnabled: PropTypes.bool,
63 | run: PropTypes.bool,
64 | onPlaneDetected: PropTypes.func,
65 | onPlaneUpdated: PropTypes.func
66 | };
67 |
68 | ARNode.propTypes = {
69 | modelUrl: PropTypes.string,
70 | size: PropTypes.object,
71 | geoposition: PropTypes.object,
72 | color: PropTypes.string
73 | }
74 |
75 | ARBoxNode.propTypes = {
76 | size: PropTypes.object,
77 | color: PropTypes.string,
78 | geoposition: PropTypes.object
79 | }
80 |
81 | ARSphereNode.propTypes = {
82 | size: PropTypes.object,
83 | color: PropTypes.string,
84 | geoposition: PropTypes.object
85 | }
86 |
87 | ARTextNode.propTypes = {
88 | size: PropTypes.object,
89 | color: PropTypes.string,
90 | geoposition: PropTypes.object,
91 | text: PropTypes.string.isRequired,
92 | font: PropTypes.string
93 | }
94 |
95 |
96 | export default ARScene;
97 | export { ARNode, ARBoxNode, ARSphereNode, ARTextNode };
98 |
--------------------------------------------------------------------------------
/ios/Foundation/ARKitDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ARKitDelegate.swift
3 | // RNReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/7/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import ARKit
11 |
12 | class ARKitDelegate: NSObject, ARSCNViewDelegate, ARSessionDelegate {
13 |
14 | func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
15 | print("YO")
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ios/Foundation/RNReactArkit-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | //
2 | // Use this file to import your target's public headers that you would like to expose to Swift.
3 | //
4 |
5 | #import
6 | #import
7 |
--------------------------------------------------------------------------------
/ios/Foundation/RNReactArkit.h:
--------------------------------------------------------------------------------
1 |
2 | #if __has_include("RCTBridgeModule.h")
3 | #import "RCTBridgeModule.h"
4 | #else
5 | #import
6 | #endif
7 |
8 | @interface RNReactArkit : NSObject
9 |
10 | @end
11 |
--------------------------------------------------------------------------------
/ios/Foundation/RNReactArkit.m:
--------------------------------------------------------------------------------
1 |
2 | #import "RNReactArkit.h"
3 |
4 | @implementation RNReactArkit
5 |
6 | - (dispatch_queue_t)methodQueue
7 | {
8 | return dispatch_get_main_queue();
9 | }
10 | RCT_EXPORT_MODULE()
11 |
12 | @end
13 |
14 |
--------------------------------------------------------------------------------
/ios/Foundation/SCNNode+Reactive.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SCNNode+Reactive.swift
3 | // RNReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/9/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import ARKit
11 | import ObjectiveC
12 |
13 | extension SCNNode {
14 |
15 | func isReactRootView() -> Bool {
16 | return self.reactTag.intValue % 10 == 1
17 | }
18 |
19 | private struct AssociatedKeys {
20 | static var keyForReactTag = "keyForReactTag"
21 | }
22 |
23 | var reactTag: NSNumber {
24 | get {
25 | return objc_getAssociatedObject(self, &AssociatedKeys.keyForReactTag) as! NSNumber
26 | }
27 | set {
28 | objc_setAssociatedObject(self, &AssociatedKeys.keyForReactTag, newValue, .OBJC_ASSOCIATION_RETAIN)
29 | }
30 | }
31 |
32 | // Need to mock React Native's UIView (see: UIView+Reach.h) extensions
33 | // here in order to let layout engine treat these SCNNodes the same way
34 | func _reactSubviews() -> NSArray { return []; }
35 | func reactSubviews() -> NSArray { return []; }
36 |
37 | func setMultipleTouchEnabled(_ isTouchEnabled: Bool) { }
38 | func setUserInteractionEnabled(_ isUserIntercactionEnabled: Bool) { }
39 | func layer() -> CALayer? { return nil }
40 | func _DEBUG_reactShadowView() -> Any? { return nil }
41 | func reactLayoutDirection() -> UIUserInterfaceLayoutDirection { return UIUserInterfaceLayoutDirection.leftToRight; }
42 | func _DEBUG_setReactShadowView(_ shadowView:Any) { }
43 | func setReactLayoutDirection(_ layoutDirection: UIUserInterfaceLayoutDirection) {}
44 | func reactSetFrame(_ frame: CGRect) { }
45 | func reactSetInheritedBackgroundColor(_ inheritedBackgroundColor: UIColor) { }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/ios/RNReactArkit.podspec:
--------------------------------------------------------------------------------
1 |
2 | Pod::Spec.new do |s|
3 | s.name = "RNReactArkit"
4 | s.version = "1.0.0"
5 | s.summary = "RNReactArkit"
6 | s.description = <<-DESC
7 | RNReactArkit
8 | DESC
9 | s.homepage = ""
10 | s.license = "MIT"
11 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" }
12 | s.author = { "author" => "author@domain.cn" }
13 | s.platform = :ios, "7.0"
14 | s.source = { :git => "https://github.com/author/RNReactArkit.git", :tag => "master" }
15 | s.source_files = "RNReactArkit/**/*.{h,m}"
16 | s.requires_arc = true
17 |
18 |
19 | s.dependency "React"
20 | #s.dependency "others"
21 |
22 | end
23 |
24 |
--------------------------------------------------------------------------------
/ios/RNReactArkit.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | B3E7B58A1CC2AC0600A0062D /* RNReactArkit.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNReactArkit.m */; };
11 | CE0694CC1F3B756400B114CB /* ARBoxNodeViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C71F3B756400B114CB /* ARBoxNodeViewManager.m */; };
12 | CE0694CD1F3B756400B114CB /* ARSceneView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C21F3B756300B114CB /* ARSceneView.swift */; };
13 | CE0694CE1F3B756400B114CB /* ARSphereNodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C41F3B756400B114CB /* ARSphereNodeView.swift */; };
14 | CE0694CF1F3B756400B114CB /* ARBoxNodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0694CA1F3B756400B114CB /* ARBoxNodeView.swift */; };
15 | CE0694D01F3B756400B114CB /* ARKitDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C11F3B756300B114CB /* ARKitDelegate.swift */; };
16 | CE0694D11F3B756400B114CB /* ARNodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C91F3B756400B114CB /* ARNodeView.swift */; };
17 | CE0694D21F3B756400B114CB /* ARSphereNodeViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C01F3B756300B114CB /* ARSphereNodeViewManager.m */; };
18 | CE0694D31F3B756400B114CB /* ARNodeViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0694CB1F3B756400B114CB /* ARNodeViewManager.m */; };
19 | CE0694D41F3B756400B114CB /* ARSceneViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C51F3B756400B114CB /* ARSceneViewManager.m */; };
20 | CE0694D51F3B756400B114CB /* SCNNode+Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0694BF1F3B756300B114CB /* SCNNode+Reactive.swift */; };
21 | CE0694D61F3B756400B114CB /* RCTNodeViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CE0694C61F3B756400B114CB /* RCTNodeViewManager.m */; };
22 | CE54A1ED1F3D94DD004C5A8F /* ARTextNodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE54A1EC1F3D94DD004C5A8F /* ARTextNodeView.swift */; };
23 | CE54A1EF1F3D94EF004C5A8F /* ARTextNodeViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CE54A1EE1F3D94EF004C5A8F /* ARTextNodeViewManager.m */; };
24 | /* End PBXBuildFile section */
25 |
26 | /* Begin PBXCopyFilesBuildPhase section */
27 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
28 | isa = PBXCopyFilesBuildPhase;
29 | buildActionMask = 2147483647;
30 | dstPath = "include/$(PRODUCT_NAME)";
31 | dstSubfolderSpec = 16;
32 | files = (
33 | );
34 | runOnlyForDeploymentPostprocessing = 0;
35 | };
36 | /* End PBXCopyFilesBuildPhase section */
37 |
38 | /* Begin PBXFileReference section */
39 | 134814201AA4EA6300B7C361 /* libRNReactArkit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNReactArkit.a; sourceTree = BUILT_PRODUCTS_DIR; };
40 | B3E7B5881CC2AC0600A0062D /* RNReactArkit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNReactArkit.h; sourceTree = ""; };
41 | B3E7B5891CC2AC0600A0062D /* RNReactArkit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNReactArkit.m; sourceTree = ""; };
42 | CE0694BE1F3B756300B114CB /* RNReactArkit-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNReactArkit-Bridging-Header.h"; sourceTree = ""; };
43 | CE0694BF1F3B756300B114CB /* SCNNode+Reactive.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SCNNode+Reactive.swift"; sourceTree = ""; };
44 | CE0694C01F3B756300B114CB /* ARSphereNodeViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARSphereNodeViewManager.m; sourceTree = ""; };
45 | CE0694C11F3B756300B114CB /* ARKitDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARKitDelegate.swift; sourceTree = ""; };
46 | CE0694C21F3B756300B114CB /* ARSceneView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARSceneView.swift; sourceTree = ""; };
47 | CE0694C31F3B756400B114CB /* RCTNodeViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTNodeViewManager.h; sourceTree = ""; };
48 | CE0694C41F3B756400B114CB /* ARSphereNodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARSphereNodeView.swift; sourceTree = ""; };
49 | CE0694C51F3B756400B114CB /* ARSceneViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARSceneViewManager.m; sourceTree = ""; };
50 | CE0694C61F3B756400B114CB /* RCTNodeViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTNodeViewManager.m; sourceTree = ""; };
51 | CE0694C71F3B756400B114CB /* ARBoxNodeViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARBoxNodeViewManager.m; sourceTree = ""; };
52 | CE0694C91F3B756400B114CB /* ARNodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARNodeView.swift; sourceTree = ""; };
53 | CE0694CA1F3B756400B114CB /* ARBoxNodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARBoxNodeView.swift; sourceTree = ""; };
54 | CE0694CB1F3B756400B114CB /* ARNodeViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARNodeViewManager.m; sourceTree = ""; };
55 | CE54A1EC1F3D94DD004C5A8F /* ARTextNodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ARTextNodeView.swift; sourceTree = ""; };
56 | CE54A1EE1F3D94EF004C5A8F /* ARTextNodeViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ARTextNodeViewManager.m; sourceTree = ""; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | /* End PBXFrameworksBuildPhase section */
68 |
69 | /* Begin PBXGroup section */
70 | 134814211AA4EA7D00B7C361 /* Products */ = {
71 | isa = PBXGroup;
72 | children = (
73 | 134814201AA4EA6300B7C361 /* libRNReactArkit.a */,
74 | );
75 | name = Products;
76 | sourceTree = "";
77 | };
78 | 58B511D21A9E6C8500147676 = {
79 | isa = PBXGroup;
80 | children = (
81 | CE0694D81F3B75A100B114CB /* Foundation */,
82 | CE0694D71F3B759800B114CB /* Views */,
83 | 134814211AA4EA7D00B7C361 /* Products */,
84 | );
85 | sourceTree = "";
86 | };
87 | CE0694D71F3B759800B114CB /* Views */ = {
88 | isa = PBXGroup;
89 | children = (
90 | CE0694CA1F3B756400B114CB /* ARBoxNodeView.swift */,
91 | CE0694C71F3B756400B114CB /* ARBoxNodeViewManager.m */,
92 | CE0694C91F3B756400B114CB /* ARNodeView.swift */,
93 | CE0694CB1F3B756400B114CB /* ARNodeViewManager.m */,
94 | CE0694C21F3B756300B114CB /* ARSceneView.swift */,
95 | CE0694C51F3B756400B114CB /* ARSceneViewManager.m */,
96 | CE0694C41F3B756400B114CB /* ARSphereNodeView.swift */,
97 | CE0694C01F3B756300B114CB /* ARSphereNodeViewManager.m */,
98 | CE0694C31F3B756400B114CB /* RCTNodeViewManager.h */,
99 | CE0694C61F3B756400B114CB /* RCTNodeViewManager.m */,
100 | CE54A1EC1F3D94DD004C5A8F /* ARTextNodeView.swift */,
101 | CE54A1EE1F3D94EF004C5A8F /* ARTextNodeViewManager.m */,
102 | );
103 | path = Views;
104 | sourceTree = "";
105 | };
106 | CE0694D81F3B75A100B114CB /* Foundation */ = {
107 | isa = PBXGroup;
108 | children = (
109 | B3E7B5881CC2AC0600A0062D /* RNReactArkit.h */,
110 | B3E7B5891CC2AC0600A0062D /* RNReactArkit.m */,
111 | CE0694BE1F3B756300B114CB /* RNReactArkit-Bridging-Header.h */,
112 | CE0694C11F3B756300B114CB /* ARKitDelegate.swift */,
113 | CE0694BF1F3B756300B114CB /* SCNNode+Reactive.swift */,
114 | );
115 | path = Foundation;
116 | sourceTree = "";
117 | };
118 | /* End PBXGroup section */
119 |
120 | /* Begin PBXNativeTarget section */
121 | 58B511DA1A9E6C8500147676 /* RNReactArkit */ = {
122 | isa = PBXNativeTarget;
123 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNReactArkit" */;
124 | buildPhases = (
125 | 58B511D71A9E6C8500147676 /* Sources */,
126 | 58B511D81A9E6C8500147676 /* Frameworks */,
127 | 58B511D91A9E6C8500147676 /* CopyFiles */,
128 | );
129 | buildRules = (
130 | );
131 | dependencies = (
132 | );
133 | name = RNReactArkit;
134 | productName = RCTDataManager;
135 | productReference = 134814201AA4EA6300B7C361 /* libRNReactArkit.a */;
136 | productType = "com.apple.product-type.library.static";
137 | };
138 | /* End PBXNativeTarget section */
139 |
140 | /* Begin PBXProject section */
141 | 58B511D31A9E6C8500147676 /* Project object */ = {
142 | isa = PBXProject;
143 | attributes = {
144 | LastUpgradeCheck = 0610;
145 | ORGANIZATIONNAME = Facebook;
146 | TargetAttributes = {
147 | 58B511DA1A9E6C8500147676 = {
148 | CreatedOnToolsVersion = 6.1.1;
149 | LastSwiftMigration = 0900;
150 | };
151 | };
152 | };
153 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNReactArkit" */;
154 | compatibilityVersion = "Xcode 3.2";
155 | developmentRegion = English;
156 | hasScannedForEncodings = 0;
157 | knownRegions = (
158 | en,
159 | );
160 | mainGroup = 58B511D21A9E6C8500147676;
161 | productRefGroup = 58B511D21A9E6C8500147676;
162 | projectDirPath = "";
163 | projectRoot = "";
164 | targets = (
165 | 58B511DA1A9E6C8500147676 /* RNReactArkit */,
166 | );
167 | };
168 | /* End PBXProject section */
169 |
170 | /* Begin PBXSourcesBuildPhase section */
171 | 58B511D71A9E6C8500147676 /* Sources */ = {
172 | isa = PBXSourcesBuildPhase;
173 | buildActionMask = 2147483647;
174 | files = (
175 | CE0694D61F3B756400B114CB /* RCTNodeViewManager.m in Sources */,
176 | CE0694CE1F3B756400B114CB /* ARSphereNodeView.swift in Sources */,
177 | CE0694D31F3B756400B114CB /* ARNodeViewManager.m in Sources */,
178 | B3E7B58A1CC2AC0600A0062D /* RNReactArkit.m in Sources */,
179 | CE54A1ED1F3D94DD004C5A8F /* ARTextNodeView.swift in Sources */,
180 | CE0694D21F3B756400B114CB /* ARSphereNodeViewManager.m in Sources */,
181 | CE0694D01F3B756400B114CB /* ARKitDelegate.swift in Sources */,
182 | CE0694CC1F3B756400B114CB /* ARBoxNodeViewManager.m in Sources */,
183 | CE0694D11F3B756400B114CB /* ARNodeView.swift in Sources */,
184 | CE0694CF1F3B756400B114CB /* ARBoxNodeView.swift in Sources */,
185 | CE54A1EF1F3D94EF004C5A8F /* ARTextNodeViewManager.m in Sources */,
186 | CE0694D41F3B756400B114CB /* ARSceneViewManager.m in Sources */,
187 | CE0694D51F3B756400B114CB /* SCNNode+Reactive.swift in Sources */,
188 | CE0694CD1F3B756400B114CB /* ARSceneView.swift in Sources */,
189 | );
190 | runOnlyForDeploymentPostprocessing = 0;
191 | };
192 | /* End PBXSourcesBuildPhase section */
193 |
194 | /* Begin XCBuildConfiguration section */
195 | 58B511ED1A9E6C8500147676 /* Debug */ = {
196 | isa = XCBuildConfiguration;
197 | buildSettings = {
198 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
199 | ALWAYS_SEARCH_USER_PATHS = NO;
200 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
201 | CLANG_CXX_LIBRARY = "libc++";
202 | CLANG_ENABLE_MODULES = YES;
203 | CLANG_ENABLE_OBJC_ARC = YES;
204 | CLANG_WARN_BOOL_CONVERSION = YES;
205 | CLANG_WARN_CONSTANT_CONVERSION = YES;
206 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
207 | CLANG_WARN_EMPTY_BODY = YES;
208 | CLANG_WARN_ENUM_CONVERSION = YES;
209 | CLANG_WARN_INT_CONVERSION = YES;
210 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
211 | CLANG_WARN_UNREACHABLE_CODE = YES;
212 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
213 | COPY_PHASE_STRIP = NO;
214 | ENABLE_STRICT_OBJC_MSGSEND = YES;
215 | GCC_C_LANGUAGE_STANDARD = gnu99;
216 | GCC_DYNAMIC_NO_PIC = NO;
217 | GCC_OPTIMIZATION_LEVEL = 0;
218 | GCC_PREPROCESSOR_DEFINITIONS = (
219 | "DEBUG=1",
220 | "$(inherited)",
221 | );
222 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
223 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
224 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
225 | GCC_WARN_UNDECLARED_SELECTOR = YES;
226 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
227 | GCC_WARN_UNUSED_FUNCTION = YES;
228 | GCC_WARN_UNUSED_VARIABLE = YES;
229 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
230 | MTL_ENABLE_DEBUG_INFO = YES;
231 | ONLY_ACTIVE_ARCH = YES;
232 | SDKROOT = iphoneos;
233 | };
234 | name = Debug;
235 | };
236 | 58B511EE1A9E6C8500147676 /* Release */ = {
237 | isa = XCBuildConfiguration;
238 | buildSettings = {
239 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
240 | ALWAYS_SEARCH_USER_PATHS = NO;
241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
242 | CLANG_CXX_LIBRARY = "libc++";
243 | CLANG_ENABLE_MODULES = YES;
244 | CLANG_ENABLE_OBJC_ARC = YES;
245 | CLANG_WARN_BOOL_CONVERSION = YES;
246 | CLANG_WARN_CONSTANT_CONVERSION = YES;
247 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
248 | CLANG_WARN_EMPTY_BODY = YES;
249 | CLANG_WARN_ENUM_CONVERSION = YES;
250 | CLANG_WARN_INT_CONVERSION = YES;
251 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
252 | CLANG_WARN_UNREACHABLE_CODE = YES;
253 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
254 | COPY_PHASE_STRIP = YES;
255 | ENABLE_NS_ASSERTIONS = NO;
256 | ENABLE_STRICT_OBJC_MSGSEND = YES;
257 | GCC_C_LANGUAGE_STANDARD = gnu99;
258 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
260 | GCC_WARN_UNDECLARED_SELECTOR = YES;
261 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
262 | GCC_WARN_UNUSED_FUNCTION = YES;
263 | GCC_WARN_UNUSED_VARIABLE = YES;
264 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
265 | MTL_ENABLE_DEBUG_INFO = NO;
266 | SDKROOT = iphoneos;
267 | VALIDATE_PRODUCT = YES;
268 | };
269 | name = Release;
270 | };
271 | 58B511F01A9E6C8500147676 /* Debug */ = {
272 | isa = XCBuildConfiguration;
273 | buildSettings = {
274 | CLANG_ENABLE_MODULES = YES;
275 | HEADER_SEARCH_PATHS = (
276 | "$(inherited)",
277 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
278 | "$(SRCROOT)/../../../React/**",
279 | "$(SRCROOT)/../../react-native/React/**",
280 | );
281 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
282 | LIBRARY_SEARCH_PATHS = "$(inherited)";
283 | OTHER_LDFLAGS = "-ObjC";
284 | PRODUCT_NAME = RNReactArkit;
285 | SKIP_INSTALL = YES;
286 | SWIFT_OBJC_BRIDGING_HEADER = "Foundation/RNReactArkit-Bridging-Header.h";
287 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
288 | SWIFT_VERSION = 3.0;
289 | };
290 | name = Debug;
291 | };
292 | 58B511F11A9E6C8500147676 /* Release */ = {
293 | isa = XCBuildConfiguration;
294 | buildSettings = {
295 | CLANG_ENABLE_MODULES = YES;
296 | HEADER_SEARCH_PATHS = (
297 | "$(inherited)",
298 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
299 | "$(SRCROOT)/../../../React/**",
300 | "$(SRCROOT)/../../react-native/React/**",
301 | );
302 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
303 | LIBRARY_SEARCH_PATHS = "$(inherited)";
304 | OTHER_LDFLAGS = "-ObjC";
305 | PRODUCT_NAME = RNReactArkit;
306 | SKIP_INSTALL = YES;
307 | SWIFT_OBJC_BRIDGING_HEADER = "Foundation/RNReactArkit-Bridging-Header.h";
308 | SWIFT_VERSION = 3.0;
309 | };
310 | name = Release;
311 | };
312 | /* End XCBuildConfiguration section */
313 |
314 | /* Begin XCConfigurationList section */
315 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNReactArkit" */ = {
316 | isa = XCConfigurationList;
317 | buildConfigurations = (
318 | 58B511ED1A9E6C8500147676 /* Debug */,
319 | 58B511EE1A9E6C8500147676 /* Release */,
320 | );
321 | defaultConfigurationIsVisible = 0;
322 | defaultConfigurationName = Release;
323 | };
324 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNReactArkit" */ = {
325 | isa = XCConfigurationList;
326 | buildConfigurations = (
327 | 58B511F01A9E6C8500147676 /* Debug */,
328 | 58B511F11A9E6C8500147676 /* Release */,
329 | );
330 | defaultConfigurationIsVisible = 0;
331 | defaultConfigurationName = Release;
332 | };
333 | /* End XCConfigurationList section */
334 | };
335 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
336 | }
337 |
--------------------------------------------------------------------------------
/ios/Views/ARBoxNodeView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ARBoxNodeView.swift
3 | // RNReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/9/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import ARKit
11 |
12 | @objc public class ARBoxNodeView: ARNodeView {
13 |
14 | override func setSize(_ size: NSDictionary) {
15 |
16 | guard let h = size["height"] as! CGFloat?
17 | else { return warnForProp("height inside position") }
18 |
19 | guard let w = size["width"] as! CGFloat?
20 | else { return warnForProp("width inside position") }
21 |
22 | guard let l = size["length"] as! CGFloat?
23 | else { return warnForProp("length inside position") }
24 |
25 | guard let chamferRadius = size["chamferRadius"] as! CGFloat?
26 | else { return warnForProp("chamferRadius inside position") }
27 |
28 | var boxGeometry: SCNBox = SCNBox.init()
29 |
30 | if self.geometry != nil {
31 | boxGeometry = self.geometry as! SCNBox
32 | }
33 |
34 | boxGeometry.width = w
35 | boxGeometry.height = h
36 | boxGeometry.length = l
37 | boxGeometry.chamferRadius = chamferRadius
38 |
39 | self.geometry = boxGeometry
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/ios/Views/ARBoxNodeViewManager.m:
--------------------------------------------------------------------------------
1 | // ReactArkit
2 | //
3 | // Created by Ilter Canberk on 8/9/17.
4 | // Copyright © 2017. All rights reserved.
5 | //
6 |
7 | #import
8 | #import "RNReactArkit-Swift.h"
9 | #import "RCTNodeViewManager.h"
10 |
11 | @interface ARBoxNodeViewManager : RCTNodeViewManager
12 |
13 | @end
14 |
15 | @implementation ARBoxNodeViewManager
16 |
17 |
18 | RCT_EXPORT_MODULE()
19 |
20 | - (ARBoxNodeView *)view
21 | {
22 | return [[ARBoxNodeView alloc] init];
23 | }
24 |
25 | RCT_EXPORT_VIEW_PROPERTY(size, NSDictionary)
26 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
27 | RCT_EXPORT_VIEW_PROPERTY(geoposition, NSDictionary)
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/Views/ARNodeView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ARSceneView.swift
3 | // ReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/6/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 | import ARKit
12 |
13 | func warnForProp(_ prop: String) {
14 | print("\(prop) must be provided to the node")
15 | }
16 |
17 | @objc public class ARNodeView: SCNNode {
18 |
19 | var modelNode: SCNNode?
20 | var modelScale: SCNVector3?
21 |
22 | override public init() {
23 | super.init()
24 | initGeometry()
25 | }
26 |
27 | required public init?(coder aDecoder: NSCoder) {
28 | super.init(coder: aDecoder)
29 | initGeometry()
30 | }
31 |
32 | func initGeometry() {
33 | self.geometry = SCNBox.init()
34 | }
35 |
36 | func setSize(_ size: NSDictionary) {
37 |
38 | if self.geometry == nil {
39 | self.geometry = SCNGeometry.init()
40 | }
41 |
42 | if size["scale"] != nil {
43 | let s: Float = Float(size["scale"] as! CGFloat)
44 | self.modelScale = SCNVector3Make(s, s, s)
45 | if self.modelNode != nil {
46 | self.modelNode?.scale = self.modelScale!
47 | }
48 | }
49 | }
50 |
51 | func setModelAssetPath(_ source: NSString) {
52 | let urlParts = source.components(separatedBy: ":")
53 | let geoScene = SCNScene(named: urlParts[0])
54 |
55 | guard let newModelNode: SCNNode = urlParts.count > 1 ? geoScene?.rootNode.childNode(withName: urlParts[1], recursively: true) : geoScene?.rootNode else {
56 | print("Asset url could not be resolved")
57 | return
58 | }
59 |
60 | self.modelNode = newModelNode
61 | self.addChildNode(newModelNode)
62 |
63 | // Reset the position so that the child node is
64 | // positioned at the center of the parent node.
65 | // We don't want this to be affected by the positioning
66 | // within the scene.
67 | self.modelNode?.position = SCNVector3Make(0, 0, 0)
68 | self.modelNode?.scale = self.modelScale ?? SCNVector3Make(1, 1, 1)
69 | self.geometry?.firstMaterial?.transparency = 0.0
70 | }
71 |
72 | func setGeoposition(_ position: NSDictionary) {
73 |
74 | guard let xPos = position.value(forKey: "x") as! Float?
75 | else { return warnForProp("X position") }
76 |
77 | guard let yPos = position.value(forKey: "y") as! Float?
78 | else { return warnForProp("Y position") }
79 |
80 | guard let zPos = position.value(forKey: "z") as! Float?
81 | else { return warnForProp("Z position") }
82 |
83 | let boxPosition = SCNVector3Make(xPos, yPos, zPos)
84 | self.position = boxPosition
85 | }
86 |
87 | func removeFromSuperview() {
88 | self.removeFromParentNode()
89 | }
90 |
91 | func setColor(_ color: UIColor) {
92 | self.geometry?.firstMaterial?.diffuse.contents = color
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/ios/Views/ARNodeViewManager.m:
--------------------------------------------------------------------------------
1 | // ReactArkit
2 | //
3 | // Created by Ilter Canberk on 8/6/17.
4 | // Copyright © 2017. All rights reserved.
5 | //
6 |
7 | #import
8 | #import
9 | #import "RNReactArkit-Swift.h"
10 |
11 | @interface ARNodeViewManager : RCTViewManager
12 |
13 | @end
14 |
15 | @implementation ARNodeViewManager
16 |
17 |
18 | RCT_EXPORT_MODULE()
19 |
20 | - (ARNodeView *)view
21 | {
22 | return [[ARNodeView alloc] init];
23 | }
24 |
25 | RCT_EXPORT_VIEW_PROPERTY(modelAssetPath, NSString)
26 | RCT_EXPORT_VIEW_PROPERTY(size, NSDictionary)
27 | RCT_EXPORT_VIEW_PROPERTY(geoposition, NSDictionary)
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/ios/Views/ARSceneView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ARSceneView.swift
3 | // RNReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/9/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import UIKit
11 | import ARKit
12 |
13 | @objc public class ARSceneView: ARSCNView, ARSCNViewDelegate, ARSessionDelegate {
14 |
15 | var config: ARWorldTrackingConfiguration = ARWorldTrackingConfiguration()
16 | var onPlaneDetectedFn: RCTBubblingEventBlock?
17 | var onPlaneUpdatedFn: RCTBubblingEventBlock?
18 |
19 | public override init(frame: CGRect) {
20 | super.init(frame: frame)
21 | self.initializeSessionAndProps()
22 | }
23 |
24 | public override init(frame: CGRect, options: [String : Any]? = nil) {
25 | super.init(frame: frame, options: options)
26 | self.initializeSessionAndProps()
27 | }
28 |
29 | required public init?(coder aDecoder: NSCoder) {
30 | super.init(coder: aDecoder)
31 | }
32 |
33 | func initializeSessionAndProps() {
34 | self.config = ARWorldTrackingConfiguration()
35 | self.config.planeDetection = [.horizontal]
36 | self.delegate = self
37 | self.session.run(self.config)
38 | self.session.delegate = self
39 | self.autoenablesDefaultLighting = true
40 | }
41 |
42 | override public func layoutSubviews() {
43 | super.layoutSubviews()
44 | self.backgroundColor = UIColor.blue
45 | }
46 |
47 | func setDebugEnabled(_ isEnabled: Bool) {
48 | if (isEnabled) {
49 | self.debugOptions = [ARSCNDebugOptions.showWorldOrigin, ARSCNDebugOptions.showFeaturePoints]
50 | } else {
51 | self.debugOptions = []
52 | }
53 | self.delegate = self
54 |
55 | }
56 |
57 | func setRun(_ shouldRun: Bool) {
58 | if shouldRun == false {
59 | self.session.pause()
60 | } else {
61 | self.session.run(self.config)
62 | }
63 | }
64 |
65 | func setOnPlaneDetected(_ a:@escaping RCTBubblingEventBlock) {
66 | self.onPlaneDetectedFn = a
67 | }
68 |
69 | func setOnPlaneUpdated(_ a:@escaping RCTBubblingEventBlock) {
70 | self.onPlaneUpdatedFn = a
71 | }
72 |
73 | public func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
74 | if let planeAnchor: ARPlaneAnchor = anchor as? ARPlaneAnchor {
75 | if self.onPlaneDetectedFn != nil {
76 | self.onPlaneDetectedFn!([
77 | "id": planeAnchor.identifier.uuidString,
78 | "alignment": planeAnchor.alignment,
79 | "node": [
80 | "x": node.position.x,
81 | "y": node.position.y,
82 | "z": node.position.z
83 | ],
84 | "center": [
85 | "x": planeAnchor.center.x,
86 | "y": planeAnchor.center.y,
87 | "z": planeAnchor.center.z
88 | ],
89 | "extent": [
90 | "x": planeAnchor.extent.x,
91 | "y": planeAnchor.extent.y,
92 | "z": planeAnchor.extent.z
93 | ]
94 | ])
95 | }
96 | }
97 | }
98 |
99 | public func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {
100 |
101 | if let planeAnchor: ARPlaneAnchor = anchor as? ARPlaneAnchor {
102 | if self.onPlaneUpdatedFn != nil {
103 | self.onPlaneUpdatedFn!([
104 | "id": anchor.identifier.uuidString,
105 | "alignment": planeAnchor.alignment,
106 | "node": [
107 | "x": node.position.x,
108 | "y": node.position.y,
109 | "z": node.position.z
110 | ],
111 | "center": [
112 | "x": planeAnchor.center.x,
113 | "y": planeAnchor.center.y,
114 | "z": planeAnchor.center.z
115 | ],
116 | "extent": [
117 | "x": planeAnchor.extent.x,
118 | "y": planeAnchor.extent.y,
119 | "z": planeAnchor.extent.z
120 | ]
121 | ])
122 | }
123 | }
124 | }
125 |
126 | // We are overwriting addSubview that React-Native calls
127 | // by default to translate these actions into
128 | // SceneKit actions. addSubview becomes addChildNode
129 | override public func addSubview(_ view: UIView) {
130 | let obj:Any = view as Any
131 | if let node: SCNNode = obj as? SCNNode {
132 | self.scene.rootNode.addChildNode(node)
133 | } else {
134 | super.addSubview(view)
135 | }
136 |
137 | self.config = ARWorldTrackingConfiguration()
138 | self.config.planeDetection = [.horizontal]
139 | self.delegate = self
140 | self.session.run(self.config)
141 | self.session.delegate = self
142 |
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/ios/Views/ARSceneViewManager.m:
--------------------------------------------------------------------------------
1 | // RNReactArkit
2 | //
3 | // Created by Ilter Canberk on 8/9/17.
4 | // Copyright © 2017. All rights reserved.
5 | //
6 |
7 | #import
8 | #import
9 | #import
10 |
11 | #import "RNReactArkit-Swift.h"
12 |
13 | @interface ARSceneViewManager : RCTViewManager
14 |
15 | @end
16 |
17 | @implementation ARSceneViewManager
18 |
19 |
20 | RCT_EXPORT_MODULE()
21 |
22 | - (UIView *)view
23 | {
24 | return [[ARSceneView alloc] init];
25 | }
26 |
27 | RCT_EXPORT_VIEW_PROPERTY(debugEnabled, BOOL)
28 | RCT_EXPORT_VIEW_PROPERTY(run, BOOL)
29 |
30 | RCT_EXPORT_VIEW_PROPERTY(onPlaneDetected, RCTBubblingEventBlock)
31 | RCT_EXPORT_VIEW_PROPERTY(onPlaneUpdated, RCTBubblingEventBlock)
32 |
33 | @end
34 |
--------------------------------------------------------------------------------
/ios/Views/ARSphereNodeView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ARBoxNodeView.swift
3 | // RNReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/9/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import ARKit
11 |
12 | @objc public class ARSphereNodeView: ARNodeView {
13 |
14 | override func initGeometry() {
15 | self.geometry = SCNSphere.init()
16 | }
17 |
18 | override func setSize(_ size: NSDictionary) {
19 |
20 | guard let radiusVal = size.value(forKey: "radius") as! CGFloat?
21 | else { return warnForProp("radius within size"); }
22 |
23 | var sphereGeometry: SCNSphere = SCNSphere.init()
24 |
25 | if self.geometry != nil {
26 | sphereGeometry = self.geometry as! SCNSphere
27 | }
28 |
29 | sphereGeometry.radius = radiusVal
30 | self.geometry = sphereGeometry
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/ios/Views/ARSphereNodeViewManager.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "RNReactArkit-Swift.h"
3 | #import "RCTNodeViewManager.h"
4 |
5 | @interface ARSphereNodeViewManager : RCTNodeViewManager
6 |
7 | @end
8 |
9 | @implementation ARSphereNodeViewManager
10 |
11 |
12 | RCT_EXPORT_MODULE()
13 |
14 | - (ARSphereNodeView *)view
15 | {
16 | return [[ARSphereNodeView alloc] init];
17 | }
18 |
19 | RCT_EXPORT_VIEW_PROPERTY(size, NSDictionary)
20 | RCT_EXPORT_VIEW_PROPERTY(geoposition, NSDictionary)
21 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/ios/Views/ARTextNodeView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ARBoxNodeView.swift
3 | // RNReactArkit
4 | //
5 | // Created by Ilter Canberk on 8/9/17.
6 | // Copyright © 2017. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import ARKit
11 |
12 | @objc public class ARTextNodeView: ARNodeView {
13 |
14 | var textNode: SCNNode?
15 |
16 | override func initGeometry() {
17 | self.geometry = SCNText.init()
18 | }
19 |
20 | override func setSize(_ size: NSDictionary) {
21 |
22 | if let existingNode = self.textNode {
23 | existingNode.removeFromParentNode()
24 | }
25 |
26 | var textGeometry: SCNText = SCNText.init()
27 |
28 | if self.geometry != nil {
29 | textGeometry = self.geometry as! SCNText
30 | }
31 |
32 | if size["fontSize"] != nil {
33 | let newFont = UIFont.init(name: textGeometry.font.fontName, size: size["fontSize"] as! CGFloat)
34 | textGeometry.font = newFont
35 | }
36 |
37 | if size["depth"] != nil {
38 | textGeometry.extrusionDepth = size["depth"] as! CGFloat
39 | }
40 |
41 | if size["chamfer"] != nil {
42 | textGeometry.chamferRadius = size["chamfer"] as! CGFloat
43 | }
44 |
45 | let scaledSize = size["fontSize"] as! CGFloat / 12;
46 | self.textNode = SCNNode.init(geometry: textGeometry)
47 |
48 | var scnMin = SCNVector3Zero
49 | var scnMax = SCNVector3Zero
50 | self.textNode?.__getBoundingBoxMin(&scnMin, max: &scnMax) // pass min and max as in-out parameters
51 | self.textNode?.position = SCNVector3Make(-(scnMin.x + scnMax.x) / 2, -(scnMin.y + scnMax.y) / 2, -(scnMin.z + scnMax.z) / 2);
52 |
53 | self.scale = SCNVector3Make(Float(scaledSize), Float(scaledSize), Float(scaledSize));
54 | self.addChildNode(self.textNode!)
55 | }
56 |
57 | func setFont(_ fontName: NSString) {
58 | let currentGeometry: SCNText = self.geometry as! SCNText
59 | let newFont = UIFont.init(name: fontName as String, size: currentGeometry.font.pointSize)
60 | currentGeometry.font = newFont
61 | self.geometry = currentGeometry
62 | }
63 |
64 | func setText(_ text: NSString) {
65 | let currentGeometry: SCNText = self.geometry as! SCNText
66 | currentGeometry.string = text
67 | self.geometry = currentGeometry
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/ios/Views/ARTextNodeViewManager.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import "RNReactArkit-Swift.h"
3 | #import "RCTNodeViewManager.h"
4 |
5 | @interface ARTextNodeViewManager : RCTNodeViewManager
6 |
7 | @end
8 |
9 | @implementation ARTextNodeViewManager
10 |
11 |
12 | RCT_EXPORT_MODULE()
13 |
14 | - (ARTextNodeView *)view
15 | {
16 | return [[ARTextNodeView alloc] init];
17 | }
18 |
19 | RCT_EXPORT_VIEW_PROPERTY(size, NSDictionary)
20 | RCT_EXPORT_VIEW_PROPERTY(geoposition, NSDictionary)
21 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor)
22 | RCT_EXPORT_VIEW_PROPERTY(text, NSString)
23 | RCT_EXPORT_VIEW_PROPERTY(font, NSString)
24 |
25 | @end
26 |
27 |
--------------------------------------------------------------------------------
/ios/Views/RCTNodeViewManager.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface RCTNodeViewManager : RCTViewManager
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/ios/Views/RCTNodeViewManager.m:
--------------------------------------------------------------------------------
1 | #import "RCTNodeViewManager.h"
2 |
3 | @implementation RCTNodeViewManager
4 |
5 | RCT_EXPORT_VIEW_PROPERTY(style, NSDictionary)
6 | RCT_EXPORT_VIEW_PROPERTY(p, NSDictionary)
7 |
8 | @end
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "name": "react-arkit",
4 | "version": "0.1.8",
5 | "description": "AR features for React Native, based on ARKit",
6 | "main": "index.js",
7 | "homepage": "https://github.com/icanb/react-arkit/",
8 | "scripts": {
9 | "test": "echo \"Error: no test specified\" && exit 1"
10 | },
11 | "keywords": [
12 | "react-native",
13 | "arkit",
14 | "react-arki",
15 | "ar",
16 | "augmented-reality"
17 | ],
18 | "devDependencies": {
19 | "react": "16.0.0-alpha.12"
20 | },
21 | "repository": {
22 | "type": "git",
23 | "url": "git@github.com:icanb/react-arkit.git"
24 | },
25 | "author": "Ilter Canberk (@icanb)",
26 | "license": "MIT License"
27 | }
28 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | *AppPackages*
2 | *BundleArtifacts*
3 | *ReactAssets*
4 |
5 | #OS junk files
6 | [Tt]humbs.db
7 | *.DS_Store
8 |
9 | #Visual Studio files
10 | *.[Oo]bj
11 | *.user
12 | *.aps
13 | *.pch
14 | *.vspscc
15 | *.vssscc
16 | *_i.c
17 | *_p.c
18 | *.ncb
19 | *.suo
20 | *.tlb
21 | *.tlh
22 | *.bak
23 | *.[Cc]ache
24 | *.ilk
25 | *.log
26 | *.lib
27 | *.sbr
28 | *.sdf
29 | *.opensdf
30 | *.opendb
31 | *.unsuccessfulbuild
32 | ipch/
33 | [Oo]bj/
34 | [Bb]in
35 | [Dd]ebug*/
36 | [Rr]elease*/
37 | Ankh.NoLoad
38 |
39 | #MonoDevelop
40 | *.pidb
41 | *.userprefs
42 |
43 | #Tooling
44 | _ReSharper*/
45 | *.resharper
46 | [Tt]est[Rr]esult*
47 | *.sass-cache
48 |
49 | #Project files
50 | [Bb]uild/
51 |
52 | #Subversion files
53 | .svn
54 |
55 | # Office Temp Files
56 | ~$*
57 |
58 | # vim Temp Files
59 | *~
60 |
61 | #NuGet
62 | packages/
63 | *.nupkg
64 |
65 | #ncrunch
66 | *ncrunch*
67 | *crunch*.local.xml
68 |
69 | # visual studio database projects
70 | *.dbmdl
71 |
72 | #Test files
73 | *.testsettings
74 |
75 | #Other files
76 | *.DotSettings
77 | .vs/
78 | *project.lock.json
79 |
--------------------------------------------------------------------------------
/windows/RNReactArkit.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio 14
3 | VisualStudioVersion = 14.0.25123.0
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RNReactArkit", "RNReactArkit\RNReactArkit.csproj", "{BE18F970-7D21-11E7-8ED9-0B3619948650}"
6 | EndProject
7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}"
8 | EndProject
9 | Global
10 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
11 | Debug|Any CPU = Debug|Any CPU
12 | Debug|ARM = Debug|ARM
13 | Debug|x64 = Debug|x64
14 | Debug|x86 = Debug|x86
15 | Development|Any CPU = Development|Any CPU
16 | Development|ARM = Development|ARM
17 | Development|x64 = Development|x64
18 | Development|x86 = Development|x86
19 | Release|Any CPU = Release|Any CPU
20 | Release|ARM = Release|ARM
21 | Release|x64 = Release|x64
22 | Release|x86 = Release|x86
23 | EndGlobalSection
24 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
25 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|ARM.ActiveCfg = Debug|ARM
28 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|ARM.Build.0 = Debug|ARM
29 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|x64.ActiveCfg = Debug|x64
30 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|x64.Build.0 = Debug|x64
31 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|x86.ActiveCfg = Debug|x86
32 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Debug|x86.Build.0 = Debug|x86
33 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|Any CPU.ActiveCfg = Development|Any CPU
34 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|Any CPU.Build.0 = Development|Any CPU
35 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|ARM.ActiveCfg = Development|ARM
36 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|ARM.Build.0 = Development|ARM
37 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|x64.ActiveCfg = Development|x64
38 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|x64.Build.0 = Development|x64
39 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|x86.ActiveCfg = Development|x86
40 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Development|x86.Build.0 = Development|x86
41 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|Any CPU.ActiveCfg = Release|Any CPU
42 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|Any CPU.Build.0 = Release|Any CPU
43 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|ARM.ActiveCfg = Release|ARM
44 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|ARM.Build.0 = Release|ARM
45 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|x64.ActiveCfg = Release|x64
46 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|x64.Build.0 = Release|x64
47 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|x86.ActiveCfg = Release|x86
48 | {BE18F970-7D21-11E7-8ED9-0B3619948650}.Release|x86.Build.0 = Release|x86
49 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|Any CPU.Build.0 = Debug|Any CPU
51 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM
52 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM
53 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64
54 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64
55 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86
56 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86
57 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|Any CPU.ActiveCfg = Debug|Any CPU
58 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|Any CPU.Build.0 = Debug|Any CPU
59 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.ActiveCfg = Debug|ARM
60 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.Build.0 = Debug|ARM
61 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.ActiveCfg = Debug|x64
62 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.Build.0 = Debug|x64
63 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.ActiveCfg = Debug|x86
64 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.Build.0 = Debug|x86
65 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|Any CPU.ActiveCfg = Release|Any CPU
66 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|Any CPU.Build.0 = Release|Any CPU
67 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM
68 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM
69 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64
70 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64
71 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86
72 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86
73 | EndGlobalSection
74 | GlobalSection(SolutionProperties) = preSolution
75 | HideSolutionNode = FALSE
76 | EndGlobalSection
77 | EndGlobal
78 |
--------------------------------------------------------------------------------
/windows/RNReactArkit/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("RNReactArkit")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RNReactArkit")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
30 |
--------------------------------------------------------------------------------
/windows/RNReactArkit/Properties/RNReactArkit.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/windows/RNReactArkit/RNReactArkit.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {BE18F970-7D21-11E7-8ED9-0B3619948650}
8 | Library
9 | Properties
10 | RNReactArkit
11 | RNReactArkit
12 | en-US
13 | UAP
14 | 10.0.10586.0
15 | 10.0.10240.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | ..\..\node_modules
20 |
21 |
22 | ..\..
23 |
24 |
25 | AnyCPU
26 | true
27 | full
28 | false
29 | bin\Debug\
30 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
31 | prompt
32 | 4
33 |
34 |
35 | AnyCPU
36 | pdbonly
37 | true
38 | bin\Release\
39 | TRACE;NETFX_CORE;WINDOWS_UWP
40 | prompt
41 | 4
42 |
43 |
44 | x86
45 | true
46 | bin\x86\Debug\
47 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
48 | ;2008
49 | full
50 | x86
51 | false
52 | prompt
53 |
54 |
55 | x86
56 | bin\x86\Release\
57 | TRACE;NETFX_CORE;WINDOWS_UWP
58 | true
59 | ;2008
60 | pdbonly
61 | x86
62 | false
63 | prompt
64 |
65 |
66 | ARM
67 | true
68 | bin\ARM\Debug\
69 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
70 | ;2008
71 | full
72 | ARM
73 | false
74 | prompt
75 |
76 |
77 | ARM
78 | bin\ARM\Release\
79 | TRACE;NETFX_CORE;WINDOWS_UWP
80 | true
81 | ;2008
82 | pdbonly
83 | ARM
84 | false
85 | prompt
86 |
87 |
88 | x64
89 | true
90 | bin\x64\Debug\
91 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
92 | ;2008
93 | full
94 | x64
95 | false
96 | prompt
97 |
98 |
99 | x64
100 | bin\x64\Release\
101 | TRACE;NETFX_CORE;WINDOWS_UWP
102 | true
103 | ;2008
104 | pdbonly
105 | x64
106 | false
107 | prompt
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | {c7673ad5-e3aa-468c-a5fd-fa38154e205c}
122 | ReactNative
123 |
124 |
125 |
126 | 14.0
127 |
128 |
129 | true
130 | bin\Development\
131 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
132 | true
133 | full
134 | AnyCPU
135 | false
136 | prompt
137 | MinimumRecommendedRules.ruleset
138 |
139 |
140 | true
141 | bin\x86\Development\
142 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
143 | ;2008
144 | true
145 | full
146 | x86
147 | false
148 | prompt
149 | MinimumRecommendedRules.ruleset
150 |
151 |
152 | true
153 | bin\ARM\Development\
154 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
155 | ;2008
156 | true
157 | full
158 | ARM
159 | false
160 | prompt
161 | MinimumRecommendedRules.ruleset
162 |
163 |
164 | true
165 | bin\x64\Development\
166 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
167 | ;2008
168 | true
169 | full
170 | x64
171 | false
172 | prompt
173 | MinimumRecommendedRules.ruleset
174 |
175 |
176 |
183 |
184 |
--------------------------------------------------------------------------------
/windows/RNReactArkit/RNReactArkitModule.cs:
--------------------------------------------------------------------------------
1 | using ReactNative.Bridge;
2 | using System;
3 | using System.Collections.Generic;
4 | using Windows.ApplicationModel.Core;
5 | using Windows.UI.Core;
6 |
7 | namespace Com.Reactlibrary.RNReactArkit
8 | {
9 | ///
10 | /// A module that allows JS to share data.
11 | ///
12 | class RNReactArkitModule : NativeModuleBase
13 | {
14 | ///
15 | /// Instantiates the .
16 | ///
17 | internal RNReactArkitModule()
18 | {
19 |
20 | }
21 |
22 | ///
23 | /// The name of the native module.
24 | ///
25 | public override string Name
26 | {
27 | get
28 | {
29 | return "RNReactArkit";
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/windows/RNReactArkit/RNReactArkitPackage.cs:
--------------------------------------------------------------------------------
1 | using ReactNative.Bridge;
2 | using ReactNative.Modules.Core;
3 | using ReactNative.UIManager;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Com.Reactlibrary.RNReactArkit
8 | {
9 | ///
10 | /// Package defining core framework modules (e.g., ).
11 | /// It should be used for modules that require special integration with
12 | /// other framework parts (e.g., with the list of packages to load view
13 | /// managers from).
14 | ///
15 | public class RNReactArkitPackage : IReactPackage
16 | {
17 | ///
18 | /// Creates the list of native modules to register with the react
19 | /// instance.
20 | ///
21 | /// The react application context.
22 | /// The list of native modules.
23 | public IReadOnlyList CreateNativeModules(ReactContext reactContext)
24 | {
25 | return new List
26 | {
27 | new RNReactArkitModule(),
28 | };
29 | }
30 |
31 | ///
32 | /// Creates the list of JavaScript modules to register with the
33 | /// react instance.
34 | ///
35 | /// The list of JavaScript modules.
36 | public IReadOnlyList CreateJavaScriptModulesConfig()
37 | {
38 | return new List(0);
39 | }
40 |
41 | ///
42 | /// Creates the list of view managers that should be registered with
43 | /// the .
44 | ///
45 | /// The react application context.
46 | /// The list of view managers.
47 | public IReadOnlyList CreateViewManagers(
48 | ReactContext reactContext)
49 | {
50 | return new List(0);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/windows/RNReactArkit/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
17 |
--------------------------------------------------------------------------------