├── .gitignore ├── README.md └── ReactNative_MyViewController ├── .buckconfig ├── .flowconfig ├── .gitignore ├── .watchmanconfig ├── MyView.js ├── android ├── app │ ├── BUCK │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── reactnative_myviewcontroller │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── keystores │ ├── BUCK │ └── debug.keystore.properties └── settings.gradle ├── index.android.js ├── index.ios.js ├── ios ├── MyView.h ├── MyView.m ├── MyViewController.h ├── MyViewController.m ├── RCTMyViewManager.h ├── RCTMyViewManager.m ├── ReactNative_MyViewController.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── ReactNative_MyViewController.xcscheme ├── ReactNative_MyViewController │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ └── main.m └── ReactNative_MyViewControllerTests │ ├── Info.plist │ └── ReactNative_MyViewControllerTests.m └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | #Code Injection 56 | # 57 | # After new code Injection tools there's a generated folder /iOSInjectionProject 58 | # https://github.com/johnno1962/injectionforxcode 59 | 60 | iOSInjectionProject/ 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReactNative_MyViewController 2 | ReactNative工程中自定义原生Controller的封装示例demo 3 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.android.js 5 | 6 | # Ignore templates with `@flow` in header 7 | .*/local-cli/generator.* 8 | 9 | # Ignore malformed json 10 | .*/node_modules/y18n/test/.*\.json 11 | 12 | # Ignore the website subdir 13 | /website/.* 14 | 15 | # Ignore BUCK generated dirs 16 | /\.buckd/ 17 | 18 | # Ignore unexpected extra @providesModule 19 | .*/node_modules/commoner/test/source/widget/share.js 20 | 21 | # Ignore duplicate module providers 22 | # For RN Apps installed via npm, "Libraries" folder is inside node_modules/react-native but in the source repo it is in the root 23 | .*/Libraries/react-native/React.js 24 | .*/Libraries/react-native/ReactNative.js 25 | .*/node_modules/jest-runtime/build/__tests__/.* 26 | 27 | [include] 28 | 29 | [libs] 30 | node_modules/react-native/Libraries/react-native/react-native-interface.js 31 | node_modules/react-native/flow 32 | flow/ 33 | 34 | [options] 35 | module.system=haste 36 | 37 | esproposal.class_static_fields=enable 38 | esproposal.class_instance_fields=enable 39 | 40 | experimental.strict_type_args=true 41 | 42 | munge_underscores=true 43 | 44 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 45 | 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\)$' -> 'RelativeImageStub' 46 | 47 | suppress_type=$FlowIssue 48 | suppress_type=$FlowFixMe 49 | suppress_type=$FixMe 50 | 51 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(30\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 52 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(30\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 53 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 54 | 55 | unsafe.enable_getters_and_setters=true 56 | 57 | [version] 58 | ^0.30.0 59 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/.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 | project.xcworkspace 24 | 25 | # Android/IJ 26 | # 27 | *.iml 28 | .idea 29 | .gradle 30 | local.properties 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | 37 | # BUCK 38 | buck-out/ 39 | \.buckd/ 40 | android/app/libs 41 | android/keystores/debug.keystore 42 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /ReactNative_MyViewController/MyView.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { View,requireNativeComponent } from 'react-native'; 3 | 4 | export default class MyView extends React.Component { 5 | // 与OC中 RCTViewManager子类中导出的属性对应 6 | 7 | static propTypes = { 8 | value: React.PropTypes.number, 9 | isTest1: React.PropTypes.bool, 10 | num: React.PropTypes.number, 11 | infoDict: React.PropTypes.object, 12 | }; 13 | 14 | componentDidMount() { 15 | 16 | console.log("MyView被加载了"); 17 | } 18 | 19 | render() { 20 | return( 21 | 24 | 25 | ); 26 | } 27 | } 28 | /** 29 | //这个文件中,凡是用到RCTMyView的地方,应该与OC中 30 | //RCTViewManager子类中RCT_EXPORT_MODULE()括号中的参数一致, 31 | //如果没有参数,应为RCTViewManager子类的类名去掉manager 32 | */ 33 | var RCTMyView = requireNativeComponent('RCTMyView', MyView); 34 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/BUCK: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | # To learn about Buck see [Docs](https://buckbuild.com/). 4 | # To run your application with Buck: 5 | # - install Buck 6 | # - `npm start` - to start the packager 7 | # - `cd android` 8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 10 | # - `buck install -r android/app` - compile, install and run application 11 | # 12 | 13 | lib_deps = [] 14 | for jarfile in glob(['libs/*.jar']): 15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) 16 | lib_deps.append(':' + name) 17 | prebuilt_jar( 18 | name = name, 19 | binary_jar = jarfile, 20 | ) 21 | 22 | for aarfile in glob(['libs/*.aar']): 23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) 24 | lib_deps.append(':' + name) 25 | android_prebuilt_aar( 26 | name = name, 27 | aar = aarfile, 28 | ) 29 | 30 | android_library( 31 | name = 'all-libs', 32 | exported_deps = lib_deps 33 | ) 34 | 35 | android_library( 36 | name = 'app-code', 37 | srcs = glob([ 38 | 'src/main/java/**/*.java', 39 | ]), 40 | deps = [ 41 | ':all-libs', 42 | ':build_config', 43 | ':res', 44 | ], 45 | ) 46 | 47 | android_build_config( 48 | name = 'build_config', 49 | package = 'com.reactnative_myviewcontroller', 50 | ) 51 | 52 | android_resource( 53 | name = 'res', 54 | res = 'src/main/res', 55 | package = 'com.reactnative_myviewcontroller', 56 | ) 57 | 58 | android_binary( 59 | name = 'app', 60 | package_type = 'debug', 61 | manifest = 'src/main/AndroidManifest.xml', 62 | keystore = '//android/keystores:debug', 63 | deps = [ 64 | ':app-code', 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/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 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // the root of your project, i.e. where "package.json" lives 37 | * root: "../../", 38 | * 39 | * // where to put the JS bundle asset in debug mode 40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 41 | * 42 | * // where to put the JS bundle asset in release mode 43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 44 | * 45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 46 | * // require('./image.png')), in debug mode 47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 48 | * 49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 50 | * // require('./image.png')), in release mode 51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 52 | * 53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 57 | * // for example, you might want to remove it from here. 58 | * inputExcludes: ["android/**", "ios/**"], 59 | * 60 | * // override which node gets called and with what additional arguments 61 | * nodeExecutableAndArgs: ["node"] 62 | * 63 | * // supply additional arguments to the packager 64 | * extraPackagerArgs: [] 65 | * ] 66 | */ 67 | 68 | apply from: "../../node_modules/react-native/react.gradle" 69 | 70 | /** 71 | * Set this to true to create two separate APKs instead of one: 72 | * - An APK that only works on ARM devices 73 | * - An APK that only works on x86 devices 74 | * The advantage is the size of the APK is reduced by about 4MB. 75 | * Upload all the APKs to the Play Store and people will download 76 | * the correct one based on the CPU architecture of their device. 77 | */ 78 | def enableSeparateBuildPerCPUArchitecture = false 79 | 80 | /** 81 | * Run Proguard to shrink the Java bytecode in release builds. 82 | */ 83 | def enableProguardInReleaseBuilds = false 84 | 85 | android { 86 | compileSdkVersion 23 87 | buildToolsVersion "23.0.1" 88 | 89 | defaultConfig { 90 | applicationId "com.reactnative_myviewcontroller" 91 | minSdkVersion 16 92 | targetSdkVersion 22 93 | versionCode 1 94 | versionName "1.0" 95 | ndk { 96 | abiFilters "armeabi-v7a", "x86" 97 | } 98 | } 99 | splits { 100 | abi { 101 | reset() 102 | enable enableSeparateBuildPerCPUArchitecture 103 | universalApk false // If true, also generate a universal APK 104 | include "armeabi-v7a", "x86" 105 | } 106 | } 107 | buildTypes { 108 | release { 109 | minifyEnabled enableProguardInReleaseBuilds 110 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 111 | } 112 | } 113 | // applicationVariants are e.g. debug, release 114 | applicationVariants.all { variant -> 115 | variant.outputs.each { output -> 116 | // For each separate APK per architecture, set a unique version code as described here: 117 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 118 | def versionCodes = ["armeabi-v7a":1, "x86":2] 119 | def abi = output.getFilter(OutputFile.ABI) 120 | if (abi != null) { // null for the universal-debug, universal-release variants 121 | output.versionCodeOverride = 122 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 123 | } 124 | } 125 | } 126 | } 127 | 128 | dependencies { 129 | compile fileTree(dir: "libs", include: ["*.jar"]) 130 | compile "com.android.support:appcompat-v7:23.0.1" 131 | compile "com.facebook.react:react-native:+" // From node_modules 132 | } 133 | 134 | // Run this once to be able to run the application with BUCK 135 | // puts all compile dependencies into folder libs for BUCK to use 136 | task copyDownloadableDepsToLibs(type: Copy) { 137 | from configurations.compile 138 | into 'libs' 139 | } 140 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/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 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # okhttp 54 | 55 | -keepattributes Signature 56 | -keepattributes *Annotation* 57 | -keep class okhttp3.** { *; } 58 | -keep interface okhttp3.** { *; } 59 | -dontwarn okhttp3.** 60 | 61 | # okio 62 | 63 | -keep class sun.misc.Unsafe { *; } 64 | -dontwarn java.nio.file.* 65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 66 | -dontwarn okio.** 67 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/java/com/reactnative_myviewcontroller/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.reactnative_myviewcontroller; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "ReactNative_MyViewController"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/java/com/reactnative_myviewcontroller/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.reactnative_myviewcontroller; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.shell.MainReactPackage; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | protected boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage() 27 | ); 28 | } 29 | }; 30 | 31 | @Override 32 | public ReactNativeHost getReactNativeHost() { 33 | return mReactNativeHost; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangxiaoshan618/ReactNative_MyViewController/ea2e5eaff3734e56786024561bd5232500e776e3/ReactNative_MyViewController/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangxiaoshan618/ReactNative_MyViewController/ea2e5eaff3734e56786024561bd5232500e776e3/ReactNative_MyViewController/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangxiaoshan618/ReactNative_MyViewController/ea2e5eaff3734e56786024561bd5232500e776e3/ReactNative_MyViewController/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangxiaoshan618/ReactNative_MyViewController/ea2e5eaff3734e56786024561bd5232500e776e3/ReactNative_MyViewController/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ReactNative_MyViewController 3 | 4 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/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.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhangxiaoshan618/ReactNative_MyViewController/ea2e5eaff3734e56786024561bd5232500e776e3/ReactNative_MyViewController/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = 'debug', 3 | store = 'debug.keystore', 4 | properties = 'debug.keystore.properties', 5 | visibility = [ 6 | 'PUBLIC', 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'ReactNative_MyViewController' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View 13 | } from 'react-native'; 14 | 15 | class ReactNative_MyViewController extends Component { 16 | render() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.android.js 24 | 25 | 26 | Double tap R on your keyboard to reload,{'\n'} 27 | Shake or press menu button for dev menu 28 | 29 | 30 | ); 31 | } 32 | } 33 | 34 | const styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('ReactNative_MyViewController', () => ReactNative_MyViewController); 54 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | NativeModules, 14 | findNodeHandle, 15 | NativeAppEventEmitter 16 | } from 'react-native'; 17 | 18 | import MyView from './MyView'; 19 | const MyViewManager = NativeModules.MyViewManager; 20 | 21 | 22 | class ReactNative_MyViewController extends Component { 23 | render() { 24 | return ( 25 | 26 | 33 | 34 | 35 | ); 36 | } 37 | 38 | componentDidMount() { 39 | 40 | MyViewManager.test4(findNodeHandle(this.refs.theMyView)).then((r)=>{ 41 | console.log('————————————————' + r); 42 | },(e)=>{ 43 | console.log('————————————————————e'); 44 | }); 45 | } 46 | } 47 | 48 | const styles = StyleSheet.create({ 49 | container: { 50 | flex: 1, 51 | justifyContent: 'center', 52 | alignItems: 'center', 53 | backgroundColor: '#F5FCFF', 54 | }, 55 | private: { 56 | width: 200, 57 | height: 200, 58 | backgroundColor: 'white' 59 | } 60 | }); 61 | 62 | AppRegistry.registerComponent('ReactNative_MyViewController', () => ReactNative_MyViewController); 63 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/MyView.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyView.h 3 | // ReactNative_MyViewController 4 | // 5 | // Created by 张晓珊 on 16/9/20. 6 | // Copyright © 2016年 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MyView : UIView 12 | 13 | /// 提供给JS使用的属性 14 | 15 | @property (nonatomic, assign) NSInteger value; 16 | @property (nonatomic, assign) BOOL isTest1; 17 | @property (nonatomic, assign) NSInteger num; 18 | 19 | /// test3方法对应的属性,num1对应的key为@“num1”,num2对应的key为@“num2” 20 | @property (nonatomic, strong) NSDictionary *infoDict; 21 | 22 | - (NSInteger)test4; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/MyView.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyView.m 3 | // ReactNative_MyViewController 4 | // 5 | // Created by 张晓珊 on 16/9/20. 6 | // Copyright © 2016年 Facebook. All rights reserved. 7 | // 8 | 9 | #import "MyView.h" 10 | #import "MyViewController.h" 11 | #import "RCTBridgeModule.h" 12 | 13 | @interface MyView () 14 | 15 | @property (nonatomic, strong) MyViewController *myViewController; 16 | @property (nonatomic, strong) UIView *myView; 17 | 18 | @end 19 | 20 | 21 | @implementation MyView 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame 24 | { 25 | self = [super initWithFrame:frame]; 26 | if (self) { 27 | self.backgroundColor = [UIColor yellowColor]; 28 | [self setUpUI]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)setUpUI { 34 | self.myView.frame = CGRectMake(10, 10, 20, 20); 35 | [self addSubview:self.myView]; 36 | } 37 | 38 | - (NSInteger)test4 { 39 | return [self.myViewController test4]; 40 | } 41 | 42 | - (void)setIsTest1:(BOOL)isTest1 { 43 | _isTest1 = isTest1; 44 | if (isTest1) { 45 | [self.myViewController test1]; 46 | } 47 | } 48 | 49 | - (void)setValue:(NSInteger)value { 50 | _value = value; 51 | self.myViewController.value = value; 52 | } 53 | 54 | - (void)setNum:(NSInteger)num { 55 | _num = num; 56 | [self.myViewController test2WithNum:num]; 57 | } 58 | 59 | - (void)setInfoDict:(NSDictionary *)infoDict { 60 | _infoDict = infoDict; 61 | [self.myViewController test3WithNum1:infoDict[@"num1"] AndNum2:infoDict[@"num2"]]; 62 | } 63 | 64 | #pragma mark - 懒加载 65 | - (UIView *)myView { 66 | if (!_myView) { 67 | self.myViewController = [MyViewController new]; 68 | _myView = self.myViewController.view; 69 | } 70 | return _myView; 71 | } 72 | 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/MyViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MyViewController.h 3 | // ReactNative_MyViewController 4 | // 5 | // Created by 张晓珊 on 16/9/20. 6 | // Copyright © 2016年 Facebook. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MyViewController : UIViewController 12 | 13 | @property (nonatomic, assign) NSInteger value; 14 | 15 | - (void)test1; 16 | - (void)test2WithNum:(NSInteger)num; 17 | - (void)test3WithNum1:(NSInteger)num1 AndNum2:(NSInteger)num2; 18 | - (NSInteger)test4; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/MyViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MyViewController.m 3 | // ReactNative_MyViewController 4 | // 5 | // Created by 张晓珊 on 16/9/20. 6 | // Copyright © 2016年 Facebook. All rights reserved. 7 | // 8 | 9 | #import "MyViewController.h" 10 | 11 | @interface MyViewController () 12 | 13 | @end 14 | 15 | @implementation MyViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | self.view.backgroundColor = [UIColor blueColor]; 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | - (void)setValue:(NSInteger)value { 29 | _value = value; 30 | NSLog(@"属性value被赋值了"); 31 | } 32 | 33 | - (void)test1 { 34 | NSLog(@"test1——无参数无返回值的方法被调用了"); 35 | } 36 | 37 | - (void)test2WithNum:(NSInteger)num { 38 | NSLog(@"test2——有一个参数无返回值的方法被调用了,参数为:%zd", num ); 39 | } 40 | 41 | 42 | - (void)test3WithNum1:(NSInteger)num1 AndNum2:(NSInteger)num2 { 43 | NSLog(@"test3——有多个参数无返回值的方法被调用了,参数1为:%zd,参数2为:%zd", num1, num2 ); 44 | } 45 | 46 | - (NSInteger)test4 { 47 | NSLog(@"test4——有返回值的方法被调用了"); 48 | 49 | return 8; 50 | } 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/RCTMyViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // RCTMyViewManager.h 3 | // ReactNative_MyViewController 4 | // 5 | // Created by 张晓珊 on 16/9/20. 6 | // Copyright © 2016年 Facebook. All rights reserved. 7 | // 8 | 9 | #import "RCTViewManager.h" 10 | 11 | @interface RCTMyViewManager : RCTViewManager 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/RCTMyViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // RCTMyViewManager.m 3 | // ReactNative_MyViewController 4 | // 5 | // Created by 张晓珊 on 16/9/20. 6 | // Copyright © 2016年 Facebook. All rights reserved. 7 | // 8 | 9 | #import "RCTMyViewManager.h" 10 | #import "MyView.h" 11 | #import "RCTBridge.h" 12 | #import "RCTUIManager.h" 13 | #import "RCTEventDispatcher.h" 14 | 15 | @implementation RCTMyViewManager 16 | 17 | RCT_EXPORT_MODULE() 18 | RCT_EXPORT_VIEW_PROPERTY(value, NSInteger) 19 | RCT_EXPORT_VIEW_PROPERTY(isTest1, BOOL) 20 | RCT_EXPORT_VIEW_PROPERTY(num, NSInteger) 21 | RCT_EXPORT_VIEW_PROPERTY(infoDict, NSDictionary) 22 | 23 | 24 | #pragma mark - 导出函数供JS调用 25 | 26 | RCT_EXPORT_METHOD(test4:(nonnull NSNumber *)reactTag 27 | resolve:(RCTPromiseResolveBlock)resolve 28 | reject:(RCTPromiseRejectBlock)reject){ 29 | 30 | NSLog(@"test4方法被调用了"); 31 | MyView *myView = [self getViewWithTag:reactTag]; 32 | NSInteger value = [myView test4]; 33 | 34 | if (value) { 35 | resolve([NSNumber numberWithInteger:value]); 36 | }else { 37 | reject(@"1002", @"调用方法4出错", [NSError errorWithDomain:@"调用方法4出错" code:1002 userInfo:nil]); 38 | } 39 | 40 | } 41 | 42 | 43 | 44 | 45 | /// 拿到当前View 46 | - (MyView *) getViewWithTag:(NSNumber *)tag { 47 | NSLog(@"%@", [NSThread currentThread]); 48 | 49 | UIView *view = [self.bridge.uiManager viewForReactTag:tag]; 50 | return [view isKindOfClass:[MyView class]] ? (MyView *)view : nil; 51 | } 52 | 53 | /// 重写这个方法,返回将要提供给RN使用的视图 54 | - (UIView *)view { 55 | return [[MyView alloc] initWithFrame: [UIScreen mainScreen].bounds]; 56 | } 57 | 58 | 59 | - (dispatch_queue_t)methodQueue 60 | { 61 | return dispatch_get_main_queue(); 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 11 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; 12 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; 13 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; 14 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; 15 | 00E356F31AD99517003FC87E /* ReactNative_MyViewControllerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNative_MyViewControllerTests.m */; }; 16 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; 17 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; 18 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; 19 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 20 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 21 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 22 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 23 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 24 | 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; 25 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; 26 | B3E10AFA1D91790C00552CE1 /* MyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E10AF91D91790C00552CE1 /* MyViewController.m */; }; 27 | B3E10B1E1D917C7700552CE1 /* MyView.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E10B1D1D917C7700552CE1 /* MyView.m */; }; 28 | B3E10B211D9182C800552CE1 /* RCTMyViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E10B201D9182C800552CE1 /* RCTMyViewManager.m */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 35 | proxyType = 2; 36 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 37 | remoteInfo = RCTActionSheet; 38 | }; 39 | 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { 40 | isa = PBXContainerItemProxy; 41 | containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 42 | proxyType = 2; 43 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 44 | remoteInfo = RCTGeolocation; 45 | }; 46 | 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { 47 | isa = PBXContainerItemProxy; 48 | containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 49 | proxyType = 2; 50 | remoteGlobalIDString = 58B5115D1A9E6B3D00147676; 51 | remoteInfo = RCTImage; 52 | }; 53 | 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { 54 | isa = PBXContainerItemProxy; 55 | containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 56 | proxyType = 2; 57 | remoteGlobalIDString = 58B511DB1A9E6C8500147676; 58 | remoteInfo = RCTNetwork; 59 | }; 60 | 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { 61 | isa = PBXContainerItemProxy; 62 | containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 63 | proxyType = 2; 64 | remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; 65 | remoteInfo = RCTVibration; 66 | }; 67 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 68 | isa = PBXContainerItemProxy; 69 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 70 | proxyType = 1; 71 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 72 | remoteInfo = ReactNative_MyViewController; 73 | }; 74 | 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { 75 | isa = PBXContainerItemProxy; 76 | containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 77 | proxyType = 2; 78 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 79 | remoteInfo = RCTSettings; 80 | }; 81 | 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { 82 | isa = PBXContainerItemProxy; 83 | containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 84 | proxyType = 2; 85 | remoteGlobalIDString = 3C86DF461ADF2C930047B81A; 86 | remoteInfo = RCTWebSocket; 87 | }; 88 | 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { 89 | isa = PBXContainerItemProxy; 90 | containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; 91 | proxyType = 2; 92 | remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; 93 | remoteInfo = React; 94 | }; 95 | 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { 96 | isa = PBXContainerItemProxy; 97 | containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 98 | proxyType = 2; 99 | remoteGlobalIDString = 134814201AA4EA6300B7C361; 100 | remoteInfo = RCTLinking; 101 | }; 102 | 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { 103 | isa = PBXContainerItemProxy; 104 | containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 105 | proxyType = 2; 106 | remoteGlobalIDString = 58B5119B1A9E6C1200147676; 107 | remoteInfo = RCTText; 108 | }; 109 | /* End PBXContainerItemProxy section */ 110 | 111 | /* Begin PBXFileReference section */ 112 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 113 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; 114 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; 115 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; 116 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; 117 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; 118 | 00E356EE1AD99517003FC87E /* ReactNative_MyViewControllerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactNative_MyViewControllerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 119 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 120 | 00E356F21AD99517003FC87E /* ReactNative_MyViewControllerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ReactNative_MyViewControllerTests.m; sourceTree = ""; }; 121 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; 122 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; 123 | 13B07F961A680F5B00A75B9A /* ReactNative_MyViewController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactNative_MyViewController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 124 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ReactNative_MyViewController/AppDelegate.h; sourceTree = ""; }; 125 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ReactNative_MyViewController/AppDelegate.m; sourceTree = ""; }; 126 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 127 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNative_MyViewController/Images.xcassets; sourceTree = ""; }; 128 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNative_MyViewController/Info.plist; sourceTree = ""; }; 129 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactNative_MyViewController/main.m; sourceTree = ""; }; 130 | 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; 131 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; 132 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; 133 | B3E10AF81D91790C00552CE1 /* MyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyViewController.h; sourceTree = ""; }; 134 | B3E10AF91D91790C00552CE1 /* MyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyViewController.m; sourceTree = ""; }; 135 | B3E10B1C1D917C7700552CE1 /* MyView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyView.h; sourceTree = ""; }; 136 | B3E10B1D1D917C7700552CE1 /* MyView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyView.m; sourceTree = ""; }; 137 | B3E10B1F1D9182C800552CE1 /* RCTMyViewManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTMyViewManager.h; sourceTree = ""; }; 138 | B3E10B201D9182C800552CE1 /* RCTMyViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMyViewManager.m; sourceTree = ""; }; 139 | /* End PBXFileReference section */ 140 | 141 | /* Begin PBXFrameworksBuildPhase section */ 142 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 143 | isa = PBXFrameworksBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, 147 | ); 148 | runOnlyForDeploymentPostprocessing = 0; 149 | }; 150 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 151 | isa = PBXFrameworksBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 146834051AC3E58100842450 /* libReact.a in Frameworks */, 155 | 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, 156 | 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, 157 | 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, 158 | 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, 159 | 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, 160 | 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, 161 | 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, 162 | 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, 163 | 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXFrameworksBuildPhase section */ 168 | 169 | /* Begin PBXGroup section */ 170 | 00C302A81ABCB8CE00DB3ED1 /* Products */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, 174 | ); 175 | name = Products; 176 | sourceTree = ""; 177 | }; 178 | 00C302B61ABCB90400DB3ED1 /* Products */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, 182 | ); 183 | name = Products; 184 | sourceTree = ""; 185 | }; 186 | 00C302BC1ABCB91800DB3ED1 /* Products */ = { 187 | isa = PBXGroup; 188 | children = ( 189 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, 190 | ); 191 | name = Products; 192 | sourceTree = ""; 193 | }; 194 | 00C302D41ABCB9D200DB3ED1 /* Products */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, 198 | ); 199 | name = Products; 200 | sourceTree = ""; 201 | }; 202 | 00C302E01ABCB9EE00DB3ED1 /* Products */ = { 203 | isa = PBXGroup; 204 | children = ( 205 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, 206 | ); 207 | name = Products; 208 | sourceTree = ""; 209 | }; 210 | 00E356EF1AD99517003FC87E /* ReactNative_MyViewControllerTests */ = { 211 | isa = PBXGroup; 212 | children = ( 213 | 00E356F21AD99517003FC87E /* ReactNative_MyViewControllerTests.m */, 214 | 00E356F01AD99517003FC87E /* Supporting Files */, 215 | ); 216 | path = ReactNative_MyViewControllerTests; 217 | sourceTree = ""; 218 | }; 219 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 220 | isa = PBXGroup; 221 | children = ( 222 | 00E356F11AD99517003FC87E /* Info.plist */, 223 | ); 224 | name = "Supporting Files"; 225 | sourceTree = ""; 226 | }; 227 | 139105B71AF99BAD00B5F7CC /* Products */ = { 228 | isa = PBXGroup; 229 | children = ( 230 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, 231 | ); 232 | name = Products; 233 | sourceTree = ""; 234 | }; 235 | 139FDEE71B06529A00C62182 /* Products */ = { 236 | isa = PBXGroup; 237 | children = ( 238 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, 239 | ); 240 | name = Products; 241 | sourceTree = ""; 242 | }; 243 | 13B07FAE1A68108700A75B9A /* ReactNative_MyViewController */ = { 244 | isa = PBXGroup; 245 | children = ( 246 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 247 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 248 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 249 | B3E10B1F1D9182C800552CE1 /* RCTMyViewManager.h */, 250 | B3E10B201D9182C800552CE1 /* RCTMyViewManager.m */, 251 | B3E10B1C1D917C7700552CE1 /* MyView.h */, 252 | B3E10B1D1D917C7700552CE1 /* MyView.m */, 253 | B3E10AF81D91790C00552CE1 /* MyViewController.h */, 254 | B3E10AF91D91790C00552CE1 /* MyViewController.m */, 255 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 256 | 13B07FB61A68108700A75B9A /* Info.plist */, 257 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 258 | 13B07FB71A68108700A75B9A /* main.m */, 259 | ); 260 | name = ReactNative_MyViewController; 261 | sourceTree = ""; 262 | }; 263 | 146834001AC3E56700842450 /* Products */ = { 264 | isa = PBXGroup; 265 | children = ( 266 | 146834041AC3E56700842450 /* libReact.a */, 267 | ); 268 | name = Products; 269 | sourceTree = ""; 270 | }; 271 | 78C398B11ACF4ADC00677621 /* Products */ = { 272 | isa = PBXGroup; 273 | children = ( 274 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, 275 | ); 276 | name = Products; 277 | sourceTree = ""; 278 | }; 279 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 280 | isa = PBXGroup; 281 | children = ( 282 | 146833FF1AC3E56700842450 /* React.xcodeproj */, 283 | 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, 284 | 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, 285 | 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, 286 | 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, 287 | 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, 288 | 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, 289 | 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, 290 | 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 291 | 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 292 | ); 293 | name = Libraries; 294 | sourceTree = ""; 295 | }; 296 | 832341B11AAA6A8300B99B32 /* Products */ = { 297 | isa = PBXGroup; 298 | children = ( 299 | 832341B51AAA6A8300B99B32 /* libRCTText.a */, 300 | ); 301 | name = Products; 302 | sourceTree = ""; 303 | }; 304 | 83CBB9F61A601CBA00E9B192 = { 305 | isa = PBXGroup; 306 | children = ( 307 | 13B07FAE1A68108700A75B9A /* ReactNative_MyViewController */, 308 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 309 | 00E356EF1AD99517003FC87E /* ReactNative_MyViewControllerTests */, 310 | 83CBBA001A601CBA00E9B192 /* Products */, 311 | ); 312 | indentWidth = 2; 313 | sourceTree = ""; 314 | tabWidth = 2; 315 | }; 316 | 83CBBA001A601CBA00E9B192 /* Products */ = { 317 | isa = PBXGroup; 318 | children = ( 319 | 13B07F961A680F5B00A75B9A /* ReactNative_MyViewController.app */, 320 | 00E356EE1AD99517003FC87E /* ReactNative_MyViewControllerTests.xctest */, 321 | ); 322 | name = Products; 323 | sourceTree = ""; 324 | }; 325 | /* End PBXGroup section */ 326 | 327 | /* Begin PBXNativeTarget section */ 328 | 00E356ED1AD99517003FC87E /* ReactNative_MyViewControllerTests */ = { 329 | isa = PBXNativeTarget; 330 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNative_MyViewControllerTests" */; 331 | buildPhases = ( 332 | 00E356EA1AD99517003FC87E /* Sources */, 333 | 00E356EB1AD99517003FC87E /* Frameworks */, 334 | 00E356EC1AD99517003FC87E /* Resources */, 335 | ); 336 | buildRules = ( 337 | ); 338 | dependencies = ( 339 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 340 | ); 341 | name = ReactNative_MyViewControllerTests; 342 | productName = ReactNative_MyViewControllerTests; 343 | productReference = 00E356EE1AD99517003FC87E /* ReactNative_MyViewControllerTests.xctest */; 344 | productType = "com.apple.product-type.bundle.unit-test"; 345 | }; 346 | 13B07F861A680F5B00A75B9A /* ReactNative_MyViewController */ = { 347 | isa = PBXNativeTarget; 348 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNative_MyViewController" */; 349 | buildPhases = ( 350 | 13B07F871A680F5B00A75B9A /* Sources */, 351 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 352 | 13B07F8E1A680F5B00A75B9A /* Resources */, 353 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 354 | ); 355 | buildRules = ( 356 | ); 357 | dependencies = ( 358 | ); 359 | name = ReactNative_MyViewController; 360 | productName = "Hello World"; 361 | productReference = 13B07F961A680F5B00A75B9A /* ReactNative_MyViewController.app */; 362 | productType = "com.apple.product-type.application"; 363 | }; 364 | /* End PBXNativeTarget section */ 365 | 366 | /* Begin PBXProject section */ 367 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 368 | isa = PBXProject; 369 | attributes = { 370 | LastUpgradeCheck = 0610; 371 | ORGANIZATIONNAME = Facebook; 372 | TargetAttributes = { 373 | 00E356ED1AD99517003FC87E = { 374 | CreatedOnToolsVersion = 6.2; 375 | TestTargetID = 13B07F861A680F5B00A75B9A; 376 | }; 377 | }; 378 | }; 379 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNative_MyViewController" */; 380 | compatibilityVersion = "Xcode 3.2"; 381 | developmentRegion = English; 382 | hasScannedForEncodings = 0; 383 | knownRegions = ( 384 | en, 385 | Base, 386 | ); 387 | mainGroup = 83CBB9F61A601CBA00E9B192; 388 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 389 | projectDirPath = ""; 390 | projectReferences = ( 391 | { 392 | ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; 393 | ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; 394 | }, 395 | { 396 | ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; 397 | ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; 398 | }, 399 | { 400 | ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; 401 | ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; 402 | }, 403 | { 404 | ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; 405 | ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; 406 | }, 407 | { 408 | ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; 409 | ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; 410 | }, 411 | { 412 | ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; 413 | ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; 414 | }, 415 | { 416 | ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; 417 | ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; 418 | }, 419 | { 420 | ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; 421 | ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; 422 | }, 423 | { 424 | ProductGroup = 139FDEE71B06529A00C62182 /* Products */; 425 | ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; 426 | }, 427 | { 428 | ProductGroup = 146834001AC3E56700842450 /* Products */; 429 | ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; 430 | }, 431 | ); 432 | projectRoot = ""; 433 | targets = ( 434 | 13B07F861A680F5B00A75B9A /* ReactNative_MyViewController */, 435 | 00E356ED1AD99517003FC87E /* ReactNative_MyViewControllerTests */, 436 | ); 437 | }; 438 | /* End PBXProject section */ 439 | 440 | /* Begin PBXReferenceProxy section */ 441 | 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { 442 | isa = PBXReferenceProxy; 443 | fileType = archive.ar; 444 | path = libRCTActionSheet.a; 445 | remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; 446 | sourceTree = BUILT_PRODUCTS_DIR; 447 | }; 448 | 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { 449 | isa = PBXReferenceProxy; 450 | fileType = archive.ar; 451 | path = libRCTGeolocation.a; 452 | remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; 453 | sourceTree = BUILT_PRODUCTS_DIR; 454 | }; 455 | 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { 456 | isa = PBXReferenceProxy; 457 | fileType = archive.ar; 458 | path = libRCTImage.a; 459 | remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; 460 | sourceTree = BUILT_PRODUCTS_DIR; 461 | }; 462 | 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { 463 | isa = PBXReferenceProxy; 464 | fileType = archive.ar; 465 | path = libRCTNetwork.a; 466 | remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; 467 | sourceTree = BUILT_PRODUCTS_DIR; 468 | }; 469 | 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { 470 | isa = PBXReferenceProxy; 471 | fileType = archive.ar; 472 | path = libRCTVibration.a; 473 | remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; 474 | sourceTree = BUILT_PRODUCTS_DIR; 475 | }; 476 | 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { 477 | isa = PBXReferenceProxy; 478 | fileType = archive.ar; 479 | path = libRCTSettings.a; 480 | remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; 481 | sourceTree = BUILT_PRODUCTS_DIR; 482 | }; 483 | 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { 484 | isa = PBXReferenceProxy; 485 | fileType = archive.ar; 486 | path = libRCTWebSocket.a; 487 | remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; 488 | sourceTree = BUILT_PRODUCTS_DIR; 489 | }; 490 | 146834041AC3E56700842450 /* libReact.a */ = { 491 | isa = PBXReferenceProxy; 492 | fileType = archive.ar; 493 | path = libReact.a; 494 | remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; 495 | sourceTree = BUILT_PRODUCTS_DIR; 496 | }; 497 | 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { 498 | isa = PBXReferenceProxy; 499 | fileType = archive.ar; 500 | path = libRCTLinking.a; 501 | remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; 502 | sourceTree = BUILT_PRODUCTS_DIR; 503 | }; 504 | 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { 505 | isa = PBXReferenceProxy; 506 | fileType = archive.ar; 507 | path = libRCTText.a; 508 | remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; 509 | sourceTree = BUILT_PRODUCTS_DIR; 510 | }; 511 | /* End PBXReferenceProxy section */ 512 | 513 | /* Begin PBXResourcesBuildPhase section */ 514 | 00E356EC1AD99517003FC87E /* Resources */ = { 515 | isa = PBXResourcesBuildPhase; 516 | buildActionMask = 2147483647; 517 | files = ( 518 | ); 519 | runOnlyForDeploymentPostprocessing = 0; 520 | }; 521 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 522 | isa = PBXResourcesBuildPhase; 523 | buildActionMask = 2147483647; 524 | files = ( 525 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 526 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 527 | ); 528 | runOnlyForDeploymentPostprocessing = 0; 529 | }; 530 | /* End PBXResourcesBuildPhase section */ 531 | 532 | /* Begin PBXShellScriptBuildPhase section */ 533 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 534 | isa = PBXShellScriptBuildPhase; 535 | buildActionMask = 2147483647; 536 | files = ( 537 | ); 538 | inputPaths = ( 539 | ); 540 | name = "Bundle React Native code and images"; 541 | outputPaths = ( 542 | ); 543 | runOnlyForDeploymentPostprocessing = 0; 544 | shellPath = /bin/sh; 545 | shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; 546 | }; 547 | /* End PBXShellScriptBuildPhase section */ 548 | 549 | /* Begin PBXSourcesBuildPhase section */ 550 | 00E356EA1AD99517003FC87E /* Sources */ = { 551 | isa = PBXSourcesBuildPhase; 552 | buildActionMask = 2147483647; 553 | files = ( 554 | 00E356F31AD99517003FC87E /* ReactNative_MyViewControllerTests.m in Sources */, 555 | ); 556 | runOnlyForDeploymentPostprocessing = 0; 557 | }; 558 | 13B07F871A680F5B00A75B9A /* Sources */ = { 559 | isa = PBXSourcesBuildPhase; 560 | buildActionMask = 2147483647; 561 | files = ( 562 | B3E10B211D9182C800552CE1 /* RCTMyViewManager.m in Sources */, 563 | B3E10B1E1D917C7700552CE1 /* MyView.m in Sources */, 564 | B3E10AFA1D91790C00552CE1 /* MyViewController.m in Sources */, 565 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 566 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 567 | ); 568 | runOnlyForDeploymentPostprocessing = 0; 569 | }; 570 | /* End PBXSourcesBuildPhase section */ 571 | 572 | /* Begin PBXTargetDependency section */ 573 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 574 | isa = PBXTargetDependency; 575 | target = 13B07F861A680F5B00A75B9A /* ReactNative_MyViewController */; 576 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 577 | }; 578 | /* End PBXTargetDependency section */ 579 | 580 | /* Begin PBXVariantGroup section */ 581 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 582 | isa = PBXVariantGroup; 583 | children = ( 584 | 13B07FB21A68108700A75B9A /* Base */, 585 | ); 586 | name = LaunchScreen.xib; 587 | path = ReactNative_MyViewController; 588 | sourceTree = ""; 589 | }; 590 | /* End PBXVariantGroup section */ 591 | 592 | /* Begin XCBuildConfiguration section */ 593 | 00E356F61AD99517003FC87E /* Debug */ = { 594 | isa = XCBuildConfiguration; 595 | buildSettings = { 596 | BUNDLE_LOADER = "$(TEST_HOST)"; 597 | GCC_PREPROCESSOR_DEFINITIONS = ( 598 | "DEBUG=1", 599 | "$(inherited)", 600 | ); 601 | INFOPLIST_FILE = ReactNative_MyViewControllerTests/Info.plist; 602 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 603 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 604 | PRODUCT_NAME = "$(TARGET_NAME)"; 605 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNative_MyViewController.app/ReactNative_MyViewController"; 606 | }; 607 | name = Debug; 608 | }; 609 | 00E356F71AD99517003FC87E /* Release */ = { 610 | isa = XCBuildConfiguration; 611 | buildSettings = { 612 | BUNDLE_LOADER = "$(TEST_HOST)"; 613 | COPY_PHASE_STRIP = NO; 614 | INFOPLIST_FILE = ReactNative_MyViewControllerTests/Info.plist; 615 | IPHONEOS_DEPLOYMENT_TARGET = 8.2; 616 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 617 | PRODUCT_NAME = "$(TARGET_NAME)"; 618 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactNative_MyViewController.app/ReactNative_MyViewController"; 619 | }; 620 | name = Release; 621 | }; 622 | 13B07F941A680F5B00A75B9A /* Debug */ = { 623 | isa = XCBuildConfiguration; 624 | buildSettings = { 625 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 626 | DEAD_CODE_STRIPPING = NO; 627 | HEADER_SEARCH_PATHS = ( 628 | "$(inherited)", 629 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 630 | "$(SRCROOT)/../node_modules/react-native/React/**", 631 | ); 632 | INFOPLIST_FILE = ReactNative_MyViewController/Info.plist; 633 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 634 | OTHER_LDFLAGS = ( 635 | "$(inherited)", 636 | "-ObjC", 637 | "-lc++", 638 | ); 639 | PRODUCT_NAME = ReactNative_MyViewController; 640 | }; 641 | name = Debug; 642 | }; 643 | 13B07F951A680F5B00A75B9A /* Release */ = { 644 | isa = XCBuildConfiguration; 645 | buildSettings = { 646 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 647 | HEADER_SEARCH_PATHS = ( 648 | "$(inherited)", 649 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 650 | "$(SRCROOT)/../node_modules/react-native/React/**", 651 | ); 652 | INFOPLIST_FILE = ReactNative_MyViewController/Info.plist; 653 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 654 | OTHER_LDFLAGS = ( 655 | "$(inherited)", 656 | "-ObjC", 657 | "-lc++", 658 | ); 659 | PRODUCT_NAME = ReactNative_MyViewController; 660 | }; 661 | name = Release; 662 | }; 663 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 664 | isa = XCBuildConfiguration; 665 | buildSettings = { 666 | ALWAYS_SEARCH_USER_PATHS = NO; 667 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 668 | CLANG_CXX_LIBRARY = "libc++"; 669 | CLANG_ENABLE_MODULES = YES; 670 | CLANG_ENABLE_OBJC_ARC = YES; 671 | CLANG_WARN_BOOL_CONVERSION = YES; 672 | CLANG_WARN_CONSTANT_CONVERSION = YES; 673 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 674 | CLANG_WARN_EMPTY_BODY = YES; 675 | CLANG_WARN_ENUM_CONVERSION = YES; 676 | CLANG_WARN_INT_CONVERSION = YES; 677 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 678 | CLANG_WARN_UNREACHABLE_CODE = YES; 679 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 680 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 681 | COPY_PHASE_STRIP = NO; 682 | ENABLE_STRICT_OBJC_MSGSEND = YES; 683 | GCC_C_LANGUAGE_STANDARD = gnu99; 684 | GCC_DYNAMIC_NO_PIC = NO; 685 | GCC_OPTIMIZATION_LEVEL = 0; 686 | GCC_PREPROCESSOR_DEFINITIONS = ( 687 | "DEBUG=1", 688 | "$(inherited)", 689 | ); 690 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 691 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 692 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 693 | GCC_WARN_UNDECLARED_SELECTOR = YES; 694 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 695 | GCC_WARN_UNUSED_FUNCTION = YES; 696 | GCC_WARN_UNUSED_VARIABLE = YES; 697 | HEADER_SEARCH_PATHS = ( 698 | "$(inherited)", 699 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 700 | "$(SRCROOT)/../node_modules/react-native/React/**", 701 | ); 702 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 703 | MTL_ENABLE_DEBUG_INFO = YES; 704 | ONLY_ACTIVE_ARCH = YES; 705 | SDKROOT = iphoneos; 706 | }; 707 | name = Debug; 708 | }; 709 | 83CBBA211A601CBA00E9B192 /* Release */ = { 710 | isa = XCBuildConfiguration; 711 | buildSettings = { 712 | ALWAYS_SEARCH_USER_PATHS = NO; 713 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 714 | CLANG_CXX_LIBRARY = "libc++"; 715 | CLANG_ENABLE_MODULES = YES; 716 | CLANG_ENABLE_OBJC_ARC = YES; 717 | CLANG_WARN_BOOL_CONVERSION = YES; 718 | CLANG_WARN_CONSTANT_CONVERSION = YES; 719 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 720 | CLANG_WARN_EMPTY_BODY = YES; 721 | CLANG_WARN_ENUM_CONVERSION = YES; 722 | CLANG_WARN_INT_CONVERSION = YES; 723 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 724 | CLANG_WARN_UNREACHABLE_CODE = YES; 725 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 726 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 727 | COPY_PHASE_STRIP = YES; 728 | ENABLE_NS_ASSERTIONS = NO; 729 | ENABLE_STRICT_OBJC_MSGSEND = YES; 730 | GCC_C_LANGUAGE_STANDARD = gnu99; 731 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 732 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 733 | GCC_WARN_UNDECLARED_SELECTOR = YES; 734 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 735 | GCC_WARN_UNUSED_FUNCTION = YES; 736 | GCC_WARN_UNUSED_VARIABLE = YES; 737 | HEADER_SEARCH_PATHS = ( 738 | "$(inherited)", 739 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 740 | "$(SRCROOT)/../node_modules/react-native/React/**", 741 | ); 742 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 743 | MTL_ENABLE_DEBUG_INFO = NO; 744 | SDKROOT = iphoneos; 745 | VALIDATE_PRODUCT = YES; 746 | }; 747 | name = Release; 748 | }; 749 | /* End XCBuildConfiguration section */ 750 | 751 | /* Begin XCConfigurationList section */ 752 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "ReactNative_MyViewControllerTests" */ = { 753 | isa = XCConfigurationList; 754 | buildConfigurations = ( 755 | 00E356F61AD99517003FC87E /* Debug */, 756 | 00E356F71AD99517003FC87E /* Release */, 757 | ); 758 | defaultConfigurationIsVisible = 0; 759 | defaultConfigurationName = Release; 760 | }; 761 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNative_MyViewController" */ = { 762 | isa = XCConfigurationList; 763 | buildConfigurations = ( 764 | 13B07F941A680F5B00A75B9A /* Debug */, 765 | 13B07F951A680F5B00A75B9A /* Release */, 766 | ); 767 | defaultConfigurationIsVisible = 0; 768 | defaultConfigurationName = Release; 769 | }; 770 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ReactNative_MyViewController" */ = { 771 | isa = XCConfigurationList; 772 | buildConfigurations = ( 773 | 83CBBA201A601CBA00E9B192 /* Debug */, 774 | 83CBBA211A601CBA00E9B192 /* Release */, 775 | ); 776 | defaultConfigurationIsVisible = 0; 777 | defaultConfigurationName = Release; 778 | }; 779 | /* End XCConfigurationList section */ 780 | }; 781 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 782 | } 783 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController.xcodeproj/xcshareddata/xcschemes/ReactNative_MyViewController.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import "RCTBundleURLProvider.h" 13 | #import "RCTRootView.h" 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"ReactNative_MyViewController" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController/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 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | } 43 | ], 44 | "info" : { 45 | "version" : 1, 46 | "author" : "xcode" 47 | } 48 | } -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController/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 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSTemporaryExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewController/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewControllerTests/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 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/ios/ReactNative_MyViewControllerTests/ReactNative_MyViewControllerTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import "RCTLog.h" 14 | #import "RCTRootView.h" 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface ReactNative_MyViewControllerTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation ReactNative_MyViewControllerTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 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 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /ReactNative_MyViewController/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ReactNative_MyViewController", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start" 7 | }, 8 | "dependencies": { 9 | "react": "15.3.2", 10 | "react-native": "0.33.0" 11 | } 12 | } 13 | --------------------------------------------------------------------------------