├── .buckconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .watchmanconfig ├── App.js ├── README.md ├── TestExample.js ├── __tests__ └── App-test.js ├── android ├── app │ ├── BUCK │ ├── build.gradle │ ├── build_defs.bzl │ ├── debug.keystore │ ├── libs │ │ ├── arm64-v8a │ │ │ └── libhello-jni.so │ │ ├── armeabi-v7a │ │ │ └── libhello-jni.so │ │ ├── x86 │ │ │ └── libhello-jni.so │ │ └── x86_64 │ │ │ └── libhello-jni.so │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ ├── example │ │ │ ├── cxxmodule │ │ │ │ └── HelloCxxPackage.java │ │ │ └── jni │ │ │ │ ├── TestModule.java │ │ │ │ └── TestPackage.java │ │ │ └── reactnativecppdemo │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── app.json ├── babel.config.js ├── cpp ├── cxxmodule │ ├── Android.mk │ ├── Application.mk │ ├── HelloCxxModule.cpp │ ├── HelloCxxModule.h │ └── SoWrapper.mk ├── hostobject │ ├── CMakeLists.txt │ ├── TestBinding.cpp │ ├── TestBinding.h │ └── jni.cpp ├── jni │ ├── CMakeLists.txt │ └── hello-jni.cpp └── src │ ├── Test.cpp │ └── Test.h ├── index.js ├── ios ├── DynamicLibraryDemo.framework │ ├── DynamicLibraryDemo │ ├── Headers │ │ ├── DynamicLibraryDemo.h │ │ └── Test.h │ ├── Info.plist │ ├── Modules │ │ └── module.modulemap │ └── _CodeSignature │ │ └── CodeResources ├── Podfile ├── Podfile.lock ├── ReactNativeCppDemo-tvOS │ └── Info.plist ├── ReactNativeCppDemo-tvOSTests │ └── Info.plist ├── ReactNativeCppDemo.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ ├── ReactNativeCppDemo-tvOS.xcscheme │ │ └── ReactNativeCppDemo.xcscheme ├── ReactNativeCppDemo.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── ReactNativeCppDemo │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ ├── example │ │ ├── cxxmodule │ │ │ ├── RCTHelloCxxModule.h │ │ │ └── RCTHelloCxxModule.mm │ │ └── jni │ │ │ ├── TestModule.h │ │ │ └── TestModule.m │ └── main.m └── ReactNativeCppDemoTests │ ├── Info.plist │ └── ReactNativeCppDemoTests.m ├── metro.config.js ├── package.json └── yarn.lock /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore polyfills 9 | node_modules/react-native/Libraries/polyfills/.* 10 | 11 | ; These should not be required directly 12 | ; require from fbjs/lib instead: require('fbjs/lib/warning') 13 | node_modules/warning/.* 14 | 15 | ; Flow doesn't support platforms 16 | .*/Libraries/Utilities/LoadingView.js 17 | 18 | [untyped] 19 | .*/node_modules/@react-native-community/cli/.*/.* 20 | 21 | [include] 22 | 23 | [libs] 24 | node_modules/react-native/Libraries/react-native/react-native-interface.js 25 | node_modules/react-native/flow/ 26 | 27 | [options] 28 | emoji=true 29 | 30 | esproposal.optional_chaining=enable 31 | esproposal.nullish_coalescing=enable 32 | 33 | module.file_ext=.js 34 | module.file_ext=.json 35 | module.file_ext=.ios.js 36 | 37 | munge_underscores=true 38 | 39 | module.name_mapper='^react-native$' -> '/node_modules/react-native/Libraries/react-native/react-native-implementation' 40 | module.name_mapper='^react-native/\(.*\)$' -> '/node_modules/react-native/\1' 41 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '/node_modules/react-native/Libraries/Image/RelativeImageStub' 42 | 43 | suppress_type=$FlowIssue 44 | suppress_type=$FlowFixMe 45 | suppress_type=$FlowFixMeProps 46 | suppress_type=$FlowFixMeState 47 | 48 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\) 49 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+ 50 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 51 | 52 | [lints] 53 | sketchy-null-number=warn 54 | sketchy-null-mixed=warn 55 | sketchy-number=warn 56 | untyped-type-import=warn 57 | nonstrict-import=warn 58 | deprecated-type=warn 59 | unsafe-getters-setters=warn 60 | inexact-spread=warn 61 | unnecessary-invariant=warn 62 | signature-verification-failure=warn 63 | deprecated-utility=error 64 | 65 | [strict] 66 | deprecated-type 67 | nonstrict-import 68 | sketchy-null 69 | unclear-type 70 | unsafe-getters-setters 71 | untyped-import 72 | untyped-type-import 73 | 74 | [version] 75 | ^0.105.0 76 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | local.properties 30 | *.iml 31 | .externalNativeBuild 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | !debug.keystore 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://docs.fastlane.tools/best-practices/source-control/ 51 | 52 | */fastlane/report.xml 53 | */fastlane/Preview.html 54 | */fastlane/screenshots 55 | 56 | # Bundle artifact 57 | *.jsbundle 58 | 59 | # CocoaPods 60 | /ios/Pods/ 61 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | * @flow 7 | */ 8 | 9 | import React from 'react'; 10 | import { 11 | SafeAreaView, 12 | StyleSheet, 13 | ScrollView, 14 | View, 15 | Text, 16 | StatusBar, 17 | } from 'react-native'; 18 | 19 | import { 20 | Header, 21 | LearnMoreLinks, 22 | Colors, 23 | DebugInstructions, 24 | ReloadInstructions, 25 | } from 'react-native/Libraries/NewAppScreen'; 26 | 27 | import TestExample from "./TestExample"; 28 | 29 | // TestExample.stringFunc("abc", (res) => { 30 | // console.warn(res); 31 | // }); 32 | 33 | // TestExample.intFunc(1, 2, (res) => { 34 | // console.warn(res); 35 | // }); 36 | 37 | TestExample.add(1, 2, (res) => { 38 | console.warn(res) 39 | }); 40 | 41 | const App: () => React$Node = () => { 42 | 43 | // console.warn(TestExample.runTest(2, 2)); 44 | // console.warn(global.nativeTest.runTest(1, 2)); 45 | 46 | return ( 47 | <> 48 | 49 | 50 | 53 |
54 | {global.HermesInternal == null ? null : ( 55 | 56 | Engine: Hermes 57 | 58 | )} 59 | 60 | 61 | Step One 62 | 63 | Edit App.js to change this 64 | screen and then come back to see your edits. 65 | 66 | 67 | 68 | See Your Changes 69 | 70 | 71 | 72 | 73 | 74 | Debug 75 | 76 | 77 | 78 | 79 | 80 | Learn More 81 | 82 | Read the docs to discover what to do next: 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | ); 91 | }; 92 | 93 | const styles = StyleSheet.create({ 94 | scrollView: { 95 | backgroundColor: Colors.lighter, 96 | }, 97 | engine: { 98 | position: 'absolute', 99 | right: 0, 100 | }, 101 | body: { 102 | backgroundColor: Colors.white, 103 | }, 104 | sectionContainer: { 105 | marginTop: 32, 106 | paddingHorizontal: 24, 107 | }, 108 | sectionTitle: { 109 | fontSize: 24, 110 | fontWeight: '600', 111 | color: Colors.black, 112 | }, 113 | sectionDescription: { 114 | marginTop: 8, 115 | fontSize: 18, 116 | fontWeight: '400', 117 | color: Colors.dark, 118 | }, 119 | highlight: { 120 | fontWeight: '700', 121 | }, 122 | footer: { 123 | color: Colors.dark, 124 | fontSize: 12, 125 | fontWeight: '600', 126 | padding: 4, 127 | paddingRight: 12, 128 | textAlign: 'right', 129 | }, 130 | }); 131 | 132 | export default App; 133 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 前言 2 | React Native是一个非常优秀的框架,它使得Web前端开发工程师也具备了移动端原生应用的开发能力。而且它还可以集成原生模块供JavaScript调用,弥补JavaScript在高性能和多线程上的短板。 3 | 4 | 然而,RN官方文档只介绍了怎么集成Java和Object-C,并没有介绍怎么集成C++。仅是在IOS使用指南中提到了可以集成C++,在Android使用指南中更是只字未提。我写这个demo主要是为了补充RN官方文档中对C++集成部分的缺失。 5 | 6 | 我参考了社区的几个demo和博客,还有Android的官方文档,总结出三种集成C++的方案。相关引用我会在下面讲解过程中逐步给出。commit记录和我下面的讲解过程基本相符,方便大家结合代码来看,比较每一步之间的差异。 7 | 8 | ## Android 9 | 大家可以看到我demo中前两个commit分别是,初始化RN项目,集成Android端原生模块。这两步没什么难度,我完全是参考[RN官方文档](https://facebook.github.io/react-native/docs/native-modules-android)来写的。大家看下文档都可以轻松实现,我也就不赘述了。完成了这两步,我们便有了一个集成原生模块的demo,可以在js层调用java层的代码。接下来我们想办法在这个Java原生模块中集成C++的代码。 10 | 11 | ### JNI 12 | JNI是为了方便Java调用C、C++等本地代码所封装的一层接口。Android官方已经提供了利用JNI集成C的[文档](https://developer.android.com/ndk/samples/sample_hellojni?hl=zh-cn)和[demo](https://github.com/android/ndk-samples/tree/master/hello-jni)。大家可以看到我的[commit记录](https://github.com/drafish/react-native-cpp-demo/commit/4c19f00762aab2368bed4daa863d8aa8d8943c50),基本上是完全复制了这个demo。我简单讲解下这个commit。 13 | 14 | 首先是`hello-jni.c`文件 15 | ```c 16 | JNIEXPORT jstring JNICALL 17 | Java_com_example_jni_ToastModule_stringFromJNI( JNIEnv* env, jobject thiz ) 18 | ``` 19 | `Java_com_example_jni_ToastModule_stringFromJNI`方法对应的是`android/app/src/main/java/com/example/jni/ToastModule.java`的`stringFromJNI`方法。 20 | ```java 21 | public native String stringFromJNI(); 22 | ``` 23 | 在Java中声明了方法,具体实现写在C中,Java层对该方法的调用都会打到C层对应的方法上。 24 | 25 | 然后是`CMakeLists.txt`文件 26 | ``` 27 | add_library(hello-jni SHARED 28 | hello-jni.c) 29 | 30 | ``` 31 | 这里声明了编译生成的库名和编译需要的源文件。Java中需要加载的库名就是在这里声明的。 32 | ```java 33 | System.loadLibrary("hello-jni"); 34 | ``` 35 | 36 | 我们需要在`android/app/build.gradle`中配置项 37 | `externalNativeBuild`中将`CMakeLists.txt`文件配置进去。 38 | ``` 39 | externalNativeBuild { 40 | cmake { 41 | version '3.10.2' 42 | path "../../cpp/jni/CMakeLists.txt" 43 | } 44 | } 45 | ``` 46 | 47 | 到这里,我们已经成功将C集成进Java。接下来我们只需要在原来暴露给js调用的java方法中调用`stringFromJNI`方法,这样就实现了`js->java->c`的调用流程。 48 | ```java 49 | public void show(String message, int duration) { 50 | message = message + " | " + stringFromJNI(); 51 | Toast.makeText(getReactApplicationContext(),message, duration).show(); 52 | } 53 | ``` 54 | 55 | 我在接下来的几个commit中做了点优化,更加方便demo的展示与阅读。大家可以看到,JNI方案本身与RN并没有什么关系,只是单纯的在Java原生模块中集成C/C++,JS对C/C++的调用还是需要通过Java。而且每导出一个C/C++方法,都需要包装一层JNI,非常繁琐。 56 | 57 | ### CxxModule 58 | 事实上,RN已经对这种情况作出了优化。RN的CxxModule可以让我们直接使用C++编写原生模块。但奇怪的是,RN官方文档中对CxxModule只字未提,仅是在源码中写了一个SampleCxxModule。如果不是Kudo大神写了篇文章[如何编写 React Native 的 CxxModule](https://maxiee.github.io/post/ReactNativeCxxModulemd/),我都不知道居然还有这样的操作。 59 | 60 | Kudo在文章中对这部分内容已经介绍的比较详细了,我就不再赘述了。这里对CxxModule和JNI两种方案做个对比。 61 | 62 | 大家应该发现这两种方案中JS层对Native Module的调用并没有什么差别,差别主要在Bridge层。对RN通信机制不太了解的同学建议看下这篇文章[ReactNative源码篇:通信机制](https://github.com/sucese/react-native/blob/master/doc/ReactNative%E6%BA%90%E7%A0%81%E7%AF%87/6ReactNative%E6%BA%90%E7%A0%81%E7%AF%87%EF%BC%9A%E9%80%9A%E4%BF%A1%E6%9C%BA%E5%88%B6.md)。js调java的流程是这样`js->bridge->java`。利用JNI集成c++以后,调用流程是这样`js->bridge->java->c++`。虽然CxxModule还是需要在java层将Module注册进Bridge,但是注册完了以后,后续的调用流程就不需要java参与了,所以调用流程就变成了这样`js->bridge->c++`。 63 | 64 | 另外,我再补充几点。 65 | 66 | - 编译CxxModule需要用到的三个库`libfolly libfb libreactnative`,必须要通过编译RN源码才能得到。 67 | - 编译CxxModule需要用到的四个第三方库`folly boost glog double-conversion`,是在编译RN源码的过程中下载下来的。 68 | - Android端集成C++有三种编译方案,这个demo中选择的是[ndk-build](https://developer.android.com/ndk/guides/ndk-build.html?hl=zh-cn),所以编译配置文件是`Android.mk`和`Application.mk` 69 | - 不建议在windows下跑这个demo,虽然我后来还是跑通了,但是坑很深。我的开发环境是MacOS。Linux下没试过,但应该问题不大 70 | 71 | ### HostObject 72 | 不管是JNI还是CxxModule,这两种方案都离不开Bridge,这导致JS调C++始终是异步的。而在RN的新架构中提供了一种JSI机制,可以为C++创建一个HostObject对象,直接挂载到js的上下文中,使得js可以获取到C++对象的引用。然后,js调c++的流程就变成了这样js->c++。就这样简单直接,而且还是同步的。 73 | 74 | 对JSI不了解的同学,建议看下Maxiee同学的[React Native 笔记](https://reactnative.maxieewong.com/docs/advanced/jsi/)。目前JSI机制在RN的源码中已经大量使用,但官方还没有相应的文档和demo,应该是还没有准备好对外开放这个特性。不过,社区已经有大神研究出怎么使用JSI来集成C++。大家可以看下这篇文章[React Native JSI 尝鲜](https://maxiee.github.io/post/ReactNativeJSIChallengemd/),对应的demo是这个[react-native-hostobject-demo](https://github.com/ericlewis/react-native-hostobject-demo)。这个demo中只在IOS端做了集成,Android端没有。不过已经有人提了个[Add Android support](https://github.com/ericlewis/react-native-hostobject-demo/pull/4)的PR。 75 | 76 | 大家可以看到我的commit记录[添加hostobject示例代码](https://github.com/drafish/react-native-cpp-demo/commit/54d83aa44ae978d2327edbe7e9882a3ca6485fc9),基本上就是复制了`react-native-hostobject-demo`中的代码。我这里主要讲下commit记录[android端集成hostobject](https://github.com/drafish/react-native-cpp-demo/commit/f70e5b01f4a0989e3c52052cabe56522b2d5d450)。大家可以看到,`android/app/src/main/java/com/reactnativecppdemo/MainActivity.java`也用到了JNI。 77 | ```java 78 | @Override 79 | public void onReactContextInitialized(ReactContext context) { 80 | install(context.getJavaScriptContextHolder().get()); 81 | } 82 | 83 | public native void install(long jsContextNativePointer); 84 | ``` 85 | 在ReactContext初始化的时候调用`install`方法,将js上下文引用传给c++。然后在c++中将HostObject挂载到js上下文上。 86 | 87 | 这里需要特别提一下的是,编译同样需要用到`folly boost glog double-conversion`这四个第三方库。这四个库有两种方式可以获取到,一是通过在编译RN源码的过程中下载获得,因为这几个库是编译RN源码的依赖包;二是在ios下执行`pod install`命令,IOS编译所需相关的依赖包括这几个库。在`CMakeLists.txt`中我是从`ios/Pods`目录下引用的,把这四个依赖包的引用路径换成`node_modules/react-native/ReactAndroid/build/third-party-ndk`也是可以的。不过这个前提是,需要先编译过RN源码,然后这些依赖包才会下载下来。 88 | ``` 89 | include_directories( 90 | ../../node_modules/react-native/React 91 | ../../node_modules/react-native/React/Base 92 | ../../node_modules/react-native/ReactCommon/jsi 93 | ../../ios/Pods/Folly 94 | ../../ios/Pods/DoubleConversion 95 | ../../ios/Pods/boost-for-react-native 96 | ../../ios/Pods/glog/src 97 | ) 98 | ``` 99 | 100 | ## IOS 101 | IOS端集成C++比Android端要容易。因为Object-C是C语言的超集,与C++有着良好的兼容性。只要做好编译相关配置,Object-C中可以直接引用C++代码。不过大概正是因为容易,社区大神们反而觉得没有写教程的必要。应该做哪些配置,怎么做这些配置,这方面的资料很少。我这里就简单讲下怎么配置,给不熟悉IOS和XCode的同学提供一个参考。 102 | 103 | ### JNI 104 | 这里特别声明一下,这个JNI标题,还有`ios/ReactNativeCppDemo/example/jni`目录,其实都和JNI没有半毛钱关系,纯粹是为了和Android保持队形。 105 | 106 | 大家可以看到我的commit记录,我先参考[RN官方文档](https://facebook.github.io/react-native/docs/native-modules-ios)实现了一个Native Module,然后在这个Native Module上集成了C++。 107 | 108 | 先来看这个commit[ios端原生模块demo](https://github.com/drafish/react-native-cpp-demo/commit/d43ed2ce1d05abc0251376a7ef3d92b72776f25b),我参考[RN官方文档](https://facebook.github.io/react-native/docs/native-modules-ios)实现了一个Native Module。这一步没什么难度,相信大家看下文档都可以实现。但其中有一个文件`ios/ReactNativeCppDemo.xcodeproj/project.pbxproj`,不熟悉XCode的同学可能会看着有点懵逼。这是XCode的项目配置文件,这个文件包含了XCode项目的所有文件路径和配置。 109 | 110 | 大家可以看到我在这个文件中将`TestModule.h TestModule.m`两个文件引入到`ios/ReactNativeCppDemo`目录下。如果没有这一步,即使你在`ios/ReactNativeCppDemo`目录下创建了这两个文件,XCode也不会认为这两个文件是这个项目的文件。 111 | 112 | 具体操作方法并不是直接修改`project.pbxproj`文件,而是在XCode中选中你要导入的目标文件夹,然后右键选择`Add Files to "some path"`,然后选择你要的文件或者文件夹。 113 | 114 | 再来看commit[ios端集成c++](https://github.com/drafish/react-native-cpp-demo/commit/da2a60a36589034e46a36d062471d46a90b48e6e),我把`Test.cpp Test.h`,两个文件引入项目,然后在`TestModule.m`中`import "Test.h"`。 115 | 116 | 这里需要提两点 117 | 118 | 一是需要将`TestModule.m`的文件类型改成`Object-C++ Source`。具体操作方法是,打开这个文件,然后看右边的侧边栏,有个`Type`选项,默认是`Default - Object-C Source`,改下就好了 119 | 120 | 二是将项目的`C++ Language Dialect`配置改成`C++14[-std=c++14]`。具体操作方法是,选中左边侧边栏的顶层目录(不是Pods目录),然后选择`Build Settings`,找到`C++ Language Dialect`选项,默认是`GNU++11[-std=gnu++11]`,改下就好了。 121 | 122 | ### CxxModule 123 | 再来看commit[ios端集成CxxModule](https://github.com/drafish/react-native-cpp-demo/commit/076337316260c6ea4dd0b94bbf53bc443787a54c),我移除了JNI方案中添加的`TestModule.h TestModule.m`,将`RCTHelloCxxModule.h RCTHelloCxxModule.mm HelloCxxModule.cpp HelloCxxModule.h`添加进项目。然后又改了`Build Settings`中的`Header Search Paths`和`Other C++ Flags`。具体操作方法我就不写了,参考前面的做法就可以了。 124 | 125 | 这里需要提一点,就是CxxModule名的问题,大家应该注意到`HelloCxxModule.cpp`中有一个方法 126 | ``` 127 | std::string HelloCxxModule::getName() { 128 | return "TestExample"; 129 | } 130 | ``` 131 | 这里会返回这个Module的方法名,但这个方法只对Android端有效,IOS中Module名定义在`RCTHelloCxxModule.h`中 132 | ``` 133 | @interface TestExample : RCTCxxModule 134 | ``` 135 | `RCTHelloCxxModule.mm`中的Module名需要和`RCTHelloCxxModule.h`中的一样 136 | ``` 137 | @implementation TestExample 138 | ``` 139 | 140 | ### HostObject 141 | 再来看commit[ios端集成hostobject](https://github.com/drafish/react-native-cpp-demo/commit/12371046a04fa26da34ece361e75e37ead148cdc),我移除了CxxModule方案中添加的`RCTHelloCxxModule.h RCTHelloCxxModule.mm HelloCxxModule.cpp HelloCxxModule.h`,将`TestBinding.cpp TestBinding.h`添加进项目,将`AppDelegate.m`的文件类型改成`Object-C++ Source`,`Build Settings`没有改动,和CxxModule完全一样. 142 | 143 | 这里需要提一点,就是在`App.js`中,我没有`import TestExample from "./TestExample";`,而是直接`console.warn(global.nativeTest.runTest(1, 2));`。不知道为什么,如果我从`TestExample.js`中import,就会一直报错。直接`global.nativeTest`这样调用,有时候报错,有时候不报错。我试过Reload,大概有超过1/2的概率会出现报错。Reload的问题在[React Native JSI 尝鲜](https://maxiee.github.io/post/ReactNativeJSIChallengemd/)中有提到过,但在Android端没碰到这个问题。另外,文章中还提到,在Debug模式跑不起来,我这边碰到了,两端都有这个问题。 144 | 145 | ## 总结 146 | 到这里,两个端,三种方案就都讲完了。我们来总结一下。 147 | 148 | - JNI 149 | - 优点:集成方式简单,不需要依赖第三方库 150 | - 缺点:Android端需要写JNI封装比较麻烦,调用流程较长,影响性能 151 | 152 | - CxxModule 153 | - 优点:Android端不需要写JNI封装,调用流程不需要JVM参与,性能较好 154 | - 缺点:Android端需要从RN源码编译,首次编译时间太长 155 | 156 | - HostObject 157 | - 优点:调用流程最直接,而且是同步操作,性能最好 158 | - 缺点:方案不太成熟,无法开启Debug模式,IOS端Reload报错 159 | 160 | 综合考虑三种方案的优缺点,我比较推荐CxxModule方案,因为只是首次编译时间比较长,二次编译就很快了。如果有精通RN的大神能搞定HostObject方案中的问题,我觉得还是可以考虑的,毕竟这个方案的性能是最好的。但我目前水平还很菜,不敢用HostObject,还是得多啃啃源码。 161 | -------------------------------------------------------------------------------- /TestExample.js: -------------------------------------------------------------------------------- 1 | // ToastExample.js 2 | /** 3 | * This exposes the native ToastExample module as a JS module. This has a 4 | * function 'show' which takes the following parameters: 5 | * 6 | * 1. String message: A string with the text to toast 7 | * 2. int duration: The duration of the toast. May be ToastExample.SHORT or 8 | * ToastExample.LONG 9 | */ 10 | import { NativeModules } from "react-native"; 11 | // 下一句中的ToastExample即对应上文 12 | // public String getName()中返回的字符串 13 | export default NativeModules.TestExample; 14 | // export default global.nativeTest; -------------------------------------------------------------------------------- /__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.reactnativecppdemo", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.reactnativecppdemo", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 22 | * bundleCommand: "ram-bundle", 23 | * 24 | * // whether to bundle JS and assets in debug mode 25 | * bundleInDebug: false, 26 | * 27 | * // whether to bundle JS and assets in release mode 28 | * bundleInRelease: true, 29 | * 30 | * // whether to bundle JS and assets in another build variant (if configured). 31 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 32 | * // The configuration property can be in the following formats 33 | * // 'bundleIn${productFlavor}${buildType}' 34 | * // 'bundleIn${buildType}' 35 | * // bundleInFreeDebug: true, 36 | * // bundleInPaidRelease: true, 37 | * // bundleInBeta: true, 38 | * 39 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 40 | * // for example: to disable dev mode in the staging build type (if configured) 41 | * devDisabledInStaging: true, 42 | * // The configuration property can be in the following formats 43 | * // 'devDisabledIn${productFlavor}${buildType}' 44 | * // 'devDisabledIn${buildType}' 45 | * 46 | * // the root of your project, i.e. where "package.json" lives 47 | * root: "../../", 48 | * 49 | * // where to put the JS bundle asset in debug mode 50 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 51 | * 52 | * // where to put the JS bundle asset in release mode 53 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 54 | * 55 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 56 | * // require('./image.png')), in debug mode 57 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 58 | * 59 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 60 | * // require('./image.png')), in release mode 61 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 62 | * 63 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 64 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 65 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 66 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 67 | * // for example, you might want to remove it from here. 68 | * inputExcludes: ["android/**", "ios/**"], 69 | * 70 | * // override which node gets called and with what additional arguments 71 | * nodeExecutableAndArgs: ["node"], 72 | * 73 | * // supply additional arguments to the packager 74 | * extraPackagerArgs: [] 75 | * ] 76 | */ 77 | 78 | project.ext.react = [ 79 | entryFile: "index.js", 80 | enableHermes: false, // clean and rebuild if changing 81 | ] 82 | 83 | apply from: "../../node_modules/react-native/react.gradle" 84 | 85 | /** 86 | * Set this to true to create two separate APKs instead of one: 87 | * - An APK that only works on ARM devices 88 | * - An APK that only works on x86 devices 89 | * The advantage is the size of the APK is reduced by about 4MB. 90 | * Upload all the APKs to the Play Store and people will download 91 | * the correct one based on the CPU architecture of their device. 92 | */ 93 | def enableSeparateBuildPerCPUArchitecture = false 94 | 95 | /** 96 | * Run Proguard to shrink the Java bytecode in release builds. 97 | */ 98 | def enableProguardInReleaseBuilds = false 99 | 100 | /** 101 | * The preferred build flavor of JavaScriptCore. 102 | * 103 | * For example, to use the international variant, you can use: 104 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 105 | * 106 | * The international variant includes ICU i18n library and necessary data 107 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 108 | * give correct results when using with locales other than en-US. Note that 109 | * this variant is about 6MiB larger per architecture than default. 110 | */ 111 | def jscFlavor = 'org.webkit:android-jsc:+' 112 | 113 | /** 114 | * Whether to enable the Hermes VM. 115 | * 116 | * This should be set on project.ext.react and mirrored here. If it is not set 117 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 118 | * and the benefits of using Hermes will therefore be sharply reduced. 119 | */ 120 | def enableHermes = project.ext.react.get("enableHermes", false); 121 | 122 | android { 123 | compileSdkVersion rootProject.ext.compileSdkVersion 124 | 125 | compileOptions { 126 | sourceCompatibility JavaVersion.VERSION_1_8 127 | targetCompatibility JavaVersion.VERSION_1_8 128 | } 129 | 130 | defaultConfig { 131 | applicationId "com.reactnativecppdemo" 132 | minSdkVersion rootProject.ext.minSdkVersion 133 | targetSdkVersion rootProject.ext.targetSdkVersion 134 | versionCode 1 135 | versionName "1.0" 136 | // externalNativeBuild { 137 | // ndkBuild { 138 | // arguments "NDK_DEBUG=0" 139 | // } 140 | // } 141 | } 142 | splits { 143 | abi { 144 | reset() 145 | enable enableSeparateBuildPerCPUArchitecture 146 | universalApk false // If true, also generate a universal APK 147 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 148 | } 149 | } 150 | signingConfigs { 151 | debug { 152 | storeFile file('debug.keystore') 153 | storePassword 'android' 154 | keyAlias 'androiddebugkey' 155 | keyPassword 'android' 156 | } 157 | } 158 | buildTypes { 159 | debug { 160 | signingConfig signingConfigs.debug 161 | } 162 | release { 163 | // Caution! In production, you need to generate your own keystore file. 164 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 165 | signingConfig signingConfigs.debug 166 | minifyEnabled enableProguardInReleaseBuilds 167 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 168 | } 169 | } 170 | // externalNativeBuild { 171 | // cmake { 172 | // version '3.10.2' 173 | // path "../../cpp/jni/CMakeLists.txt" 174 | // // path "../../cpp/hostobject/CMakeLists.txt" 175 | // } 176 | // // ndkBuild { 177 | // // path file('../../cpp/cxxmodule/Android.mk') 178 | // // } 179 | // } 180 | sourceSets { 181 | main { 182 | jniLibs.srcDirs = ['libs'] 183 | } 184 | } 185 | // applicationVariants are e.g. debug, release 186 | applicationVariants.all { variant -> 187 | variant.outputs.each { output -> 188 | // For each separate APK per architecture, set a unique version code as described here: 189 | // https://developer.android.com/studio/build/configure-apk-splits.html 190 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 191 | def abi = output.getFilter(OutputFile.ABI) 192 | if (abi != null) { // null for the universal-debug, universal-release variants 193 | output.versionCodeOverride = 194 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 195 | } 196 | 197 | } 198 | } 199 | } 200 | 201 | dependencies { 202 | implementation fileTree(dir: "libs", include: ["*.jar"]) 203 | implementation "com.facebook.react:react-native:+" // From node_modules 204 | // implementation project(':ReactAndroid') // Build from RN source 205 | 206 | if (enableHermes) { 207 | def hermesPath = "../../node_modules/hermes-engine/android/"; 208 | debugImplementation files(hermesPath + "hermes-debug.aar") 209 | releaseImplementation files(hermesPath + "hermes-release.aar") 210 | } else { 211 | implementation jscFlavor 212 | } 213 | } 214 | 215 | // Run this once to be able to run the application with BUCK 216 | // puts all compile dependencies into folder libs for BUCK to use 217 | task copyDownloadableDepsToLibs(type: Copy) { 218 | from configurations.compile 219 | into 'libs' 220 | } 221 | 222 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 223 | -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/debug.keystore -------------------------------------------------------------------------------- /android/app/libs/arm64-v8a/libhello-jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/libs/arm64-v8a/libhello-jni.so -------------------------------------------------------------------------------- /android/app/libs/armeabi-v7a/libhello-jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/libs/armeabi-v7a/libhello-jni.so -------------------------------------------------------------------------------- /android/app/libs/x86/libhello-jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/libs/x86/libhello-jni.so -------------------------------------------------------------------------------- /android/app/libs/x86_64/libhello-jni.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/libs/x86_64/libhello-jni.so -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/cxxmodule/HelloCxxPackage.java: -------------------------------------------------------------------------------- 1 | package com.example.cxxmodule; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.CxxModuleWrapper; 5 | import com.facebook.react.bridge.NativeModule; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.react.uimanager.ViewManager; 8 | 9 | import java.util.Arrays; 10 | import java.util.Collections; 11 | import java.util.List; 12 | 13 | public final class HelloCxxPackage implements ReactPackage { 14 | @Override 15 | public List createNativeModules(ReactApplicationContext reactContext) { 16 | return Arrays.asList( 17 | CxxModuleWrapper.makeDso("rnpackage-hellocxx", "createHelloCxxModule") 18 | ); 19 | } 20 | @Override 21 | public List createViewManagers(ReactApplicationContext reactContext) { 22 | return Collections.emptyList(); 23 | } 24 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/jni/TestModule.java: -------------------------------------------------------------------------------- 1 | package com.example.jni; 2 | 3 | import com.facebook.react.bridge.NativeModule; 4 | import com.facebook.react.bridge.ReactApplicationContext; 5 | import com.facebook.react.bridge.ReactContext; 6 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 7 | import com.facebook.react.bridge.ReactMethod; 8 | import com.facebook.react.bridge.Callback; 9 | 10 | import java.util.Map; 11 | import java.util.HashMap; 12 | 13 | public class TestModule extends ReactContextBaseJavaModule { 14 | private static ReactApplicationContext reactContext; 15 | 16 | public TestModule(ReactApplicationContext reactContext) { 17 | super(reactContext); 18 | this.reactContext = reactContext; 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return "TestExample"; 24 | } 25 | 26 | @ReactMethod 27 | public void stringFunc(String message, Callback callback) { 28 | callback.invoke(stringFromJNI(message)); 29 | } 30 | 31 | @ReactMethod 32 | public void intFunc(int a, int b, Callback callback) { 33 | callback.invoke(intFromJNI(a, b)); 34 | } 35 | 36 | public native String stringFromJNI(String message); 37 | 38 | public native int intFromJNI(int a, int b); 39 | 40 | static { 41 | System.loadLibrary("hello-jni"); 42 | } 43 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/jni/TestPackage.java: -------------------------------------------------------------------------------- 1 | package com.example.jni; 2 | 3 | import com.facebook.react.ReactPackage; 4 | import com.facebook.react.bridge.NativeModule; 5 | import com.facebook.react.bridge.ReactApplicationContext; 6 | import com.facebook.react.uimanager.ViewManager; 7 | 8 | import java.util.ArrayList; 9 | import java.util.Collections; 10 | import java.util.List; 11 | 12 | public class TestPackage implements ReactPackage { 13 | 14 | @Override 15 | public List createViewManagers(ReactApplicationContext reactContext) { 16 | return Collections.emptyList(); 17 | } 18 | 19 | @Override 20 | public List createNativeModules( 21 | ReactApplicationContext reactContext) { 22 | List modules = new ArrayList<>(); 23 | 24 | modules.add(new TestModule(reactContext)); 25 | 26 | return modules; 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /android/app/src/main/java/com/reactnativecppdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactnativecppdemo; 2 | 3 | import com.facebook.react.ReactActivity; 4 | // import com.facebook.react.ReactInstanceManager; 5 | // import com.facebook.react.bridge.ReactContext; 6 | 7 | public class MainActivity extends ReactActivity { 8 | // public class MainActivity extends ReactActivity implements ReactInstanceManager.ReactInstanceEventListener { 9 | // static { 10 | // System.loadLibrary("cpp_module_jni"); // this loads the library when the class is loaded 11 | // } 12 | 13 | /** 14 | * Returns the name of the main component registered from JavaScript. This is used to schedule 15 | * rendering of the component. 16 | */ 17 | @Override 18 | protected String getMainComponentName() { 19 | return "ReactNativeCppDemo"; 20 | } 21 | 22 | // @Override 23 | // public void onResume() { 24 | // super.onResume(); 25 | // getReactInstanceManager().addReactInstanceEventListener(this); 26 | // } 27 | 28 | // @Override 29 | // public void onPause() { 30 | // super.onPause(); 31 | // getReactInstanceManager().removeReactInstanceEventListener(this); 32 | // } 33 | 34 | // @Override 35 | // public void onReactContextInitialized(ReactContext context) { 36 | // install(context.getJavaScriptContextHolder().get()); 37 | // } 38 | 39 | // public native void install(long jsContextNativePointer); 40 | } 41 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/reactnativecppdemo/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.reactnativecppdemo; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | import java.lang.reflect.InvocationTargetException; 11 | import java.util.List; 12 | 13 | import com.example.jni.TestPackage; // <-- 引入你自己的包 14 | // import com.example.cxxmodule.HelloCxxPackage; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = 19 | new ReactNativeHost(this) { 20 | @Override 21 | public boolean getUseDeveloperSupport() { 22 | return BuildConfig.DEBUG; 23 | } 24 | 25 | @Override 26 | protected List getPackages() { 27 | @SuppressWarnings("UnnecessaryLocalVariable") 28 | List packages = new PackageList(this).getPackages(); 29 | // Packages that cannot be autolinked yet can be added manually here, for example: 30 | // packages.add(new MyReactNativePackage()); 31 | packages.add(new TestPackage()); // <-- 添加这一行,类名替换成你的Package类的名字 name. 32 | // packages.add(new HelloCxxPackage()); 33 | return packages; 34 | } 35 | 36 | @Override 37 | protected String getJSMainModuleName() { 38 | return "index"; 39 | } 40 | }; 41 | 42 | @Override 43 | public ReactNativeHost getReactNativeHost() { 44 | return mReactNativeHost; 45 | } 46 | 47 | @Override 48 | public void onCreate() { 49 | super.onCreate(); 50 | SoLoader.init(this, /* native exopackage */ false); 51 | initializeFlipper(this); // Remove this line if you don't want Flipper enabled 52 | } 53 | 54 | /** 55 | * Loads Flipper in React Native templates. 56 | * 57 | * @param context 58 | */ 59 | private static void initializeFlipper(Context context) { 60 | if (BuildConfig.DEBUG) { 61 | try { 62 | /* 63 | We use reflection here to pick up the class that initializes Flipper, 64 | since Flipper library is not available in release mode 65 | */ 66 | Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); 67 | aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); 68 | } catch (ClassNotFoundException e) { 69 | e.printStackTrace(); 70 | } catch (NoSuchMethodException e) { 71 | e.printStackTrace(); 72 | } catch (IllegalAccessException e) { 73 | e.printStackTrace(); 74 | } catch (InvocationTargetException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ReactNativeCppDemo 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | } 10 | repositories { 11 | google() 12 | jcenter() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle:3.4.2") 16 | // classpath("de.undercouch:gradle-download-task:3.4.3") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | maven { 27 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 28 | url("$rootDir/../node_modules/react-native/android") 29 | } 30 | maven { 31 | // Android JSC is installed from npm 32 | url("$rootDir/../node_modules/jsc-android/dist") 33 | } 34 | 35 | google() 36 | jcenter() 37 | maven { url 'https://jitpack.io' } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useAndroidX=true 21 | android.enableJetifier=true 22 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ReactNativeCppDemo' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | 5 | // include ':ReactAndroid' 6 | // project(':ReactAndroid').projectDir = new File(rootProject.projectDir, '../node_modules/react-native/ReactAndroid') 7 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeCppDemo", 3 | "displayName": "ReactNativeCppDemo" 4 | } -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /cpp/cxxmodule/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | RN_DIR := $(LOCAL_PATH)/../../node_modules/react-native 6 | RN_BUILD_THIRD_PARTY_DIR := $(RN_DIR)/ReactAndroid/build/third-party-ndk 7 | RN_BUILD_LIB_DIR := $(RN_DIR)/ReactAndroid/build/react-ndk/exported/ 8 | 9 | LOCAL_MODULE := rnpackage-hellocxx 10 | 11 | LOCAL_SRC_FILES := \ 12 | HelloCxxModule.cpp \ 13 | ../src/Test.cpp \ 14 | 15 | LOCAL_C_INCLUDES := $(RN_DIR)/ReactCommon 16 | LOCAL_C_INCLUDES += $(RN_DIR)/ReactAndroid/src/main/jni/react/jni 17 | LOCAL_C_INCLUDES += $(RN_DIR)/ReactAndroid/src/main/jni/first-party/fb/include 18 | LOCAL_C_INCLUDES += $(RN_BUILD_THIRD_PARTY_DIR)/boost/boost_1_63_0 19 | LOCAL_C_INCLUDES += $(RN_BUILD_THIRD_PARTY_DIR)/folly 20 | LOCAL_C_INCLUDES += $(RN_BUILD_THIRD_PARTY_DIR)/glog/exported 21 | LOCAL_C_INCLUDES += $(RN_BUILD_THIRD_PARTY_DIR)/double-conversion 22 | 23 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) 24 | 25 | LOCAL_SHARED_LIBRARIES := libfolly libfb libreactnative 26 | 27 | include $(BUILD_SHARED_LIBRARY) 28 | 29 | BASE_DIR := $(LOCAL_PATH) 30 | include $(BASE_DIR)/SoWrapper.mk 31 | -------------------------------------------------------------------------------- /cpp/cxxmodule/Application.mk: -------------------------------------------------------------------------------- 1 | APP_BUILD_SCRIPT := Android.mk 2 | 3 | APP_ABI := armeabi-v7a x86 arm64-v8a x86_64 4 | APP_PLATFORM := android-16 5 | 6 | APP_STL := c++_shared 7 | 8 | APP_CFLAGS := -Wall -Werror -fexceptions -frtti 9 | APP_CPPFLAGS := -std=c++1y 10 | # Make sure every shared lib includes a .note.gnu.build-id header 11 | APP_LDFLAGS := -Wl,--build-id 12 | -------------------------------------------------------------------------------- /cpp/cxxmodule/HelloCxxModule.cpp: -------------------------------------------------------------------------------- 1 | #include "HelloCxxModule.h" 2 | 3 | HelloCxxModule::HelloCxxModule() {} 4 | 5 | std::string HelloCxxModule::getName() { 6 | return "TestExample"; 7 | } 8 | 9 | auto HelloCxxModule::getConstants() -> std::map { 10 | return { 11 | {"one", 1}, {"two", 2}, {"animal", "fox"}, 12 | }; 13 | } 14 | 15 | auto HelloCxxModule::getMethods() -> std::vector { 16 | return { 17 | Method("add", [](folly::dynamic args, Callback cb) { 18 | example::Test test; 19 | int a = facebook::xplat::jsArgAsDouble(args, 0); 20 | int b = facebook::xplat::jsArgAsDouble(args, 1); 21 | int j = test.add(a, b); 22 | cb({j}); 23 | }), 24 | }; 25 | } 26 | 27 | extern "C" HelloCxxModule* createHelloCxxModule() { 28 | return new HelloCxxModule(); 29 | } 30 | -------------------------------------------------------------------------------- /cpp/cxxmodule/HelloCxxModule.h: -------------------------------------------------------------------------------- 1 | #ifndef RNPACKAGE_HELLO_CXX_MODULE_H_ 2 | #define RNPACKAGE_HELLO_CXX_MODULE_H_ 3 | 4 | #include 5 | #include 6 | #include "../src/Test.h" 7 | 8 | class HelloCxxModule : public facebook::xplat::module::CxxModule { 9 | public: 10 | HelloCxxModule(); 11 | 12 | std::string getName() override; 13 | 14 | auto getConstants() -> std::map override; 15 | 16 | auto getMethods() -> std::vector override; 17 | }; 18 | 19 | #endif // RNPACKAGE_HELLO_CXX_MODULE_H_ 20 | -------------------------------------------------------------------------------- /cpp/cxxmodule/SoWrapper.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | LOCAL_MODULE := fb 5 | 6 | LOCAL_SRC_FILES := \ 7 | $(RN_BUILD_LIB_DIR)/$(TARGET_ARCH_ABI)/libfb.so \ 8 | 9 | include $(PREBUILT_SHARED_LIBRARY) 10 | 11 | LOCAL_PATH := $(call my-dir) 12 | 13 | include $(CLEAR_VARS) 14 | LOCAL_MODULE := folly 15 | 16 | LOCAL_SRC_FILES := \ 17 | $(RN_BUILD_LIB_DIR)/$(TARGET_ARCH_ABI)/libfolly_json.so \ 18 | 19 | FOLLY_FLAGS := \ 20 | -DFOLLY_NO_CONFIG=1 \ 21 | -DFOLLY_HAVE_CLOCK_GETTIME=1 \ 22 | -DFOLLY_HAVE_MEMRCHR=1 \ 23 | -DFOLLY_USE_LIBCPP=1 24 | LOCAL_CFLAGS += $(FOLLY_FLAGS) 25 | LOCAL_EXPORT_CPPFLAGS := $(FOLLY_FLAGS) 26 | 27 | include $(PREBUILT_SHARED_LIBRARY) 28 | 29 | LOCAL_PATH := $(call my-dir) 30 | 31 | include $(CLEAR_VARS) 32 | LOCAL_MODULE := reactnative 33 | 34 | LOCAL_SRC_FILES := \ 35 | $(RN_BUILD_LIB_DIR)/$(TARGET_ARCH_ABI)/libreactnativejni.so \ 36 | 37 | include $(PREBUILT_SHARED_LIBRARY) 38 | -------------------------------------------------------------------------------- /cpp/hostobject/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # For more information about using CMake with Android Studio, read the 2 | # documentation: https://d.android.com/studio/projects/add-native-code.html 3 | 4 | # Sets the minimum version of CMake required to build the native library. 5 | 6 | cmake_minimum_required(VERSION 3.4.1) 7 | 8 | # Creates and names a library, sets it as either STATIC 9 | # or SHARED, and provides the relative paths to its source code. 10 | # You can define multiple libraries, and CMake builds them for you. 11 | # Gradle automatically packages shared libraries with your APK. 12 | 13 | # Needed to locate double-conversion src correctly for folly includes 14 | 15 | include_directories( 16 | ../../node_modules/react-native/React 17 | ../../node_modules/react-native/React/Base 18 | ../../node_modules/react-native/ReactCommon/jsi 19 | ../../ios/Pods/Folly 20 | ../../ios/Pods/DoubleConversion 21 | ../../ios/Pods/boost-for-react-native 22 | ../../ios/Pods/glog/src 23 | ) 24 | 25 | add_definitions( 26 | -DFOLLY_USE_LIBCPP=1 27 | -DFOLLY_NO_CONFIG=1 28 | -DFOLLY_HAVE_MEMRCHR=1 29 | ) 30 | 31 | add_library( # Sets the name of the library. 32 | cpp_module_jni 33 | 34 | # Sets the library as a shared library. 35 | SHARED 36 | 37 | # Provides a relative path to your source file(s). 38 | ../../node_modules/react-native/ReactCommon/jsi/jsi/jsi.cpp 39 | ../src/Test.cpp 40 | TestBinding.cpp 41 | jni.cpp) 42 | 43 | target_link_libraries(cpp_module_jni 44 | android 45 | log) 46 | -------------------------------------------------------------------------------- /cpp/hostobject/TestBinding.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 2004-present Facebook. All Rights Reserved. 2 | 3 | #include "TestBinding.h" 4 | #include 5 | 6 | namespace example { 7 | 8 | static jsi::Object getModule( 9 | jsi::Runtime &runtime, 10 | const std::string &moduleName) { 11 | auto batchedBridge = 12 | runtime.global().getPropertyAsObject(runtime, "__fbBatchedBridge"); 13 | auto getCallableModule = 14 | batchedBridge.getPropertyAsFunction(runtime, "getCallableModule"); 15 | auto module = getCallableModule 16 | .callWithThis( 17 | runtime, 18 | batchedBridge, 19 | {jsi::String::createFromUtf8(runtime, moduleName)}) 20 | .asObject(runtime); 21 | return module; 22 | } 23 | 24 | void TestBinding::install( 25 | jsi::Runtime &runtime, 26 | std::shared_ptr testBinding) { 27 | auto testModuleName = "nativeTest"; 28 | auto object = jsi::Object::createFromHostObject(runtime, testBinding); 29 | runtime.global().setProperty(runtime, testModuleName, std::move(object)); 30 | } 31 | 32 | TestBinding::TestBinding(std::unique_ptr test) 33 | : test_(std::move(test)) {} 34 | 35 | jsi::Value TestBinding::get( 36 | jsi::Runtime &runtime, 37 | const jsi::PropNameID &name) { 38 | auto methodName = name.utf8(runtime); 39 | auto &test = *test_; 40 | 41 | if (methodName == "runTest") { 42 | return jsi::Function::createFromHostFunction(runtime, name, 1, [&test]( 43 | jsi::Runtime &runtime, 44 | const jsi::Value &thisValue, 45 | const jsi::Value *arguments, 46 | size_t count) -> jsi::Value { 47 | auto arg0 = &arguments[0]; 48 | auto arg1 = &arguments[1]; 49 | return test.add(arg0->asNumber(), arg1->asNumber()); 50 | }); 51 | } 52 | 53 | return jsi::Value::undefined(); 54 | } 55 | 56 | } // namespace example -------------------------------------------------------------------------------- /cpp/hostobject/TestBinding.h: -------------------------------------------------------------------------------- 1 | // Copyright 2004-present Facebook. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "../src/Test.h" 6 | #include 7 | 8 | using namespace facebook; 9 | 10 | namespace example { 11 | 12 | /* 13 | * Exposes Test to JavaScript realm. 14 | */ 15 | class TestBinding : public jsi::HostObject { 16 | public: 17 | /* 18 | * Installs TestBinding into JavaSctipt runtime. 19 | * Thread synchronization must be enforced externally. 20 | */ 21 | static void install( 22 | jsi::Runtime &runtime, 23 | std::shared_ptr testBinding); 24 | 25 | TestBinding(std::unique_ptr test); 26 | 27 | /* 28 | * `jsi::HostObject` specific overloads. 29 | */ 30 | jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; 31 | 32 | private: 33 | std::unique_ptr test_; 34 | }; 35 | 36 | } // namespace example -------------------------------------------------------------------------------- /cpp/hostobject/jni.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "TestBinding.h" 4 | 5 | extern "C" 6 | { 7 | JNIEXPORT void JNICALL 8 | Java_com_reactnativecppdemo_MainActivity_install(JNIEnv* env, jobject thiz, jlong runtimePtr) 9 | { 10 | auto test = std::make_unique(); 11 | auto testBinding = std::make_shared(std::move(test)); 12 | jsi::Runtime* runtime = (jsi::Runtime*)runtimePtr; 13 | 14 | example::TestBinding::install(*runtime, testBinding); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /cpp/jni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.4.1) 2 | 3 | add_library(hello-jni SHARED 4 | hello-jni.cpp 5 | ../src/Test.cpp) 6 | 7 | # Include libraries needed for hello-jni lib 8 | target_link_libraries(hello-jni 9 | android 10 | log) -------------------------------------------------------------------------------- /cpp/jni/hello-jni.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "../src/Test.h" 3 | 4 | extern "C" { 5 | JNIEXPORT jstring JNICALL 6 | Java_com_example_jni_TestModule_stringFromJNI( JNIEnv* env, jobject thiz, jstring jstr ) 7 | { 8 | return jstr; 9 | } 10 | 11 | JNIEXPORT jint JNICALL 12 | Java_com_example_jni_TestModule_intFromJNI( JNIEnv* env, jobject thiz, jint a, jint b ) 13 | { 14 | example::Test test; 15 | return test.add(a, b); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /cpp/src/Test.cpp: -------------------------------------------------------------------------------- 1 | #include "Test.h" 2 | 3 | namespace example { 4 | int Test::add(int a, int b) const { 5 | return a + b; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /cpp/src/Test.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace example { 4 | 5 | class Test { 6 | public: 7 | int add(int a, int b) const; 8 | }; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /ios/DynamicLibraryDemo.framework/DynamicLibraryDemo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/ios/DynamicLibraryDemo.framework/DynamicLibraryDemo -------------------------------------------------------------------------------- /ios/DynamicLibraryDemo.framework/Headers/DynamicLibraryDemo.h: -------------------------------------------------------------------------------- 1 | // 2 | // DynamicLibraryDemo.h 3 | // DynamicLibraryDemo 4 | // 5 | // Created by 丁吉钦 on 2020/2/12. 6 | // Copyright © 2020 drafish. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for DynamicLibraryDemo. 12 | FOUNDATION_EXPORT double DynamicLibraryDemoVersionNumber; 13 | 14 | //! Project version string for DynamicLibraryDemo. 15 | FOUNDATION_EXPORT const unsigned char DynamicLibraryDemoVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /ios/DynamicLibraryDemo.framework/Headers/Test.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace example { 4 | 5 | class Test { 6 | public: 7 | int add(int a, int b) const; 8 | }; 9 | 10 | } 11 | -------------------------------------------------------------------------------- /ios/DynamicLibraryDemo.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/drafish/react-native-cpp-demo/bf8d7d3aa9bfceaf678ad7248a800e31ab3574eb/ios/DynamicLibraryDemo.framework/Info.plist -------------------------------------------------------------------------------- /ios/DynamicLibraryDemo.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module DynamicLibraryDemo { 2 | umbrella header "DynamicLibraryDemo.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /ios/DynamicLibraryDemo.framework/_CodeSignature/CodeResources: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | files 6 | 7 | Headers/DynamicLibraryDemo.h 8 | 9 | Gpdh+Tk0Qd0DLiWbjabsxDftBVQ= 10 | 11 | Headers/Test.h 12 | 13 | 093HXSWrx3LYMOmWBXiMjje7PGs= 14 | 15 | Info.plist 16 | 17 | VqLpEuAkmFB3RNDn/yPuFLCCmsA= 18 | 19 | Modules/module.modulemap 20 | 21 | OSocC4neg/ZeV5dRHyhCvV+J8+c= 22 | 23 | 24 | files2 25 | 26 | Headers/DynamicLibraryDemo.h 27 | 28 | hash2 29 | 30 | 9EeLO5yIlAhkIl7Whp7ZfZKpEpqHY4JuZjQGebVzMy4= 31 | 32 | 33 | Headers/Test.h 34 | 35 | hash2 36 | 37 | +YbNqItTy4LaJz40BRSDoMXT5wrC+LIb3QRYZeOBLYo= 38 | 39 | 40 | Modules/module.modulemap 41 | 42 | hash2 43 | 44 | 40IJZ8abDTQ8XYn9Za/YjR30+QnmlBvQA4TxkpC4FTA= 45 | 46 | 47 | 48 | rules 49 | 50 | ^.* 51 | 52 | ^.*\.lproj/ 53 | 54 | optional 55 | 56 | weight 57 | 1000 58 | 59 | ^.*\.lproj/locversion.plist$ 60 | 61 | omit 62 | 63 | weight 64 | 1100 65 | 66 | ^Base\.lproj/ 67 | 68 | weight 69 | 1010 70 | 71 | ^version.plist$ 72 | 73 | 74 | rules2 75 | 76 | .*\.dSYM($|/) 77 | 78 | weight 79 | 11 80 | 81 | ^(.*/)?\.DS_Store$ 82 | 83 | omit 84 | 85 | weight 86 | 2000 87 | 88 | ^.* 89 | 90 | ^.*\.lproj/ 91 | 92 | optional 93 | 94 | weight 95 | 1000 96 | 97 | ^.*\.lproj/locversion.plist$ 98 | 99 | omit 100 | 101 | weight 102 | 1100 103 | 104 | ^Base\.lproj/ 105 | 106 | weight 107 | 1010 108 | 109 | ^Info\.plist$ 110 | 111 | omit 112 | 113 | weight 114 | 20 115 | 116 | ^PkgInfo$ 117 | 118 | omit 119 | 120 | weight 121 | 20 122 | 123 | ^embedded\.provisionprofile$ 124 | 125 | weight 126 | 20 127 | 128 | ^version\.plist$ 129 | 130 | weight 131 | 20 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | target 'ReactNativeCppDemo' do 5 | # Pods for ReactNativeCppDemo 6 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 7 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 8 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 9 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 10 | pod 'React', :path => '../node_modules/react-native/' 11 | pod 'React-Core', :path => '../node_modules/react-native/' 12 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 13 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 14 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 15 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 16 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 17 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 18 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 19 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 20 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 21 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 22 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 23 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 24 | 25 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 26 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 27 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 28 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 29 | pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" 30 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 31 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' 32 | 33 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 34 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 35 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 36 | 37 | target 'ReactNativeCppDemoTests' do 38 | inherit! :search_paths 39 | # Pods for testing 40 | end 41 | 42 | use_native_modules! 43 | end 44 | 45 | target 'ReactNativeCppDemo-tvOS' do 46 | # Pods for ReactNativeCppDemo-tvOS 47 | 48 | target 'ReactNativeCppDemo-tvOSTests' do 49 | inherit! :search_paths 50 | # Pods for testing 51 | end 52 | 53 | end 54 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost-for-react-native (1.63.0) 3 | - DoubleConversion (1.1.6) 4 | - FBLazyVector (0.61.5) 5 | - FBReactNativeSpec (0.61.5): 6 | - Folly (= 2018.10.22.00) 7 | - RCTRequired (= 0.61.5) 8 | - RCTTypeSafety (= 0.61.5) 9 | - React-Core (= 0.61.5) 10 | - React-jsi (= 0.61.5) 11 | - ReactCommon/turbomodule/core (= 0.61.5) 12 | - Folly (2018.10.22.00): 13 | - boost-for-react-native 14 | - DoubleConversion 15 | - Folly/Default (= 2018.10.22.00) 16 | - glog 17 | - Folly/Default (2018.10.22.00): 18 | - boost-for-react-native 19 | - DoubleConversion 20 | - glog 21 | - glog (0.3.5) 22 | - RCTRequired (0.61.5) 23 | - RCTTypeSafety (0.61.5): 24 | - FBLazyVector (= 0.61.5) 25 | - Folly (= 2018.10.22.00) 26 | - RCTRequired (= 0.61.5) 27 | - React-Core (= 0.61.5) 28 | - React (0.61.5): 29 | - React-Core (= 0.61.5) 30 | - React-Core/DevSupport (= 0.61.5) 31 | - React-Core/RCTWebSocket (= 0.61.5) 32 | - React-RCTActionSheet (= 0.61.5) 33 | - React-RCTAnimation (= 0.61.5) 34 | - React-RCTBlob (= 0.61.5) 35 | - React-RCTImage (= 0.61.5) 36 | - React-RCTLinking (= 0.61.5) 37 | - React-RCTNetwork (= 0.61.5) 38 | - React-RCTSettings (= 0.61.5) 39 | - React-RCTText (= 0.61.5) 40 | - React-RCTVibration (= 0.61.5) 41 | - React-Core (0.61.5): 42 | - Folly (= 2018.10.22.00) 43 | - glog 44 | - React-Core/Default (= 0.61.5) 45 | - React-cxxreact (= 0.61.5) 46 | - React-jsi (= 0.61.5) 47 | - React-jsiexecutor (= 0.61.5) 48 | - Yoga 49 | - React-Core/CoreModulesHeaders (0.61.5): 50 | - Folly (= 2018.10.22.00) 51 | - glog 52 | - React-Core/Default 53 | - React-cxxreact (= 0.61.5) 54 | - React-jsi (= 0.61.5) 55 | - React-jsiexecutor (= 0.61.5) 56 | - Yoga 57 | - React-Core/Default (0.61.5): 58 | - Folly (= 2018.10.22.00) 59 | - glog 60 | - React-cxxreact (= 0.61.5) 61 | - React-jsi (= 0.61.5) 62 | - React-jsiexecutor (= 0.61.5) 63 | - Yoga 64 | - React-Core/DevSupport (0.61.5): 65 | - Folly (= 2018.10.22.00) 66 | - glog 67 | - React-Core/Default (= 0.61.5) 68 | - React-Core/RCTWebSocket (= 0.61.5) 69 | - React-cxxreact (= 0.61.5) 70 | - React-jsi (= 0.61.5) 71 | - React-jsiexecutor (= 0.61.5) 72 | - React-jsinspector (= 0.61.5) 73 | - Yoga 74 | - React-Core/RCTActionSheetHeaders (0.61.5): 75 | - Folly (= 2018.10.22.00) 76 | - glog 77 | - React-Core/Default 78 | - React-cxxreact (= 0.61.5) 79 | - React-jsi (= 0.61.5) 80 | - React-jsiexecutor (= 0.61.5) 81 | - Yoga 82 | - React-Core/RCTAnimationHeaders (0.61.5): 83 | - Folly (= 2018.10.22.00) 84 | - glog 85 | - React-Core/Default 86 | - React-cxxreact (= 0.61.5) 87 | - React-jsi (= 0.61.5) 88 | - React-jsiexecutor (= 0.61.5) 89 | - Yoga 90 | - React-Core/RCTBlobHeaders (0.61.5): 91 | - Folly (= 2018.10.22.00) 92 | - glog 93 | - React-Core/Default 94 | - React-cxxreact (= 0.61.5) 95 | - React-jsi (= 0.61.5) 96 | - React-jsiexecutor (= 0.61.5) 97 | - Yoga 98 | - React-Core/RCTImageHeaders (0.61.5): 99 | - Folly (= 2018.10.22.00) 100 | - glog 101 | - React-Core/Default 102 | - React-cxxreact (= 0.61.5) 103 | - React-jsi (= 0.61.5) 104 | - React-jsiexecutor (= 0.61.5) 105 | - Yoga 106 | - React-Core/RCTLinkingHeaders (0.61.5): 107 | - Folly (= 2018.10.22.00) 108 | - glog 109 | - React-Core/Default 110 | - React-cxxreact (= 0.61.5) 111 | - React-jsi (= 0.61.5) 112 | - React-jsiexecutor (= 0.61.5) 113 | - Yoga 114 | - React-Core/RCTNetworkHeaders (0.61.5): 115 | - Folly (= 2018.10.22.00) 116 | - glog 117 | - React-Core/Default 118 | - React-cxxreact (= 0.61.5) 119 | - React-jsi (= 0.61.5) 120 | - React-jsiexecutor (= 0.61.5) 121 | - Yoga 122 | - React-Core/RCTSettingsHeaders (0.61.5): 123 | - Folly (= 2018.10.22.00) 124 | - glog 125 | - React-Core/Default 126 | - React-cxxreact (= 0.61.5) 127 | - React-jsi (= 0.61.5) 128 | - React-jsiexecutor (= 0.61.5) 129 | - Yoga 130 | - React-Core/RCTTextHeaders (0.61.5): 131 | - Folly (= 2018.10.22.00) 132 | - glog 133 | - React-Core/Default 134 | - React-cxxreact (= 0.61.5) 135 | - React-jsi (= 0.61.5) 136 | - React-jsiexecutor (= 0.61.5) 137 | - Yoga 138 | - React-Core/RCTVibrationHeaders (0.61.5): 139 | - Folly (= 2018.10.22.00) 140 | - glog 141 | - React-Core/Default 142 | - React-cxxreact (= 0.61.5) 143 | - React-jsi (= 0.61.5) 144 | - React-jsiexecutor (= 0.61.5) 145 | - Yoga 146 | - React-Core/RCTWebSocket (0.61.5): 147 | - Folly (= 2018.10.22.00) 148 | - glog 149 | - React-Core/Default (= 0.61.5) 150 | - React-cxxreact (= 0.61.5) 151 | - React-jsi (= 0.61.5) 152 | - React-jsiexecutor (= 0.61.5) 153 | - Yoga 154 | - React-CoreModules (0.61.5): 155 | - FBReactNativeSpec (= 0.61.5) 156 | - Folly (= 2018.10.22.00) 157 | - RCTTypeSafety (= 0.61.5) 158 | - React-Core/CoreModulesHeaders (= 0.61.5) 159 | - React-RCTImage (= 0.61.5) 160 | - ReactCommon/turbomodule/core (= 0.61.5) 161 | - React-cxxreact (0.61.5): 162 | - boost-for-react-native (= 1.63.0) 163 | - DoubleConversion 164 | - Folly (= 2018.10.22.00) 165 | - glog 166 | - React-jsinspector (= 0.61.5) 167 | - React-jsi (0.61.5): 168 | - boost-for-react-native (= 1.63.0) 169 | - DoubleConversion 170 | - Folly (= 2018.10.22.00) 171 | - glog 172 | - React-jsi/Default (= 0.61.5) 173 | - React-jsi/Default (0.61.5): 174 | - boost-for-react-native (= 1.63.0) 175 | - DoubleConversion 176 | - Folly (= 2018.10.22.00) 177 | - glog 178 | - React-jsiexecutor (0.61.5): 179 | - DoubleConversion 180 | - Folly (= 2018.10.22.00) 181 | - glog 182 | - React-cxxreact (= 0.61.5) 183 | - React-jsi (= 0.61.5) 184 | - React-jsinspector (0.61.5) 185 | - React-RCTActionSheet (0.61.5): 186 | - React-Core/RCTActionSheetHeaders (= 0.61.5) 187 | - React-RCTAnimation (0.61.5): 188 | - React-Core/RCTAnimationHeaders (= 0.61.5) 189 | - React-RCTBlob (0.61.5): 190 | - React-Core/RCTBlobHeaders (= 0.61.5) 191 | - React-Core/RCTWebSocket (= 0.61.5) 192 | - React-jsi (= 0.61.5) 193 | - React-RCTNetwork (= 0.61.5) 194 | - React-RCTImage (0.61.5): 195 | - React-Core/RCTImageHeaders (= 0.61.5) 196 | - React-RCTNetwork (= 0.61.5) 197 | - React-RCTLinking (0.61.5): 198 | - React-Core/RCTLinkingHeaders (= 0.61.5) 199 | - React-RCTNetwork (0.61.5): 200 | - React-Core/RCTNetworkHeaders (= 0.61.5) 201 | - React-RCTSettings (0.61.5): 202 | - React-Core/RCTSettingsHeaders (= 0.61.5) 203 | - React-RCTText (0.61.5): 204 | - React-Core/RCTTextHeaders (= 0.61.5) 205 | - React-RCTVibration (0.61.5): 206 | - React-Core/RCTVibrationHeaders (= 0.61.5) 207 | - ReactCommon/jscallinvoker (0.61.5): 208 | - DoubleConversion 209 | - Folly (= 2018.10.22.00) 210 | - glog 211 | - React-cxxreact (= 0.61.5) 212 | - ReactCommon/turbomodule/core (0.61.5): 213 | - DoubleConversion 214 | - Folly (= 2018.10.22.00) 215 | - glog 216 | - React-Core (= 0.61.5) 217 | - React-cxxreact (= 0.61.5) 218 | - React-jsi (= 0.61.5) 219 | - ReactCommon/jscallinvoker (= 0.61.5) 220 | - Yoga (1.14.0) 221 | 222 | DEPENDENCIES: 223 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 224 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 225 | - FBReactNativeSpec (from `../node_modules/react-native/Libraries/FBReactNativeSpec`) 226 | - Folly (from `../node_modules/react-native/third-party-podspecs/Folly.podspec`) 227 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 228 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 229 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 230 | - React (from `../node_modules/react-native/`) 231 | - React-Core (from `../node_modules/react-native/`) 232 | - React-Core/DevSupport (from `../node_modules/react-native/`) 233 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 234 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 235 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 236 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 237 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 238 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 239 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 240 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 241 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 242 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 243 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 244 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 245 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 246 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 247 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 248 | - ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`) 249 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 250 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 251 | 252 | SPEC REPOS: 253 | trunk: 254 | - boost-for-react-native 255 | 256 | EXTERNAL SOURCES: 257 | DoubleConversion: 258 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 259 | FBLazyVector: 260 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 261 | FBReactNativeSpec: 262 | :path: "../node_modules/react-native/Libraries/FBReactNativeSpec" 263 | Folly: 264 | :podspec: "../node_modules/react-native/third-party-podspecs/Folly.podspec" 265 | glog: 266 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 267 | RCTRequired: 268 | :path: "../node_modules/react-native/Libraries/RCTRequired" 269 | RCTTypeSafety: 270 | :path: "../node_modules/react-native/Libraries/TypeSafety" 271 | React: 272 | :path: "../node_modules/react-native/" 273 | React-Core: 274 | :path: "../node_modules/react-native/" 275 | React-CoreModules: 276 | :path: "../node_modules/react-native/React/CoreModules" 277 | React-cxxreact: 278 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 279 | React-jsi: 280 | :path: "../node_modules/react-native/ReactCommon/jsi" 281 | React-jsiexecutor: 282 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 283 | React-jsinspector: 284 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 285 | React-RCTActionSheet: 286 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 287 | React-RCTAnimation: 288 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 289 | React-RCTBlob: 290 | :path: "../node_modules/react-native/Libraries/Blob" 291 | React-RCTImage: 292 | :path: "../node_modules/react-native/Libraries/Image" 293 | React-RCTLinking: 294 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 295 | React-RCTNetwork: 296 | :path: "../node_modules/react-native/Libraries/Network" 297 | React-RCTSettings: 298 | :path: "../node_modules/react-native/Libraries/Settings" 299 | React-RCTText: 300 | :path: "../node_modules/react-native/Libraries/Text" 301 | React-RCTVibration: 302 | :path: "../node_modules/react-native/Libraries/Vibration" 303 | ReactCommon: 304 | :path: "../node_modules/react-native/ReactCommon" 305 | Yoga: 306 | :path: "../node_modules/react-native/ReactCommon/yoga" 307 | 308 | SPEC CHECKSUMS: 309 | boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c 310 | DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2 311 | FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f 312 | FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75 313 | Folly: 30e7936e1c45c08d884aa59369ed951a8e68cf51 314 | glog: 1f3da668190260b06b429bb211bfbee5cd790c28 315 | RCTRequired: b153add4da6e7dbc44aebf93f3cf4fcae392ddf1 316 | RCTTypeSafety: 9aa1b91d7f9310fc6eadc3cf95126ffe818af320 317 | React: b6a59ef847b2b40bb6e0180a97d0ca716969ac78 318 | React-Core: 688b451f7d616cc1134ac95295b593d1b5158a04 319 | React-CoreModules: d04f8494c1a328b69ec11db9d1137d667f916dcb 320 | React-cxxreact: d0f7bcafa196ae410e5300736b424455e7fb7ba7 321 | React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7 322 | React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386 323 | React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0 324 | React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76 325 | React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360 326 | React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72 327 | React-RCTImage: 6b8e8df449eb7c814c99a92d6b52de6fe39dea4e 328 | React-RCTLinking: 121bb231c7503cf9094f4d8461b96a130fabf4a5 329 | React-RCTNetwork: fb353640aafcee84ca8b78957297bd395f065c9a 330 | React-RCTSettings: 8db258ea2a5efee381fcf7a6d5044e2f8b68b640 331 | React-RCTText: 9ccc88273e9a3aacff5094d2175a605efa854dbe 332 | React-RCTVibration: a49a1f42bf8f5acf1c3e297097517c6b3af377ad 333 | ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd 334 | Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b 335 | 336 | PODFILE CHECKSUM: 30ffc338fbf7334c2e2080171915e12e54af511a 337 | 338 | COCOAPODS: 1.8.4 339 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSAppTransportSecurity 26 | 27 | NSExceptionDomains 28 | 29 | localhost 30 | 31 | NSExceptionAllowsInsecureHTTPLoads 32 | 33 | 34 | 35 | 36 | NSLocationWhenInUseUsageDescription 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations 45 | 46 | UIInterfaceOrientationPortrait 47 | UIInterfaceOrientationLandscapeLeft 48 | UIInterfaceOrientationLandscapeRight 49 | 50 | UIViewControllerBasedStatusBarAppearance 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00E356F31AD99517003FC87E /* ReactNativeCppDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeCppDemoTests.m */; }; 11 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 12 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 13 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 14 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 15 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 16 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 17 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 18 | 2DCD954D1E0B4F2C00145EB5 /* ReactNativeCppDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeCppDemoTests.m */; }; 19 | 2E408DF6AFFC29473D76516E /* libPods-ReactNativeCppDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B6DEB7B4C7ADAC0413D1F901 /* libPods-ReactNativeCppDemo.a */; }; 20 | 4D1613E2C50272DB7F48D7F7 /* libPods-ReactNativeCppDemo-tvOSTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FAC29F1BC72B680AA5F76D2 /* libPods-ReactNativeCppDemo-tvOSTests.a */; }; 21 | 89E87BEE2756359352AB391D /* libPods-ReactNativeCppDemoTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19FEF3DAEE73C7C95A2D19AF /* libPods-ReactNativeCppDemoTests.a */; }; 22 | 9EC97CE4AEE232C3AAB9E838 /* libPods-ReactNativeCppDemo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CCDA862AB3EF9D7B4B43F706 /* libPods-ReactNativeCppDemo-tvOS.a */; }; 23 | FC71BC2B23F3C8AB004E6E43 /* TestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = FC71BC2A23F3C8AA004E6E43 /* TestModule.m */; }; 24 | FC71BC3123F3CADF004E6E43 /* DynamicLibraryDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FC71BC2C23F3C9B6004E6E43 /* DynamicLibraryDemo.framework */; }; 25 | FC71BC3223F3CADF004E6E43 /* DynamicLibraryDemo.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = FC71BC2C23F3C9B6004E6E43 /* DynamicLibraryDemo.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 34 | remoteInfo = ReactNativeCppDemo; 35 | }; 36 | 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = { 37 | isa = PBXContainerItemProxy; 38 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 39 | proxyType = 1; 40 | remoteGlobalIDString = 2D02E47A1E0B4A5D006451C7; 41 | remoteInfo = "ReactNativeCppDemo-tvOS"; 42 | }; 43 | /* End PBXContainerItemProxy section */ 44 | 45 | /* Begin PBXCopyFilesBuildPhase section */ 46 | FC71BC3323F3CADF004E6E43 /* Embed Frameworks */ = { 47 | isa = PBXCopyFilesBuildPhase; 48 | buildActionMask = 2147483647; 49 | dstPath = ""; 50 | dstSubfolderSpec = 10; 51 | files = ( 52 | FC71BC3223F3CADF004E6E43 /* DynamicLibraryDemo.framework in Embed Frameworks */, 53 | ); 54 | name = "Embed Frameworks"; 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | /* End PBXCopyFilesBuildPhase section */ 58 | 59 | /* Begin PBXFileReference section */ 60 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 61 | 00E356EE1AD99517003FC87E /* ReactNativeCppDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactNativeCppDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | 00E356F21AD99517003FC87E /* ReactNativeCppDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactNativeCppDemoTests.m; sourceTree = ""; }; 64 | 13B07F961A680F5B00A75B9A /* ReactNativeCppDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactNativeCppDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 65 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ReactNativeCppDemo/AppDelegate.h; sourceTree = ""; }; 66 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; name = AppDelegate.m; path = ReactNativeCppDemo/AppDelegate.m; sourceTree = ""; }; 67 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 68 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNativeCppDemo/Images.xcassets; sourceTree = ""; }; 69 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeCppDemo/Info.plist; sourceTree = ""; }; 70 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactNativeCppDemo/main.m; sourceTree = ""; }; 71 | 19FEF3DAEE73C7C95A2D19AF /* libPods-ReactNativeCppDemoTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeCppDemoTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 72 | 27DAA7DC201E6F1C6E2ED2CE /* Pods-ReactNativeCppDemoTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemoTests.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemoTests/Pods-ReactNativeCppDemoTests.release.xcconfig"; sourceTree = ""; }; 73 | 29CC21E90354F9EC084AA10E /* Pods-ReactNativeCppDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemo.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemo/Pods-ReactNativeCppDemo.debug.xcconfig"; sourceTree = ""; }; 74 | 2D02E47B1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ReactNativeCppDemo-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 75 | 2D02E4901E0B4A5D006451C7 /* ReactNativeCppDemo-tvOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "ReactNativeCppDemo-tvOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 76 | 44CF5CE3C3EBEC8DF20BB987 /* Pods-ReactNativeCppDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemo.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemo/Pods-ReactNativeCppDemo.release.xcconfig"; sourceTree = ""; }; 77 | 4FF7F5C89766D294836EE96F /* Pods-ReactNativeCppDemo-tvOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemo-tvOS.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemo-tvOS/Pods-ReactNativeCppDemo-tvOS.release.xcconfig"; sourceTree = ""; }; 78 | 94FD464131913E2F71FC6C70 /* Pods-ReactNativeCppDemo-tvOSTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemo-tvOSTests.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemo-tvOSTests/Pods-ReactNativeCppDemo-tvOSTests.debug.xcconfig"; sourceTree = ""; }; 79 | 9FAC29F1BC72B680AA5F76D2 /* libPods-ReactNativeCppDemo-tvOSTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeCppDemo-tvOSTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 80 | B6DEB7B4C7ADAC0413D1F901 /* libPods-ReactNativeCppDemo.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeCppDemo.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 81 | CCDA862AB3EF9D7B4B43F706 /* libPods-ReactNativeCppDemo-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeCppDemo-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 82 | D19AC57DBD7F549E6DBE7EBC /* Pods-ReactNativeCppDemo-tvOSTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemo-tvOSTests.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemo-tvOSTests/Pods-ReactNativeCppDemo-tvOSTests.release.xcconfig"; sourceTree = ""; }; 83 | DB072E366BF39FCDAA54031F /* Pods-ReactNativeCppDemoTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemoTests.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemoTests/Pods-ReactNativeCppDemoTests.debug.xcconfig"; sourceTree = ""; }; 84 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 85 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; 86 | EEB2EF7A2F55C70D37204724 /* Pods-ReactNativeCppDemo-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeCppDemo-tvOS.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeCppDemo-tvOS/Pods-ReactNativeCppDemo-tvOS.debug.xcconfig"; sourceTree = ""; }; 87 | FC71BC2923F3C8AA004E6E43 /* TestModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestModule.h; sourceTree = ""; }; 88 | FC71BC2A23F3C8AA004E6E43 /* TestModule.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = TestModule.m; sourceTree = ""; }; 89 | FC71BC2C23F3C9B6004E6E43 /* DynamicLibraryDemo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = DynamicLibraryDemo.framework; sourceTree = ""; }; 90 | /* End PBXFileReference section */ 91 | 92 | /* Begin PBXFrameworksBuildPhase section */ 93 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 94 | isa = PBXFrameworksBuildPhase; 95 | buildActionMask = 2147483647; 96 | files = ( 97 | 89E87BEE2756359352AB391D /* libPods-ReactNativeCppDemoTests.a in Frameworks */, 98 | ); 99 | runOnlyForDeploymentPostprocessing = 0; 100 | }; 101 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 102 | isa = PBXFrameworksBuildPhase; 103 | buildActionMask = 2147483647; 104 | files = ( 105 | 2E408DF6AFFC29473D76516E /* libPods-ReactNativeCppDemo.a in Frameworks */, 106 | FC71BC3123F3CADF004E6E43 /* DynamicLibraryDemo.framework in Frameworks */, 107 | ); 108 | runOnlyForDeploymentPostprocessing = 0; 109 | }; 110 | 2D02E4781E0B4A5D006451C7 /* Frameworks */ = { 111 | isa = PBXFrameworksBuildPhase; 112 | buildActionMask = 2147483647; 113 | files = ( 114 | 9EC97CE4AEE232C3AAB9E838 /* libPods-ReactNativeCppDemo-tvOS.a in Frameworks */, 115 | ); 116 | runOnlyForDeploymentPostprocessing = 0; 117 | }; 118 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */ = { 119 | isa = PBXFrameworksBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | 4D1613E2C50272DB7F48D7F7 /* libPods-ReactNativeCppDemo-tvOSTests.a in Frameworks */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXFrameworksBuildPhase section */ 127 | 128 | /* Begin PBXGroup section */ 129 | 00E356EF1AD99517003FC87E /* ReactNativeCppDemoTests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 00E356F21AD99517003FC87E /* ReactNativeCppDemoTests.m */, 133 | 00E356F01AD99517003FC87E /* Supporting Files */, 134 | ); 135 | path = ReactNativeCppDemoTests; 136 | sourceTree = ""; 137 | }; 138 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 00E356F11AD99517003FC87E /* Info.plist */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | 13B07FAE1A68108700A75B9A /* ReactNativeCppDemo */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 150 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 151 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 152 | FC71BC2C23F3C9B6004E6E43 /* DynamicLibraryDemo.framework */, 153 | FC71BC2823F3C8AA004E6E43 /* jni */, 154 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 155 | 13B07FB61A68108700A75B9A /* Info.plist */, 156 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 157 | 13B07FB71A68108700A75B9A /* main.m */, 158 | ); 159 | name = ReactNativeCppDemo; 160 | sourceTree = ""; 161 | }; 162 | 1462DC13AA4D2B1BAD5CEF48 /* Pods */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 29CC21E90354F9EC084AA10E /* Pods-ReactNativeCppDemo.debug.xcconfig */, 166 | 44CF5CE3C3EBEC8DF20BB987 /* Pods-ReactNativeCppDemo.release.xcconfig */, 167 | EEB2EF7A2F55C70D37204724 /* Pods-ReactNativeCppDemo-tvOS.debug.xcconfig */, 168 | 4FF7F5C89766D294836EE96F /* Pods-ReactNativeCppDemo-tvOS.release.xcconfig */, 169 | 94FD464131913E2F71FC6C70 /* Pods-ReactNativeCppDemo-tvOSTests.debug.xcconfig */, 170 | D19AC57DBD7F549E6DBE7EBC /* Pods-ReactNativeCppDemo-tvOSTests.release.xcconfig */, 171 | DB072E366BF39FCDAA54031F /* Pods-ReactNativeCppDemoTests.debug.xcconfig */, 172 | 27DAA7DC201E6F1C6E2ED2CE /* Pods-ReactNativeCppDemoTests.release.xcconfig */, 173 | ); 174 | path = Pods; 175 | sourceTree = ""; 176 | }; 177 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 178 | isa = PBXGroup; 179 | children = ( 180 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 181 | ED2971642150620600B7C4FE /* JavaScriptCore.framework */, 182 | B6DEB7B4C7ADAC0413D1F901 /* libPods-ReactNativeCppDemo.a */, 183 | CCDA862AB3EF9D7B4B43F706 /* libPods-ReactNativeCppDemo-tvOS.a */, 184 | 9FAC29F1BC72B680AA5F76D2 /* libPods-ReactNativeCppDemo-tvOSTests.a */, 185 | 19FEF3DAEE73C7C95A2D19AF /* libPods-ReactNativeCppDemoTests.a */, 186 | ); 187 | name = Frameworks; 188 | sourceTree = ""; 189 | }; 190 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 191 | isa = PBXGroup; 192 | children = ( 193 | ); 194 | name = Libraries; 195 | sourceTree = ""; 196 | }; 197 | 83CBB9F61A601CBA00E9B192 = { 198 | isa = PBXGroup; 199 | children = ( 200 | 13B07FAE1A68108700A75B9A /* ReactNativeCppDemo */, 201 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 202 | 00E356EF1AD99517003FC87E /* ReactNativeCppDemoTests */, 203 | 83CBBA001A601CBA00E9B192 /* Products */, 204 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 205 | 1462DC13AA4D2B1BAD5CEF48 /* Pods */, 206 | ); 207 | indentWidth = 2; 208 | sourceTree = ""; 209 | tabWidth = 2; 210 | usesTabs = 0; 211 | }; 212 | 83CBBA001A601CBA00E9B192 /* Products */ = { 213 | isa = PBXGroup; 214 | children = ( 215 | 13B07F961A680F5B00A75B9A /* ReactNativeCppDemo.app */, 216 | 00E356EE1AD99517003FC87E /* ReactNativeCppDemoTests.xctest */, 217 | 2D02E47B1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOS.app */, 218 | 2D02E4901E0B4A5D006451C7 /* ReactNativeCppDemo-tvOSTests.xctest */, 219 | ); 220 | name = Products; 221 | sourceTree = ""; 222 | }; 223 | FC71BC2823F3C8AA004E6E43 /* jni */ = { 224 | isa = PBXGroup; 225 | children = ( 226 | FC71BC2923F3C8AA004E6E43 /* TestModule.h */, 227 | FC71BC2A23F3C8AA004E6E43 /* TestModule.m */, 228 | ); 229 | name = jni; 230 | path = ReactNativeCppDemo/example/jni; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXGroup section */ 234 | 235 | /* Begin PBXNativeTarget section */ 236 | 00E356ED1AD99517003FC87E /* ReactNativeCppDemoTests */ = { 237 | isa = PBXNativeTarget; 238 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeCppDemoTests" */; 239 | buildPhases = ( 240 | E39B4DA1A778845FA90469E2 /* [CP] Check Pods Manifest.lock */, 241 | 00E356EA1AD99517003FC87E /* Sources */, 242 | 00E356EB1AD99517003FC87E /* Frameworks */, 243 | 00E356EC1AD99517003FC87E /* Resources */, 244 | ); 245 | buildRules = ( 246 | ); 247 | dependencies = ( 248 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 249 | ); 250 | name = ReactNativeCppDemoTests; 251 | productName = ReactNativeCppDemoTests; 252 | productReference = 00E356EE1AD99517003FC87E /* ReactNativeCppDemoTests.xctest */; 253 | productType = "com.apple.product-type.bundle.unit-test"; 254 | }; 255 | 13B07F861A680F5B00A75B9A /* ReactNativeCppDemo */ = { 256 | isa = PBXNativeTarget; 257 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeCppDemo" */; 258 | buildPhases = ( 259 | 6AA14A8B3FAEC0CF356B3EAC /* [CP] Check Pods Manifest.lock */, 260 | FD10A7F022414F080027D42C /* Start Packager */, 261 | 13B07F871A680F5B00A75B9A /* Sources */, 262 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 263 | 13B07F8E1A680F5B00A75B9A /* Resources */, 264 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 265 | FC71BC3323F3CADF004E6E43 /* Embed Frameworks */, 266 | ); 267 | buildRules = ( 268 | ); 269 | dependencies = ( 270 | ); 271 | name = ReactNativeCppDemo; 272 | productName = ReactNativeCppDemo; 273 | productReference = 13B07F961A680F5B00A75B9A /* ReactNativeCppDemo.app */; 274 | productType = "com.apple.product-type.application"; 275 | }; 276 | 2D02E47A1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOS */ = { 277 | isa = PBXNativeTarget; 278 | buildConfigurationList = 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ReactNativeCppDemo-tvOS" */; 279 | buildPhases = ( 280 | 0956A4CC2F996A6B2DDC78D6 /* [CP] Check Pods Manifest.lock */, 281 | FD10A7F122414F3F0027D42C /* Start Packager */, 282 | 2D02E4771E0B4A5D006451C7 /* Sources */, 283 | 2D02E4781E0B4A5D006451C7 /* Frameworks */, 284 | 2D02E4791E0B4A5D006451C7 /* Resources */, 285 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */, 286 | ); 287 | buildRules = ( 288 | ); 289 | dependencies = ( 290 | ); 291 | name = "ReactNativeCppDemo-tvOS"; 292 | productName = "ReactNativeCppDemo-tvOS"; 293 | productReference = 2D02E47B1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOS.app */; 294 | productType = "com.apple.product-type.application"; 295 | }; 296 | 2D02E48F1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOSTests */ = { 297 | isa = PBXNativeTarget; 298 | buildConfigurationList = 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ReactNativeCppDemo-tvOSTests" */; 299 | buildPhases = ( 300 | 385F7DBF4745C4D9245FEB5C /* [CP] Check Pods Manifest.lock */, 301 | 2D02E48C1E0B4A5D006451C7 /* Sources */, 302 | 2D02E48D1E0B4A5D006451C7 /* Frameworks */, 303 | 2D02E48E1E0B4A5D006451C7 /* Resources */, 304 | ); 305 | buildRules = ( 306 | ); 307 | dependencies = ( 308 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */, 309 | ); 310 | name = "ReactNativeCppDemo-tvOSTests"; 311 | productName = "ReactNativeCppDemo-tvOSTests"; 312 | productReference = 2D02E4901E0B4A5D006451C7 /* ReactNativeCppDemo-tvOSTests.xctest */; 313 | productType = "com.apple.product-type.bundle.unit-test"; 314 | }; 315 | /* End PBXNativeTarget section */ 316 | 317 | /* Begin PBXProject section */ 318 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 319 | isa = PBXProject; 320 | attributes = { 321 | LastUpgradeCheck = 0940; 322 | ORGANIZATIONNAME = Facebook; 323 | TargetAttributes = { 324 | 00E356ED1AD99517003FC87E = { 325 | CreatedOnToolsVersion = 6.2; 326 | TestTargetID = 13B07F861A680F5B00A75B9A; 327 | }; 328 | 2D02E47A1E0B4A5D006451C7 = { 329 | CreatedOnToolsVersion = 8.2.1; 330 | ProvisioningStyle = Automatic; 331 | }; 332 | 2D02E48F1E0B4A5D006451C7 = { 333 | CreatedOnToolsVersion = 8.2.1; 334 | ProvisioningStyle = Automatic; 335 | TestTargetID = 2D02E47A1E0B4A5D006451C7; 336 | }; 337 | }; 338 | }; 339 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNativeCppDemo" */; 340 | compatibilityVersion = "Xcode 3.2"; 341 | developmentRegion = English; 342 | hasScannedForEncodings = 0; 343 | knownRegions = ( 344 | English, 345 | en, 346 | Base, 347 | ); 348 | mainGroup = 83CBB9F61A601CBA00E9B192; 349 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 350 | projectDirPath = ""; 351 | projectRoot = ""; 352 | targets = ( 353 | 13B07F861A680F5B00A75B9A /* ReactNativeCppDemo */, 354 | 00E356ED1AD99517003FC87E /* ReactNativeCppDemoTests */, 355 | 2D02E47A1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOS */, 356 | 2D02E48F1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOSTests */, 357 | ); 358 | }; 359 | /* End PBXProject section */ 360 | 361 | /* Begin PBXResourcesBuildPhase section */ 362 | 00E356EC1AD99517003FC87E /* Resources */ = { 363 | isa = PBXResourcesBuildPhase; 364 | buildActionMask = 2147483647; 365 | files = ( 366 | ); 367 | runOnlyForDeploymentPostprocessing = 0; 368 | }; 369 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 370 | isa = PBXResourcesBuildPhase; 371 | buildActionMask = 2147483647; 372 | files = ( 373 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 374 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 375 | ); 376 | runOnlyForDeploymentPostprocessing = 0; 377 | }; 378 | 2D02E4791E0B4A5D006451C7 /* Resources */ = { 379 | isa = PBXResourcesBuildPhase; 380 | buildActionMask = 2147483647; 381 | files = ( 382 | 2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */, 383 | ); 384 | runOnlyForDeploymentPostprocessing = 0; 385 | }; 386 | 2D02E48E1E0B4A5D006451C7 /* Resources */ = { 387 | isa = PBXResourcesBuildPhase; 388 | buildActionMask = 2147483647; 389 | files = ( 390 | ); 391 | runOnlyForDeploymentPostprocessing = 0; 392 | }; 393 | /* End PBXResourcesBuildPhase section */ 394 | 395 | /* Begin PBXShellScriptBuildPhase section */ 396 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 397 | isa = PBXShellScriptBuildPhase; 398 | buildActionMask = 2147483647; 399 | files = ( 400 | ); 401 | inputPaths = ( 402 | ); 403 | name = "Bundle React Native code and images"; 404 | outputPaths = ( 405 | ); 406 | runOnlyForDeploymentPostprocessing = 0; 407 | shellPath = /bin/sh; 408 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; 409 | }; 410 | 0956A4CC2F996A6B2DDC78D6 /* [CP] Check Pods Manifest.lock */ = { 411 | isa = PBXShellScriptBuildPhase; 412 | buildActionMask = 2147483647; 413 | files = ( 414 | ); 415 | inputFileListPaths = ( 416 | ); 417 | inputPaths = ( 418 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 419 | "${PODS_ROOT}/Manifest.lock", 420 | ); 421 | name = "[CP] Check Pods Manifest.lock"; 422 | outputFileListPaths = ( 423 | ); 424 | outputPaths = ( 425 | "$(DERIVED_FILE_DIR)/Pods-ReactNativeCppDemo-tvOS-checkManifestLockResult.txt", 426 | ); 427 | runOnlyForDeploymentPostprocessing = 0; 428 | shellPath = /bin/sh; 429 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 430 | showEnvVarsInLog = 0; 431 | }; 432 | 2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = { 433 | isa = PBXShellScriptBuildPhase; 434 | buildActionMask = 2147483647; 435 | files = ( 436 | ); 437 | inputPaths = ( 438 | ); 439 | name = "Bundle React Native Code And Images"; 440 | outputPaths = ( 441 | ); 442 | runOnlyForDeploymentPostprocessing = 0; 443 | shellPath = /bin/sh; 444 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh"; 445 | }; 446 | 385F7DBF4745C4D9245FEB5C /* [CP] Check Pods Manifest.lock */ = { 447 | isa = PBXShellScriptBuildPhase; 448 | buildActionMask = 2147483647; 449 | files = ( 450 | ); 451 | inputFileListPaths = ( 452 | ); 453 | inputPaths = ( 454 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 455 | "${PODS_ROOT}/Manifest.lock", 456 | ); 457 | name = "[CP] Check Pods Manifest.lock"; 458 | outputFileListPaths = ( 459 | ); 460 | outputPaths = ( 461 | "$(DERIVED_FILE_DIR)/Pods-ReactNativeCppDemo-tvOSTests-checkManifestLockResult.txt", 462 | ); 463 | runOnlyForDeploymentPostprocessing = 0; 464 | shellPath = /bin/sh; 465 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 466 | showEnvVarsInLog = 0; 467 | }; 468 | 6AA14A8B3FAEC0CF356B3EAC /* [CP] Check Pods Manifest.lock */ = { 469 | isa = PBXShellScriptBuildPhase; 470 | buildActionMask = 2147483647; 471 | files = ( 472 | ); 473 | inputFileListPaths = ( 474 | ); 475 | inputPaths = ( 476 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 477 | "${PODS_ROOT}/Manifest.lock", 478 | ); 479 | name = "[CP] Check Pods Manifest.lock"; 480 | outputFileListPaths = ( 481 | ); 482 | outputPaths = ( 483 | "$(DERIVED_FILE_DIR)/Pods-ReactNativeCppDemo-checkManifestLockResult.txt", 484 | ); 485 | runOnlyForDeploymentPostprocessing = 0; 486 | shellPath = /bin/sh; 487 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 488 | showEnvVarsInLog = 0; 489 | }; 490 | E39B4DA1A778845FA90469E2 /* [CP] Check Pods Manifest.lock */ = { 491 | isa = PBXShellScriptBuildPhase; 492 | buildActionMask = 2147483647; 493 | files = ( 494 | ); 495 | inputFileListPaths = ( 496 | ); 497 | inputPaths = ( 498 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 499 | "${PODS_ROOT}/Manifest.lock", 500 | ); 501 | name = "[CP] Check Pods Manifest.lock"; 502 | outputFileListPaths = ( 503 | ); 504 | outputPaths = ( 505 | "$(DERIVED_FILE_DIR)/Pods-ReactNativeCppDemoTests-checkManifestLockResult.txt", 506 | ); 507 | runOnlyForDeploymentPostprocessing = 0; 508 | shellPath = /bin/sh; 509 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 510 | showEnvVarsInLog = 0; 511 | }; 512 | FD10A7F022414F080027D42C /* Start Packager */ = { 513 | isa = PBXShellScriptBuildPhase; 514 | buildActionMask = 2147483647; 515 | files = ( 516 | ); 517 | inputFileListPaths = ( 518 | ); 519 | inputPaths = ( 520 | ); 521 | name = "Start Packager"; 522 | outputFileListPaths = ( 523 | ); 524 | outputPaths = ( 525 | ); 526 | runOnlyForDeploymentPostprocessing = 0; 527 | shellPath = /bin/sh; 528 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 529 | showEnvVarsInLog = 0; 530 | }; 531 | FD10A7F122414F3F0027D42C /* Start Packager */ = { 532 | isa = PBXShellScriptBuildPhase; 533 | buildActionMask = 2147483647; 534 | files = ( 535 | ); 536 | inputFileListPaths = ( 537 | ); 538 | inputPaths = ( 539 | ); 540 | name = "Start Packager"; 541 | outputFileListPaths = ( 542 | ); 543 | outputPaths = ( 544 | ); 545 | runOnlyForDeploymentPostprocessing = 0; 546 | shellPath = /bin/sh; 547 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 548 | showEnvVarsInLog = 0; 549 | }; 550 | /* End PBXShellScriptBuildPhase section */ 551 | 552 | /* Begin PBXSourcesBuildPhase section */ 553 | 00E356EA1AD99517003FC87E /* Sources */ = { 554 | isa = PBXSourcesBuildPhase; 555 | buildActionMask = 2147483647; 556 | files = ( 557 | 00E356F31AD99517003FC87E /* ReactNativeCppDemoTests.m in Sources */, 558 | ); 559 | runOnlyForDeploymentPostprocessing = 0; 560 | }; 561 | 13B07F871A680F5B00A75B9A /* Sources */ = { 562 | isa = PBXSourcesBuildPhase; 563 | buildActionMask = 2147483647; 564 | files = ( 565 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 566 | FC71BC2B23F3C8AB004E6E43 /* TestModule.m in Sources */, 567 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 568 | ); 569 | runOnlyForDeploymentPostprocessing = 0; 570 | }; 571 | 2D02E4771E0B4A5D006451C7 /* Sources */ = { 572 | isa = PBXSourcesBuildPhase; 573 | buildActionMask = 2147483647; 574 | files = ( 575 | 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 576 | 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, 577 | ); 578 | runOnlyForDeploymentPostprocessing = 0; 579 | }; 580 | 2D02E48C1E0B4A5D006451C7 /* Sources */ = { 581 | isa = PBXSourcesBuildPhase; 582 | buildActionMask = 2147483647; 583 | files = ( 584 | 2DCD954D1E0B4F2C00145EB5 /* ReactNativeCppDemoTests.m in Sources */, 585 | ); 586 | runOnlyForDeploymentPostprocessing = 0; 587 | }; 588 | /* End PBXSourcesBuildPhase section */ 589 | 590 | /* Begin PBXTargetDependency section */ 591 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 592 | isa = PBXTargetDependency; 593 | target = 13B07F861A680F5B00A75B9A /* ReactNativeCppDemo */; 594 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 595 | }; 596 | 2D02E4921E0B4A5D006451C7 /* PBXTargetDependency */ = { 597 | isa = PBXTargetDependency; 598 | target = 2D02E47A1E0B4A5D006451C7 /* ReactNativeCppDemo-tvOS */; 599 | targetProxy = 2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */; 600 | }; 601 | /* End PBXTargetDependency section */ 602 | 603 | /* Begin PBXVariantGroup section */ 604 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 605 | isa = PBXVariantGroup; 606 | children = ( 607 | 13B07FB21A68108700A75B9A /* Base */, 608 | ); 609 | name = LaunchScreen.xib; 610 | path = ReactNativeCppDemo; 611 | sourceTree = ""; 612 | }; 613 | /* End PBXVariantGroup section */ 614 | 615 | /* Begin XCBuildConfiguration section */ 616 | 00E356F61AD99517003FC87E /* Debug */ = { 617 | isa = XCBuildConfiguration; 618 | baseConfigurationReference = DB072E366BF39FCDAA54031F /* Pods-ReactNativeCppDemoTests.debug.xcconfig */; 619 | buildSettings = { 620 | BUNDLE_LOADER = "$(TEST_HOST)"; 621 | GCC_PREPROCESSOR_DEFINITIONS = ( 622 | "DEBUG=1", 623 | "$(inherited)", 624 | ); 625 | INFOPLIST_FILE = ReactNativeCppDemoTests/Info.plist; 626 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 627 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 628 | OTHER_LDFLAGS = ( 629 | "-ObjC", 630 | "-lc++", 631 | "$(inherited)", 632 | ); 633 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 634 | PRODUCT_NAME = "$(TARGET_NAME)"; 635 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeCppDemo.app/ReactNativeCppDemo"; 636 | }; 637 | name = Debug; 638 | }; 639 | 00E356F71AD99517003FC87E /* Release */ = { 640 | isa = XCBuildConfiguration; 641 | baseConfigurationReference = 27DAA7DC201E6F1C6E2ED2CE /* Pods-ReactNativeCppDemoTests.release.xcconfig */; 642 | buildSettings = { 643 | BUNDLE_LOADER = "$(TEST_HOST)"; 644 | COPY_PHASE_STRIP = NO; 645 | INFOPLIST_FILE = ReactNativeCppDemoTests/Info.plist; 646 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 647 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 648 | OTHER_LDFLAGS = ( 649 | "-ObjC", 650 | "-lc++", 651 | "$(inherited)", 652 | ); 653 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 654 | PRODUCT_NAME = "$(TARGET_NAME)"; 655 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeCppDemo.app/ReactNativeCppDemo"; 656 | }; 657 | name = Release; 658 | }; 659 | 13B07F941A680F5B00A75B9A /* Debug */ = { 660 | isa = XCBuildConfiguration; 661 | baseConfigurationReference = 29CC21E90354F9EC084AA10E /* Pods-ReactNativeCppDemo.debug.xcconfig */; 662 | buildSettings = { 663 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 664 | CLANG_CXX_LANGUAGE_STANDARD = "c++14"; 665 | CURRENT_PROJECT_VERSION = 1; 666 | DEAD_CODE_STRIPPING = NO; 667 | FRAMEWORK_SEARCH_PATHS = ( 668 | "$(inherited)", 669 | "$(PROJECT_DIR)", 670 | ); 671 | HEADER_SEARCH_PATHS = ( 672 | "$(inherited)", 673 | "\"${PODS_ROOT}/Headers/Public\"", 674 | "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"", 675 | "\"${PODS_ROOT}/Headers/Public/FBLazyVector\"", 676 | "\"${PODS_ROOT}/Headers/Public/FBReactNativeSpec\"", 677 | "\"${PODS_ROOT}/Headers/Public/RCTRequired\"", 678 | "\"${PODS_ROOT}/Headers/Public/RCTTypeSafety\"", 679 | "\"${PODS_ROOT}/Headers/Public/React-Core\"", 680 | "\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"", 681 | "\"${PODS_ROOT}/Headers/Public/React-RCTText\"", 682 | "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"", 683 | "\"${PODS_ROOT}/Headers/Public/React-jsi\"", 684 | "\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"", 685 | "\"${PODS_ROOT}/Headers/Public/React-jsinspector\"", 686 | "\"${PODS_ROOT}/Headers/Public/ReactCommon\"", 687 | "\"${PODS_ROOT}/Headers/Public/Yoga\"", 688 | "\"${PODS_ROOT}/Headers/Public/glog\"", 689 | "\"$(PODS_ROOT)/Headers/Private/React-Core\"", 690 | "\"$(PODS_ROOT)/boost-for-react-native\"", 691 | "\"$(PODS_ROOT)/Folly\"", 692 | ); 693 | INFOPLIST_FILE = ReactNativeCppDemo/Info.plist; 694 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 695 | OTHER_CPLUSPLUSFLAGS = ( 696 | "$(OTHER_CFLAGS)", 697 | "-DFOLLY_NO_CONFIG", 698 | "-DFOLLY_MOBILE=1", 699 | "-DFOLLY_USE_LIBCPP=1", 700 | "-DFOLLY_HAVE_PTHREAD=1", 701 | ); 702 | OTHER_LDFLAGS = ( 703 | "$(inherited)", 704 | "-ObjC", 705 | "-lc++", 706 | ); 707 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 708 | PRODUCT_NAME = ReactNativeCppDemo; 709 | VERSIONING_SYSTEM = "apple-generic"; 710 | }; 711 | name = Debug; 712 | }; 713 | 13B07F951A680F5B00A75B9A /* Release */ = { 714 | isa = XCBuildConfiguration; 715 | baseConfigurationReference = 44CF5CE3C3EBEC8DF20BB987 /* Pods-ReactNativeCppDemo.release.xcconfig */; 716 | buildSettings = { 717 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 718 | CLANG_CXX_LANGUAGE_STANDARD = "c++14"; 719 | CURRENT_PROJECT_VERSION = 1; 720 | FRAMEWORK_SEARCH_PATHS = ( 721 | "$(inherited)", 722 | "$(PROJECT_DIR)", 723 | ); 724 | HEADER_SEARCH_PATHS = ( 725 | "$(inherited)", 726 | "\"${PODS_ROOT}/Headers/Public\"", 727 | "\"${PODS_ROOT}/Headers/Public/DoubleConversion\"", 728 | "\"${PODS_ROOT}/Headers/Public/FBLazyVector\"", 729 | "\"${PODS_ROOT}/Headers/Public/FBReactNativeSpec\"", 730 | "\"${PODS_ROOT}/Headers/Public/RCTRequired\"", 731 | "\"${PODS_ROOT}/Headers/Public/RCTTypeSafety\"", 732 | "\"${PODS_ROOT}/Headers/Public/React-Core\"", 733 | "\"${PODS_ROOT}/Headers/Public/React-RCTBlob\"", 734 | "\"${PODS_ROOT}/Headers/Public/React-RCTText\"", 735 | "\"${PODS_ROOT}/Headers/Public/React-cxxreact\"", 736 | "\"${PODS_ROOT}/Headers/Public/React-jsi\"", 737 | "\"${PODS_ROOT}/Headers/Public/React-jsiexecutor\"", 738 | "\"${PODS_ROOT}/Headers/Public/React-jsinspector\"", 739 | "\"${PODS_ROOT}/Headers/Public/ReactCommon\"", 740 | "\"${PODS_ROOT}/Headers/Public/Yoga\"", 741 | "\"${PODS_ROOT}/Headers/Public/glog\"", 742 | "\"$(PODS_ROOT)/Headers/Private/React-Core\"", 743 | "\"$(PODS_ROOT)/boost-for-react-native\"", 744 | "\"$(PODS_ROOT)/Folly\"", 745 | ); 746 | INFOPLIST_FILE = ReactNativeCppDemo/Info.plist; 747 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 748 | OTHER_CPLUSPLUSFLAGS = ( 749 | "$(OTHER_CFLAGS)", 750 | "-DFOLLY_NO_CONFIG", 751 | "-DFOLLY_MOBILE=1", 752 | "-DFOLLY_USE_LIBCPP=1", 753 | "-DFOLLY_HAVE_PTHREAD=1", 754 | ); 755 | OTHER_LDFLAGS = ( 756 | "$(inherited)", 757 | "-ObjC", 758 | "-lc++", 759 | ); 760 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)"; 761 | PRODUCT_NAME = ReactNativeCppDemo; 762 | VERSIONING_SYSTEM = "apple-generic"; 763 | }; 764 | name = Release; 765 | }; 766 | 2D02E4971E0B4A5E006451C7 /* Debug */ = { 767 | isa = XCBuildConfiguration; 768 | baseConfigurationReference = EEB2EF7A2F55C70D37204724 /* Pods-ReactNativeCppDemo-tvOS.debug.xcconfig */; 769 | buildSettings = { 770 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 771 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 772 | CLANG_ANALYZER_NONNULL = YES; 773 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 774 | CLANG_WARN_INFINITE_RECURSION = YES; 775 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 776 | DEBUG_INFORMATION_FORMAT = dwarf; 777 | ENABLE_TESTABILITY = YES; 778 | GCC_NO_COMMON_BLOCKS = YES; 779 | INFOPLIST_FILE = "ReactNativeCppDemo-tvOS/Info.plist"; 780 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 781 | OTHER_LDFLAGS = ( 782 | "$(inherited)", 783 | "-ObjC", 784 | "-lc++", 785 | ); 786 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ReactNativeCppDemo-tvOS"; 787 | PRODUCT_NAME = "$(TARGET_NAME)"; 788 | SDKROOT = appletvos; 789 | TARGETED_DEVICE_FAMILY = 3; 790 | TVOS_DEPLOYMENT_TARGET = 9.2; 791 | }; 792 | name = Debug; 793 | }; 794 | 2D02E4981E0B4A5E006451C7 /* Release */ = { 795 | isa = XCBuildConfiguration; 796 | baseConfigurationReference = 4FF7F5C89766D294836EE96F /* Pods-ReactNativeCppDemo-tvOS.release.xcconfig */; 797 | buildSettings = { 798 | ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; 799 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 800 | CLANG_ANALYZER_NONNULL = YES; 801 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 802 | CLANG_WARN_INFINITE_RECURSION = YES; 803 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 804 | COPY_PHASE_STRIP = NO; 805 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 806 | GCC_NO_COMMON_BLOCKS = YES; 807 | INFOPLIST_FILE = "ReactNativeCppDemo-tvOS/Info.plist"; 808 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 809 | OTHER_LDFLAGS = ( 810 | "$(inherited)", 811 | "-ObjC", 812 | "-lc++", 813 | ); 814 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ReactNativeCppDemo-tvOS"; 815 | PRODUCT_NAME = "$(TARGET_NAME)"; 816 | SDKROOT = appletvos; 817 | TARGETED_DEVICE_FAMILY = 3; 818 | TVOS_DEPLOYMENT_TARGET = 9.2; 819 | }; 820 | name = Release; 821 | }; 822 | 2D02E4991E0B4A5E006451C7 /* Debug */ = { 823 | isa = XCBuildConfiguration; 824 | baseConfigurationReference = 94FD464131913E2F71FC6C70 /* Pods-ReactNativeCppDemo-tvOSTests.debug.xcconfig */; 825 | buildSettings = { 826 | BUNDLE_LOADER = "$(TEST_HOST)"; 827 | CLANG_ANALYZER_NONNULL = YES; 828 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 829 | CLANG_WARN_INFINITE_RECURSION = YES; 830 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 831 | DEBUG_INFORMATION_FORMAT = dwarf; 832 | ENABLE_TESTABILITY = YES; 833 | GCC_NO_COMMON_BLOCKS = YES; 834 | INFOPLIST_FILE = "ReactNativeCppDemo-tvOSTests/Info.plist"; 835 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 836 | OTHER_LDFLAGS = ( 837 | "$(inherited)", 838 | "-ObjC", 839 | "-lc++", 840 | ); 841 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ReactNativeCppDemo-tvOSTests"; 842 | PRODUCT_NAME = "$(TARGET_NAME)"; 843 | SDKROOT = appletvos; 844 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeCppDemo-tvOS.app/ReactNativeCppDemo-tvOS"; 845 | TVOS_DEPLOYMENT_TARGET = 10.1; 846 | }; 847 | name = Debug; 848 | }; 849 | 2D02E49A1E0B4A5E006451C7 /* Release */ = { 850 | isa = XCBuildConfiguration; 851 | baseConfigurationReference = D19AC57DBD7F549E6DBE7EBC /* Pods-ReactNativeCppDemo-tvOSTests.release.xcconfig */; 852 | buildSettings = { 853 | BUNDLE_LOADER = "$(TEST_HOST)"; 854 | CLANG_ANALYZER_NONNULL = YES; 855 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 856 | CLANG_WARN_INFINITE_RECURSION = YES; 857 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 858 | COPY_PHASE_STRIP = NO; 859 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 860 | GCC_NO_COMMON_BLOCKS = YES; 861 | INFOPLIST_FILE = "ReactNativeCppDemo-tvOSTests/Info.plist"; 862 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 863 | OTHER_LDFLAGS = ( 864 | "$(inherited)", 865 | "-ObjC", 866 | "-lc++", 867 | ); 868 | PRODUCT_BUNDLE_IDENTIFIER = "com.facebook.REACT.ReactNativeCppDemo-tvOSTests"; 869 | PRODUCT_NAME = "$(TARGET_NAME)"; 870 | SDKROOT = appletvos; 871 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNativeCppDemo-tvOS.app/ReactNativeCppDemo-tvOS"; 872 | TVOS_DEPLOYMENT_TARGET = 10.1; 873 | }; 874 | name = Release; 875 | }; 876 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 877 | isa = XCBuildConfiguration; 878 | buildSettings = { 879 | ALWAYS_SEARCH_USER_PATHS = NO; 880 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 881 | CLANG_CXX_LIBRARY = "libc++"; 882 | CLANG_ENABLE_MODULES = YES; 883 | CLANG_ENABLE_OBJC_ARC = YES; 884 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 885 | CLANG_WARN_BOOL_CONVERSION = YES; 886 | CLANG_WARN_COMMA = YES; 887 | CLANG_WARN_CONSTANT_CONVERSION = YES; 888 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 889 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 890 | CLANG_WARN_EMPTY_BODY = YES; 891 | CLANG_WARN_ENUM_CONVERSION = YES; 892 | CLANG_WARN_INFINITE_RECURSION = YES; 893 | CLANG_WARN_INT_CONVERSION = YES; 894 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 895 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 896 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 897 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 898 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 899 | CLANG_WARN_STRICT_PROTOTYPES = YES; 900 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 901 | CLANG_WARN_UNREACHABLE_CODE = YES; 902 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 903 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 904 | COPY_PHASE_STRIP = NO; 905 | ENABLE_STRICT_OBJC_MSGSEND = YES; 906 | ENABLE_TESTABILITY = YES; 907 | GCC_C_LANGUAGE_STANDARD = gnu99; 908 | GCC_DYNAMIC_NO_PIC = NO; 909 | GCC_NO_COMMON_BLOCKS = YES; 910 | GCC_OPTIMIZATION_LEVEL = 0; 911 | GCC_PREPROCESSOR_DEFINITIONS = ( 912 | "DEBUG=1", 913 | "$(inherited)", 914 | ); 915 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 916 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 917 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 918 | GCC_WARN_UNDECLARED_SELECTOR = YES; 919 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 920 | GCC_WARN_UNUSED_FUNCTION = YES; 921 | GCC_WARN_UNUSED_VARIABLE = YES; 922 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 923 | MTL_ENABLE_DEBUG_INFO = YES; 924 | ONLY_ACTIVE_ARCH = YES; 925 | SDKROOT = iphoneos; 926 | }; 927 | name = Debug; 928 | }; 929 | 83CBBA211A601CBA00E9B192 /* Release */ = { 930 | isa = XCBuildConfiguration; 931 | buildSettings = { 932 | ALWAYS_SEARCH_USER_PATHS = NO; 933 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 934 | CLANG_CXX_LIBRARY = "libc++"; 935 | CLANG_ENABLE_MODULES = YES; 936 | CLANG_ENABLE_OBJC_ARC = YES; 937 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 938 | CLANG_WARN_BOOL_CONVERSION = YES; 939 | CLANG_WARN_COMMA = YES; 940 | CLANG_WARN_CONSTANT_CONVERSION = YES; 941 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 942 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 943 | CLANG_WARN_EMPTY_BODY = YES; 944 | CLANG_WARN_ENUM_CONVERSION = YES; 945 | CLANG_WARN_INFINITE_RECURSION = YES; 946 | CLANG_WARN_INT_CONVERSION = YES; 947 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 948 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 949 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 950 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 951 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 952 | CLANG_WARN_STRICT_PROTOTYPES = YES; 953 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 954 | CLANG_WARN_UNREACHABLE_CODE = YES; 955 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 956 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 957 | COPY_PHASE_STRIP = YES; 958 | ENABLE_NS_ASSERTIONS = NO; 959 | ENABLE_STRICT_OBJC_MSGSEND = YES; 960 | GCC_C_LANGUAGE_STANDARD = gnu99; 961 | GCC_NO_COMMON_BLOCKS = YES; 962 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 963 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 964 | GCC_WARN_UNDECLARED_SELECTOR = YES; 965 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 966 | GCC_WARN_UNUSED_FUNCTION = YES; 967 | GCC_WARN_UNUSED_VARIABLE = YES; 968 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 969 | MTL_ENABLE_DEBUG_INFO = NO; 970 | SDKROOT = iphoneos; 971 | VALIDATE_PRODUCT = YES; 972 | }; 973 | name = Release; 974 | }; 975 | /* End XCBuildConfiguration section */ 976 | 977 | /* Begin XCConfigurationList section */ 978 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNativeCppDemoTests" */ = { 979 | isa = XCConfigurationList; 980 | buildConfigurations = ( 981 | 00E356F61AD99517003FC87E /* Debug */, 982 | 00E356F71AD99517003FC87E /* Release */, 983 | ); 984 | defaultConfigurationIsVisible = 0; 985 | defaultConfigurationName = Release; 986 | }; 987 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeCppDemo" */ = { 988 | isa = XCConfigurationList; 989 | buildConfigurations = ( 990 | 13B07F941A680F5B00A75B9A /* Debug */, 991 | 13B07F951A680F5B00A75B9A /* Release */, 992 | ); 993 | defaultConfigurationIsVisible = 0; 994 | defaultConfigurationName = Release; 995 | }; 996 | 2D02E4BA1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ReactNativeCppDemo-tvOS" */ = { 997 | isa = XCConfigurationList; 998 | buildConfigurations = ( 999 | 2D02E4971E0B4A5E006451C7 /* Debug */, 1000 | 2D02E4981E0B4A5E006451C7 /* Release */, 1001 | ); 1002 | defaultConfigurationIsVisible = 0; 1003 | defaultConfigurationName = Release; 1004 | }; 1005 | 2D02E4BB1E0B4A5E006451C7 /* Build configuration list for PBXNativeTarget "ReactNativeCppDemo-tvOSTests" */ = { 1006 | isa = XCConfigurationList; 1007 | buildConfigurations = ( 1008 | 2D02E4991E0B4A5E006451C7 /* Debug */, 1009 | 2D02E49A1E0B4A5E006451C7 /* Release */, 1010 | ); 1011 | defaultConfigurationIsVisible = 0; 1012 | defaultConfigurationName = Release; 1013 | }; 1014 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNativeCppDemo" */ = { 1015 | isa = XCConfigurationList; 1016 | buildConfigurations = ( 1017 | 83CBBA201A601CBA00E9B192 /* Debug */, 1018 | 83CBBA211A601CBA00E9B192 /* Release */, 1019 | ); 1020 | defaultConfigurationIsVisible = 0; 1021 | defaultConfigurationName = Release; 1022 | }; 1023 | /* End XCConfigurationList section */ 1024 | }; 1025 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 1026 | } 1027 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo.xcodeproj/xcshareddata/xcschemes/ReactNativeCppDemo-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo.xcodeproj/xcshareddata/xcschemes/ReactNativeCppDemo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | //#import 12 | #import 13 | #import 14 | 15 | //#import "TestBinding.h" 16 | 17 | @implementation AppDelegate 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 20 | { 21 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 22 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 23 | moduleName:@"ReactNativeCppDemo" 24 | initialProperties:nil]; 25 | 26 | // [[NSNotificationCenter defaultCenter] addObserver:self 27 | // selector:@selector(handleJavaScriptDidLoadNotification:) 28 | // name:RCTJavaScriptDidLoadNotification 29 | // object:bridge]; 30 | 31 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 32 | 33 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 34 | UIViewController *rootViewController = [UIViewController new]; 35 | rootViewController.view = rootView; 36 | self.window.rootViewController = rootViewController; 37 | [self.window makeKeyAndVisible]; 38 | return YES; 39 | } 40 | 41 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 42 | { 43 | #if DEBUG 44 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 45 | #else 46 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 47 | #endif 48 | } 49 | 50 | //- (void)handleJavaScriptDidLoadNotification:(__unused NSNotification*)notification { 51 | // RCTCxxBridge* bridge = notification.userInfo[@"bridge"]; 52 | // facebook::jsi::Runtime* runtime = (facebook::jsi::Runtime*)bridge.runtime; 53 | // auto test = std::make_unique(); 54 | // std::shared_ptr testBinding_ = std::make_shared(std::move(test)); 55 | // example::TestBinding::install((*runtime), testBinding_); 56 | //} 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ReactNativeCppDemo 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/example/cxxmodule/RCTHelloCxxModule.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface TestExample : RCTCxxModule 6 | 7 | - (std::unique_ptr)createModule; 8 | 9 | @end 10 | 11 | NS_ASSUME_NONNULL_END 12 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/example/cxxmodule/RCTHelloCxxModule.mm: -------------------------------------------------------------------------------- 1 | #import "RCTHelloCxxModule.h" 2 | #import "HelloCxxModule.h" 3 | 4 | @implementation TestExample 5 | 6 | RCT_EXPORT_MODULE() 7 | 8 | - (std::unique_ptr)createModule 9 | { 10 | return std::make_unique(); 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/example/jni/TestModule.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface TestExample : NSObject 4 | @end 5 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/example/jni/TestModule.m: -------------------------------------------------------------------------------- 1 | #import "TestModule.h" 2 | #import 3 | 4 | @implementation TestExample 5 | 6 | RCT_EXPORT_MODULE(); 7 | 8 | RCT_EXPORT_METHOD(add:(int)numberA numberParameter:(int)numberB callback:(RCTResponseSenderBlock)callback) 9 | { 10 | example::Test test; 11 | int c = test.add(numberA, numberB); 12 | // NSInteger c = numberA + numberB; 13 | callback(@[@(c)]); 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemo/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/ReactNativeCppDemoTests/ReactNativeCppDemoTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 16 | 17 | @interface ReactNativeCppDemoTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation ReactNativeCppDemoTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | #ifdef DEBUG 44 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 45 | if (level >= RCTLogLevelError) { 46 | redboxError = message; 47 | } 48 | }); 49 | #endif 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | #ifdef DEBUG 64 | RCTSetLogFunction(RCTDefaultLogFunction); 65 | #endif 66 | 67 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 68 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNativeCppDemo", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint ." 11 | }, 12 | "dependencies": { 13 | "react": "16.9.0", 14 | "react-native": "0.61.5" 15 | }, 16 | "devDependencies": { 17 | "@babel/core": "^7.8.3", 18 | "@babel/runtime": "^7.8.3", 19 | "@react-native-community/eslint-config": "^0.0.6", 20 | "babel-jest": "^24.9.0", 21 | "eslint": "^6.8.0", 22 | "jest": "^24.9.0", 23 | "metro-react-native-babel-preset": "^0.56.4", 24 | "react-test-renderer": "16.9.0" 25 | }, 26 | "jest": { 27 | "preset": "react-native" 28 | } 29 | } 30 | --------------------------------------------------------------------------------