diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 723ef36..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.idea \ No newline at end of file diff --git a/Demo/README.md b/Demo/README.md deleted file mode 100644 index 6089b1a..0000000 --- a/Demo/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# [React Native 研究与实践相关Demo源码](https://github.com/crazycodeboy/RNStudyNotes/) - -这里存放的是[React Native 研究与实践](https://github.com/crazycodeboy/RNStudyNotes/)相关Demo源码。 - - -**想和大牛一起讨论?可加入:** - -> -React Native学习交流1群:`165774887`(已满) -React Native学习交流2群:`422654286` - -![React Native学习交流群](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%E5%8F%91%E5%B8%83APP%E4%B9%8B%E7%AD%BE%E5%90%8D%E6%89%93%E5%8C%85APK/images/react%20native%20%E5%AD%A6%E4%B9%A0%E4%BA%A4%E6%B5%81%E7%BE%A4_qrcode_share.png) - -## 列表 - -* [React Native按钮详解|Touchable系列组件使用详解](./rn_button_demo) -* [React Native iOS/Android原生模块开发实战|教程|心得](./rn_native_module_demo) - - diff --git a/Demo/rn_button_demo/.babelrc b/Demo/rn_button_demo/.babelrc deleted file mode 100644 index 8df53fe..0000000 --- a/Demo/rn_button_demo/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ -"presets": ["react-native"] -} \ No newline at end of file diff --git a/Demo/rn_button_demo/.buckconfig b/Demo/rn_button_demo/.buckconfig deleted file mode 100644 index 934256c..0000000 --- a/Demo/rn_button_demo/.buckconfig +++ /dev/null @@ -1,6 +0,0 @@ - -[android] - target = Google Inc.:Google APIs:23 - -[maven_repositories] - central = https://repo1.maven.org/maven2 diff --git a/Demo/rn_button_demo/.flowconfig b/Demo/rn_button_demo/.flowconfig deleted file mode 100644 index 876e701..0000000 --- a/Demo/rn_button_demo/.flowconfig +++ /dev/null @@ -1,44 +0,0 @@ -[ignore] -; We fork some components by platform -.*/*[.]android.js - -; Ignore "BUCK" generated dirs -/\.buckd/ - -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js -.*/Libraries/react-native/ReactNative.js - -[include] - -[libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow -flow/ - -[options] -module.system=haste - -experimental.strict_type_args=true - -munge_underscores=true - -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' - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FixMe - -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy - -unsafe.enable_getters_and_setters=true - -[version] -^0.36.0 diff --git a/Demo/rn_button_demo/.gitattributes b/Demo/rn_button_demo/.gitattributes deleted file mode 100644 index d42ff18..0000000 --- a/Demo/rn_button_demo/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/Demo/rn_button_demo/.gitignore b/Demo/rn_button_demo/.gitignore deleted file mode 100644 index fc13f16..0000000 --- a/Demo/rn_button_demo/.gitignore +++ /dev/null @@ -1,53 +0,0 @@ -# OSX -# -.DS_Store - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# node.js -# -node_modules/ -npm-debug.log - -# BUCK -buck-out/ -\.buckd/ -android/app/libs -*.keystore - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots diff --git a/Demo/rn_button_demo/.watchmanconfig b/Demo/rn_button_demo/.watchmanconfig deleted file mode 100644 index 9e26dfe..0000000 --- a/Demo/rn_button_demo/.watchmanconfig +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/Demo/rn_button_demo/__tests__/index.android.js b/Demo/rn_button_demo/__tests__/index.android.js deleted file mode 100644 index b49b908..0000000 --- a/Demo/rn_button_demo/__tests__/index.android.js +++ /dev/null @@ -1,12 +0,0 @@ -import 'react-native'; -import React from 'react'; -import Index from '../index.android.js'; - -// Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; - -it('renders correctly', () => { - const tree = renderer.create( - - ); -}); diff --git a/Demo/rn_button_demo/__tests__/index.ios.js b/Demo/rn_button_demo/__tests__/index.ios.js deleted file mode 100644 index ba7c5b5..0000000 --- a/Demo/rn_button_demo/__tests__/index.ios.js +++ /dev/null @@ -1,12 +0,0 @@ -import 'react-native'; -import React from 'react'; -import Index from '../index.ios.js'; - -// Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; - -it('renders correctly', () => { - const tree = renderer.create( - - ); -}); diff --git a/Demo/rn_button_demo/android/app/BUCK b/Demo/rn_button_demo/android/app/BUCK deleted file mode 100644 index ba3d853..0000000 --- a/Demo/rn_button_demo/android/app/BUCK +++ /dev/null @@ -1,66 +0,0 @@ -import re - -# To learn about Buck see [Docs](https://buckbuild.com/). -# To run your application with Buck: -# - install Buck -# - `npm start` - to start the packager -# - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck -# - `buck install -r android/app` - compile, install and run application -# - -lib_deps = [] -for jarfile in glob(['libs/*.jar']): - name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) - lib_deps.append(':' + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) - -for aarfile in glob(['libs/*.aar']): - name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) - lib_deps.append(':' + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -android_library( - name = 'all-libs', - exported_deps = lib_deps -) - -android_library( - name = 'app-code', - srcs = glob([ - 'src/main/java/**/*.java', - ]), - deps = [ - ':all-libs', - ':build_config', - ':res', - ], -) - -android_build_config( - name = 'build_config', - package = 'com.rn_button_demo', -) - -android_resource( - name = 'res', - res = 'src/main/res', - package = 'com.rn_button_demo', -) - -android_binary( - name = 'app', - package_type = 'debug', - manifest = 'src/main/AndroidManifest.xml', - keystore = '//android/keystores:debug', - deps = [ - ':app-code', - ], -) diff --git a/Demo/rn_button_demo/android/app/build.gradle b/Demo/rn_button_demo/android/app/build.gradle deleted file mode 100644 index 10171d5..0000000 --- a/Demo/rn_button_demo/android/app/build.gradle +++ /dev/null @@ -1,139 +0,0 @@ -apply plugin: "com.android.application" - -import com.android.build.OutputFile - -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation - * entryFile: "index.android.js", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"] - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ - -apply from: "../../node_modules/react-native/react.gradle" - -/** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. - */ -def enableSeparateBuildPerCPUArchitecture = false - -/** - * Run Proguard to shrink the Java bytecode in release builds. - */ -def enableProguardInReleaseBuilds = false - -android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" - - defaultConfig { - applicationId "com.rn_button_demo" - minSdkVersion 16 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - ndk { - abiFilters "armeabi-v7a", "x86" - } - } - splits { - abi { - reset() - enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86" - } - } - buildTypes { - release { - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - } - } - // applicationVariants are e.g. debug, release - applicationVariants.all { variant -> - variant.outputs.each { output -> - // For each separate APK per architecture, set a unique version code as described here: - // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2] - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { // null for the universal-debug, universal-release variants - output.versionCodeOverride = - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode - } - } - } -} - -dependencies { - compile fileTree(dir: "libs", include: ["*.jar"]) - compile "com.android.support:appcompat-v7:23.0.1" - compile "com.facebook.react:react-native:+" // From node_modules -} - -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' -} diff --git a/Demo/rn_button_demo/android/app/proguard-rules.pro b/Demo/rn_button_demo/android/app/proguard-rules.pro deleted file mode 100644 index 48361a9..0000000 --- a/Demo/rn_button_demo/android/app/proguard-rules.pro +++ /dev/null @@ -1,66 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Disabling obfuscation is useful if you collect stack traces from production crashes -# (unless you are using a system that supports de-obfuscate the stack traces). --dontobfuscate - -# React Native - -# Keep our interfaces so they can be used by other ProGuard rules. -# See http://sourceforge.net/p/proguard/bugs/466/ --keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip --keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters --keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip - -# Do not strip any method/class that is annotated with @DoNotStrip --keep @com.facebook.proguard.annotations.DoNotStrip class * --keep @com.facebook.common.internal.DoNotStrip class * --keepclassmembers class * { - @com.facebook.proguard.annotations.DoNotStrip *; - @com.facebook.common.internal.DoNotStrip *; -} - --keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { - void set*(***); - *** get*(); -} - --keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } --keep class * extends com.facebook.react.bridge.NativeModule { *; } --keepclassmembers,includedescriptorclasses class * { native ; } --keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } - --dontwarn com.facebook.react.** - -# okhttp - --keepattributes Signature --keepattributes *Annotation* --keep class okhttp3.** { *; } --keep interface okhttp3.** { *; } --dontwarn okhttp3.** - -# okio - --keep class sun.misc.Unsafe { *; } --dontwarn java.nio.file.* --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement --dontwarn okio.** diff --git a/Demo/rn_button_demo/android/app/src/main/AndroidManifest.xml b/Demo/rn_button_demo/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 3919914..0000000 --- a/Demo/rn_button_demo/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Demo/rn_button_demo/android/app/src/main/java/com/rn_button_demo/MainActivity.java b/Demo/rn_button_demo/android/app/src/main/java/com/rn_button_demo/MainActivity.java deleted file mode 100644 index 65559db..0000000 --- a/Demo/rn_button_demo/android/app/src/main/java/com/rn_button_demo/MainActivity.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.rn_button_demo; - -import com.facebook.react.ReactActivity; - -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "rn_button_demo"; - } -} diff --git a/Demo/rn_button_demo/android/app/src/main/java/com/rn_button_demo/MainApplication.java b/Demo/rn_button_demo/android/app/src/main/java/com/rn_button_demo/MainApplication.java deleted file mode 100644 index 6f96ef4..0000000 --- a/Demo/rn_button_demo/android/app/src/main/java/com/rn_button_demo/MainApplication.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.rn_button_demo; - -import android.app.Application; -import android.util.Log; - -import com.facebook.react.ReactApplication; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; - -import java.util.Arrays; -import java.util.List; - -public class MainApplication extends Application implements ReactApplication { - - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage() - ); - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } - - @Override - public void onCreate() { - super.onCreate(); - SoLoader.init(this, /* native exopackage */ false); - } -} diff --git a/Demo/rn_button_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Demo/rn_button_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bc..0000000 Binary files a/Demo/rn_button_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_button_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Demo/rn_button_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0c..0000000 Binary files a/Demo/rn_button_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_button_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Demo/rn_button_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0..0000000 Binary files a/Demo/rn_button_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_button_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Demo/rn_button_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72c..0000000 Binary files a/Demo/rn_button_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_button_demo/android/app/src/main/res/values/strings.xml b/Demo/rn_button_demo/android/app/src/main/res/values/strings.xml deleted file mode 100644 index 62fac61..0000000 --- a/Demo/rn_button_demo/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - rn_button_demo - diff --git a/Demo/rn_button_demo/android/app/src/main/res/values/styles.xml b/Demo/rn_button_demo/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 319eb0c..0000000 --- a/Demo/rn_button_demo/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/Demo/rn_button_demo/android/build.gradle b/Demo/rn_button_demo/android/build.gradle deleted file mode 100644 index fcba4c5..0000000 --- a/Demo/rn_button_demo/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.3.1' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - mavenLocal() - jcenter() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url "$rootDir/../node_modules/react-native/android" - } - } -} diff --git a/Demo/rn_button_demo/android/gradle.properties b/Demo/rn_button_demo/android/gradle.properties deleted file mode 100644 index 1fd964e..0000000 --- a/Demo/rn_button_demo/android/gradle.properties +++ /dev/null @@ -1,20 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true - -android.useDeprecatedNdk=true diff --git a/Demo/rn_button_demo/android/gradle/wrapper/gradle-wrapper.jar b/Demo/rn_button_demo/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index b5166da..0000000 Binary files a/Demo/rn_button_demo/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Demo/rn_button_demo/android/gradle/wrapper/gradle-wrapper.properties b/Demo/rn_button_demo/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b9fbfab..0000000 --- a/Demo/rn_button_demo/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/Demo/rn_button_demo/android/gradlew b/Demo/rn_button_demo/android/gradlew deleted file mode 100755 index 91a7e26..0000000 --- a/Demo/rn_button_demo/android/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/Demo/rn_button_demo/android/gradlew.bat b/Demo/rn_button_demo/android/gradlew.bat deleted file mode 100644 index 8a0b282..0000000 --- a/Demo/rn_button_demo/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/Demo/rn_button_demo/android/keystores/BUCK b/Demo/rn_button_demo/android/keystores/BUCK deleted file mode 100644 index 15da20e..0000000 --- a/Demo/rn_button_demo/android/keystores/BUCK +++ /dev/null @@ -1,8 +0,0 @@ -keystore( - name = 'debug', - store = 'debug.keystore', - properties = 'debug.keystore.properties', - visibility = [ - 'PUBLIC', - ], -) diff --git a/Demo/rn_button_demo/android/keystores/debug.keystore.properties b/Demo/rn_button_demo/android/keystores/debug.keystore.properties deleted file mode 100644 index 121bfb4..0000000 --- a/Demo/rn_button_demo/android/keystores/debug.keystore.properties +++ /dev/null @@ -1,4 +0,0 @@ -key.store=debug.keystore -key.alias=androiddebugkey -key.store.password=android -key.alias.password=android diff --git a/Demo/rn_button_demo/android/settings.gradle b/Demo/rn_button_demo/android/settings.gradle deleted file mode 100644 index 0427ed8..0000000 --- a/Demo/rn_button_demo/android/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -rootProject.name = 'rn_button_demo' - -include ':app' diff --git a/Demo/rn_button_demo/index.android.js b/Demo/rn_button_demo/index.android.js deleted file mode 100644 index 3356827..0000000 --- a/Demo/rn_button_demo/index.android.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * React Native按钮使用详解 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -import { - AppRegistry, -} from 'react-native'; -import index from './index.ios' - -AppRegistry.registerComponent('rn_button_demo', () => index); diff --git a/Demo/rn_button_demo/index.ios.js b/Demo/rn_button_demo/index.ios.js deleted file mode 100644 index 39f934f..0000000 --- a/Demo/rn_button_demo/index.ios.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * React Native按钮使用详解 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -import React, {Component} from 'react'; -import { - AppRegistry, - StyleSheet, - Text, - TouchableWithoutFeedback, - View, - Alert, - TouchableHighlight, - TouchableNativeFeedback -} from 'react-native'; - -export default class rn_demo extends Component { - state = { - count: 0, - countLong: 0, - text: '', - waiting: false, - startTime: 0 - } - - render() { - return ( - - - { - this.setState({count: this.state.count + 1}) - }} - onLongPress={()=> { - this.setState({countLong: this.state.countLong + 1}) - Alert.alert( - '提示', - '确定要删除吗?', - [ - {text: '取消', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, - {text: '确实', onPress: () => console.log('OK Pressed')}, - ] - ) - }} - > - - - 我是TouchableWithoutFeedback,单击我 - - - - { - this.setState({text: '正在登录...', waiting: true}) - setTimeout(()=> { - this.setState({text: '网络不流畅', waiting: false}) - }, 2000); - - }} - > - - - 登录 - - - - { - this.setState({text: '触摸开始', startTime: new Date().getTime()}) - }} - onPressOut={()=> { - this.setState({text: '触摸结束,持续时间:' + (new Date().getTime() - this.state.startTime) + '毫秒'}) - }} - > - - - 点我 - - - - { - this.setState({text: '衬底被隐藏'}) - }} - onShowUnderlay={()=> { - this.setState({text: '衬底显示'}) - }} - onPress={()=> { - - }} - > - - - TouchableHighlight - - - - { - this.setState({count: this.state.count + 1}) - }} - background={TouchableNativeFeedback.SelectableBackground()}> - - TouchableNativeFeedback - - - {this.state.text} - 您单击了:{this.state.count}次 - 您长按了:{this.state.countLong}次 - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - marginTop: 50 - }, - button: { - borderWidth: 1, - }, - buttonText: { - fontSize: 18, - color: 'red', - backgroundColor:'white' - }, - text: { - fontSize: 16, - marginBottom:20 - }, - -}); - -AppRegistry.registerComponent('rn_button_demo', () => rn_demo); diff --git a/Demo/rn_button_demo/ios/rn_button_demo.xcodeproj/project.pbxproj b/Demo/rn_button_demo/ios/rn_button_demo.xcodeproj/project.pbxproj deleted file mode 100644 index 02e6a4a..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo.xcodeproj/project.pbxproj +++ /dev/null @@ -1,988 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* rn_button_demoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* rn_button_demoTests.m */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = rn_button_demo; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; - remoteInfo = "RCTImage-tvOS"; - }; - 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28471D9B043800D4039D; - remoteInfo = "RCTLinking-tvOS"; - }; - 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28541D9B044C00D4039D; - remoteInfo = "RCTNetwork-tvOS"; - }; - 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28611D9B046600D4039D; - remoteInfo = "RCTSettings-tvOS"; - }; - 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A287B1D9B048500D4039D; - remoteInfo = "RCTText-tvOS"; - }; - 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28881D9B049200D4039D; - remoteInfo = "RCTWebSocket-tvOS"; - }; - 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28131D9B038B00D4039D; - remoteInfo = "React-tvOS"; - }; - 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C059A1DE3340900C268FA; - remoteInfo = yoga; - }; - 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C06751DE3340C00C268FA; - remoteInfo = "yoga-tvOS"; - }; - 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; - remoteInfo = jschelpers; - }; - 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; - remoteInfo = "jschelpers-tvOS"; - }; - 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTAnimation; - }; - 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28201D9B03D100D4039D; - remoteInfo = "RCTAnimation-tvOS"; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* rn_button_demoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = rn_button_demoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* rn_button_demoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = rn_button_demoTests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* rn_button_demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = rn_button_demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = rn_button_demo/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = rn_button_demo/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = rn_button_demo/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = rn_button_demo/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = rn_button_demo/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* rn_button_demoTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* rn_button_demoTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = rn_button_demoTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDEE71B06529A00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* rn_button_demo */ = { - isa = PBXGroup; - children = ( - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = rn_button_demo; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - 3DAD3EA31DF850E9000B6D8A /* libReact.a */, - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */, - 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */, - ); - name = Products; - sourceTree = ""; - }; - 5E91572E1DD0AC6500FF2AA8 /* Products */ = { - isa = PBXGroup; - children = ( - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* rn_button_demo */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* rn_button_demoTests */, - 83CBBA001A601CBA00E9B192 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* rn_button_demo.app */, - 00E356EE1AD99517003FC87E /* rn_button_demoTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* rn_button_demoTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "rn_button_demoTests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = rn_button_demoTests; - productName = rn_button_demoTests; - productReference = 00E356EE1AD99517003FC87E /* rn_button_demoTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* rn_button_demo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "rn_button_demo" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = rn_button_demo; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* rn_button_demo.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "rn_button_demo" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; - ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDEE71B06529A00C62182 /* Products */; - ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* rn_button_demo */, - 00E356ED1AD99517003FC87E /* rn_button_demoTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTImage-tvOS.a"; - remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTLinking-tvOS.a"; - remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTNetwork-tvOS.a"; - remoteRef = 3DAD3E8B1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTSettings-tvOS.a"; - remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTText-tvOS.a"; - remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTWebSocket-tvOS.a"; - remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTAnimation-tvOS.a"; - remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* rn_button_demoTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* rn_button_demo */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = rn_button_demo; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = rn_button_demoTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/rn_button_demo.app/rn_button_demo"; - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - INFOPLIST_FILE = rn_button_demoTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/rn_button_demo.app/rn_button_demo"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = NO; - INFOPLIST_FILE = rn_button_demo/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = rn_button_demo; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - INFOPLIST_FILE = rn_button_demo/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = rn_button_demo; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "rn_button_demoTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "rn_button_demo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "rn_button_demo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/Demo/rn_button_demo/ios/rn_button_demo.xcodeproj/xcshareddata/xcschemes/rn_button_demo.xcscheme b/Demo/rn_button_demo/ios/rn_button_demo.xcodeproj/xcshareddata/xcschemes/rn_button_demo.xcscheme deleted file mode 100644 index 90cb10a..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo.xcodeproj/xcshareddata/xcschemes/rn_button_demo.xcscheme +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Demo/rn_button_demo/ios/rn_button_demo/AppDelegate.h b/Demo/rn_button_demo/ios/rn_button_demo/AppDelegate.h deleted file mode 100644 index a9654d5..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo/AppDelegate.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -@interface AppDelegate : UIResponder - -@property (nonatomic, strong) UIWindow *window; - -@end diff --git a/Demo/rn_button_demo/ios/rn_button_demo/AppDelegate.m b/Demo/rn_button_demo/ios/rn_button_demo/AppDelegate.m deleted file mode 100644 index af5950e..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo/AppDelegate.m +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "AppDelegate.h" - -#import -#import - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - NSURL *jsCodeLocation; - - jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; - - RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation - moduleName:@"rn_button_demo" - initialProperties:nil - launchOptions:launchOptions]; - rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; - - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/Demo/rn_button_demo/ios/rn_button_demo/Base.lproj/LaunchScreen.xib b/Demo/rn_button_demo/ios/rn_button_demo/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 470e6a6..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Demo/rn_button_demo/ios/rn_button_demo/Images.xcassets/AppIcon.appiconset/Contents.json b/Demo/rn_button_demo/ios/rn_button_demo/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Demo/rn_button_demo/ios/rn_button_demo/Info.plist b/Demo/rn_button_demo/ios/rn_button_demo/Info.plist deleted file mode 100644 index 2fb6a11..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo/Info.plist +++ /dev/null @@ -1,54 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UIViewControllerBasedStatusBarAppearance - - NSLocationWhenInUseUsageDescription - - NSAppTransportSecurity - - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - - diff --git a/Demo/rn_button_demo/ios/rn_button_demo/main.m b/Demo/rn_button_demo/ios/rn_button_demo/main.m deleted file mode 100644 index 3d767fc..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demo/main.m +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/Demo/rn_button_demo/ios/rn_button_demoTests/Info.plist b/Demo/rn_button_demo/ios/rn_button_demoTests/Info.plist deleted file mode 100644 index 886825c..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demoTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Demo/rn_button_demo/ios/rn_button_demoTests/rn_button_demoTests.m b/Demo/rn_button_demo/ios/rn_button_demoTests/rn_button_demoTests.m deleted file mode 100644 index 27d5fc1..0000000 --- a/Demo/rn_button_demo/ios/rn_button_demoTests/rn_button_demoTests.m +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import - -#import -#import - -#define TIMEOUT_SECONDS 600 -#define TEXT_TO_LOOK_FOR @"Welcome to React Native!" - -@interface rn_button_demoTests : XCTestCase - -@end - -@implementation rn_button_demoTests - -- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test -{ - if (test(view)) { - return YES; - } - for (UIView *subview in [view subviews]) { - if ([self findSubviewInView:subview matching:test]) { - return YES; - } - } - return NO; -} - -- (void)testRendersWelcomeScreen -{ - UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; - BOOL foundElement = NO; - - __block NSString *redboxError = nil; - RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - if (level >= RCTLogLevelError) { - redboxError = message; - } - }); - - while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - - foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { - if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { - return YES; - } - return NO; - }]; - } - - RCTSetLogFunction(RCTDefaultLogFunction); - - XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); - XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); -} - - -@end diff --git a/Demo/rn_button_demo/package.json b/Demo/rn_button_demo/package.json deleted file mode 100644 index fae6f5b..0000000 --- a/Demo/rn_button_demo/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "rn_button_demo", - "version": "0.0.1", - "private": true, - "scripts": { - "start": "node node_modules/react-native/local-cli/cli.js start", - "test": "jest" - }, - "dependencies": { - "react": "15.4.2", - "react-native": "0.40.0" - }, - "devDependencies": { - "babel-jest": "18.0.0", - "babel-preset-react-native": "1.9.1", - "jest": "18.1.0", - "react-test-renderer": "15.4.2" - }, - "jest": { - "preset": "react-native" - } -} \ No newline at end of file diff --git a/Demo/rn_native_module_demo/.babelrc b/Demo/rn_native_module_demo/.babelrc deleted file mode 100644 index 8df53fe..0000000 --- a/Demo/rn_native_module_demo/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ -"presets": ["react-native"] -} \ No newline at end of file diff --git a/Demo/rn_native_module_demo/.buckconfig b/Demo/rn_native_module_demo/.buckconfig deleted file mode 100644 index 934256c..0000000 --- a/Demo/rn_native_module_demo/.buckconfig +++ /dev/null @@ -1,6 +0,0 @@ - -[android] - target = Google Inc.:Google APIs:23 - -[maven_repositories] - central = https://repo1.maven.org/maven2 diff --git a/Demo/rn_native_module_demo/.flowconfig b/Demo/rn_native_module_demo/.flowconfig deleted file mode 100644 index 876e701..0000000 --- a/Demo/rn_native_module_demo/.flowconfig +++ /dev/null @@ -1,44 +0,0 @@ -[ignore] -; We fork some components by platform -.*/*[.]android.js - -; Ignore "BUCK" generated dirs -/\.buckd/ - -; Ignore unexpected extra "@providesModule" -.*/node_modules/.*/node_modules/fbjs/.* - -; Ignore duplicate module providers -; For RN Apps installed via npm, "Libraries" folder is inside -; "node_modules/react-native" but in the source repo it is in the root -.*/Libraries/react-native/React.js -.*/Libraries/react-native/ReactNative.js - -[include] - -[libs] -node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow -flow/ - -[options] -module.system=haste - -experimental.strict_type_args=true - -munge_underscores=true - -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' - -suppress_type=$FlowIssue -suppress_type=$FlowFixMe -suppress_type=$FixMe - -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-6]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-6]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ -suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy - -unsafe.enable_getters_and_setters=true - -[version] -^0.36.0 diff --git a/Demo/rn_native_module_demo/.gitattributes b/Demo/rn_native_module_demo/.gitattributes deleted file mode 100644 index d42ff18..0000000 --- a/Demo/rn_native_module_demo/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.pbxproj -text diff --git a/Demo/rn_native_module_demo/.gitignore b/Demo/rn_native_module_demo/.gitignore deleted file mode 100644 index fc13f16..0000000 --- a/Demo/rn_native_module_demo/.gitignore +++ /dev/null @@ -1,53 +0,0 @@ -# OSX -# -.DS_Store - -# Xcode -# -build/ -*.pbxuser -!default.pbxuser -*.mode1v3 -!default.mode1v3 -*.mode2v3 -!default.mode2v3 -*.perspectivev3 -!default.perspectivev3 -xcuserdata -*.xccheckout -*.moved-aside -DerivedData -*.hmap -*.ipa -*.xcuserstate -project.xcworkspace - -# Android/IntelliJ -# -build/ -.idea -.gradle -local.properties -*.iml - -# node.js -# -node_modules/ -npm-debug.log - -# BUCK -buck-out/ -\.buckd/ -android/app/libs -*.keystore - -# fastlane -# -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. -# For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md - -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots diff --git a/Demo/rn_native_module_demo/.watchmanconfig b/Demo/rn_native_module_demo/.watchmanconfig deleted file mode 100644 index 9e26dfe..0000000 --- a/Demo/rn_native_module_demo/.watchmanconfig +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/Demo/rn_native_module_demo/ImageCrop.js b/Demo/rn_native_module_demo/ImageCrop.js deleted file mode 100644 index 31319a0..0000000 --- a/Demo/rn_native_module_demo/ImageCrop.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; -/** - * React Native Android/iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -import { NativeModules } from 'react-native'; - -export default NativeModules.ImageCrop; \ No newline at end of file diff --git a/Demo/rn_native_module_demo/__tests__/index.android.js b/Demo/rn_native_module_demo/__tests__/index.android.js deleted file mode 100644 index b49b908..0000000 --- a/Demo/rn_native_module_demo/__tests__/index.android.js +++ /dev/null @@ -1,12 +0,0 @@ -import 'react-native'; -import React from 'react'; -import Index from '../index.android.js'; - -// Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; - -it('renders correctly', () => { - const tree = renderer.create( - - ); -}); diff --git a/Demo/rn_native_module_demo/__tests__/index.ios.js b/Demo/rn_native_module_demo/__tests__/index.ios.js deleted file mode 100644 index ba7c5b5..0000000 --- a/Demo/rn_native_module_demo/__tests__/index.ios.js +++ /dev/null @@ -1,12 +0,0 @@ -import 'react-native'; -import React from 'react'; -import Index from '../index.ios.js'; - -// Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; - -it('renders correctly', () => { - const tree = renderer.create( - - ); -}); diff --git a/Demo/rn_native_module_demo/android/app/BUCK b/Demo/rn_native_module_demo/android/app/BUCK deleted file mode 100644 index 06025c4..0000000 --- a/Demo/rn_native_module_demo/android/app/BUCK +++ /dev/null @@ -1,66 +0,0 @@ -import re - -# To learn about Buck see [Docs](https://buckbuild.com/). -# To run your application with Buck: -# - install Buck -# - `npm start` - to start the packager -# - `cd android` -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck -# - `buck install -r android/app` - compile, install and run application -# - -lib_deps = [] -for jarfile in glob(['libs/*.jar']): - name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) - lib_deps.append(':' + name) - prebuilt_jar( - name = name, - binary_jar = jarfile, - ) - -for aarfile in glob(['libs/*.aar']): - name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) - lib_deps.append(':' + name) - android_prebuilt_aar( - name = name, - aar = aarfile, - ) - -android_library( - name = 'all-libs', - exported_deps = lib_deps -) - -android_library( - name = 'app-code', - srcs = glob([ - 'src/main/java/**/*.java', - ]), - deps = [ - ':all-libs', - ':build_config', - ':res', - ], -) - -android_build_config( - name = 'build_config', - package = 'com.rn_native_module_demo', -) - -android_resource( - name = 'res', - res = 'src/main/res', - package = 'com.rn_native_module_demo', -) - -android_binary( - name = 'app', - package_type = 'debug', - manifest = 'src/main/AndroidManifest.xml', - keystore = '//android/keystores:debug', - deps = [ - ':app-code', - ], -) diff --git a/Demo/rn_native_module_demo/android/app/build.gradle b/Demo/rn_native_module_demo/android/app/build.gradle deleted file mode 100644 index 9199efc..0000000 --- a/Demo/rn_native_module_demo/android/app/build.gradle +++ /dev/null @@ -1,139 +0,0 @@ -apply plugin: "com.android.application" - -import com.android.build.OutputFile - -/** - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets - * and bundleReleaseJsAndAssets). - * These basically call `react-native bundle` with the correct arguments during the Android build - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the - * bundle directly from the development server. Below you can see all the possible configurations - * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "../../node_modules/react-native/react.gradle"` line. - * - * project.ext.react = [ - * // the name of the generated asset file containing your JS bundle - * bundleAssetName: "index.android.bundle", - * - * // the entry file for bundle generation - * entryFile: "index.android.js", - * - * // whether to bundle JS and assets in debug mode - * bundleInDebug: false, - * - * // whether to bundle JS and assets in release mode - * bundleInRelease: true, - * - * // whether to bundle JS and assets in another build variant (if configured). - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants - * // The configuration property can be in the following formats - * // 'bundleIn${productFlavor}${buildType}' - * // 'bundleIn${buildType}' - * // bundleInFreeDebug: true, - * // bundleInPaidRelease: true, - * // bundleInBeta: true, - * - * // the root of your project, i.e. where "package.json" lives - * root: "../../", - * - * // where to put the JS bundle asset in debug mode - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", - * - * // where to put the JS bundle asset in release mode - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in debug mode - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", - * - * // where to put drawable resources / React Native assets, e.g. the ones you use via - * // require('./image.png')), in release mode - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", - * - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to - * // date; if you have any other folders that you want to ignore for performance reasons (gradle - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ - * // for example, you might want to remove it from here. - * inputExcludes: ["android/**", "ios/**"], - * - * // override which node gets called and with what additional arguments - * nodeExecutableAndArgs: ["node"] - * - * // supply additional arguments to the packager - * extraPackagerArgs: [] - * ] - */ - -apply from: "../../node_modules/react-native/react.gradle" - -/** - * Set this to true to create two separate APKs instead of one: - * - An APK that only works on ARM devices - * - An APK that only works on x86 devices - * The advantage is the size of the APK is reduced by about 4MB. - * Upload all the APKs to the Play Store and people will download - * the correct one based on the CPU architecture of their device. - */ -def enableSeparateBuildPerCPUArchitecture = false - -/** - * Run Proguard to shrink the Java bytecode in release builds. - */ -def enableProguardInReleaseBuilds = false - -android { - compileSdkVersion 23 - buildToolsVersion "23.0.1" - - defaultConfig { - applicationId "com.rn_native_module_demo" - minSdkVersion 16 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - ndk { - abiFilters "armeabi-v7a", "x86" - } - } - splits { - abi { - reset() - enable enableSeparateBuildPerCPUArchitecture - universalApk false // If true, also generate a universal APK - include "armeabi-v7a", "x86" - } - } - buildTypes { - release { - minifyEnabled enableProguardInReleaseBuilds - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" - } - } - // applicationVariants are e.g. debug, release - applicationVariants.all { variant -> - variant.outputs.each { output -> - // For each separate APK per architecture, set a unique version code as described here: - // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2] - def abi = output.getFilter(OutputFile.ABI) - if (abi != null) { // null for the universal-debug, universal-release variants - output.versionCodeOverride = - versionCodes.get(abi) * 1048576 + defaultConfig.versionCode - } - } - } -} - -dependencies { - compile fileTree(dir: "libs", include: ["*.jar"]) - compile "com.android.support:appcompat-v7:23.0.1" - compile "com.facebook.react:react-native:+" // From node_modules -} - -// Run this once to be able to run the application with BUCK -// puts all compile dependencies into folder libs for BUCK to use -task copyDownloadableDepsToLibs(type: Copy) { - from configurations.compile - into 'libs' -} diff --git a/Demo/rn_native_module_demo/android/app/proguard-rules.pro b/Demo/rn_native_module_demo/android/app/proguard-rules.pro deleted file mode 100644 index 48361a9..0000000 --- a/Demo/rn_native_module_demo/android/app/proguard-rules.pro +++ /dev/null @@ -1,66 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Disabling obfuscation is useful if you collect stack traces from production crashes -# (unless you are using a system that supports de-obfuscate the stack traces). --dontobfuscate - -# React Native - -# Keep our interfaces so they can be used by other ProGuard rules. -# See http://sourceforge.net/p/proguard/bugs/466/ --keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip --keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters --keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip - -# Do not strip any method/class that is annotated with @DoNotStrip --keep @com.facebook.proguard.annotations.DoNotStrip class * --keep @com.facebook.common.internal.DoNotStrip class * --keepclassmembers class * { - @com.facebook.proguard.annotations.DoNotStrip *; - @com.facebook.common.internal.DoNotStrip *; -} - --keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { - void set*(***); - *** get*(); -} - --keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } --keep class * extends com.facebook.react.bridge.NativeModule { *; } --keepclassmembers,includedescriptorclasses class * { native ; } --keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } --keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } - --dontwarn com.facebook.react.** - -# okhttp - --keepattributes Signature --keepattributes *Annotation* --keep class okhttp3.** { *; } --keep interface okhttp3.** { *; } --dontwarn okhttp3.** - -# okio - --keep class sun.misc.Unsafe { *; } --dontwarn java.nio.file.* --dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement --dontwarn okio.** diff --git a/Demo/rn_native_module_demo/android/app/src/main/AndroidManifest.xml b/Demo/rn_native_module_demo/android/app/src/main/AndroidManifest.xml deleted file mode 100644 index 233ec46..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/MainActivity.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/MainActivity.java deleted file mode 100644 index 9f32333..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/MainActivity.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.rn_native_module_demo; - -import com.facebook.react.ReactActivity; -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -public class MainActivity extends ReactActivity { - - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "rn_native_module_demo"; - } -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/MainApplication.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/MainApplication.java deleted file mode 100644 index 994f44d..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/MainApplication.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.rn_native_module_demo; - -import android.app.Application; -import android.util.Log; - -import com.facebook.react.ReactApplication; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.ReactNativeHost; -import com.facebook.react.ReactPackage; -import com.facebook.react.shell.MainReactPackage; -import com.facebook.soloader.SoLoader; -import com.rn_native_module_demo.crop.ImageCropReactPackage; - -import java.util.Arrays; -import java.util.List; -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -public class MainApplication extends Application implements ReactApplication { - - private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { - @Override - protected boolean getUseDeveloperSupport() { - return BuildConfig.DEBUG; - } - - @Override - protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new ImageCropReactPackage() - ); - } - }; - - @Override - public ReactNativeHost getReactNativeHost() { - return mReactNativeHost; - } - - @Override - public void onCreate() { - super.onCreate(); - SoLoader.init(this, /* native exopackage */ false); - } -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/Crop.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/Crop.java deleted file mode 100644 index 343c56c..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/Crop.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.rn_native_module_demo.crop; - -import com.facebook.react.bridge.Promise; - -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -public interface Crop { - /** - * 选择并裁切照片 - * @param outputX - * @param outputY - * @param promise - */ - void selectWithCrop(int outputX,int outputY,Promise promise); -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/CropImpl.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/CropImpl.java deleted file mode 100644 index da88d15..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/CropImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.rn_native_module_demo.crop; - -import android.app.Activity; -import android.content.Intent; -import android.net.Uri; -import com.facebook.react.bridge.ActivityEventListener; -import com.facebook.react.bridge.Promise; - -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -public class CropImpl implements ActivityEventListener,Crop{ - private final int RC_PICK=50081; - private final int RC_CROP=50082; - private final String CODE_ERROR_PICK="用户取消"; - private final String CODE_ERROR_CROP="裁切失败"; - - private Promise pickPromise; - private Uri outPutUri; - private int aspectX; - private int aspectY; - private Activity activity; - public static CropImpl of(Activity activity){ - return new CropImpl(activity); - } - - private CropImpl(Activity activity) { - this.activity = activity; - } - public void updateActivity(Activity activity){ - this.activity=activity; - } - @Override - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { - if(requestCode==RC_PICK){ - if (resultCode == Activity.RESULT_OK && data != null) {//从相册选择照片并裁剪 - outPutUri= Uri.fromFile(Utils.getPhotoCacheDir(System.currentTimeMillis()+".jpg")); - onCrop(data.getData(),outPutUri); - } else { - pickPromise.reject(CODE_ERROR_PICK,"没有获取到结果"); - } - }else if(requestCode==RC_CROP){ - if (resultCode == Activity.RESULT_OK) { - pickPromise.resolve(outPutUri.getPath()); - }else { - pickPromise.reject(CODE_ERROR_CROP,"裁剪失败"); - } - } - } - - @Override - public void onNewIntent(Intent intent) {} - @Override - public void selectWithCrop(int aspectX, int aspectY, Promise promise) { - this.pickPromise=promise; - this.aspectX=aspectX; - this.aspectY=aspectY; - this.activity.startActivityForResult(IntentUtils.getPickIntentWithGallery(),RC_PICK); - } - private void onCrop(Uri targetUri,Uri outputUri){ - this.activity.startActivityForResult(IntentUtils.getCropIntentWith(targetUri,outputUri,aspectX,aspectY),RC_CROP); - } -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/ImageCropModule.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/ImageCropModule.java deleted file mode 100644 index b81f9df..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/ImageCropModule.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.rn_native_module_demo.crop; - -import com.facebook.react.bridge.Promise; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; - -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -public class ImageCropModule extends ReactContextBaseJavaModule implements Crop{ - private CropImpl cropImpl; - public ImageCropModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "ImageCrop"; - } - - @Override @ReactMethod - public void selectWithCrop(int aspectX, int aspectY, Promise promise) { - getCrop().selectWithCrop(aspectX,aspectY,promise); - } - private CropImpl getCrop(){ - if(cropImpl==null){ - cropImpl=CropImpl.of(getCurrentActivity()); - getReactApplicationContext().addActivityEventListener(cropImpl); - }else { - cropImpl.updateActivity(getCurrentActivity()); - } - return cropImpl; - } -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/ImageCropReactPackage.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/ImageCropReactPackage.java deleted file mode 100644 index dd8e011..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/ImageCropReactPackage.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.rn_native_module_demo.crop; - -import com.facebook.react.ReactPackage; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.NativeModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.uimanager.ViewManager; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - - -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -public class ImageCropReactPackage implements ReactPackage { - - @Override - public List> createJSModules() { - return Collections.emptyList(); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules( - ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new ImageCropModule(reactContext)); - return modules; - } -} \ No newline at end of file diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/IntentUtils.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/IntentUtils.java deleted file mode 100644 index e305ab6..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/IntentUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.rn_native_module_demo.crop; - -import android.content.Intent; -import android.graphics.Bitmap; -import android.net.Uri; -import android.provider.MediaStore; - -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -public class IntentUtils { - /** - * 获取选择照片的Intent - * @return - */ - public static Intent getPickIntentWithGallery() { - Intent intent = new Intent(); - intent.setAction(Intent.ACTION_PICK);//Pick an item from the data - intent.setType("image/*");//从所有图片中进行选择 - return intent; - } - - /** - * 获取裁切照片的Intent - * @param targetUri 要裁切的照片 - * @param outPutUri 裁切之后输出的照片 - * @param aspectX 宽 - * @param aspectY 高 - * @return - */ - public static Intent getCropIntentWith(Uri targetUri, Uri outPutUri, int aspectX, int aspectY) { - Intent intent = new Intent("com.android.camera.action.CROP"); - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.setDataAndType(targetUri, "image/*"); - intent.putExtra("crop", "true"); - intent.putExtra("aspectX", aspectX); - intent.putExtra("aspectY", aspectY); - intent.putExtra("scale", true); - intent.putExtra(MediaStore.EXTRA_OUTPUT, outPutUri); - intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); - intent.putExtra("noFaceDetection", true); // no face detection - return intent; - } -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/Utils.java b/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/Utils.java deleted file mode 100644 index d834271..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/java/com/rn_native_module_demo/crop/Utils.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.rn_native_module_demo.crop; - -import android.os.Environment; -import java.io.File; - -/** - * React Native Android原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -public class Utils { - /** - * 获取一个临时文件 - * @param fileName - * @return - */ - public static File getPhotoCacheDir(String fileName) { - return new File(Environment.getExternalStorageDirectory().getAbsoluteFile(),fileName); - } -} diff --git a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index cde69bc..0000000 Binary files a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index c133a0c..0000000 Binary files a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index bfa42f0..0000000 Binary files a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 324e72c..0000000 Binary files a/Demo/rn_native_module_demo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/Demo/rn_native_module_demo/android/app/src/main/res/values/strings.xml b/Demo/rn_native_module_demo/android/app/src/main/res/values/strings.xml deleted file mode 100644 index 4215127..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - rn_native_module_demo - diff --git a/Demo/rn_native_module_demo/android/app/src/main/res/values/styles.xml b/Demo/rn_native_module_demo/android/app/src/main/res/values/styles.xml deleted file mode 100644 index 319eb0c..0000000 --- a/Demo/rn_native_module_demo/android/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - diff --git a/Demo/rn_native_module_demo/android/build.gradle b/Demo/rn_native_module_demo/android/build.gradle deleted file mode 100644 index fcba4c5..0000000 --- a/Demo/rn_native_module_demo/android/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - -buildscript { - repositories { - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:1.3.1' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - mavenLocal() - jcenter() - maven { - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm - url "$rootDir/../node_modules/react-native/android" - } - } -} diff --git a/Demo/rn_native_module_demo/android/gradle.properties b/Demo/rn_native_module_demo/android/gradle.properties deleted file mode 100644 index 1fd964e..0000000 --- a/Demo/rn_native_module_demo/android/gradle.properties +++ /dev/null @@ -1,20 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true - -android.useDeprecatedNdk=true diff --git a/Demo/rn_native_module_demo/android/gradle/wrapper/gradle-wrapper.jar b/Demo/rn_native_module_demo/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index b5166da..0000000 Binary files a/Demo/rn_native_module_demo/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/Demo/rn_native_module_demo/android/gradle/wrapper/gradle-wrapper.properties b/Demo/rn_native_module_demo/android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b9fbfab..0000000 --- a/Demo/rn_native_module_demo/android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip diff --git a/Demo/rn_native_module_demo/android/gradlew b/Demo/rn_native_module_demo/android/gradlew deleted file mode 100755 index 91a7e26..0000000 --- a/Demo/rn_native_module_demo/android/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/Demo/rn_native_module_demo/android/gradlew.bat b/Demo/rn_native_module_demo/android/gradlew.bat deleted file mode 100644 index 8a0b282..0000000 --- a/Demo/rn_native_module_demo/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/Demo/rn_native_module_demo/android/keystores/BUCK b/Demo/rn_native_module_demo/android/keystores/BUCK deleted file mode 100644 index 15da20e..0000000 --- a/Demo/rn_native_module_demo/android/keystores/BUCK +++ /dev/null @@ -1,8 +0,0 @@ -keystore( - name = 'debug', - store = 'debug.keystore', - properties = 'debug.keystore.properties', - visibility = [ - 'PUBLIC', - ], -) diff --git a/Demo/rn_native_module_demo/android/keystores/debug.keystore.properties b/Demo/rn_native_module_demo/android/keystores/debug.keystore.properties deleted file mode 100644 index 121bfb4..0000000 --- a/Demo/rn_native_module_demo/android/keystores/debug.keystore.properties +++ /dev/null @@ -1,4 +0,0 @@ -key.store=debug.keystore -key.alias=androiddebugkey -key.store.password=android -key.alias.password=android diff --git a/Demo/rn_native_module_demo/android/settings.gradle b/Demo/rn_native_module_demo/android/settings.gradle deleted file mode 100644 index 1caf39d..0000000 --- a/Demo/rn_native_module_demo/android/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -rootProject.name = 'rn_native_module_demo' - -include ':app' diff --git a/Demo/rn_native_module_demo/index.android.js b/Demo/rn_native_module_demo/index.android.js deleted file mode 100644 index 6af6462..0000000 --- a/Demo/rn_native_module_demo/index.android.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * React Native Android/iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -import React, {Component} from 'react'; -import { - AppRegistry, -} from 'react-native'; -import index from './index.js' - - -AppRegistry.registerComponent('rn_native_module_demo', () => index); diff --git a/Demo/rn_native_module_demo/index.ios.js b/Demo/rn_native_module_demo/index.ios.js deleted file mode 100644 index 6af6462..0000000 --- a/Demo/rn_native_module_demo/index.ios.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * React Native Android/iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -import React, {Component} from 'react'; -import { - AppRegistry, -} from 'react-native'; -import index from './index.js' - - -AppRegistry.registerComponent('rn_native_module_demo', () => index); diff --git a/Demo/rn_native_module_demo/index.js b/Demo/rn_native_module_demo/index.js deleted file mode 100644 index a091b31..0000000 --- a/Demo/rn_native_module_demo/index.js +++ /dev/null @@ -1,88 +0,0 @@ -/** - * React Native Android/iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ -import React, {Component} from 'react'; -import { - StyleSheet, - Text, - View, - Image, - TextInput, - Platform -} from 'react-native'; -import ImageCrop from './ImageCrop' -const ASPECT_X="2"; -const ASPECT_Y="1"; -export default class index extends Component { - state = { - result: '' - } - - onSelectCrop() { - let x=this.aspectX?this.aspectX:ASPECT_X; - let y=this.aspectY?this.aspectY:ASPECT_Y; - ImageCrop.selectWithCrop(parseInt(x),parseInt(y)).then(result=> { - this.setState({ - result: result['imageUrl']?result['imageUrl']:result - }) - }).catch(e=> {6 - this.setState({ - result: e - }) - }); - } - - render() { - let imgUrl =Platform.OS==='android'? 'file:///' + this.state.result:this.state.result; - let imageView=this.state.result===""?null: - - return ( - - - 宽: - this.aspectX=aspectX} - /> - 比 高: - this.aspectY=aspectY} - /> - this.onSelectCrop()} - >裁切图片 - - - {imgUrl} - {imageView} - - ); - } -} - -const styles = StyleSheet.create({ - container: { - flex: 1, - marginTop:20 - }, - row: { - flexDirection: 'row', - alignItems: 'center' - }, - input:{ - height:40, - width:40 - } -}); diff --git a/Demo/rn_native_module_demo/ios/Crop.h b/Demo/rn_native_module_demo/ios/Crop.h deleted file mode 100644 index a4c3f75..0000000 --- a/Demo/rn_native_module_demo/ios/Crop.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * React Native iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - - -#import -#import - -@interface Crop:NSObject --(instancetype)initWithViewController:(UIViewController *)vc; -typedef void(^PickSuccess)(NSDictionary *resultDic); -typedef void(^PickFailure)(NSString* message); -@property (nonatomic, retain) NSMutableDictionary *response; -@property (nonatomic,copy)PickSuccess pickSuccess; -@property (nonatomic,copy)PickFailure pickFailure; -@property(nonatomic,strong)UIViewController *viewController; - --(void)selectImage:(NSDictionary*)option successs:(PickSuccess)success failure:(PickFailure)failure; -@end diff --git a/Demo/rn_native_module_demo/ios/Crop.m b/Demo/rn_native_module_demo/ios/Crop.m deleted file mode 100644 index df2f2e2..0000000 --- a/Demo/rn_native_module_demo/ios/Crop.m +++ /dev/null @@ -1,105 +0,0 @@ -/** - * React Native iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -#import "Crop.h" -#import -@interface Crop () -@property(strong,nonatomic)NSDictionary*option; -@end - -@implementation Crop --(instancetype)initWithViewController:(UIViewController *)vc{ - self=[super init]; - self.viewController=vc; - return self; -} - --(void)selectImage:(NSDictionary*)option successs:(PickSuccess)success failure:(PickFailure)failure{ - self.pickSuccess=success; - self.pickFailure=failure; - self.option=option; - UIImagePickerController *pickerController = [[UIImagePickerController alloc] init]; - pickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; - pickerController.delegate = self; - pickerController.allowsEditing = YES; - [self.viewController presentViewController:pickerController animated:YES completion:nil]; -} - --(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ - UIImage*image=[info objectForKey:@"UIImagePickerControllerEditedImage"]; - image=[self scaleToSize:image size:CGSizeMake([[self.option objectForKey:@"aspectX"]integerValue], [[self.option objectForKey:@"aspectY"]integerValue])]; - if(image){ - [self writeToFileWithImage:image outPut:[self getTempFile:[self getFileName:info]] handler:^(NSString *path) { - [picker dismissViewControllerAnimated:YES completion:nil]; - self.pickSuccess(@{@"imageUrl": path}); - }]; - - }else{ - self.pickFailure(@"获取照片失败"); - [picker dismissViewControllerAnimated:YES completion:nil]; - } - -} -#pragma mark 裁剪照片 --(UIImage *)scaleToSize:(UIImage *)image size:(CGSize)size -{ - //并把他设置成当前的context - UIGraphicsBeginImageContext(size); - //绘制图片的大小 - [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; - //从当前context中创建一个改变大小后的图片 - UIImage *endImage=UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); - return endImage; -} -#pragma mark 将image写入沙盒 --(void)writeToFileWithImage:(UIImage*)image outPut:(NSString*)imagePath handler:(void(^)(NSString *path))handler{ - NSData *data= UIImageJPEGRepresentation(image, 1); - [data writeToFile:imagePath atomically:YES]; - dispatch_async(dispatch_get_main_queue(), ^{ - handler(imagePath); - }); - -} -#pragma mark 将指定url对于的图片写入沙盒 --(void)writeToFileWithUrl:(NSURL*)url outPut:(NSString*)imagePath handler:(void(^)(NSString *path))handler{ - ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init]; - if (url) { - [assetLibrary assetForURL:url resultBlock:^(ALAsset *asset) { - ALAssetRepresentation *rep = [asset defaultRepresentation]; - Byte *buffer = (Byte*)malloc((unsigned long)rep.size); - NSUInteger buffered = [rep getBytes:buffer fromOffset:0.0 length:((unsigned long)rep.size) error:nil]; - NSData *data = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES]; - [data writeToFile:imagePath atomically:YES]; - dispatch_async(dispatch_get_main_queue(), ^{ - handler(imagePath); - }); - } failureBlock:^(NSError *error) { - dispatch_async(dispatch_get_main_queue(), ^{ - handler(@"获取图片失败"); - }); - }]; - } -} -#pragma mark 获取临时文件路径 --(NSString*)getTempFile:(NSString*)fileName{ - NSString *imageContent=[[NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingString:@"/temp"]; - NSFileManager * fileManager = [NSFileManager defaultManager]; - if (![fileManager fileExistsAtPath:imageContent]) { - [fileManager createDirectoryAtPath:imageContent withIntermediateDirectories:YES attributes:nil error:nil]; - } - return [imageContent stringByAppendingPathComponent:fileName]; -} --(NSString*)getFileName:(NSDictionary*)info{ - NSString *fileName; - NSString *tempFileName = [[NSUUID UUID] UUIDString]; - fileName = [tempFileName stringByAppendingString:@".jpg"]; - return fileName; -} -@end diff --git a/Demo/rn_native_module_demo/ios/ImageCrop.h b/Demo/rn_native_module_demo/ios/ImageCrop.h deleted file mode 100644 index e70f720..0000000 --- a/Demo/rn_native_module_demo/ios/ImageCrop.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * React Native iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - - -#import -#import -@interface ImageCrop: NSObject - -@end diff --git a/Demo/rn_native_module_demo/ios/ImageCrop.m b/Demo/rn_native_module_demo/ios/ImageCrop.m deleted file mode 100644 index 3bdb917..0000000 --- a/Demo/rn_native_module_demo/ios/ImageCrop.m +++ /dev/null @@ -1,48 +0,0 @@ -/** - * React Native iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - - -#import "ImageCrop.h" -#import "Crop.h" - -@interface ImageCrop () -@property(strong,nonatomic)Crop *crop; -@end - -@implementation ImageCrop - - -RCT_EXPORT_MODULE(); - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} -RCT_EXPORT_METHOD(selectWithCrop:(NSInteger)aspectX aspectY:(NSInteger)aspectY resolver:(RCTPromiseResolveBlock)resolve - rejecter:(RCTPromiseRejectBlock)reject) -{ - UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; - while (root.presentedViewController != nil) { - root = root.presentedViewController; - } - NSString*aspectXStr=[NSString stringWithFormat: @"%ld",aspectX]; - NSString*aspectYStr=[NSString stringWithFormat: @"%ld",aspectY]; - [[self _crop:root] selectImage:@{@"aspectX":aspectXStr,@"aspectY":aspectYStr} successs:^(NSDictionary *resultDic) { - resolve(resultDic); - } failure:^(NSString *message) { - reject(@"fail",message,nil); - }]; -} --(Crop*)_crop:(UIViewController*)vc{ - if(self.crop==nil){ - self.crop=[[Crop alloc] initWithViewController:vc]; - } - return self.crop; -} - -@end diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo.xcodeproj/project.pbxproj b/Demo/rn_native_module_demo/ios/rn_native_module_demo.xcodeproj/project.pbxproj deleted file mode 100644 index 0f8c402..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1005 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; }; - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; }; - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; }; - 00E356F31AD99517003FC87E /* rn_native_module_demoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* rn_native_module_demoTests.m */; }; - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; }; - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; }; - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; }; - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; - 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; }; - 3D9B50631E31D9A300272C84 /* Crop.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9B50621E31D9A300272C84 /* Crop.m */; }; - 3D9B50661E31F6CE00272C84 /* ImageCrop.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D9B50651E31F6CE00272C84 /* ImageCrop.m */; }; - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; }; - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTActionSheet; - }; - 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTGeolocation; - }; - 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5115D1A9E6B3D00147676; - remoteInfo = RCTImage; - }; - 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B511DB1A9E6C8500147676; - remoteInfo = RCTNetwork; - }; - 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 832C81801AAF6DEF007FA2F7; - remoteInfo = RCTVibration; - }; - 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 13B07F861A680F5B00A75B9A; - remoteInfo = rn_native_module_demo; - }; - 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTSettings; - }; - 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3C86DF461ADF2C930047B81A; - remoteInfo = RCTWebSocket; - }; - 146834031AC3E56700842450 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192; - remoteInfo = React; - }; - 3D9B50921E31FD4400272C84 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28541D9B044C00D4039D; - remoteInfo = "RCTNetwork-tvOS"; - }; - 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A283A1D9B042B00D4039D; - remoteInfo = "RCTImage-tvOS"; - }; - 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28471D9B043800D4039D; - remoteInfo = "RCTLinking-tvOS"; - }; - 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28611D9B046600D4039D; - remoteInfo = "RCTSettings-tvOS"; - }; - 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A287B1D9B048500D4039D; - remoteInfo = "RCTText-tvOS"; - }; - 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28881D9B049200D4039D; - remoteInfo = "RCTWebSocket-tvOS"; - }; - 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28131D9B038B00D4039D; - remoteInfo = "React-tvOS"; - }; - 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C059A1DE3340900C268FA; - remoteInfo = yoga; - }; - 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3C06751DE3340C00C268FA; - remoteInfo = "yoga-tvOS"; - }; - 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9251DE5FBEC00167DC4; - remoteInfo = cxxreact; - }; - 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9321DE5FBEE00167DC4; - remoteInfo = "cxxreact-tvOS"; - }; - 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD90B1DE5FBD600167DC4; - remoteInfo = jschelpers; - }; - 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4; - remoteInfo = "jschelpers-tvOS"; - }; - 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTAnimation; - }; - 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 2D2A28201D9B03D100D4039D; - remoteInfo = "RCTAnimation-tvOS"; - }; - 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 134814201AA4EA6300B7C361; - remoteInfo = RCTLinking; - }; - 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 58B5119B1A9E6C1200147676; - remoteInfo = RCTText; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = ""; }; - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = ""; }; - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = ""; }; - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = ""; }; - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = ""; }; - 00E356EE1AD99517003FC87E /* rn_native_module_demoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = rn_native_module_demoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 00E356F21AD99517003FC87E /* rn_native_module_demoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = rn_native_module_demoTests.m; sourceTree = ""; }; - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = ""; }; - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = ""; }; - 13B07F961A680F5B00A75B9A /* rn_native_module_demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = rn_native_module_demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = rn_native_module_demo/AppDelegate.h; sourceTree = ""; }; - 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = rn_native_module_demo/AppDelegate.m; sourceTree = ""; }; - 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; - 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = rn_native_module_demo/Images.xcassets; sourceTree = ""; }; - 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = rn_native_module_demo/Info.plist; sourceTree = ""; }; - 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = rn_native_module_demo/main.m; sourceTree = ""; }; - 146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = ""; }; - 3D9B50611E31D9A300272C84 /* Crop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Crop.h; sourceTree = ""; }; - 3D9B50621E31D9A300272C84 /* Crop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Crop.m; sourceTree = ""; }; - 3D9B50641E31F6CE00272C84 /* ImageCrop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageCrop.h; sourceTree = ""; }; - 3D9B50651E31F6CE00272C84 /* ImageCrop.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageCrop.m; sourceTree = ""; }; - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = ""; }; - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = ""; }; - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 00E356EB1AD99517003FC87E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */, - 146834051AC3E58100842450 /* libReact.a in Frameworks */, - 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */, - 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */, - 00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */, - 133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */, - 00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */, - 139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */, - 832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */, - 00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */, - 139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 00C302A81ABCB8CE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302B61ABCB90400DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302BC1ABCB91800DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */, - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302D41ABCB9D200DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */, - 3D9B50931E31FD4400272C84 /* libRCTNetwork-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 00C302E01ABCB9EE00DB3ED1 /* Products */ = { - isa = PBXGroup; - children = ( - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */, - ); - name = Products; - sourceTree = ""; - }; - 00E356EF1AD99517003FC87E /* rn_native_module_demoTests */ = { - isa = PBXGroup; - children = ( - 00E356F21AD99517003FC87E /* rn_native_module_demoTests.m */, - 00E356F01AD99517003FC87E /* Supporting Files */, - ); - path = rn_native_module_demoTests; - sourceTree = ""; - }; - 00E356F01AD99517003FC87E /* Supporting Files */ = { - isa = PBXGroup; - children = ( - 00E356F11AD99517003FC87E /* Info.plist */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - 139105B71AF99BAD00B5F7CC /* Products */ = { - isa = PBXGroup; - children = ( - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */, - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 139FDEE71B06529A00C62182 /* Products */ = { - isa = PBXGroup; - children = ( - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */, - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 13B07FAE1A68108700A75B9A /* rn_native_module_demo */ = { - isa = PBXGroup; - children = ( - 3D9B50641E31F6CE00272C84 /* ImageCrop.h */, - 3D9B50651E31F6CE00272C84 /* ImageCrop.m */, - 3D9B50611E31D9A300272C84 /* Crop.h */, - 3D9B50621E31D9A300272C84 /* Crop.m */, - 008F07F21AC5B25A0029DE68 /* main.jsbundle */, - 13B07FAF1A68108700A75B9A /* AppDelegate.h */, - 13B07FB01A68108700A75B9A /* AppDelegate.m */, - 13B07FB51A68108700A75B9A /* Images.xcassets */, - 13B07FB61A68108700A75B9A /* Info.plist */, - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, - 13B07FB71A68108700A75B9A /* main.m */, - ); - name = rn_native_module_demo; - sourceTree = ""; - }; - 146834001AC3E56700842450 /* Products */ = { - isa = PBXGroup; - children = ( - 146834041AC3E56700842450 /* libReact.a */, - 3DAD3EA31DF850E9000B6D8A /* libReact.a */, - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */, - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */, - 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */, - 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */, - ); - name = Products; - sourceTree = ""; - }; - 5E91572E1DD0AC6500FF2AA8 /* Products */ = { - isa = PBXGroup; - children = ( - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */, - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 78C398B11ACF4ADC00677621 /* Products */ = { - isa = PBXGroup; - children = ( - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */, - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 832341AE1AAA6A7D00B99B32 /* Libraries */ = { - isa = PBXGroup; - children = ( - 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */, - 146833FF1AC3E56700842450 /* React.xcodeproj */, - 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */, - 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */, - 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */, - 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */, - 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */, - 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */, - 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */, - 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, - 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, - ); - name = Libraries; - sourceTree = ""; - }; - 832341B11AAA6A8300B99B32 /* Products */ = { - isa = PBXGroup; - children = ( - 832341B51AAA6A8300B99B32 /* libRCTText.a */, - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */, - ); - name = Products; - sourceTree = ""; - }; - 83CBB9F61A601CBA00E9B192 = { - isa = PBXGroup; - children = ( - 13B07FAE1A68108700A75B9A /* rn_native_module_demo */, - 832341AE1AAA6A7D00B99B32 /* Libraries */, - 00E356EF1AD99517003FC87E /* rn_native_module_demoTests */, - 83CBBA001A601CBA00E9B192 /* Products */, - ); - indentWidth = 2; - sourceTree = ""; - tabWidth = 2; - }; - 83CBBA001A601CBA00E9B192 /* Products */ = { - isa = PBXGroup; - children = ( - 13B07F961A680F5B00A75B9A /* rn_native_module_demo.app */, - 00E356EE1AD99517003FC87E /* rn_native_module_demoTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 00E356ED1AD99517003FC87E /* rn_native_module_demoTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "rn_native_module_demoTests" */; - buildPhases = ( - 00E356EA1AD99517003FC87E /* Sources */, - 00E356EB1AD99517003FC87E /* Frameworks */, - 00E356EC1AD99517003FC87E /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 00E356F51AD99517003FC87E /* PBXTargetDependency */, - ); - name = rn_native_module_demoTests; - productName = rn_native_module_demoTests; - productReference = 00E356EE1AD99517003FC87E /* rn_native_module_demoTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 13B07F861A680F5B00A75B9A /* rn_native_module_demo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "rn_native_module_demo" */; - buildPhases = ( - 13B07F871A680F5B00A75B9A /* Sources */, - 13B07F8C1A680F5B00A75B9A /* Frameworks */, - 13B07F8E1A680F5B00A75B9A /* Resources */, - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = rn_native_module_demo; - productName = "Hello World"; - productReference = 13B07F961A680F5B00A75B9A /* rn_native_module_demo.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 83CBB9F71A601CBA00E9B192 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0610; - ORGANIZATIONNAME = Facebook; - TargetAttributes = { - 00E356ED1AD99517003FC87E = { - CreatedOnToolsVersion = 6.2; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; - 13B07F861A680F5B00A75B9A = { - DevelopmentTeam = YH926WFY68; - }; - }; - }; - buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "rn_native_module_demo" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 83CBB9F61A601CBA00E9B192; - productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 00C302A81ABCB8CE00DB3ED1 /* Products */; - ProjectRef = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */; - }, - { - ProductGroup = 5E91572E1DD0AC6500FF2AA8 /* Products */; - ProjectRef = 5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */; - }, - { - ProductGroup = 00C302B61ABCB90400DB3ED1 /* Products */; - ProjectRef = 00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */; - }, - { - ProductGroup = 00C302BC1ABCB91800DB3ED1 /* Products */; - ProjectRef = 00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */; - }, - { - ProductGroup = 78C398B11ACF4ADC00677621 /* Products */; - ProjectRef = 78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */; - }, - { - ProductGroup = 00C302D41ABCB9D200DB3ED1 /* Products */; - ProjectRef = 00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */; - }, - { - ProductGroup = 139105B71AF99BAD00B5F7CC /* Products */; - ProjectRef = 139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */; - }, - { - ProductGroup = 832341B11AAA6A8300B99B32 /* Products */; - ProjectRef = 832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */; - }, - { - ProductGroup = 00C302E01ABCB9EE00DB3ED1 /* Products */; - ProjectRef = 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */; - }, - { - ProductGroup = 139FDEE71B06529A00C62182 /* Products */; - ProjectRef = 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */; - }, - { - ProductGroup = 146834001AC3E56700842450 /* Products */; - ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 13B07F861A680F5B00A75B9A /* rn_native_module_demo */, - 00E356ED1AD99517003FC87E /* rn_native_module_demoTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTActionSheet.a; - remoteRef = 00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTGeolocation.a; - remoteRef = 00C302B91ABCB90400DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTImage.a; - remoteRef = 00C302BF1ABCB91800DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTNetwork.a; - remoteRef = 00C302DB1ABCB9D200DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTVibration.a; - remoteRef = 00C302E31ABCB9EE00DB3ED1 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTSettings.a; - remoteRef = 139105C01AF99BAD00B5F7CC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTWebSocket.a; - remoteRef = 139FDEF31B06529B00C62182 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 146834041AC3E56700842450 /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3D9B50931E31FD4400272C84 /* libRCTNetwork-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTNetwork-tvOS.a"; - remoteRef = 3D9B50921E31FD4400272C84 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTImage-tvOS.a"; - remoteRef = 3DAD3E831DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTLinking-tvOS.a"; - remoteRef = 3DAD3E871DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTSettings-tvOS.a"; - remoteRef = 3DAD3E8F1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTText-tvOS.a"; - remoteRef = 3DAD3E931DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTWebSocket-tvOS.a"; - remoteRef = 3DAD3E981DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA31DF850E9000B6D8A /* libReact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libReact.a; - remoteRef = 3DAD3EA21DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA51DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA41DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA71DF850E9000B6D8A /* libyoga.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libyoga.a; - remoteRef = 3DAD3EA61DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EA91DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EA81DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libcxxreact.a; - remoteRef = 3DAD3EAA1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3DAD3EAC1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libjschelpers.a; - remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTAnimation.a; - remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libRCTAnimation-tvOS.a"; - remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 78C398B91ACF4ADC00677621 /* libRCTLinking.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTLinking.a; - remoteRef = 78C398B81ACF4ADC00677621 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 832341B51AAA6A8300B99B32 /* libRCTText.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libRCTText.a; - remoteRef = 832341B41AAA6A8300B99B32 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 00E356EC1AD99517003FC87E /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F8E1A680F5B00A75B9A /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, - 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "Bundle React Native code and images"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 00E356EA1AD99517003FC87E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00E356F31AD99517003FC87E /* rn_native_module_demoTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 13B07F871A680F5B00A75B9A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3D9B50631E31D9A300272C84 /* Crop.m in Sources */, - 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, - 13B07FC11A68108700A75B9A /* main.m in Sources */, - 3D9B50661E31F6CE00272C84 /* ImageCrop.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 13B07F861A680F5B00A75B9A /* rn_native_module_demo */; - targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { - isa = PBXVariantGroup; - children = ( - 13B07FB21A68108700A75B9A /* Base */, - ); - name = LaunchScreen.xib; - path = rn_native_module_demo; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 00E356F61AD99517003FC87E /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - INFOPLIST_FILE = rn_native_module_demoTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/rn_native_module_demo.app/rn_native_module_demo"; - }; - name = Debug; - }; - 00E356F71AD99517003FC87E /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - BUNDLE_LOADER = "$(TEST_HOST)"; - COPY_PHASE_STRIP = NO; - INFOPLIST_FILE = rn_native_module_demoTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_NAME = "$(TARGET_NAME)"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/rn_native_module_demo.app/rn_native_module_demo"; - }; - name = Release; - }; - 13B07F941A680F5B00A75B9A /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - DEAD_CODE_STRIPPING = NO; - DEVELOPMENT_TEAM = YH926WFY68; - INFOPLIST_FILE = rn_native_module_demo/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = rn_native_module_demo; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Debug; - }; - 13B07F951A680F5B00A75B9A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = YH926WFY68; - INFOPLIST_FILE = rn_native_module_demo/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-ObjC", - "-lc++", - ); - PRODUCT_NAME = rn_native_module_demo; - VERSIONING_SYSTEM = "apple-generic"; - }; - name = Release; - }; - 83CBBA201A601CBA00E9B192 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - }; - name = Debug; - }; - 83CBBA211A601CBA00E9B192 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "rn_native_module_demoTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00E356F61AD99517003FC87E /* Debug */, - 00E356F71AD99517003FC87E /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "rn_native_module_demo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 13B07F941A680F5B00A75B9A /* Debug */, - 13B07F951A680F5B00A75B9A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "rn_native_module_demo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 83CBBA201A601CBA00E9B192 /* Debug */, - 83CBBA211A601CBA00E9B192 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; -} diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo.xcodeproj/xcshareddata/xcschemes/rn_native_module_demo.xcscheme b/Demo/rn_native_module_demo/ios/rn_native_module_demo.xcodeproj/xcshareddata/xcschemes/rn_native_module_demo.xcscheme deleted file mode 100644 index 5cda6b0..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo.xcodeproj/xcshareddata/xcschemes/rn_native_module_demo.xcscheme +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo/AppDelegate.h b/Demo/rn_native_module_demo/ios/rn_native_module_demo/AppDelegate.h deleted file mode 100644 index ac6e12f..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * React Native iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - -#import - -@interface AppDelegate : UIResponder - -@property (nonatomic, strong) UIWindow *window; - -@end diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo/AppDelegate.m b/Demo/rn_native_module_demo/ios/rn_native_module_demo/AppDelegate.m deleted file mode 100644 index fd0b2dc..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo/AppDelegate.m +++ /dev/null @@ -1,37 +0,0 @@ -/** - * React Native iOS原生模块开发 - * Author: CrazyCodeBoy - * 技术博文:http://www.devio.org - * GitHub:https://github.com/crazycodeboy - * Email:crazycodeboy@gmail.com - */ - - -#import "AppDelegate.h" - -#import -#import - -@implementation AppDelegate - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions -{ - NSURL *jsCodeLocation; - - jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; - - RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation - moduleName:@"rn_native_module_demo" - initialProperties:nil - launchOptions:launchOptions]; - rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; - - self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; - UIViewController *rootViewController = [UIViewController new]; - rootViewController.view = rootView; - self.window.rootViewController = rootViewController; - [self.window makeKeyAndVisible]; - return YES; -} - -@end diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo/Base.lproj/LaunchScreen.xib b/Demo/rn_native_module_demo/ios/rn_native_module_demo/Base.lproj/LaunchScreen.xib deleted file mode 100644 index 26dd904..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo/Base.lproj/LaunchScreen.xib +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo/Images.xcassets/AppIcon.appiconset/Contents.json b/Demo/rn_native_module_demo/ios/rn_native_module_demo/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo/Info.plist b/Demo/rn_native_module_demo/ios/rn_native_module_demo/Info.plist deleted file mode 100644 index 5424073..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo/Info.plist +++ /dev/null @@ -1,55 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - LSRequiresIPhoneOS - - NSAppTransportSecurity - - NSExceptionDomains - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - NSLocationWhenInUseUsageDescription - - UILaunchStoryboardName - LaunchScreen - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - NSPhotoLibraryUsageDescription - http://www.devio.org - UIViewControllerBasedStatusBarAppearance - - - diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demo/main.m b/Demo/rn_native_module_demo/ios/rn_native_module_demo/main.m deleted file mode 100644 index 3d767fc..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demo/main.m +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -#import "AppDelegate.h" - -int main(int argc, char * argv[]) { - @autoreleasepool { - return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); - } -} diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demoTests/Info.plist b/Demo/rn_native_module_demo/ios/rn_native_module_demoTests/Info.plist deleted file mode 100644 index 886825c..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demoTests/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1 - - diff --git a/Demo/rn_native_module_demo/ios/rn_native_module_demoTests/rn_native_module_demoTests.m b/Demo/rn_native_module_demo/ios/rn_native_module_demoTests/rn_native_module_demoTests.m deleted file mode 100644 index 8b2c52e..0000000 --- a/Demo/rn_native_module_demo/ios/rn_native_module_demoTests/rn_native_module_demoTests.m +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import - -#import -#import - -#define TIMEOUT_SECONDS 600 -#define TEXT_TO_LOOK_FOR @"Welcome to React Native!" - -@interface rn_native_module_demoTests : XCTestCase - -@end - -@implementation rn_native_module_demoTests - -- (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test -{ - if (test(view)) { - return YES; - } - for (UIView *subview in [view subviews]) { - if ([self findSubviewInView:subview matching:test]) { - return YES; - } - } - return NO; -} - -- (void)testRendersWelcomeScreen -{ - UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; - BOOL foundElement = NO; - - __block NSString *redboxError = nil; - RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - if (level >= RCTLogLevelError) { - redboxError = message; - } - }); - - while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - - foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { - if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { - return YES; - } - return NO; - }]; - } - - RCTSetLogFunction(RCTDefaultLogFunction); - - XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); - XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); -} - - -@end diff --git a/Demo/rn_native_module_demo/package.json b/Demo/rn_native_module_demo/package.json deleted file mode 100644 index 3a58b7e..0000000 --- a/Demo/rn_native_module_demo/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "rn_native_module_demo", - "version": "0.0.1", - "private": true, - "scripts": { - "start": "node node_modules/react-native/local-cli/cli.js start", - "test": "jest" - }, - "dependencies": { - "react": "15.4.1", - "react-native": "^0.40.0" - }, - "devDependencies": { - "babel-jest": "18.0.0", - "babel-preset-react-native": "1.9.1", - "jest": "18.1.0", - "react-test-renderer": "15.4.1" - }, - "jest": { - "preset": "react-native" - } -} diff --git a/README.md b/README.md deleted file mode 100644 index 50eb67f..0000000 --- a/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# [React Native 研究与实践](https://github.com/crazycodeboy/RNStudyNotes/) -该项目用于分享我们在研究与实践React Native过程中的一些经验,总结,教程,以及踩过的一些坑。 -本项目持续更新,欢迎大家[Fork and Star](https://github.com/crazycodeboy/RNStudyNotes/)。 -**另外感谢项目的每一位无私的[贡献者](https://github.com/crazycodeboy/RNStudyNotes/graphs/contributors)。** - -**想和大牛一起讨论?可加入:** - - ->React Native学习交流1群:`165774887`(已满) - ->React Native学习交流2群:`422654286`(已满) - ->React Native学习交流3群:`600893779` - -![React Native学习交流群](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%E5%8F%91%E5%B8%83APP%E4%B9%8B%E7%AD%BE%E5%90%8D%E6%89%93%E5%8C%85APK/images/react%20native%20%E5%AD%A6%E4%B9%A0%E4%BA%A4%E6%B5%81%E7%BE%A4_qrcode_share.png) - -## 列表 - -* [最新版React Native+Redux打造高质量上线App](http://coding.imooc.com/class/304.html)![ hot](http://www.devio.org/img/ico/ico_hot.gif) -* [Redux开发实用教程](http://www.imooc.com/article/281446)![ new](http://www.devio.org/img/ico/ico_new.gif) -* [React Native+react-navigation+redux开发实用教程](http://www.imooc.com/article/283337)![ new](http://www.devio.org/img/ico/ico_new.gif) -* [React Native+Redux开发实用教程](http://www.imooc.com/article/283047)![ new](http://www.devio.org/img/ico/ico_new.gif) -* [React Native开发之必备React基础](http://www.imooc.com/article/279228) -* [React Native+react-navigation3x实战视频](http://coding.imooc.com/class/304.html) -* [最新版React Native+Redux打造高质量上线App](http://coding.imooc.com/class/304.html) -* [『React Navigation 3x系列教程』createDrawerNavigator开发指南](http://www.imooc.com/article/273065) -* [『React Navigation 3x系列教程』createMaterialTopTabNavigator开发指南](http://www.imooc.com/article/271652) -* [『React Navigation 3x系列教程』之createBottomTabNavigator开发指南](http://www.imooc.com/article/269529) -* [『React Navigation 3x系列教程』之React Navigation 3x开发指南](http://www.imooc.com/article/267857) -* [『React Navigation 3x系列教程』之createStackNavigator开发指南](http://www.imooc.com/article/268381) -* [React Native 混合开发(Android篇)](http://www.devio.org/2018/08/26/React-Native-Hybrid-Android/) -* [React Native 混合开发(iOS篇)](http://www.devio.org/2018/08/26/React-Native-Hybrid-iOS/) -* [React Native年度报告(2017-2018)](http://www.devio.org/2018/02/26/React-Native-Annual-Report-2017-2018/) -* [React Native0.50+开发指导](http://www.devio.org/2017/12/12/React-Native0.50-Development-Guide-Chinese-update-instructions/) -* [React Native 开发适配心得](http://www.devio.org/2017/10/06/How-to-develop-a-React-Native-application-for-Android-and-iOS-dual-platforms/) -* [React Native 集成分享第三方登录功能分享第三方登录模块开发(iOS)](http://www.devio.org/2017/09/30/React-Native-integration-share-third-party-login-function-ios/) -* [React Native 集成分享第三方登录功能分享第三方登录模块开发(Android)](http://www.devio.org/2017/09/10/React-Native-integration-share-third-party-login-function/) -* [教你轻松在React Native中集成统计的功能)](http://www.devio.org/2017/09/03/React-Native-Integrated-analysis-function/) -* [React Native免费自学视频](http://www.imooc.com/learn/808) -* [教你轻松修改React Native端口(如何同时运行多个React Native、8081端口占用问题)](http://www.devio.org/2017/08/18/Modify-the-React-Native-listening-port/) -* [快速创建React Native App](http://www.devio.org/2017/07/12/quickly-create-react-native-app/) -* [GitHub Popular开发教程,源码解析,项目总结](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E9%A1%B9%E7%9B%AE%E5%AE%9E%E8%B7%B5%E6%80%BB%E7%BB%93/GitHub%20Popular%E5%BC%80%E5%8F%91%E6%95%99%E7%A8%8B%EF%BC%8C%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90%EF%BC%8C%E9%A1%B9%E7%9B%AE%E6%80%BB%E7%BB%93) -* [React Native 问题及解决方案合集](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86) -* [React Native 性能优化](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96) -* [React Native Awesome(汇聚知识,分享精华)](https://github.com/crazycodeboy/react-native-awesome):只求精不求全的React Native学习资料库。React Native Awesome 汇集了各类react-native学习资料、工具、组件、开源App、以及相关新闻等(**据说还有资源下载哦**)。 -* [React Native 每日一学](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6):每天一个知识点(技巧,经验,填坑日记等),每天学一点,离大神近一点。 -* [React Native 项目实践总结](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E9%A1%B9%E7%9B%AE%E5%AE%9E%E8%B7%B5%E6%80%BB%E7%BB%93) -* [React Native原生组件开发](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%E5%8E%9F%E7%94%9F%E7%BB%84%E4%BB%B6%E5%BC%80%E5%8F%91) -* [React Native之React速学教程(上)](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B%20(%E4%B8%8A).md) -* [React Native之React速学教程(中)](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B%20(%E4%B8%AD)%20.md) -* [React Native之React速学教程(下)](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B%20(%E4%B8%8B).md) -* [React Native调试技巧与心得](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7%E4%B8%8E%E5%BF%83%E5%BE%97/React%20Native%E8%B0%83%E8%AF%95%E6%8A%80%E5%B7%A7%E4%B8%8E%E5%BF%83%E5%BE%97.md) -* [Reac Native布局详细指南](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E5%B8%83%E5%B1%80/React%20Native%E5%B8%83%E5%B1%80%E8%AF%A6%E7%BB%86%E6%8C%87%E5%8D%97/React%20Native%E5%B8%83%E5%B1%80%E8%AF%A6%E7%BB%86%E6%8C%87%E5%8D%97.md) -* [React Native 打包发布App](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%E6%89%93%E5%8C%85%E5%8F%91%E5%B8%83App) -* [React Native应用部署、热更新-CodePush最新集成总结](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%E5%BA%94%E7%94%A8%E9%83%A8%E7%BD%B2%E3%80%81%E7%83%AD%E6%9B%B4%E6%96%B0-CodePush%E6%9C%80%E6%96%B0%E9%9B%86%E6%88%90%E6%80%BB%E7%BB%93) -* [React Native组件详解](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%E7%BB%84%E4%BB%B6%E8%AF%A6%E8%A7%A3) -* [React Native 升级与适配](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E5%8D%87%E7%BA%A7%E4%B8%8E%E9%80%82%E9%85%8D) -* [Mac(OSX)平台搭建React Native开发环境](http://www.devio.org/2016/05/20/React-Native-development-environment-build-mac-platform/) -* [Windows平台搭建React Native开发环境](http://www.devio.org/2016/05/20/React-Native-development-environment-build-Windows-platform/) -* [构建React Native官方Examples](http://www.devio.org/2017/06/01/Construction-of-React-Native-Official/) - - - diff --git "a/React Native \345\215\207\347\272\247\344\270\216\351\200\202\351\205\215/README.md" "b/React Native \345\215\207\347\272\247\344\270\216\351\200\202\351\205\215/README.md" deleted file mode 100644 index c1b5b6d..0000000 --- "a/React Native \345\215\207\347\272\247\344\270\216\351\200\202\351\205\215/README.md" +++ /dev/null @@ -1,17 +0,0 @@ -# [React Native 升级与适配](https://github.com/crazycodeboy/RNStudyNotes/React Native 升级与适配) - - - -**想和大牛一起讨论?可加入:** - -> -React Native学习交流1群:`165774887`(已满) -React Native学习交流2群:`422654286` - -![React Native学习交流群](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%E5%8F%91%E5%B8%83APP%E4%B9%8B%E7%AD%BE%E5%90%8D%E6%89%93%E5%8C%85APK/images/react%20native%20%E5%AD%A6%E4%B9%A0%E4%BA%A4%E6%B5%81%E7%BE%A4_qrcode_share.png) - -## 列表 - -* [React Native升级指南|v0.40+升级适配经验与心得](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E5%8D%87%E7%BA%A7%E4%B8%8E%E9%80%82%E9%85%8D/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97.md) - - diff --git "a/React Native \345\215\207\347\272\247\344\270\216\351\200\202\351\205\215/React Native\345\215\207\347\272\247\346\214\207\345\215\227|v0.40+\345\215\207\347\272\247\351\200\202\351\205\215\347\273\217\351\252\214\344\270\216\345\277\203\345\276\227/React Native\345\215\207\347\272\247\346\214\207\345\215\227|v0.40+\345\215\207\347\272\247\351\200\202\351\205\215\347\273\217\351\252\214\344\270\216\345\277\203\345\276\227.md" "b/React Native \345\215\207\347\272\247\344\270\216\351\200\202\351\205\215/React Native\345\215\207\347\272\247\346\214\207\345\215\227|v0.40+\345\215\207\347\272\247\351\200\202\351\205\215\347\273\217\351\252\214\344\270\216\345\277\203\345\276\227/React Native\345\215\207\347\272\247\346\214\207\345\215\227|v0.40+\345\215\207\347\272\247\351\200\202\351\205\215\347\273\217\351\252\214\344\270\216\345\277\203\345\276\227.md" deleted file mode 100644 index ffb3671..0000000 --- "a/React Native \345\215\207\347\272\247\344\270\216\351\200\202\351\205\215/React Native\345\215\207\347\272\247\346\214\207\345\215\227|v0.40+\345\215\207\347\272\247\351\200\202\351\205\215\347\273\217\351\252\214\344\270\216\345\277\203\345\276\227/React Native\345\215\207\347\272\247\346\214\207\345\215\227|v0.40+\345\215\207\347\272\247\351\200\202\351\205\215\347\273\217\351\252\214\344\270\216\345\277\203\345\276\227.md" +++ /dev/null @@ -1,140 +0,0 @@ - - -本文出自[《React Native学习笔记》](https://github.com/crazycodeboy/RNStudyNotes/)系列文章。 - - -React Native作为一个有上千开发者参与的开源项目,自从2015年3月27日第一版发布以来到现在已经有147次版本发布了,平均起来几乎每周都会有新的版本发布。随着一次次版本的迭代,React Native也逐渐稳定,版本发布频率保持在了每一到两周一次。新版本不停的迭代对于React Native开发者来说,及时升级React Native版本让项目能够使用更多的API、新特性以及淘汰掉一些老的API,不仅成为了一门必修课也是一个不小的挑战。 - -![React Native参与者](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/React%20Native%E5%8F%82%E4%B8%8E%E8%80%85.png) - -升级一个React Native项目不仅需要JS部分还牵扯到Android项目和iOS项目,尽管React Native官方极力降低升级的繁琐,但如果两个React Native版本跨度较大的话升级起来还是需要不少工作量的。在这篇文章中我将向大家分享React Native升级的流程指南以及我在升级React Native过程中的一些经验心得。 - -## React Native升级流程 -React Native升级流程可分为三大步: - -1. 安装`react-native-git-upgrade` 模块; -2. 执行更新命令; -3. 解决冲突; - - ->心得:上述步骤都依赖于Git,没有安装Git客户端的小伙伴,需要安装一下。 - -### 1.安装`react-native-git-upgrade` 模块 -首先我们需要安装`react-native-git-upgrade` 模块,打开终端执行下面命名即可: - -``` -$ npm install -g react-native-git-upgrade -``` - -安装成功后,会看到下图输出: -![react-native-git-upgrade](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/%20npm%20install%20-g%20react-native-git-upgrade.png) - ->心得:react-native-git-upgrade是一个命令行界面的工具,我们需要将它安装到全局,所以通过`npm install`命令安装的时候需要加上`-g`这个参数。 - -### 2.执行更新命令 -安装过react-native-git-upgrade工具之后,我们就可以通过它来更新我们项目的React Native版本了,通过运行下面命令即可完成更新: - -``` -$ react-native-git-upgrade -``` -通过这个命令可以将React Native更新到最新的版本,但不是预发布版哦。 - ->心得:我们需要在React Native项目的根目录下执行更新命令,也就是package.json所在的目录。 - -如果想更新到指定版本的React Native则需要在上述命令后加上指定版本的参数,如下: - -``` -$ react-native-git-upgrade X.Y.Z -``` - -这样以来,React Native便会被更新到X.Y.Z版,在运行这个命令时,需要将X.Y.Z替换成具体的版本。 - -更新命令执行成功之后,你会从终端看到如下输出: - -![react-native-git-upgrade](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/react-native-git-upgrade.png) - -从终端的输出中我们可以看出,更新的全过程以及我们所更新到的React Native版本。 - -另外,我们通过Version Control可以看出此次更新后发生变化的文件: - -![升级后发生改变的文件](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/%E5%8D%87%E7%BA%A7%E5%90%8E%E5%8F%91%E7%94%9F%E6%94%B9%E5%8F%98%E7%9A%84%E6%96%87%E4%BB%B6.png) - -### 3.解决冲突 - -需要特别提到的是react-native-git-upgrade工具在更新React Native版本的时候会进行一个合并操作,也就是将我们本地的React Native版本和最新或指定的React Native版本进行合并,在合并过程中可能会产生一些冲突,在终端的输出中我们能清晰的看出发生冲突的文件: - -![react-native-git-upgrade-conflicts](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/react-native-git-upgrade-conflicts.png) - -从上图中我们可以看到AppDelegate.m与project.pbxproj发生了冲突,所以接下来我们需要处理发生冲突的文件。 - -![AppDelegate.m](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/%E5%86%B2%E7%AA%81%20AppDelegate.m.png) - ->心得:一般来说,React Native版本跨度越大,产生冲突的可能性也就越大。 - -在处理冲突的时候通常我们会保留最新的代码移除老的代码,但具体还是要看了代码的具体功能后在做处理,比如,在上图中我们需要移除`#import "RCTBundleURLProvider.h"`与`#import "RCTRootView.h"`保留`#import `、`#import `以及`#import "SplashScreen.h"`,为什么要保留`#import "SplashScreen.h" `呢,这是因为,`#import "SplashScreen.h"`是我们添加的,并不属于React Native的一部分。 - ->心得:另外一个需要特别提到的就是xxx.xcodeproj文件夹下所产生的冲突文件了,比如`project.pbxproj`,xxx.xcodeproj文件夹下存放的是整个iOS项目的一些配置文件,在处理这些文件冲突的时候我们需要特别注意文件的格式,处理不当很有可能导致真个iOS项目无法打开。 - -当处理完冲突后如果在打开iOS项目时出现`the project file cannot be parsed`错误: -![the project file cannot be parsed](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2017/1/React%20Native%E5%8D%87%E7%BA%A7%E6%8C%87%E5%8D%97%7Cv0.40%2B%E5%8D%87%E7%BA%A7%E9%80%82%E9%85%8D%E7%BB%8F%E9%AA%8C%E4%B8%8E%E5%BF%83%E5%BE%97/the%20project%20file%20cannot%20be%20parsed.png) -则很可能是在处理xxx.xcodeproj文件夹下的冲突的时候破坏了文件的结构,导致XCode无法解析相应文件,要解决这个问题则需要找到出现问题的文件将被破坏的文件结构修复好。 - -到这里整个更新流程便走完了,现在我们便可以使用以及体验React Native最新版本的API以及特性了。 - ->心得:虽然我们完成了React Native的整个更新流程,但我们这个时候还需要运行一下我们的React Native项目,然后看一下各个功能是否正常,因为很有可能我们在项目中所使用的一些旧版的API在新版的React Native中已经被移除了,所以我们需要及时的更新被移除或被弃用的API。关于每一个版本所发生的具体变化我们可以查阅:[React Native项目的发布说明](https://github.com/facebook/react-native/releases) -。 - -## React Native v0.40+升级适配经验与心得 - -在2017年1月初,React Native发布了v0.40版本,并起名为December 2016,这也是2016年的最后一个版本。和以往一样每次React Native整版的发布都会带来一些大的变更,这次也不例外。在这篇文章中,我将向大家分享React Native v0.40对开发者影响比较大的变更以及升级到v0.40的一些经验心得。 - -关于如何升级React Native项目,可参考[React Native升级流程](#React Native升级流程)。 - -在昨天我对[react-native-splash-screen](https://github.com/crazycodeboy/react-native-splash-screen/)做了React Native v0.40适配,并按照[React Native升级流程](#React Native升级流程)的步骤,将[examples]()的React Native版本从v0.32升级到了 v0.40。在这里我会结合这次升级来讲解一下React Native v0.40所带来的一些变化。 - ->心得:升级的过程是痛苦的,但疼并快乐着。 - -### React Native v0.40所带来的一些重大变化 - -从React Native的[更新文档](https://github.com/facebook/react-native/releases)我们可以看到每次版本升级所带了的一些重大变化,在v0.40版本中也是一样。 - -#### iOS Native部分的头文件被移动 - -在 v0.40版本中,影响最为广泛的一个变化就是这个了,iOS Native部分的头文件被移动到了React下。这一变化直接导致所有原生模块和有引用React Native .h文件的代码在v0.40上无法运行。 - -在v0.40之前要导入一个React Native .h文件的格式是这样的: - -``` -#import "RCTUtils.h" -``` -在v0.40版本导入一个React Native .h文件则变成了这个样子: - -``` -#import -``` - -为了解决我们需要将所有引用到了React Native .h文件的代码改成v0.40的写法。 - -可参考:[AppDelegate.m](https://github.com/crazycodeboy/react-native-splash-screen/commit/fec4d944747b1b2f3c3dde5fcdfad7702ec7c588#diff-7638dab4ccf49497742716e3b3a23d7d) - ->心得:不仅于此,这一变更直接导致所有用到React Native .h的第三方库在没有做上述更改之前都无法兼容v0.40 - -#### require('image!...')引用图片方式不在支持 - -require('image!...')这种使用图片的方式已经被启用很久了,在v0.40版本中则直接把它移除了,也就是以后我们不能再通过这种方式来使用图片了。更多使用图片的方式可以参考官方文档:[Images使用](https://facebook.github.io/react-native/docs/images.html) - ->心得:无论是在做React Native开发还是在做其他开发,一些被标记为deprecated的API,要及时的替换掉,因为在不久的将来这些被弃用的API很可能从SDK中移除。 - - -## 最后 - -**既然来了,留下个喜欢再走吧,鼓励我继续创作(^_^)∠※** - -**如果喜欢我的文章,那就关注我的[博客](http://www.devio.org/)@ [devio.org](http://www.devio.org)吧,让我们一起做朋友~~** - -#### 戳这里,加关注哦: - ->**[微博](http://weibo.com/u/6003602003):第一时间获取推送** -**[个人博客](http://www.devio.org/):干货文章都在这里哦** -**[GitHub](https://github.com/crazycodeboy/):我的开源项目** - diff --git "a/React Native \346\200\247\350\203\275\344\274\230\345\214\226/Jest/Jest\347\232\204\346\265\213\350\257\225\347\211\271\346\200\247.md" "b/React Native \346\200\247\350\203\275\344\274\230\345\214\226/Jest/Jest\347\232\204\346\265\213\350\257\225\347\211\271\346\200\247.md" deleted file mode 100644 index 4dd4ce1..0000000 --- "a/React Native \346\200\247\350\203\275\344\274\230\345\214\226/Jest/Jest\347\232\204\346\265\213\350\257\225\347\211\271\346\200\247.md" +++ /dev/null @@ -1,260 +0,0 @@ -#Jest-Javascript单元测试工具 -Jest是一个JavaScript测试框架,由Facebook用来测试所有JavaScript代码,包括React应用程序。 - -不同级别的自动化测试:单元、集成、组件和功能. 单元测试可以看作是和在组件级别测试JavaScript对象和方法一样的最基本的。默认情况下,React Native提供在Android和iOS都可以使用的Jest来进行单元测试。现在,测试的覆盖率并不完美,但是根据Facebook的说法,未来将会有更强大测试能力的工具被引入到React Native,同时用户也可以构建他们自己的测试工具。 - -## Jest的测试特性 -适应性:Jest是模块化、可扩展和可配置的。 - -快速和沙盒:Jest虚拟化JavaScript环境,能模拟浏览器,并在工作进程之间并行运行测试。 - -快照测试:Jest能够对React 树进行快照或别的序列化数值快速编写测试,提供快速更新的用户体验。 - -快速交互模式: 错误信息会有帮助的颜色编码标记,堆栈跟踪快速指向问题的根源。 - -##使用 -###配置Jest -可以使用npm运行 **npm install --save-dev jest** 也可以与使用所有的Js包一样:先配置package.json,再执行npm install。 - -###编写测试脚本 -1.让我们写一个假设的测试是sum.js文件,函数为: - - module.exports = (a, b) => a + b; - -2.创建一个目录____tests____/和文件xxx-test.js,或直接创建名称xxx.test.js或xxx.spec.js并把它放在你的项目的任何地方(**其实在jest中我们对脚步的定义是有约束的,采用这几钟创建方式,使jest在源码文件中可以找到测试脚步并执行**) - - test('adds 1 + 2 to equal 3', () => { - const sum = require('../sum'); - expect(sum(1, 2)).toBe(3); - }); - -3.执行脚本 (执行脚本有两种方式) - -1)可以添加到package.json - - "scripts": { - "test": "jest" - } -2)直接执行命令 - -需要安装全局jest命令: npm install -g jest,进入项目,执行命令:jest - -4.运行 -运行**npm test**会打印此消息:**PASS ____tests____/sum-test.js** 到此你就成功使用Jest写了你的第一个测试! - -##断言 -###API - .expect(value) - .lastCalledWith(arg1, arg2, ...) is an alias for .toHaveBeenLastCalledWith(arg1, arg2, ...) - .not - .toBe(value) - .toBeCalled() is an alias for .toHaveBeenCalled() - .toBeCalledWith(arg1, arg2, ...) is an alias for .toHaveBeenCalledWith(arg1, arg2, ...) - .toHaveBeenCalled() - .toHaveBeenCalledTimes(number) - .toHaveBeenCalledWith(arg1, arg2, ...) - .toHaveBeenLastCalledWith(arg1, arg2, ...) - .toBeCloseTo(number, numDigits) - .toBeDefined() - .toBeFalsy() - .toBeGreaterThan(number) - .toBeGreaterThanOrEqual(number) - .toBeLessThan(number) - .toBeLessThanOrEqual(number) - .toBeInstanceOf(Class) - .toBeNull() - .toBeTruthy() - .toBeUndefined() - .toContain(item) - .toContainEqual(item) - .toEqual(value) - .toHaveLength(number) - .toMatch(regexp) - .toMatchObject(object) - .toMatchSnapshot() - .toThrow() - .toThrowError(error) - .toThrowErrorMatchingSnapshot() - -##实例 - -####.toBeFalsy-------------------------------- - -使用toBeFalsy当你不在乎一个值是什么,你只是想确保在布尔上下文值是错误的时候使用它 -可能一开始的代码是这样,你可能不关心getErrors回报,特别是,它可能会返回false,null,或0,代码仍然工作 - -在JavaScript中,有六个falsy值:false, 0, '', null, undefined, and NaN。其他的都是真。 - - drinkSomeLaCroix(); - if (!getErrors()) { - drinkMoreLaCroix(); - } - describe('drinking some La Croix', () => { - it('does not lead to errors', () => { - var getErrors = require('../js/sum'); - expect(getErrors()).toBeFalsy(); - }); - }); - -####.toBeGreaterThan--------------------------- -比较浮点数,您可以使用toBeGreaterThan。例如,如果您想要测试,ouncesPerCan()返回的值超过10 - - describe('ounces per can', () => { - it('is more than 10', () => { - var ouncesPerCan = require('../js/sum'); - expect(ouncesPerCan()).toBeGreaterThan(10); - }); - }); - -####.toBeGreaterThanOrEqual-------------------- -ouncesPerCan()返回的值至少12 - - describe('ounces per can', () => { - it('is at least 12', () => { - var ouncesPerCan = require('../js/sum'); - expect(ouncesPerCan()).toBeGreaterThanOrEqual(12); - }); - }); - -####.toBeLessThan------------------------------ -ouncesPerCan()返回的值小于20 - - describe('ounces per can', () => { - it('is less than 20', () => { - var ouncesPerCan = require('../js/sum'); - expect(ouncesPerCan()).toBeLessThan(20); - }); - }); - -####.toBeLessThanOrEqual----------------------- -ouncesPerCan()返回的值最多12 - - describe('ounces per can', () => { - it('is at most 12', () => { - var ouncesPerCan = require('../js/sum'); - expect(ouncesPerCan()).toBeLessThanOrEqual(12); - }); - }); - -####.toBeInstanceOf---------------------------- -使用.toBeInstanceOf(类)来检查一个对象是一个类的实例 - - class A {} - expect(new A()).toBeInstanceOf(A); - expect(() => {}).toBeInstanceOf(Function); - expect(new A()).toBeInstanceOf(Function); // throws - -####.toBeNull----------------------------------- -.toBeNull 和 .toBe(null)是一样的,使用.toBeNull有点更好的错误消息。当你想检查null时所以使用.toBeNull() - - function bloop() { - return null; - } - describe('bloop', () => { - it('returns null', () => { - expect(bloop()).toBeNull(); - }); - }) - -####.toBeTruthy---------------------------------- -你可能不关心thirstInfo回报,特别是,它可能会返回true或一个复杂的对象,和代码仍然工作 -可能一开始的代码是这样 - - drinkSomeLaCroix(); - if (thirstInfo()) { - drinkMoreLaCroix(); - } - describe('drinking some La Croix', () => { - it('leads to having thirst info', () => { - var thirstInfo = require('../js/sum'); - expect(thirstInfo()).toBeTruthy(); - }); - }); - -####.toContain---------------------------------- -使用 .toContain当你想检查一个项目列表。测试列表中的项目,它使用===,检查是否对等 - - describe('the list of all flavors', () => { - it('contains haha', () => { - var getAllFlavors = require('../js/sum'); - expect(getAllFlavors()).toContain('haha'); - }); - }); - -####.toEqual(value)----------------------------- -使用.toEqual当您想要检查两个对象具有相同的值。递归检查所有的字段是否相等,而不是检查对象的属性。例如,toEqual和toBr这个测试组件的反应是不同的 - - const can1 = { - flavor: 'grapefruit', - ounces: 12, - }; - const can2 = { - flavor: 'grapefruit', - ounces: 12, - }; - - describe('the La Croix cans on my desk', () => { - it('have all the same properties', () => { - expect(can1).toEqual(can2); - }); - it('are not the exact same can', () => { - expect(can1).not.toBe(can2); - }); - }); - -####.toHaveLength(number)------------------------- -长度属性,设置一定的数值,这是特别有用的检查数组或字符串的大小。 - - expect([1, 2, 3]).toHaveLength(3); - expect('abc').toHaveLength(3); - expect('').not.toHaveLength(5); - -####.toHaveLength(number)------------------------- - - expect([1, 2, 3]).toHaveLength(3); - expect('abc').toHaveLength(3); - expect('').not.toHaveLength(5); - -####.toMatch(regexp)----------------------------- - - describe('an essay on the best flavor', () => { - it('mentions grapefruit', () => { - expect(essayOnTheBestFlavor()).toMatch(/grapefruit/); - expect(essayOnTheBestFlavor()).toMatch(new RegExp('grapefruit')); - }) - }) - - describe('grapefruits are healthy', () => { - it('grapefruits are a fruit', () => { - expect('grapefruits').toMatch('fruit'); - }) - }) - -####.toMatchObject(object)------------------------ - - const houseForSale = { - bath: true, - kitchen: { - amenities: ['oven', 'stove', 'washer'], - area: 20, - wallColor: 'white' - }, - bedrooms: 4 - }; - const desiredHouse = { - bath: true, - kitchen: { - amenities: ['oven', 'stove', 'washer'], - wallColor: 'white' - } - }; - - describe('looking for a new house', () => { - it('the house has my desired features', () => { - expect(houseForSale).toMatchObject(desiredHouse); - }); - }); - - -###等等等------------------------------- -###附:[官网API Reference](http://facebook.github.io/jest/docs/api.html) diff --git "a/React Native \346\200\247\350\203\275\344\274\230\345\214\226/README.md" "b/React Native \346\200\247\350\203\275\344\274\230\345\214\226/README.md" deleted file mode 100644 index 2673eb9..0000000 --- "a/React Native \346\200\247\350\203\275\344\274\230\345\214\226/README.md" +++ /dev/null @@ -1,23 +0,0 @@ -# [React Native 性能优化](https://github.com/crazycodeboy/RNStudyNotes/) -该项目用于分享我们在研究与实践React Native过程中的一些经验,总结,教程,以及踩过的一些坑。 -本项目持续更新,欢迎大家[Fork and Star](https://github.com/crazycodeboy/RNStudyNotes/)。 -**另外感谢项目的每一位无私的[贡献者](https://github.com/crazycodeboy/RNStudyNotes/graphs/contributors)。** - -**想和大牛一起讨论?可加入:** - -> -React Native学习交流1群:`165774887`(已满) -React Native学习交流2群:`422654286` - -![React Native学习交流群](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%E5%8F%91%E5%B8%83APP%E4%B9%8B%E7%AD%BE%E5%90%8D%E6%89%93%E5%8C%85APK/images/react%20native%20%E5%AD%A6%E4%B9%A0%E4%BA%A4%E6%B5%81%E7%BE%A4_qrcode_share.png) - - -## 列表 - -* [React Native 性能优化之可取消的异步操作](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/React%20Native%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E4%B9%8B%E5%8F%AF%E5%8F%96%E6%B6%88%E7%9A%84%E5%BC%82%E6%AD%A5%E6%93%8D%E4%BD%9C) - -* [Jest简单使用介绍](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/Jest/Jest%E7%9A%84%E6%B5%8B%E8%AF%95%E7%89%B9%E6%80%A7.md) - - - - diff --git "a/React Native \346\200\247\350\203\275\344\274\230\345\214\226/React Native \346\200\247\350\203\275\344\274\230\345\214\226\344\271\213\345\217\257\345\217\226\346\266\210\347\232\204\345\274\202\346\255\245\346\223\215\344\275\234/README.md" "b/React Native \346\200\247\350\203\275\344\274\230\345\214\226/React Native \346\200\247\350\203\275\344\274\230\345\214\226\344\271\213\345\217\257\345\217\226\346\266\210\347\232\204\345\274\202\346\255\245\346\223\215\344\275\234/README.md" deleted file mode 100644 index 8393194..0000000 --- "a/React Native \346\200\247\350\203\275\344\274\230\345\214\226/React Native \346\200\247\350\203\275\344\274\230\345\214\226\344\271\213\345\217\257\345\217\226\346\266\210\347\232\204\345\274\202\346\255\245\346\223\215\344\275\234/README.md" +++ /dev/null @@ -1,137 +0,0 @@ -# [React Native 性能优化之可取消的异步操作](https://github.com/crazycodeboy/RNStudyNotes/) - -本文出自[《React Native 研究与实践》](https://github.com/crazycodeboy/RNStudyNotes/)系列文章。 - -## 概述 -在项目开发中离不了的需要进行一些异步操作,这些异步操作在改善用户体验的同时也带来了一些性能隐患。 -比如,在某页面进行异步操作,异步操作还没有完成时,该页面已经关闭,这时由于异步操作的存在,导致系统无法及时的回收资源,从而导致性能的降低,甚至出现oom。 - -总而言之,异步操作在改善用户体验,增强系统灵活性的同时也带来了一些性能隐患,如果使用不当则会带来一些副作用。 - -那么如何在使用异步操作的同时规避它所带来的副作用呢? - -问题不是出在异步操作上,异步操作本没有错,错在异步操作的不合理使用上。比如,页面已经关闭了,而页面的异步操作还在进行等使用问题。 -所以我们需要在编程中学会“舍得”,在适当的时候去取消一些异步操作。 - - -## 为Promise插上可取消的翅膀 - -`Promise`是React Native开发过程中用于异步操作的最常用的API,但Promise没有提供用于取消异步操作的方法。为了实现可取消的异步操作,我们可以为Promise包裹一层可取消的外衣。 - -```javascript -const makeCancelable = (promise) => { - let hasCanceled_ = false; - const wrappedPromise = new Promise((resolve, reject) => { - promise.then((val) => - hasCanceled_ ? reject({isCanceled: true}) : resolve(val) - ); - promise.catch((error) => - hasCanceled_ ? reject({isCanceled: true}) : reject(error) - ); - }); - return { - promise: wrappedPromise, - cancel() { - hasCanceled_ = true; - }, - }; -}; -``` - -然后可以这样使用取消操作: - -```javascript -const somePromise = new Promise(r => setTimeout(r, 1000));//创建一个异步操作 -const cancelable = makeCancelable(somePromise);//为异步操作添加可取消的功能 -cancelable - .promise - .then(() => console.log('resolved')) - .catch(({isCanceled, ...error}) => console.log('isCanceled', isCanceled)); -// 取消异步操作 -cancelable.cancel(); -``` - -上述方法,可以为异步操作添加可取消的功能,但是使用还是不够方便:在每个使用`makeCancelable`的页面都需要复制粘贴上述代码。 -下面我们做一下改进,将上述代码抽离到一个文件中。 - - ```javascript - /** - * Cancelable - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - * @flow - **/ -'use strict' - -export default function makeCancelable(promise){ - let hasCanceled_ = false; - const wrappedPromise = new Promise((resolve, reject) => { - promise.then((val) => - hasCanceled_ ? reject({isCanceled: true}) : resolve(val) - ); - promise.catch((error) => - hasCanceled_ ? reject({isCanceled: true}) : reject(error) - ); - }); - - return { - promise: wrappedPromise, - cancel() { - hasCanceled_ = true; - }, - }; -} -``` - -这样在使用的时候只需要将makeCancelable导入到你的相应js文件中就可以了。 - -```javascript -import makeCancelable from '../util/Cancelable' -``` - -## 可取消的网络请求fetch - -`fetch`是React Native开发过程中最常用的网络请求API,和`Promis`一样,fetch也没有提供用于取消已发出的网络请求的API。因为fetch返回的是一个`Promise`,所以我们可以借助上述方法,来取消fetch所发出的网络请求。 - -```JavaScript -this.cancelable = makeCancelable(fetch('url'))); - this.cancelable.promise - .then((response)=>response.json()) - .then((responseData)=> { - console.log(responseData); - }).catch((error)=> { - console.log(error); - }); -``` - -取消网络请求: - -`this.cancelable.cancel();` - -## 在项目中的使用 - -为了提高React Native应用的性能,我们需要在组件卸载的时候不仅要主动释放掉所持有的资源,也要取消所发出的一些异步请求操作。 - -```JavaScript -componentWillUnmount() { - this.cancelable.cancel(); -} -``` - -## About -本文出自[《[React Native 研究与实践》](https://github.com/crazycodeboy/RNStudyNotes)栏目。 - -#### 这里有你需要的干货: - ->**[微博](http://weibo.com/u/6003602003):第一时间获取推送** -**[个人博客](http://jiapenghui.com):你需要的,才是干货** -**[GitHub](https://github.com/crazycodeboy/):我的开源项目** - - -推荐阅读 ----- - -* [React Native 学习资源精选仓库](https://github.com/crazycodeboy/react-native-awesome):汇集了各类react-native学习资料、工具、组件、开源App、资源下载、以及相关新闻等。 -* [React Native 每日一学](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6):汇聚知识,分享精华。 - - diff --git "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/Readme.md" "b/React Native \346\257\217\346\227\245\344\270\200\345\255\246/Readme.md" deleted file mode 100644 index 570c010..0000000 --- "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/Readme.md" +++ /dev/null @@ -1,1215 +0,0 @@ - -# React Native 每日一学(Learn a little every day) - -汇聚知识,分享精华。 ->如果你是一名React Native爱好者,或者有一颗热爱钻研新技术的心,喜欢分享技术干货、项目经验、以及你在React Naive学习研究或实践中的一些经验心得等等,欢迎投稿《React Native 每日一学》栏目。 -如果你是一名Android、iOS、或前端开发人员,有者一颗积极进取的心,欢迎关注《React Native 每日一学》。本栏目汇聚React Native开发的技巧,知识点,经验等。 - -## 列表 -1. [D1:React Native 读取本地的json文件 (2016-8-18)](#d1react-native-读取本地的json文件-2016-8-18) -2. [D2:React Native import 文件的小技巧 (2016-8-19)](#d2react-native-import-文件的小技巧-2016-8-19) -3. [D3:React Native 真机调试 (2016-8-22)](#d3react-native-真机调试-2016-8-22) -4. [D4:React Native 函数的绑定 (2016-8-23)](#d4react-native-函数的绑定-2016-8-23) -5. [D5:React Native setNativeProps使用 (2016-8-24)](#d5react-native-setnativeprops使用2016-8-24) -6. [D6:ref属性不只是string(2016-8-25)](#d6ref属性不只是string2016-8-25) -7. [D7:解构赋值(Destructuring assignment)(2016-8-26)](#d7解构赋值destructuring-assignment2016-8-26) -8. [D8:React-Native 原生模块调用(iOS) (2016-8-29)](#d8react-native-原生模块调用ios-2016-8-29) -9. [D9:动态属性名&字符串模板(2016-8-30)](#d9动态属性名字符串模板2016-8-30) -10. [D10:优化切换动画卡顿的问题(2016-8-31)](#d10优化切换动画卡顿的问题2016-8-31) -11. [D11:AsyncStorage存储key管理小技巧(2016-9-1)](#d11asyncstorage存储key管理小技巧---) -12. [D12:延展操作符(Spread operator)(2016-9-2)](#d12延展操作符spread-operator2016-9-2) -13. [D13:React Native学习资料整理(2016-9-5)](#d13react-native学习资料整理2016-9-5) -14. [D14:React Native Android跳入RN界面(2016-9-7)](#d14react-native-android跳入rn界面2016-9-7) -15. [D15:为Promise插上可取消的翅膀(2016-9-8)](#d15为promise插上可取消的翅膀2016-9-8) -16. [D16:Image组件遇到的宽高问题(2016-9-9)](#d16image组件遇到的宽高问题2016-9-9) -17. [D17:数据类型优化(2016-9-12)](#d17数据类型优化2016-9-12) -18. [D18:TextInput高度自增长(2016-9-19)](#d18textinput高度自增长2016-9-19) -19. [D19:ListView滚动平滑(2016-9-20)](#d19listview滚动平滑2016-9-20) -20. [D20:ReactMethod的参数类型(2016-9-21)](#d20reactmethod的参数类型2016-9-21) -21. [D21:React Native 和iOS Simulator 那点事(2016-9-22)](#d21react-native-和ios-simulator-那点事2016-9-22) -22. [D22:如何判断对象是否有某个属性(2016-9-23)](#d22如何判断对象是否有某个属性2016-9-23) -23. [D23:生命周期回调函数总结(2016-9-26)](#d23生命周期回调函数总结2016-9-26) - -``` -模板: -D1:标题 (日期) ------- -概述 -### 子标题 -内容 -### 子标题 -内容 -另外:记得在列表中添加链接 -``` - -D23:生命周期回调函数总结(2016-9-26) ------- -就和iOS开发一样,RN中的组件也有生命周期,所谓生命周期,就是一个对象从开始生成到最后消亡所经历的状态,生命周期大家肯定都很熟悉,此篇把生命周期的回调函数做一个总结 -###总结 -``` -生命周期 调用次数 能否使用 setSate() -getDefaultProps 1(全局调用一次) 否 -getInitialState 1 否 -componentWillMount 1 是 -render >=1 否 -componentDidMount 1 是 -componentWillReceiveProps >=0 是 -shouldComponentUpdate >=0 否 -componentWillUpdate >=0 否 -componentDidUpdate >=0 否 -componentWillUnmount 1 否 -``` - -D22:如何判断对象是否有某个属性(2016-9-23) ------- -- 使用in关键字 该方法可以判断对象的自有属性和继承来的属性是否存在。 - - ``` - var o={x:1}; - "x" in o; //true,自有属性存在 - "y" in o; //false - "toString" in o; //true,是一个继承属性 - ``` - -- 使用对象的hasOwnProperty()方法 该方法只能判断自有属性是否存在,对于继承属性会返回false。 - - ``` - var o={x:1}; - o.hasOwnProperty("x");    //true,自有属性中有x - o.hasOwnProperty("y");    //false,自有属性中不存在y - o.hasOwnProperty("toString"); //false,这是一个继承属性,但不是自有属性 - ``` - -- 用undefined判断 自有属性和继承属性均可判断。 - - ``` - var o={x:1}; - o.x!==undefined; //true - o.y!==undefined; //false - o.toString!==undefined //true - ``` -- 在条件语句中直接判断 - - ``` - var o={}; - if(o.x) o.x+=1; //如果x是undefine,null,false," ",0或NaN,它将保持不变 - ``` - - -D21:React Native 和iOS Simulator 那点事(2016-9-22) ----- - -### 问题1:使用React Native时按cmd+r无法reload js,cmd+d无法唤起 React Native开发菜单? - -不知大家是否有过这样的经历,用 React Native开发应用正不亦乐乎的时候,突然发现,cmd+r,cmd+d快捷键在iOS Simulator上不起作用了,一时抓狂,不知道问题出在哪。 - -其实这个问题主要是由于iOS Simulator和键盘之间断开了连接导致的,也就是说iOS Simulator不在接受键盘的事件了(也不是完全不是受,至少cmd+shift+h它还是会响应的)。 - -那么你肯定会问了,刚才还好好的,怎么突然间就断开连接了呢,我也没做什么啊? - -这是因为在iOS Simulator的Hardware菜单下的“Connect hardware keyboard”功能有个打开和关闭的快捷键“shift+cmd+k”,想想刚才是不是使用了这组快捷键了呢。 - -![Connect hardware keyboard](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%92%8CiOS%20Simulator%20%E9%82%A3%E7%82%B9%E4%BA%8B/images/Connect%20hardware%20keyboard.png) - ->解决办法:将“Connect hardware keyboard”重新勾选上就好了。 - -### 问题2:iOS Simulator的动画变得非常慢? - -为了方便开发者调试动画,iOS官方为iOS Simulator添加了一个可以“放慢动画”的功能叫“Slow Animation”,以方便开发者能更好的调试动画。 - -![Slow Animation](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%92%8CiOS%20Simulator%20%E9%82%A3%E7%82%B9%E4%BA%8B/images/Slow%20Animation.png) - -这个功能确实在调试动画的时候起了不少的作用,但不知情的开发者,当不小心打开了“Slow Animation”功能之后,发现APP所有的动画都变得非常慢,一时不解,是不是程序出什么问题了?难道摊上性能方面的事了? - ->解决办法:取消勾选iOS Simulator(模拟器)的Debug菜单下“Slow Animation”功能即可。 - - - - - -D20:ReactMethod的参数类型(2016-9-21) ------- -`@ReactMethod`方法中传的参数必须是JavaScript和Java相互对应的。 - -```javascript -Boolean -> Bool -Integer -> Number -Double -> Number -Float -> Number -String -> String -Callback -> function -ReadableMap -> Object -ReadableArray -> Array -``` - -D19:ListView滚动平滑(2016-9-20) ------- -ListView设计的时候,当需要动态加载非常大的数据的时候,下面的方法性能优化的方法可以让我们的ListView滚动的时候更加平滑: - -- 只更新渲染数据变化的那一行 ,`rowHasChanged`方法会告诉ListView组件是否需要重新渲染当前那一行。 -- 选择渲染的频率 ,默认情况下面每一个`event-loop`(事件循环)只会渲染一行(可以同pageSize自定义属性设置)。这样可以把大的工作量进行分隔,提供整体渲染的性能。 - -D18:TextInput高度自增长(2016-9-19) ------- -自定义组件 - - class AutoExpandingTextInput extends Component{ - render() { - return ( - - ); - } - } - -然后引用: - - render() { - return ( - - - - ); - - -D17:数据类型优化(2016-9-12) ------- -经常会遇到页面需要加载和渲染数据,有时刷新数据是state中的值没有修改,但是遇到this.setState(),界面就会被重新渲染,因为react-native的生命周期就是,当你调用setState时,总是会触发render的方法。 -###优化1 -可以使用shouldComponentUpdate生命周期方法,此方法作用是在props或 者state改变且接收到新的值时,则在要render方法之前调用。此方法在初始化渲染的时候不会调用,在使用forceUpdate方法的时候也不会。所以在这个方法中我们可以增加些判断规则来避免当state或者props没有改变时所造成的重新render. - -``` -shouldComponentUpdate(dataProps,dataState) { - return dataProps.value !== this.props.value; -} -``` - -###优化2 -如果是一个列表的话这样判断就有问题,这里即使使用了shouldComponentUpdate中的判断,但却一直返回true,导致还会执行render。所以必须对对象所有的键值进行进行比较才能确认是否相等。这里推荐使用facebook自家的immutablejs。一个不可变数据类型的库。使用后可以直接使用以下的写法达到我们之前的目的。immutablejs其他的具体用法请见:[Immutable 详解及 React 中实践](http://www.w3ctech.com/topic/1595)优化后代码如下: - -``` -export default class KSD extends Component { - constructor(props) { - super(props); - this.state = { - data: Immutable.formJS({ - value:{ - value1:'value1', - value2:'value2', - value3:'value3' - } - }) - } - } - shouldComponentUpdate(dataProps,dataState) { - return( - return dataProps.data !== this.props.data; - ) - } -} -``` - -D16:Image组件遇到的宽高问题(2016-9-9) ------- -开发中使用Image组件展示图片,在某些机型上有时并不能得到正确的宽高,设置`resizeMode`无效,此时可以设置宽高属性为`null`这样就可以正常显示了。 - -| 宽度不正确 | 宽度正确 | -|--------------------------------|------------------------------| -|![宽度不正确](./images/D16/1.png) | ![宽度正确](./images/D16/2.png)| - -更多相关问题[Stack Overflow][1] [Github][2] - - -D15:为Promise插上可取消的翅膀(2016-9-8) ------- -`Promise`是React Native开发过程中用于异步操作的最常用的API,但Promise没有提供用于取消异步操作的方法。为了实现可取消的异步操作,我们可以为Promise包裹一层可取消的外衣。 - -```javascript -const makeCancelable = (promise) => { - let hasCanceled_ = false; - const wrappedPromise = new Promise((resolve, reject) => { - promise.then((val) => - hasCanceled_ ? reject({isCanceled: true}) : resolve(val) - ); - promise.catch((error) => - hasCanceled_ ? reject({isCanceled: true}) : reject(error) - ); - }); - return { - promise: wrappedPromise, - cancel() { - hasCanceled_ = true; - }, - }; -}; -``` - -然后可以这样使用取消操作: - -```javascript -const somePromise = new Promise(r => setTimeout(r, 1000));//创建一个异步操作 -const cancelable = makeCancelable(somePromise);//为异步操作添加可取消的功能 -cancelable - .promise - .then(() => console.log('resolved')) - .catch(({isCanceled, ...error}) => console.log('isCanceled', isCanceled)); -// 取消异步操作 -cancelable.cancel(); -``` - -**了解更多:[React Native 性能优化之可取消的异步操作](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/React%20Native%20%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E4%B9%8B%E5%8F%AF%E5%8F%96%E6%B6%88%E7%9A%84%E5%BC%82%E6%AD%A5%E6%93%8D%E4%BD%9C)** - - -D14:React Native Android跳入RN界面(2016-9-7) ------- -步骤: -1.新建一个类继承`Activity`,并实现`DefaultHardwareBackBtnHandler`接口 -2.new一个`ReactRootView`,并build 一个`ReactInstanceManager` -3.`setContentView(mReactRootView);` -```java - mReactRootView = new ReactRootView(this); - mReactInstanceManager = ReactInstanceManager.builder() - .setApplication(getApplication()) - .setBundleAssetName("index.android.bundle") - .setJSMainModuleName("index.android") - .addPackage(new MainReactPackage()) - .setUseDeveloperSupport(true) - .setInitialLifecycleState(LifecycleState.RESUMED) - .build(); - Bundle bundle = new Bundle(); - bundle.putString("enter","KsudiReward"); - mReactRootView.startReactApplication(mReactInstanceManager, "KsudiCircle", bundle); - - setContentView(mReactRootView); -``` -其中`KsudiCircle`是RN入口 注册的组件名称,bundle为原生带入RN的属性值 - -D13:React Native学习资料整理(2016-9-5) ------- -收集整理了一些学习指南,包含 教程、开源app和资源网站等的链接,如果需要查阅资料或找寻第三方库,大家可以去查找 - -###资源整合 - -[RNStudyNotes - ★350 ](https://github.com/crazycodeboy/RNStudyNotes)作者的学习笔记,欢迎star,每天不定时更新 - -[awesome-react-native - ★7037](https://github.com/jondot/awesome-react-native) Awesome React Native系列,有最全的第三方组件(推荐!) - -[react-native-guide - ★5777](https://github.com/reactnativecn/react-native-guide) React-Native学习指南,开源App和组件 - - [React Native 高质量学习资料汇总](http://www.jianshu.com/p/454f2e6f28e9) @author ASCE1885整理 - - [React Native 从入门到原理](http://www.jianshu.com/p/978c4bd3a759) 作者@bestswifter - - [深入浅出ES6](www.infoq.com/cn/es6-in-depth/)深入浅出ES6专栏合集迷你书 - -D12:延展操作符(Spread operator)(2016-9-2) ------- -通常我们在封装一个组件时,会对外公开一些 props 用于实现功能。大部分情况下在外部使用都应显示的传递 props 。但是当传递大量的props时,会非常繁琐,这时我们可以使用 `...(延展操作符,用于取出参数对象的所有可遍历属性)` 来进行传递。 - -### 一般情况下我们应该这样写 -``` - -``` - -### 使用 ... ,等同于上面的写法 - -``` -var params = { - - type: 'normal', - - number: 2 - - } - - -``` - -### 配合解构赋值避免传入一些不需要的参数 - -``` -var params = { - name: '123', - title: '456', - type: 'aaa' -} - -var { type, ...other } = params; - - -//等同于 - -``` - - -D11:AsyncStorage存储key管理小技巧 ------- - -### 场景 - -AsyncStorage是React Native推荐的数据存储方式。当我们需要根据条件从本地查询出多条记录时,你会想到来一个`select * from xx where xx`。但是很不幸的告诉你,AsyncStorage -是不支持sql的,因为AsyncStorage是Key-Value存储系统。 - -**那么如何才能快速的从众多记录中将符合条件的记录查询出来呢?** -请往下看... - -### AsyncStorage key管理 - -为了方便查询多条符合规则的记录,我们可以在保存数据前,对这条数据进行分类,然后记录下这条记录的key。下次再查询该数据前,只需要先查询之前保存的key,然后通过 -`static multiGet(keys, callback?) `API,将符合规则的数据一并查询出来。 - -### 用例 - ->保存数据 - -**第一步:保存数据** - -```javascript - saveFavoriteItem(key,vaule,callback) { - AsyncStorage.setItem(key,vaule,(error,result)=>{ - if (!error) {//更新Favorite的key - this.updateFavoriteKeys(key,true); - } - }); - } -``` - -**第二步:更新key** - -```javascript -/** - * 更新Favorite key集合 - * @param isAdd true 添加,false 删除 - * **/ - updateFavoriteKeys(key,isAdd){ - AsyncStorage.getItem(this.favoriteKey,(error,result)=>{ - if (!error) { - var favoriteKeys=[]; - if (result) { - favoriteKeys=JSON.parse(result); - } - var index=favoriteKeys.indexOf(key); - if(isAdd){ - if (index===-1)favoriteKeys.push(key); - }else { - if (index!==-1)favoriteKeys.splice(index, 1); - } - AsyncStorage.setItem(this.favoriteKey,JSON.stringify(favoriteKeys)); - } - }); - } -``` - ->查询批量数据 - -**第一步:查询key** - -```javascript -getFavoriteKeys(){//获取收藏的Respository对应的key - return new Promise((resolve,reject)=>{ - AsyncStorage.getItem(this.favoriteKey,(error,result)=>{ - if (!error) { - try { - resolve(JSON.parse(result)); - } catch (e) { - reject(error); - } - }else { - reject(error); - } - }); - }); - } -``` - -**第二步:根据key查询数据** - -```javascript -AsyncStorage.multiGet(keys, (err, stores) => { - try { - stores.map((result, i, store) => { - // get at each store's key/value so you can work with it - let key = store[i][0]; - let value = store[i][1]; - if (value)items.push(JSON.parse(value)); - }); - resolve(items); - } catch (e) { - reject(e); - } - }); - ``` - ->**以上是我在使用AsyncStorage进行批量数据查询的一些思路,大家根据实际情况进行调整。** - - - - -D10:优化切换动画卡顿的问题(2016-8-31) ------- -使用API InteractionManager,它的作用就是可以使本来JS的一些操作在动画完成之后执行,这样就可确保动画的流程性。当然这是在延迟执行为代价上来获得帧数的提高。 -```javascript - InteractionManager.runAfterInteractions(()=>{ - //...耗时较长的同步任务... - //更新state也需要时间 - this.setState({ - ... - }) - //获取某些数据,需要长时间等待 - this.fetchData(arguements) - }) -``` -D9:动态属性名&字符串模板(2016-8-30) ------- -在 ES6+ 中,我们不仅可以在对象字面量属性的定义中使用表达式,还有使用使用字符串模板: - - class Form extends React.Component { - onChange(inputName, e) { - this.setState({ - [`${inputName}Value`]: e.target.value, - }); - } - } - -D8:React-Native 原生模块调用(iOS) (2016-8-29) ------- -在项目中遇到地图,拨打电话,清除缓存等iOS与Andiorid机制不同的功能,就需要调用原生的界面或模块,这里说下React Native调用iOS原生模块,Andiorid也是大同小异 -###1.创建原生模块,实现“RCTBridgeModule”协议 -``` -#import -#import "RCTBridgeModule.h" - -@interface KSDMapManager : NSObject - -@end -``` -###2 导出模块,导出方法 -``` -@implementation KSDMapManager -//导出模块 -RCT_EXPORT_MODULE(); - -RCT_EXPORT_METHOD(gotoIM:(RCTResponseSenderBlock)callback) -{ - __weak typeof(self) weakSelf = self; - self.callback = callback; - - UIViewController *controller = (UIViewController*)[[[UIApplication sharedApplication] keyWindow] rootViewController]; - KSDMapLocationViewController *mapVc = [[KSDMapLocationViewController alloc] init]; - mapVc.handle = ^(NSString *address) { - weakSelf.itemValue = address; - NSArray *events = [[NSArray alloc] initWithObjects:self.itemValue, nil]; - callback(events); - }; - [controller presentViewController:mapVc animated:YES completion:nil]; -} - -``` - -###3 js文件中调用 -``` -//创建原生模块实例 -var KSDMapManager = NativeModules.KSDMapManager; -//方法调用 -KSDMapManager.gotoIM( - (events)=>{ - this._inputReceiveAddress(events); - console.log(events); - }) - -``` - -D7:解构赋值([Destructuring assignment][0])(2016-8-26) ------- -解构赋值语法是JavaScript的一种表达式,可以方便的从数组或者对象中快速提取值赋给定义的变量。 - -### 获取数组中的值 -从数组中获取值并赋值到变量中,变量的顺序与数组中对象顺序对应。 - -``` -var foo = ["one", "two", "three", "four"]; - -var [one, two, three] = foo; -console.log(one); // "one" -console.log(two); // "two" -console.log(three); // "three" - -//如果你要忽略某些值,你可以按照下面的写法获取你想要的值 -var [first, , , last] = foo; -console.log(first); // "one" -console.log(last); // "four" - -//你也可以这样写 -var a, b; //先声明变量 - -[a, b] = [1, 2]; -console.log(a); // 1 -console.log(b); // 2 -``` - -如果没有从数组中的获取到值,你可以为变量设置一个默认值。 - -``` -var a, b; - -[a=5, b=7] = [1]; -console.log(a); // 1 -console.log(b); // 7 -``` - -通过解构赋值可以方便的交换两个变量的值。 - -``` -var a = 1; -var b = 3; - -[a, b] = [b, a]; -console.log(a); // 3 -console.log(b); // 1 - -``` - -### 获取对象的值 -从对象中获取对象属性的值,在声明变量的时候要与对象的属性名保持一致。 - -``` -var o = {p: 42, q: true}; -var {p, q} = o; - -console.log(p); // 42 -console.log(q); // true - -//你也可以这样写 -var a, b; - -({a, b} = {a:1, b:2}); - -console.log(a); // 1 -console.log(b); // 2 -``` - -可以从一个对象中获取对象属性的值并赋值给与对象属性名不同的变量。 - -``` -var o = {p: 42, q: true}; -var {p: foo, q: bar} = o; - -console.log(foo); // 42 -console.log(bar); // true -``` -和获取数组中的值一样,从对象中获取属性的值也可以设置一个默认值。 - -``` -var {a=10, b=5} = {a: 3}; - -console.log(a); // 3 -console.log(b); // 5 -``` - - - -D6:ref属性不只是string(2016-8-25) ----- - -ref属性不仅接受string类型的参数,而且它还接受一个function作为callback。这一特性让开发者对ref的使用更加灵活。 - - -```javascript - render: function() { - return ( - - ); - }, -``` -在ES6中我们可以使用箭头函数来为组件的ref设置一个callback。 - -```javascript - render() { - return this._input = c} />; - }, - componentDidMount() { - this._input.focus(); - }, -``` -需要提醒大家的是,只有在组件的render方法被调用时,ref才会被调用,组件才会返回ref。如果你在调用this.refs.xx时render方法还没被调用,那么你得到的是undefined。 - ->心得:ref属性在开发中使用频率很高,使用它你可以获取到任何你想要获取的组件的对象,有个这个对象你就可以灵活地做很多事情,比如:读写对象的变量,甚至调用对象的函数。 - - - -D5:React Native setNativeProps使用(2016-8-24) ----- - -有时候我们需要直接改动组件并触发局部的刷新,但不使用`state`或是`props`。 -`setNativeProps` 方法可以理解为web的直接修改dom。使用该方法修改 `View` 、 `Text` 等 RN自带的组件 ,则不会触发组件的 `componentWillReceiveProps` 、 `shouldComponentUpdate` 、`componentWillUpdate` 等组件生命周期中的方法。 - -### 使用例子 - - ```javascript - class MyButton extends React.Component({ - setNativeProps(nativeProps) { - this._root.setNativeProps({ //这里输入你要修改的组件style - height:48, - backgroundColor:'red' - }); - }, - render() { - return ( - this._root = component} {...this.props} style={styles.button}> - {this.props.label} - - ) - }, - }); - ``` - -### 避免和`render`方法的冲突 - -如果要更新一个由`render`方法来维护的属性,则可能会碰到一些出人意料的bug。因为每一次组件重新渲染都可能引起属性变化,这样一来,之前通过`setNativeProps`所设定的值就被完全忽略和覆盖掉了。 - - -D4:React Native 函数的绑定 (2016-8-23) ----- -在ES6的class中函数不再被自动绑定,你需要手动去绑定它们。 - -第一种在构造函数里绑定。 - - constructor(props) { - super(props); - // Set up initial state - this.state = { - text: props.initialValue || 'placeholder' - }; - // Functions must be bound manually with ES6 classes - this.handleChange = this.handleChange.bind(this); -另一种方式就是在你使用的地方通过内联来绑定: - - // Use `.bind`: - render() { - return ( - - ); - } - // Use an arrow function: - render() { - return ( - this.handleChange()} - value={this.state.text} /> - ); -以上任意一种都可以,然而在效率上却不行了。每一次调用render(可以说是非常频繁!)一个新的函数都会被创建。与在构造函数里只绑定一次相比就慢一些。 - -最终的选择是使用箭头函数直接替换函数在类中的声明,像这样: - - // the normal way - // requires binding elsewhere - handleChange(event) { - this.setState({ - text: event.target.value - }); - } - // the ES7 way - // all done, no binding required - handleChange = (event) => { - this.setState({ - text: event.target.value - }); - } -通过这种方式,你不需要绑定任何东西。这都已经通过神奇的箭头函数被搞定了。像期望的那样,函数内部的this将会指向组件实例。 -参考:[http://www.jianshu.com/p/a4c23654932e](http://www.jianshu.com/p/a4c23654932e) - -D3:React Native 真机调试 (2016-8-22) ------- -开发中真机调试是必不可少的,有些功能和问题模拟器是无法重现的,所以就需要配合真机测试,接下来就说下安卓和iOS的真机调试,不难,但是有很多细节需要注意 - -###iOS 真机调试 -1. ``必须`` 保证调试用电脑的和你的设备处于相同的 ``WiFi ``网络环境中下 -2. 打开Xcode,找到 AppDelegate.m 文件 -3. 更改 jsCodeLocation 中的 localhost 改成你电脑的局域网IP地址 -4. IP地址点击左面右上角WIFi图标,找到打开网络偏好设置,状态栏下就可以看见了 -5. 在Xcode中,选择你的手机作为目标设备,Run运行就可以了 -![React Native 真机调试的json文件-1](https://raw.githubusercontent.com/WT-Road/RNStudyNotes/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6/images/D1/React%20Native%20%E7%9C%9F%E6%9C%BA%E8%B0%83%E8%AF%95%E7%9A%84json%E6%96%87%E4%BB%B6-1.png) - -###Android 真机调试 -1. 在 Android 设备上打开 USB debugging 并连接上电脑启动调试。 - -2. 在真机上运行的方法与在模拟器上运行一致,都是通过 react-native run-android 来安装并且运行你的 React Native 应用。 - -3. 如果不是 Android 5.0+ (API 21) ,那么就没办法通过 adb reverse 进行调试,需要通过 WiFi 来连接上你的开发者服务器 -4. 让调试用电脑和你的手机必须处于相同的 WiFi 网络中下 打开震动菜单 (摇动设备)->前往 Dev Settings->选择 Debug server host for device->输入调试用电脑的局域网IP->点击 Reload JS - -注:因为本人不是安卓开发,所以参考[http://my.oschina.net/imot/blog/512808](http://my.oschina.net/imot/blog/512808) - -###细节 -其实还是有些坑的,这里只说iOS 如开始所说,必须是同一网络下,有时电脑同时开着Wifi和插着网线,建议把网线拔掉,但是也不排除可以,没有试过,还有就是 - -``jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];`` - -这一句千万不能注释,需要注意的就这几点,很简单 - -D2:React Native import 文件的小技巧 (2016-8-19) ------- -开发中经常需要 import 其他 js 文件,如果需要同时导入一些相关的 js 文件时,可以创建一个索引文件方便引用。 - -### 第一步:创建index.js -在 index.js 中 import 相关的 js 文件 - -``` -'use strict'; - -import * as Type from './network/EnvironmentConst'; -import Request from './network/RequestManager'; -import AppContext from './network/AppContext'; -import ApiServiceFactory from './network/ApiServiceFactory'; - -module.exports = { - ApiServiceFactory, - Type, - Request, - AppContext -}; -``` - -### 第二步:使用 -如果需要使用这些类,只需要导入index文件就可以了~ - -``` -import {Request, ApiServiceFactory, AppContext, Type} from '../expand/index'; -``` - - -D1:React Native 读取本地的json文件 (2016-8-18) ------- -自 React Native 0.4.3,你可以以导入的形式,来读取本地的json文件,导入的文件可以作为一个js对象使用。 - -### 第一步:导入json文件 - -```javascript -var langsData = require('../../../res/data/langs.json'); -``` - -ES6/ES2015 - -```javascript -import langsData from '../../../res/data/langs.json' -``` - -### 第二步:使用 -如果`langs.json`的路径正确切没有格式错误,那么现在你可以操作`langsData`对象了。 - -### Usage - -**读取`langs.json`** - -![React Native 读取本地的json文件-1](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6/images/D1/React%20Native%20%E8%AF%BB%E5%8F%96%E6%9C%AC%E5%9C%B0%E7%9A%84json%E6%96%87%E4%BB%B6-1.png) - -**使用`langs.json`** - -![React Native 读取本地的json文件-2](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6/images/D1/React%20Native%20%E8%AF%BB%E5%8F%96%E6%9C%AC%E5%9C%B0%E7%9A%84json%E6%96%87%E4%BB%B6-2.png) - -@[How to fetch data from local JSON file on react native?](http://stackoverflow.com/questions/29452822/how-to-fetch-data-from-local-json-file-on-react-native) - - - - - -[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment - - -# React Native 每日一学(Learn a little every day) - -汇聚知识,分享精华。 ->如果你是一名React Native爱好者,或者有一颗热爱钻研新技术的心,喜欢分享技术干货、项目经验、以及你在React Naive学习研究或实践中的一些经验心得等等,欢迎投稿《React Native 每日一学》栏目。 -如果你是一名Android、iOS、或前端开发人员,有者一颗积极进取的心,欢迎关注《React Native 每日一学》。本栏目汇聚React Native开发的技巧,知识点,经验等。 - -## 列表 -1. [D1:React Native 读取本地的json文件 (2016-8-18)](#d1react-native-读取本地的json文件-2016-8-18) -2. [D2:React Native import 文件的小技巧 (2016-8-19)](#d2react-native-import-文件的小技巧-2016-8-19) -3. [D3:React Native 真机调试 (2016-8-22)](#d3react-native-真机调试-2016-8-22) -4. [D4:React Native 函数的绑定 (2016-8-23)](#d4react-native-函数的绑定-2016-8-23) -5. [D5:React Native setNativeProps使用 (2016-8-24)](#d5react-native-setnativeprops使用2016-8-24) -6. [D6:ref属性不只是string(2016-8-25)](#d6ref属性不只是string2016-8-25) -7. [D7:解构赋值(Destructuring assignment)(2016-8-26)](#d7解构赋值destructuring-assignment2016-8-26) -8. [D8:React-Native 原生模块调用(iOS) (2016-8-29)](#d8react-native-原生模块调用ios-2016-8-29) - -``` -模板: -D1:标题 (日期) ------- -概述 -### 子标题 -内容 -### 子标题 -内容 -另外:记得在列表中添加链接 -``` - -D8:React-Native 原生模块调用(iOS) (2016-8-29) ------- -在项目中遇到地图,拨打电话,清除缓存等iOS与Andiorid机制不同的功能,就需要调用原生的界面或模块,这里说下React Native调用iOS原生模块,Andiorid也是大同小异 -###1.创建原生模块,实现“RCTBridgeModule”协议 -``` -#import -#import "RCTBridgeModule.h" - -@interface KSDMapManager : NSObject - -@end -``` -###2 导出模块,导出方法 -``` -@implementation KSDMapManager -//导出模块 -RCT_EXPORT_MODULE(); - -RCT_EXPORT_METHOD(gotoIM:(RCTResponseSenderBlock)callback) -{ - __weak typeof(self) weakSelf = self; - self.callback = callback; - - UIViewController *controller = (UIViewController*)[[[UIApplication sharedApplication] keyWindow] rootViewController]; - KSDMapLocationViewController *mapVc = [[KSDMapLocationViewController alloc] init]; - mapVc.handle = ^(NSString *address) { - weakSelf.itemValue = address; - NSArray *events = [[NSArray alloc] initWithObjects:self.itemValue, nil]; - callback(events); - }; - [controller presentViewController:mapVc animated:YES completion:nil]; -} - -``` - -###3 js文件中调用 -``` -//创建原生模块实例 -var KSDMapManager = NativeModules.KSDMapManager; -//方法调用 -KSDMapManager.gotoIM( - (events)=>{ - this._inputReceiveAddress(events); - console.log(events); - }) - -``` - -D7:解构赋值([Destructuring assignment][0])(2016-8-26) ------- -解构赋值语法是JavaScript的一种表达式,可以方便的从数组或者对象中快速提取值赋给定义的变量。 - -### 获取数组中的值 -从数组中获取值并赋值到变量中,变量的顺序与数组中对象顺序对应。 - -``` -var foo = ["one", "two", "three", "four"]; - -var [one, two, three] = foo; -console.log(one); // "one" -console.log(two); // "two" -console.log(three); // "three" - -//如果你要忽略某些值,你可以按照下面的写法获取你想要的值 -var [first, , , last] = foo; -console.log(first); // "one" -console.log(last); // "four" - -//你也可以这样写 -var a, b; //先声明变量 - -[a, b] = [1, 2]; -console.log(a); // 1 -console.log(b); // 2 -``` - -如果没有从数组中的获取到值,你可以为变量设置一个默认值。 - -``` -var a, b; - -[a=5, b=7] = [1]; -console.log(a); // 1 -console.log(b); // 7 -``` - -通过解构赋值可以方便的交换两个变量的值。 - -``` -var a = 1; -var b = 3; - -[a, b] = [b, a]; -console.log(a); // 3 -console.log(b); // 1 - -``` - -### 获取对象的值 -从对象中获取对象属性的值,在声明变量的时候要与对象的属性名保持一致。 - -``` -var o = {p: 42, q: true}; -var {p, q} = o; - -console.log(p); // 42 -console.log(q); // true - -//你也可以这样写 -var a, b; - -({a, b} = {a:1, b:2}); - -console.log(a); // 1 -console.log(b); // 2 -``` - -可以从一个对象中获取对象属性的值并赋值给与对象属性名不同的变量。 - -``` -var o = {p: 42, q: true}; -var {p: foo, q: bar} = o; - -console.log(foo); // 42 -console.log(bar); // true -``` -和获取数组中的值一样,从对象中获取属性的值也可以设置一个默认值。 - -``` -var {a=10, b=5} = {a: 3}; - -console.log(a); // 3 -console.log(b); // 5 -``` - - - -D6:ref属性不只是string(2016-8-25) ----- - -ref属性不仅接受string类型的参数,而且它还接受一个function作为callback。这一特性让开发者对ref的使用更加灵活。 - - -```javascript - render: function() { - return ( - - ); - }, -``` -在ES6中我们可以使用箭头函数来为组件的ref设置一个callback。 - -```javascript - render() { - return this._input = c} />; - }, - componentDidMount() { - this._input.focus(); - }, -``` -需要提醒大家的是,只有在组件的render方法被调用时,ref才会被调用,组件才会返回ref。如果你在调用this.refs.xx时render方法还没被调用,那么你得到的是undefined。 - ->心得:ref属性在开发中使用频率很高,使用它你可以获取到任何你想要获取的组件的对象,有个这个对象你就可以灵活地做很多事情,比如:读写对象的变量,甚至调用对象的函数。 - - - -D5:React Native setNativeProps使用(2016-8-24) ----- - -有时候我们需要直接改动组件并触发局部的刷新,但不使用`state`或是`props`。 -`setNativeProps` 方法可以理解为web的直接修改dom。使用该方法修改 `View` 、 `Text` 等 RN自带的组件 ,则不会触发组件的 `componentWillReceiveProps` 、 `shouldComponentUpdate` 、`componentWillUpdate` 等组件生命周期中的方法。 - -### 使用例子 - - ```javascript - class MyButton extends React.Component({ - setNativeProps(nativeProps) { - this._root.setNativeProps({ //这里输入你要修改的组件style - height:48, - backgroundColor:'red' - }); - }, - render() { - return ( - this._root = component} {...this.props} style={styles.button}> - {this.props.label} - - ) - }, - }); - ``` - -### 避免和`render`方法的冲突 - -如果要更新一个由`render`方法来维护的属性,则可能会碰到一些出人意料的bug。因为每一次组件重新渲染都可能引起属性变化,这样一来,之前通过`setNativeProps`所设定的值就被完全忽略和覆盖掉了。 - - -D4:React Native 函数的绑定 (2016-8-23) ----- -在ES6的class中函数不再被自动绑定,你需要手动去绑定它们。 - -第一种在构造函数里绑定。 - - constructor(props) { - super(props); - // Set up initial state - this.state = { - text: props.initialValue || 'placeholder' - }; - // Functions must be bound manually with ES6 classes - this.handleChange = this.handleChange.bind(this); -另一种方式就是在你使用的地方通过内联来绑定: - - // Use `.bind`: - render() { - return ( - - ); - } - // Use an arrow function: - render() { - return ( - this.handleChange()} - value={this.state.text} /> - ); -以上任意一种都可以,然而在效率上却不行了。每一次调用render(可以说是非常频繁!)一个新的函数都会被创建。与在构造函数里只绑定一次相比就慢一些。 - -最终的选择是使用箭头函数直接替换函数在类中的声明,像这样: - - // the normal way - // requires binding elsewhere - handleChange(event) { - this.setState({ - text: event.target.value - }); - } - // the ES7 way - // all done, no binding required - handleChange = (event) => { - this.setState({ - text: event.target.value - }); - } -通过这种方式,你不需要绑定任何东西。这都已经通过神奇的箭头函数被搞定了。像期望的那样,函数内部的this将会指向组件实例。 -参考:[http://www.jianshu.com/p/a4c23654932e](http://www.jianshu.com/p/a4c23654932e) - -D3:React Native 真机调试 (2016-8-22) ------- -开发中真机调试是必不可少的,有些功能和问题模拟器是无法重现的,所以就需要配合真机测试,接下来就说下安卓和iOS的真机调试,不难,但是有很多细节需要注意 - -###iOS 真机调试 -1. ``必须`` 保证调试用电脑的和你的设备处于相同的 ``WiFi ``网络环境中下 -2. 打开Xcode,找到 AppDelegate.m 文件 -3. 更改 jsCodeLocation 中的 localhost 改成你电脑的局域网IP地址 -4. IP地址点击左面右上角WIFi图标,找到打开网络偏好设置,状态栏下就可以看见了 -5. 在Xcode中,选择你的手机作为目标设备,Run运行就可以了 -![React Native 真机调试的json文件-1](https://raw.githubusercontent.com/WT-Road/RNStudyNotes/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6/images/D1/React%20Native%20%E7%9C%9F%E6%9C%BA%E8%B0%83%E8%AF%95%E7%9A%84json%E6%96%87%E4%BB%B6-1.png) - -###Android 真机调试 -1. 在 Android 设备上打开 USB debugging 并连接上电脑启动调试。 - -2. 在真机上运行的方法与在模拟器上运行一致,都是通过 react-native run-android 来安装并且运行你的 React Native 应用。 - -3. 如果不是 Android 5.0+ (API 21) ,那么就没办法通过 adb reverse 进行调试,需要通过 WiFi 来连接上你的开发者服务器 -4. 让调试用电脑和你的手机必须处于相同的 WiFi 网络中下 打开震动菜单 (摇动设备)->前往 Dev Settings->选择 Debug server host for device->输入调试用电脑的局域网IP->点击 Reload JS - -注:因为本人不是安卓开发,所以参考[http://my.oschina.net/imot/blog/512808](http://my.oschina.net/imot/blog/512808) - -###细节 -其实还是有些坑的,这里只说iOS 如开始所说,必须是同一网络下,有时电脑同时开着Wifi和插着网线,建议把网线拔掉,但是也不排除可以,没有试过,还有就是 - -``jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];`` - -这一句千万不能注释,需要注意的就这几点,很简单 - -D2:React Native import 文件的小技巧 (2016-8-19) ------- -开发中经常需要 import 其他 js 文件,如果需要同时导入一些相关的 js 文件时,可以创建一个索引文件方便引用。 - -### 第一步:创建index.js -在 index.js 中 import 相关的 js 文件 - -``` -'use strict'; - -import * as Type from './network/EnvironmentConst'; -import Request from './network/RequestManager'; -import AppContext from './network/AppContext'; -import ApiServiceFactory from './network/ApiServiceFactory'; - -module.exports = { - ApiServiceFactory, - Type, - Request, - AppContext -}; -``` - -### 第二步:使用 -如果需要使用这些类,只需要导入index文件就可以了~ - -``` -import {Request, ApiServiceFactory, AppContext, Type} from '../expand/index'; -``` - - -D1:React Native 读取本地的json文件 (2016-8-18) ------- -自 React Native 0.4.3,你可以以导入的形式,来读取本地的json文件,导入的文件可以作为一个js对象使用。 - -### 第一步:导入json文件 - -```javascript -var langsData = require('../../../res/data/langs.json'); -``` - -ES6/ES2015 - -```javascript -import langsData from '../../../res/data/langs.json' -``` - -### 第二步:使用 -如果`langs.json`的路径正确切没有格式错误,那么现在你可以操作`langsData`对象了。 - -### Usage - -**读取`langs.json`** - -![React Native 读取本地的json文件-1](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6/images/D1/React%20Native%20%E8%AF%BB%E5%8F%96%E6%9C%AC%E5%9C%B0%E7%9A%84json%E6%96%87%E4%BB%B6-1.png) - -**使用`langs.json`** - -![React Native 读取本地的json文件-2](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E6%AF%8F%E6%97%A5%E4%B8%80%E5%AD%A6/images/D1/React%20Native%20%E8%AF%BB%E5%8F%96%E6%9C%AC%E5%9C%B0%E7%9A%84json%E6%96%87%E4%BB%B6-2.png) - -@[How to fetch data from local JSON file on react native?](http://stackoverflow.com/questions/29452822/how-to-fetch-data-from-local-json-file-on-react-native) - - - - - -[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment -[1]: http://stackoverflow.com/questions/29322973/whats-the-best-way-to-add-a-full-screen-background-image-in-react-native - -[2]: https://github.com/facebook/react-native/issues/4598#issuecomment-162328501 - - diff --git "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \347\234\237\346\234\272\350\260\203\350\257\225\347\232\204json\346\226\207\344\273\266-1.png" "b/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \347\234\237\346\234\272\350\260\203\350\257\225\347\232\204json\346\226\207\344\273\266-1.png" deleted file mode 100644 index 4c62b77..0000000 Binary files "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \347\234\237\346\234\272\350\260\203\350\257\225\347\232\204json\346\226\207\344\273\266-1.png" and /dev/null differ diff --git "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \350\257\273\345\217\226\346\234\254\345\234\260\347\232\204json\346\226\207\344\273\266-1.png" "b/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \350\257\273\345\217\226\346\234\254\345\234\260\347\232\204json\346\226\207\344\273\266-1.png" deleted file mode 100644 index 02205ba..0000000 Binary files "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \350\257\273\345\217\226\346\234\254\345\234\260\347\232\204json\346\226\207\344\273\266-1.png" and /dev/null differ diff --git "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \350\257\273\345\217\226\346\234\254\345\234\260\347\232\204json\346\226\207\344\273\266-2.png" "b/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \350\257\273\345\217\226\346\234\254\345\234\260\347\232\204json\346\226\207\344\273\266-2.png" deleted file mode 100644 index 2409aa1..0000000 Binary files "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D1/React Native \350\257\273\345\217\226\346\234\254\345\234\260\347\232\204json\346\226\207\344\273\266-2.png" and /dev/null differ diff --git "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D16/1.png" "b/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D16/1.png" deleted file mode 100644 index 3f74437..0000000 Binary files "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D16/1.png" and /dev/null differ diff --git "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D16/2.png" "b/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D16/2.png" deleted file mode 100644 index 4f55d75..0000000 Binary files "a/React Native \346\257\217\346\227\245\344\270\200\345\255\246/images/D16/2.png" and /dev/null differ diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/README.md" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/README.md" deleted file mode 100644 index b8da18a..0000000 --- "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/README.md" +++ /dev/null @@ -1,25 +0,0 @@ -# [React Native 问题及解决方案合集](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20问题及解决方案合集) -该项目用于分享我们在研究与实践React Native过程中的一些经验,总结,教程,以及踩过的一些坑。 -本项目持续更新,欢迎大家[Fork and Star](https://github.com/crazycodeboy/RNStudyNotes/)。 -**另外感谢项目的每一位无私的[贡献者](https://github.com/crazycodeboy/RNStudyNotes/graphs/contributors)。** - -**想和大牛一起讨论?可加入:** - -> -React Native学习交流1群:`165774887`(已满) -React Native学习交流2群:`422654286` - -![React Native学习交流群](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%E5%8F%91%E5%B8%83APP%E4%B9%8B%E7%AD%BE%E5%90%8D%E6%89%93%E5%8C%85APK/images/react%20native%20%E5%AD%A6%E4%B9%A0%E4%BA%A4%E6%B5%81%E7%BE%A4_qrcode_share.png) - - -## 列表 - -* [React Native 和iOS Simulator 那点事](https://github.com/crazycodeboy/RNStudyNotes/tree/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%92%8CiOS%20Simulator%20%E9%82%A3%E7%82%B9%E4%BA%8B) -* [React Native Android启动屏,启动白屏,闪现白屏](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20Android%E5%90%AF%E5%8A%A8%E5%B1%8F%EF%BC%8C%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%EF%BC%8C%E9%97%AA%E7%8E%B0%E7%99%BD%E5%B1%8F/React%20Native%20Android%E5%90%AF%E5%8A%A8%E5%B1%8F%EF%BC%8C%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%EF%BC%8C%E9%97%AA%E7%8E%B0%E7%99%BD%E5%B1%8F.md) -* [React Native 启动白屏问题解决方案,教程](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B.md) - - - - - - diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217.md" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217.md" deleted file mode 100755 index 2c4ed02..0000000 --- "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217.md" +++ /dev/null @@ -1,363 +0,0 @@ -# React Native Android启动屏,启动白屏,闪现白屏 - -本文出自[《React Native学习笔记》](https://github.com/crazycodeboy/RNStudyNotes/)系列文章。 - -![React Native Android启动屏,启动白屏,闪现白屏](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20Android%E5%90%AF%E5%8A%A8%E5%B1%8F%EF%BC%8C%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%EF%BC%8C%E9%97%AA%E7%8E%B0%E7%99%BD%E5%B1%8F/img/React%20Native%20Android%E5%90%AF%E5%8A%A8%E5%B1%8F%EF%BC%8C%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%EF%BC%8C%E9%97%AA%E7%8E%B0%E7%99%BD%E5%B1%8F.gif) - -## 问题描述: -用React Native架构的无论是Android APP还是iOS APP,在启动时都出现白屏现象,时间大概1~3s(根据手机或模拟器的性能不同而不同)。 - -## 问题分析: -React Native应用在启动时会将js bundle读取到内存中,并完成渲染。这期间由于js bundle还没有完成装载并渲染,所以界面显示的是白屏。 - -白屏给人的感觉很不友好,那有没有办法不显示白屏呢? - -上文解释了:为什么React Native应用会在启动的时候显示一会白屏。既然知道了出现问题的原因,那么离解决问题也不远了。市场上大部分APP在启动的时候都会有个启动屏,启动屏对于用户是比较友好的,一来展示欢迎信息,二来显示一些产品信息或一些广告,启动页对于程序来说,是为程序完成初始化加载数据,做一些初始化工作的所保留的时间,启动屏等待的时间可长可短,具体根据业务而定。 - -下面我就教大家如何给React Native Android加启动屏,并解决启动白屏的问题。 - - -## 为React Native Android添加启动屏(解决白屏等待问题) - -为了实现为React Native Android添加启动屏,我们需要给React Native动刀了了。下面就让我们从源码看起。 - -### 原理分析 -通过`react-native init `初始化的应用,Android部分,只有一个`MainActivity`,它是整个Android程序的入口。 - -```java -public class MainActivity extends ReactActivity { - /** - * Returns the name of the main component registered from JavaScript. - * This is used to schedule rendering of the component. - */ - @Override - protected String getMainComponentName() { - return "GitHubPopular"; - } -} -``` - -通过上述代码可以看出`MainActivity`很干净,就一个`getMainComponentName()`方法。显然启动白屏不是因为`MainActivity`导致的。 - -接下来,我们就继续探索,进入`ReactActivity`源码一探究竟。 - -```java -@Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - if (getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) { - // Get permission to show redbox in dev builds. - if (!Settings.canDrawOverlays(this)) { - Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); - startActivity(serviceIntent); - FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE); - Toast.makeText(this, REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show(); - } - } - mReactRootView = createRootView(); - mReactRootView.startReactApplication( - getReactNativeHost().getReactInstanceManager(), - getMainComponentName(), - getLaunchOptions()); - setContentView(mReactRootView); - mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer(); - } -``` - -上面代码是`ReactActivity`的`onCreate`方法的代码,`onCreate`作为一个Activity的入口,负责着程序初始化等一系列工作。 -熟悉Android开发的小伙伴都知道,在`onCreate`方法通过`setContentView()`方法设置一个用于用户交互界面。在`ReactActivity`的`onCreate`方法中也有使用`setContentView()`。 - -```java - mReactRootView = createRootView(); - - mReactRootView.startReactApplication( - getReactNativeHost().getReactInstanceManager(), - getMainComponentName(), - getLaunchOptions()); - setContentView(mReactRootView); -``` - -上述代码中,首先通过` mReactRootView = createRootView();`创建一个根视图,该视图便是React Native应用的最顶部视图。然后通过`mReactRootView.startReactApplication`方法,加载并渲染js bundle,此过程是比较耗时的。最后,通过`setContentView(mReactRootView);`将根视图绑定到Activity界面上。 - -基本原理就是这些,下面我们就对`ReactActivity`动动刀子。 - -## 实现思路 -先说一下思路: - -1. APP启动的时候控制ReactActivity显示启动屏。 -2. 提供关闭启动屏的公共接口。 -3. 在js的适当位(一般是程序初始化工作完成后)置调用上述公共接口关闭启动屏。 - - -## 具体实现 - -### 第一步:APP启动的时候控制ReactActivity显示启动屏 - -在给`ReactActivity`动刀子前我们需要进行一些准备工作。 - -**基础准备:** - -**首先,我们需要将`ReactActivity`复制一份出来。** -因为`ReactActivity`是React Native源码中的一部分,我们无法直接对其源码进行修改,所以我们需将它复制一份出来。然后将`MainActivity`继承改为我们复制出来的这个`ReactActivity`。 - -**其次。修改getUseDeveloperSupport方法。** - -因为,`ReactNativeHost`的`getUseDeveloperSupport`方法是受保护类型的,所以我们无法在它所属包之外访问该方法。但我们又需要在`ReactActivity`中调用该方法,那么我们可以使用反射来满足我们这一需求。 - -```java -protected boolean getUseDeveloperSupport() { - ReactNativeHost rnh=((ReactApplication) getApplication()).getReactNativeHost(); - Classcls=rnh.getClass(); - Object support= null; - try { - Method method = cls.getDeclaredMethod("getUseDeveloperSupport", new Class[]{}); - method.setAccessible(true); - support=method.invoke(rnh); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } - return (boolean) support; -} -``` - ->前期工作准备玩了,现在让我们开始吧。 - - -为了让ReactActivity显示启动屏我们需要创建一个View容器,来容纳启动屏视图和React Native根视图。 - -```java -@Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - if (getUseDeveloperSupport() && Build.VERSION.SDK_INT >= 23) { - // Get permission to show redbox in dev builds. - if (!Settings.canDrawOverlays(this)) { - Intent serviceIntent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); - startActivity(serviceIntent); - FLog.w(ReactConstants.TAG, REDBOX_PERMISSION_MESSAGE); - Toast.makeText(this, REDBOX_PERMISSION_MESSAGE, Toast.LENGTH_LONG).show(); - } - } - - mRootView = new FrameLayout(this); - splashView = LayoutInflater.from(this).inflate(R.layout.launch_screen, null); - - mReactRootView = createRootView(); - mReactRootView.startReactApplication( - getReactNativeHost().getReactInstanceManager(), - getMainComponentName(), - getLaunchOptions()); - mRootView.addView(mReactRootView); - mRootView.addView(splashView, new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - setContentView(mRootView); - mDoubleTapReloadRecognizer = new DoubleTapReloadRecognizer(); - } -``` - -**首先,我创建了一个`mRootView = new FrameLayout(this);`视图容器。** - -**其次,将启动屏布局文件读到内存中`splashView = LayoutInflater.from(this).inflate(R.layout.launch_screen, null);`。** - -**再次,添加`mReactRootView`与`splashView`,注意添加顺序。** - -**最后,将`mRootView`绑定到Activity。** - -这样一来,我们就控制了ReactActivity在启动的时候显示欢迎界面。下面我们需要让ReactActivity开放关闭换用界面的接口方法。 - - -```java -/** - * 隐藏启动屏幕 - */ -public void hide() { - if (mRootView == null || splashView == null) return; - AlphaAnimation fadeOut = new AlphaAnimation(1, 0); - fadeOut.setDuration(1000); - splashView.startAnimation(fadeOut); - fadeOut.setAnimationListener(new Animation.AnimationListener() { - @Override - public void onAnimationStart(Animation animation) { - } - - @Override - public void onAnimationEnd(Animation animation) { - mRootView.removeView(splashView); - splashView = null; - } - - @Override - public void onAnimationRepeat(Animation animation) { - } - }); -} -``` - -上述方法,中加入了一个淡出动画持续1s,目的是让欢迎界面和其他界面之间过度自然些。 -做到这里还不够,因为我们需要在js中调用`hide`方法还控制欢迎界面的关闭。js不能直接调Java,所有我们需要为他们搭建一个桥梁([Native Modules](https://facebook.github.io/react-native/docs/native-modules-android.html))。 - -**首先,创建一个`ReactContextBaseJavaModule`类型的类,供js调用。** - -```java -/** - * LaunchScreenModule - * 出自:http://www.cboy.me - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - */ -public class LaunchScreenModule extends ReactContextBaseJavaModule{ - public LaunchScreenModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "LaunchScreen"; - } - @ReactMethod - public void hide(){ - getCurrentActivity().runOnUiThread(new Runnable() { - @Override - public void run() { - ((ReactActivity)getCurrentActivity()).hide(); - } - }); - - } -} -``` - -**其次,创建一个`ReactPackage`类型的类,用于向React Native注册我们的`LaunchScreenModule`组件。** - -```java -/** - * LaunchScreenReactPackage - * 出自:http://www.cboy.me - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - */ -public class LaunchScreenReactPackage implements ReactPackage { - - @Override - public List> createJSModules() { - return Collections.emptyList(); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules( - ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new LaunchScreenModule(reactContext)); - return modules; - } -} -``` - -**再次,在MainApplication中注册`LaunchScreenModule`组件。** - -```java -@Override -protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new LaunchScreenReactPackage() - ); -} -``` - -**最后,在js中调用LaunchScreenModule。** - -创建一个名为`LaunchScreen`的文件,加入下面代码。 - -```JavaScript -/** - * LaunchScreen - * Android启动屏 - * 出自:http://www.cboy.me - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - * @flow - */ -'use strict'; - -import { NativeModules } from 'react-native'; -module.exports = NativeModules.LaunchScreen; -``` - ->上述代码,目的是向js暴露`LaunchScreen`模块。 - -下面我们就可以在js中调用`LaunchScreen`的`hide()`方法来关闭启动屏了。 - -``` -LaunchScreen.hide(); -``` - -不要忘记在使用LaunchScreen的js文件中导入它哦`import LaunchScreen from './LaunchScreen`。 - -到这里,React Native Android的启动白屏的原因,解决方案,原理,使用方法已经向大家介绍完了。大家如果还有什么疑问可以加群:`165774887`,和我一起讨论。 - -另外,跟大家分享一个Android启动时闪现白屏或黑屏的解决方案。 -这个问题是Android主题的问题和React Native无关,请往下看。 - -## 修改主题解决闪现白屏/黑屏 - -### 问题描述: -市场上有很多应用,在启动的时候,会出现闪现黑屏或白屏,有的应用却没有。究其原因,是主题在搞鬼。 - -### 问题分析 - -当单击应用的图标时,Android会为被单击的应用创建一个进程,然后创建一个Application实例,然后应用主题,然后启动Activity。 -因为启动Activity也是需要时间的,这之间的时间间隔,便是闪现白屏或黑屏的时间。 - -### 解决方案 - -为解决启动时闪现白屏或黑屏的问题,我们可以从主题下手,为应用创建一个透明的主题。 - -**第一步:创建一个透明主题。** - -``` - - -``` - -**第二步:在AndroidManifest.xml中为application应用主题。** - -``` - -``` - -这样一来,启动时变不会闪现黑屏或白屏了。 - ->如果,你的应用需要一个特定的主题,但该主题不是透明的,你可以先将application的默认主题设置成透明的主题,然后在程序启动后(可以在启动页进行),通过`public void setTheme(int resid)`方法将主题设置成你想要的主题即可。 - -## 最后 - -**既然来了,留下个喜欢再走吧,鼓励我继续创作(^_^)∠※** - -**如果喜欢我的文章,那就关注我的[博客](http://www.cboy.me/)吧,让我们一起做朋友~~** - -#### 戳这里,加关注哦: - ->**[微博](http://weibo.com/u/6003602003):第一时间获取推送** -**[个人博客](http://www.cboy.me/):干货文章都在这里哦** -**[GitHub](https://github.com/crazycodeboy/):我的开源项目** - - diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217/img/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217.gif" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217/img/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217.gif" deleted file mode 100755 index aeb69c6..0000000 Binary files "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217/img/React Native Android\345\220\257\345\212\250\345\261\217\357\274\214\345\220\257\345\212\250\347\231\275\345\261\217\357\274\214\351\227\252\347\216\260\347\231\275\345\261\217.gif" and /dev/null differ diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213.md" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213.md" deleted file mode 100644 index 4a1d41e..0000000 --- "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213.md" +++ /dev/null @@ -1,348 +0,0 @@ -# React Native 启动白屏问题解决教程 - -![react-native-splash-screen.png](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%95%99%E7%A8%8B/images/react-native-splash-screen-.png) - -## 目录 - -* [问题描述](#问题描述) -* [问题分析](#问题分析) -* [Android启动白屏解决方案](#android启动白屏解决方案) -* [iOS启动白屏解决方案](#ios启动白屏解决方案) -* [开源库](#开源库) -* [最后](#最后) - -**[项目源码:react-native-splash-screen](https://github.com/crazycodeboy/react-native-splash-screen)** - -## 问题描述: -用React Native架构的无论是Android APP还是iOS APP,在启动时都出现白屏现象,时间大概1~3s(根据手机或模拟器的性能不同而不同)。 - -## 问题分析: - -**为什么会产生白屏?** - -React Native应用在启动时会将js bundle读取到内存中,并完成渲染。这期间由于js bundle还没有完成装载并渲染,所以界面显示的是白屏。 - -白屏给人的感觉很不友好,那有没有办法不显示白屏呢? - -上文解释了:为什么React Native应用会在启动的时候显示一会白屏。既然知道了出现问题的原因,那么离解决问题也不远了。市场上大部分APP在启动的时候都会有个启动屏,启动屏对于用户是比较友好的,一来展示欢迎信息,二来显示一些产品信息或一些广告,启动页对于程序来说,是为程序完成初始化加载数据,做一些初始化工作的所保留的时间,启动屏等待的时间可长可短,具体根据业务而定。 - -下面我就教大家如何给React Native 应用添加启动屏,并解决启动白屏的问题。 - -## Android启动白屏解决方案 - -我们可以通过为React Native Android应用添加启动屏的方式,来解决启动白屏的问题。我在[《React Native Android启动屏,启动白屏,闪现白屏》](http://www.cboy.me/2016/09/15/React-Native-Android%E5%90%AF%E5%8A%A8%E5%B1%8F-%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F-%E9%97%AA%E7%8E%B0%E7%99%BD%E5%B1%8F/)一文中介绍过一种为React Native Android应用添加启动屏的方法, -不过那种方法虽好,但牵扯到对React Native 源码的修改,如果React Native 版本有更新还需要对源码做一些处理,所以以后维护起来不是很方便。 - -下面就向大家介绍另外一种为React Native Android应用添加启动屏的方案。 - -在[《React Native Android启动屏,启动白屏,闪现白屏》](http://www.cboy.me/2016/09/15/React-Native-Android%E5%90%AF%E5%8A%A8%E5%B1%8F-%E5%90%AF%E5%8A%A8%E7%99%BD%E5%B1%8F-%E9%97%AA%E7%8E%B0%E7%99%BD%E5%B1%8F/)一文中 -我们使用的是在根视图容器上添加一个视图作为启动屏,当js bundle加载并渲染完成后,再将添加的视图从根视图上移除。在根视图上添加一个视图的方式其实就是为了遮挡白屏,既然是遮挡白屏,我们是不是可以弹出一个对话框呢? - -小伙伴们肯定会说,对话框也不是全屏啊,主题也不一样啊,不过没关系,既然我们可以添加对话框,那么我们就可以修改对话框的样式来达到我们需要的效果。 - -要达到启动屏的效果,我们需要一个什么样效果的对话框呢? - -1. 在APP启动的时候显示; -2. 在js bundle加载并渲染完成后消失; -3. 全屏显示; -4. 显示的内容可以通过 layout xml 进行修改; - -上述是我们对这个对话框的基本需求,现在就让我们来实现这一需求: - -### 第一步,创建一个对话框组件[SplashScreen](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/android/src/main/java/com/cboy/rn/splashscreen/SplashScreen.java) - -为满足上述需求,对话框组件需要提供下面两个方法: - -**1.显示对话框的方法:** - -```java -/** - * 打开启动屏 - */ -public static void show(final Activity activity,final boolean fullScreen) { - if (activity == null) return; - mActivity = new WeakReference(activity); - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - if (!activity.isFinishing()) { - - mSplashDialog = new Dialog(activity,fullScreen? R.style.SplashScreen_Fullscreen:R.style.SplashScreen_SplashTheme); - mSplashDialog.setContentView(R.layout.launch_screen); - mSplashDialog.setCancelable(false); - - if (!mSplashDialog.isShowing()) { - mSplashDialog.show(); - } - } - } - }); -} -``` - -为了Activity被销毁的时候,持有的Activity能被及时的回收,这里我们通过`new WeakReference(activity);`创建了一个Activity的弱引用。 - -另外,因为在Android中所有的有关UI操作都必须在主线程,所有我们通过`activity.runOnUiThread(new Runnable()...`,将对话框的显示放在了主线程处理。 - -上述代码中,`show`的第二个参数`fullScreen`表示启动屏是全屏显示(即是否隐藏状态栏),代码会控制对话框加载不同的主题样式[R.style.SplashScreen_Fullscreen](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/android/src/main/res/values/styles.xml)与[R.style.SplashScreen_SplashTheme](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/android/src/main/res/values/styles.xml)来达到是否隐藏状态的需求。 - -然后,我们可以在`MainActivity.java`的`onCreate`方法中调`void show(final Activity activity,final boolean fullScreen)`方法来显示启动屏。 - -```java -@Override -protected void onCreate(Bundle savedInstanceState) { - SplashScreen.show(this,true); - super.onCreate(savedInstanceState); -} -``` - ->提示:`SplashScreen.show(this,true);`放在`super.onCreate(savedInstanceState);`之前的位置效果会更好。 - - -**2.关闭对话框的方法:** - -```java -/** - * 关闭启动屏 - */ -public static void hide(Activity activity) { - if (activity == null) activity = mActivity.get(); - if (activity == null) return; - - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - if (mSplashDialog != null && mSplashDialog.isShowing()) { - mSplashDialog.dismiss(); - } - } - }); -} -``` - -上述代码中,我们提供了关闭启动屏的方法。那么如何才能让JS模块调用`void hide(Activity activity)`来关闭启动屏呢? - - -### 第二步:向JS模块提供[SplashScreen](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/android/src/main/java/com/cboy/rn/splashscreen/SplashScreen.java)组件 - - -因为我们需要在js中调用`hide`方法还控制启动屏的关闭。js不能直接调Java,所有我们需要为他们搭建一个桥梁([Native Modules](https://facebook.github.io/react-native/docs/native-modules-android.html))。 - -**首先,创建一个`ReactContextBaseJavaModule`类型的类,供js调用。** - -```java -/** - * SplashScreenModule - * 出自:http://www.cboy.me - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - */ -public class SplashScreenModule extends ReactContextBaseJavaModule{ - public SplashScreenModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public String getName() { - return "SplashScreen"; - } - - /** - * 打开启动屏 - */ - @ReactMethod - public void show() { - SplashScreen.show(getCurrentActivity()); - } - - /** - * 关闭启动屏 - */ - @ReactMethod - public void hide() { - SplashScreen.hide(getCurrentActivity()); - } -} -``` - -**其次,创建一个`ReactPackage`类型的类,用于向React Native注册我们的`SplashScreenModule`组件。** - - -```java -/** - * SplashScreenReactPackage - * 出自:http://www.cboy.me - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - */ -public class SplashScreenReactPackage implements ReactPackage { - - @Override - public List> createJSModules() { - return Collections.emptyList(); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - - @Override - public List createNativeModules( - ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new SplashScreenModule(reactContext)); - return modules; - } -} -``` - -**再次,在MainApplication中注册`SplashScreenModule`组件。** - -```java -@Override -protected List getPackages() { - return Arrays.asList( - new MainReactPackage(), - new SplashScreenReactPackage() - ); -} -``` - -准备工作,做好之后,下面我们就可以在JS中调用`hide`方法来关闭启动屏了。 - - -### 第三步:在JS模块中控制启动屏的关闭 - -创建一个名为[SplashScreen](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/index.js)的文件,加入下面代码。 - - -```JavaScript -/** - * SplashScreen - * 启动屏 - * 出自:http://www.cboy.me - * GitHub:https://github.com/crazycodeboy - * Eamil:crazycodeboy@gmail.com - * @flow - */ -'use strict'; - -import { NativeModules } from 'react-native'; -module.exports = NativeModules.SplashScreen; -``` - -然后,我们可以在js中调用SplashScreen的hide()方法来关闭启动屏了。 - - -```JavaScript -componentDidMount() { - SplashScreen.hide(); -} -``` - ->不要忘记在使用SplashScreen的js文件中导入它哦`import SplashScreen from './SplashScreen`。 - - - -## iOS启动白屏解决方案 - -在iOS中,iOS支持为程序设置一个Launch Image或Launch Screen File来作为启动屏,当程序被打开的时候,首先显示的便是设置的这个启动屏了。 - -那么小伙伴会问了,这个启动屏幕什么时候会消失呢? - -在`AppDelegate`如下方法: - -`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions` - -该方法返回一个 BOOL类型的值,当系统调用该方并返回值之后,标志着APP启动加载已经完成,系统会将启动屏给关掉。 - -所以如果我们控制了这个启动屏幕让它在js bundle加载并渲染完成之后再关闭不就解决了iOS 启动白屏了吗? - -上面已经说到,`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions`方法执行完成之后,启动屏会被关掉。 - -所以我们就想办法控制该方实行的时间。 - -### 第一步:创建一个名为[SplashScreen](https://github.com/crazycodeboy/react-native-splash-screen/tree/master/ios)的Object-C文件 - -在SplashScreen.h文件中添加如下代码: - -```obj-c -// -// SplashScreen.h -// SplashScreen -// 出自:http://www.cboy.me -// GitHub:https://github.com/crazycodeboy -// Eamil:crazycodeboy@gmail.com - - -#import "RCTBridgeModule.h" - -@interface SplashScreen : NSObject -+ (void)show; -@end -``` - -在SplashScreen.m中添加如下代码: - -```obj-c -// SplashScreen -// 出自:http://www.cboy.me -// GitHub:https://github.com/crazycodeboy -// Eamil:crazycodeboy@gmail.com - -#import "SplashScreen.h" - -static bool waiting = true; - -@implementation SplashScreen -- (dispatch_queue_t)methodQueue{ - return dispatch_get_main_queue(); -} -RCT_EXPORT_MODULE() - -+ (void)show { - while (waiting) { - NSDate* later = [NSDate dateWithTimeIntervalSinceNow:0.1]; - [[NSRunLoop mainRunLoop] runUntilDate:later]; - } -} - -RCT_EXPORT_METHOD(hide) { - dispatch_async(dispatch_get_main_queue(), - ^{ - waiting = false; - }); -} -@end - -``` - -在上述代码中,我们通过`[[NSRunLoop mainRunLoop] runUntilDate:later];`来控制`- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions`方法执行的时间, -主线程会每隔0.1s阻塞一次,直到`waiting`变量为true,然后我们就可以通过暴露给JS模块的`hide`方法来控制`waiting`变量的值,继而达到控制启动屏幕的关闭。 - -### 第二步:在JS模块中控制启动屏的关闭 - -通过第一步我们已经向JS模块暴露了`hide`方法,然我们就可以在JS模块中通过`hide`方法来关闭启动屏幕。 -由于iOS在JS模块中控制启动屏的关闭的方法和Android中[第三步:在JS模块中控制启动屏的关闭](#第三步在js模块中控制启动屏的关闭)的方法是一样的,这里就不再介绍了。 - -### 开源库 - -为了方便大家使用和解决React Native应用启动白屏的问题,我已经将上述方案做成React Native组件[react-native-splash-screen](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/README.zh.md), -开源在了[GitHub](https://github.com/crazycodeboy/react-native-splash-screen/blob/master/README.zh.md)上,小伙伴们可以下载使用。 - - -## 最后 - -**既然来了,留下个喜欢再走吧,鼓励我继续创作(^_^)∠※** - -**如果喜欢我的文章,那就关注我的[博客](http://www.cboy.me/)吧,让我们一起做朋友~~** - -#### 戳这里,加关注哦: - ->**[微博](http://weibo.com/u/6003602003):第一时间获取推送** -**[个人博客](http://www.cboy.me/):干货文章都在这里哦** -**[GitHub](https://github.com/crazycodeboy/):我的开源项目** - - - diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213/images/react-native-splash-screen-.png" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213/images/react-native-splash-screen-.png" deleted file mode 100644 index 7d6ac9c..0000000 Binary files "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\220\257\345\212\250\347\231\275\345\261\217\351\227\256\351\242\230\350\247\243\345\206\263\346\225\231\347\250\213/images/react-native-splash-screen-.png" and /dev/null differ diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/Readme.md" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/Readme.md" deleted file mode 100644 index 687fec9..0000000 --- "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/Readme.md" +++ /dev/null @@ -1,40 +0,0 @@ -# React Native 和iOS Simulator 那点事 - -本文出自[《React Native学习笔记》](https://github.com/crazycodeboy/RNStudyNotes/)系列文章。 - -## 问题1:使用React Native时按cmd+r无法reload js,cmd+d无法唤起 React Native开发菜单? - -不知大家是否有过这样的经历,用 React Native开发应用正不亦乐乎的时候,突然发现,cmd+r,cmd+d快捷键在iOS Simulator上不起作用了,一时抓狂,不知道问题出在哪。 - -其实这个问题主要是由于iOS Simulator和键盘之间断开了连接导致的,也就是说iOS Simulator不在接受键盘的事件了(也不是完全不是受,至少cmd+shift+h它还是会响应的)。 - -那么你肯定会问了,刚才还好好的,怎么突然间就断开连接了呢,我也没做什么啊? - -这是因为在iOS Simulator的Hardware菜单下的“Connect hardware keyboard”功能有个打开和关闭的快捷键“shift+cmd+k”,想想刚才是不是使用了这组快捷键了呢。 - -![Connect hardware keyboard](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%92%8CiOS%20Simulator%20%E9%82%A3%E7%82%B9%E4%BA%8B/images/Connect%20hardware%20keyboard.png) - ->解决办法:将“Connect hardware keyboard”重新勾选上就好了。 - -## 问题2:iOS Simulator的动画变得非常慢? - -为了方便开发者调试动画,iOS官方为iOS Simulator添加了一个可以“放慢动画”的功能叫“Slow Animation”,以方便开发者能更好的调试动画。 - -![Slow Animation](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%20%E9%97%AE%E9%A2%98%E5%8F%8A%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88%E5%90%88%E9%9B%86/React%20Native%20%E5%92%8CiOS%20Simulator%20%E9%82%A3%E7%82%B9%E4%BA%8B/images/Slow%20Animation.png) - -这个功能确实在调试动画的时候起了不少的作用,但不知情的开发者,当不小心打开了“Slow Animation”功能之后,发现APP所有的动画都变得非常慢,一时不解,是不是程序出什么问题了?难道摊上性能方面的事了? - ->解决办法:取消勾选iOS Simulator(模拟器)的Debug菜单下“Slow Animation”功能即可。 - - -## 最后 - -**既然来了,留下个喜欢再走吧,鼓励我继续创作(^_^)∠※** - -**如果喜欢我的文章,那就关注我的[博客](http://www.cboy.me/)吧,让我们一起做朋友~~** - -#### 戳这里,加关注哦: - ->**[微博](http://weibo.com/u/6003602003):第一时间获取推送** -**[个人博客](http://www.cboy.me/):干货文章都在这里哦** -**[GitHub](https://github.com/crazycodeboy/):我的开源项目** \ No newline at end of file diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/images/Connect hardware keyboard.png" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/images/Connect hardware keyboard.png" deleted file mode 100644 index 420b1e5..0000000 Binary files "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/images/Connect hardware keyboard.png" and /dev/null differ diff --git "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/images/Slow Animation.png" "b/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/images/Slow Animation.png" deleted file mode 100644 index d1475b9..0000000 Binary files "a/React Native \351\227\256\351\242\230\345\217\212\350\247\243\345\206\263\346\226\271\346\241\210\345\220\210\351\233\206/React Native \345\222\214iOS Simulator \351\202\243\347\202\271\344\272\213/images/Slow Animation.png" and /dev/null differ diff --git "a/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/GitHub Popular\345\274\200\345\217\221\346\225\231\347\250\213\357\274\214\346\272\220\347\240\201\350\247\243\346\236\220\357\274\214\351\241\271\347\233\256\346\200\273\347\273\223/\344\270\200\344\270\252\344\270\212\346\236\266\344\272\206\347\232\204React Native\351\241\271\347\233\256\345\256\236\346\210\230\346\200\273\347\273\223.md" "b/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/GitHub Popular\345\274\200\345\217\221\346\225\231\347\250\213\357\274\214\346\272\220\347\240\201\350\247\243\346\236\220\357\274\214\351\241\271\347\233\256\346\200\273\347\273\223/\344\270\200\344\270\252\344\270\212\346\236\266\344\272\206\347\232\204React Native\351\241\271\347\233\256\345\256\236\346\210\230\346\200\273\347\273\223.md" deleted file mode 100644 index 48d0231..0000000 --- "a/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/GitHub Popular\345\274\200\345\217\221\346\225\231\347\250\213\357\274\214\346\272\220\347\240\201\350\247\243\346\236\220\357\274\214\351\241\271\347\233\256\346\200\273\347\273\223/\344\270\200\344\270\252\344\270\212\346\236\266\344\272\206\347\232\204React Native\351\241\271\347\233\256\345\256\236\346\210\230\346\200\273\347\273\223.md" +++ /dev/null @@ -1,82 +0,0 @@ - -本文出自:([React Native 研究与实践](https://github.com/crazycodeboy/RNStudyNotes)) - - ->项目源码下载:[GitHub Popular](https://github.com/crazycodeboy/GitHubPopular) - -喜欢逛GitHub的小伙伴都知道,它有个查看最热项目的功能叫[trending](https://github.com/trending),但这个功能只能在网页上查看, -而且在手机上浏览显示效果很不友好,而我想在地铁上,餐厅,路上等空余的时间使用它,所以我需要一款带有这个功能的App, -不仅于此,我还想要在这款App上查询GitHub上我所喜欢的项目,甚至在手机没网的时候也能看到,而且我想要我的iOS和Android手机都能使用这款App, -于是[GitHub Popular](https://github.com/crazycodeboy/GitHubPopular)便诞生了。 - ->这个项目满足了我如下3方面的需求: - -1. 在手机App上也可以使用GitHub 的[trending](https://github.com/trending)功能来查看最热最火的开源项目。 -2. 在手机App上也可以搜索GitHub上的开源项目,并且可以进行查看、收藏、分享等操作。 -3. 可以订阅我所喜欢的标签或语言,让感兴趣的热门项目一个不漏。 - -![githubpupular](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2016/10/githubpupular.png) - -## 开发环境及工具 - -### 环境: - -* OSX:10.11.6 -* Node.js:6.3.1 -* react-native:0.32.0 - -### 工具: - -* Git -* WebStorm -* AndroidStudio -* Xcode - - -## 所用技术与第三方库 - -### 所用技术 - -* ES5/ES6 -* React -* Flexbox -* AsyncStorage -* fetch api -* Native Modules - -### 第三方工具 - -* react-native-check-box -* react-native-easy-toast -* react-native-splash-screen -* react-native-htmlview -* react-native-parallax-scroll-view -* react-native-scrollable-tab-view -* react-native-sortable-listview -* react-native-tab-navigator - - -## 功能流程图 - -![GitHub Popular-功能结构图](https://raw.githubusercontent.com/crazycodeboy/Resources-Blog/master/images/2016/10/GitHub%20Popular-%E5%8A%9F%E8%83%BD%E7%BB%93%E6%9E%84%E5%9B%BE.png) - -## 总结 - -此项目是基于目前比较火的React Native技术架构的,也用到一些Android和iOS技术,其中Android、iOS两端代码复用率有90%之多,该项目占据我不少业余时间,不过总算研发完成,并成功上架。在此过程中填了不少的坑,包括GitHub没有开放[trending](https://github.com/trending)的Api,需要自己动手实现它,以及自定义主题等等,后期有时间会整理出来分享给大家。 - -[GitHub Popular](https://github.com/crazycodeboy/GitHubPopular)的Android版本已上架,大家可以从[百度手机助手](http://shouji.baidu.com/software/10123273.html),[应用宝](http://sj.qq.com/myapp/detail.htm?apkName=com.jph.githubpopular)上下载使用,iOS版就差一个99刀的账号就可以上架了,囊中羞涩呜呜~~~~。项目开源在[GitHub](https://github.com/crazycodeboy/GitHubPopular)上供热爱移动开发的小伙伴学习研究,喜欢的小伙伴不要忘记点个赞支持一下哦。 - -## 最后 - -**既然来了,留下个喜欢再走吧,鼓励我继续创作(^_^)∠※** - -**如果喜欢我的文章,那就关注我的[博客](http://www.devio.org/)@ [devio.org](http://www.devio.org)吧,让我们一起做朋友~~** - -#### 戳这里,加关注哦: - ->**[微博](http://weibo.com/u/6003602003):第一时间获取推送** -**[个人博客](http://www.devio.org/):干货文章都在这里哦** -**[GitHub](https://github.com/crazycodeboy/):我的开源项目** - - - diff --git "a/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/React Native \345\237\272\347\241\200\347\237\245\350\257\206\346\200\273\347\273\223.md" "b/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/React Native \345\237\272\347\241\200\347\237\245\350\257\206\346\200\273\347\273\223.md" deleted file mode 100644 index d786f2e..0000000 --- "a/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/React Native \345\237\272\347\241\200\347\237\245\350\257\206\346\200\273\347\273\223.md" +++ /dev/null @@ -1,259 +0,0 @@ -## React Native 基础知识总结 - - - -### Component -Component:组件,使用`extends React.Component`创建的类为组件。? - `componentWillMount()`还可以用` constructor `来代替: - -```javascript - class Label extends React.Component{ - constructor(props) { - super(props); - } - render(){ - } - } -``` - -### props与state - -##### props属性: -组件可以定义初始值,自己不可更改props属性值,只允许从父组件中传递过来: - -```javascript - // 父组件 - class ParentComponent extends React.Component{ - render(){ - return(); - } - } - - // 子组件 - class Child extends React.Component{ - render(){ - return({this.props.name}); - } - } -``` - -父组件向子组件传递name="name"的props属性,在子组件中使用this.props.name引用此属性。 - -属性类型``` prop type ```和默认属性 ```default prop ```可以通过类中的 ```static ```来声明: - -```javascript -class Demo extends React.Component { - // 默认props - static defaultProps = { - autoPlay: false, - maxLoops: 10, - } - // propTypes用于验证转入的props,当向 props 传入无效数据时,JavaScript 控制台会抛出警告 - static propTypes = { - autoPlay: React.PropTypes.bool.isRequired, - maxLoops: React.PropTypes.number.isRequired, - posterFrameSrc: React.PropTypes.string.isRequired, - } - state = { - loopsRemaining: this.props.maxLoops, - } - } -``` - -##### state属性: -组件用来改变自己状态的属性,通常使用```setState({key:value})```来改变属性值触发界面刷新,不能使用```this.state.xxx```来直接改变。 -在开发中,一般不会在定时器函数(setInterval、setTimeout等)中来操作state。典型的场景是在接收到服务器返回的新数据,或者在用户输入数据之后。 - -对于经常改变的数据且需要刷新界面显示,可以使用state。对于不需要改变的属性值可以使用props。React Native建议由顶层的父组件定义state值,并将state值作为子组件的props属性值传递给子组件,这样可以保持单一的数据传递。 - - - -###生命周期 - -我们把组件从```装载```,到```渲染```,再到```卸载```当做一次生命周期,也就是组件的生存状态从```装载```开始到```卸载```为止,期间可以根据属性的变化进行多次渲染。 -生命周期的三种状态: -- Mounting:装载 -1.componentWillMount() -2.componentDidMount() -- Updating:渲染 -1.componentWillReceiveProps() -2.shouldComponentUpdate() -3.componentWillUpdate() -4.componentDidUpdate() -- Unmounting:卸载 -componentWillUnmount() - -```javascript -componentWillMount(),组件开始装载之前调用,在一次生命周期中只会执行一次。 -componentDidMount(),组件完成装载之后立即调用,在一次生命周期中只会执行一次。在这里开始就可以对组件进行各种操作了,比如在组件装载完成后要显示的时候执行动画。 -componentWillUpdate(object nextProps, object nextState),当新的props或者state被接受时,组件属性更新之前调用,这个方法不会被初始渲染调用。不能在这个方法里使用 this.setState()。如果你要响应一个prop变化来更新state,使用componentWillReceiveProps 来替代。 - -componentDidUpdate(object prevProps, object prevState),组件属性更新之后调用,每次属性更新都会调用,这个方法不会被初始渲染调用。 -componentWillUnmount(),组件卸载之前调用,在这个方法里执行一些必要的清理操作,比如timers。 -``` - -##### 组件属性更改时会调用以下方法,在一次生命周期中可以执行多次: - -```javascript - componentWillReceiveProps(object nextProps),已加载组件收到新的props时被调用.这个方法不会为最初的渲染调用。 - - shouldComponentUpdate(object nextProps, object nextState),组件判断是否重新渲染时调用,当新的props或者state被收到,在渲染前被调用.这个方法不会在最初的渲染被调用。 -``` - -并没有类似的 ```componentWillReceiveState ()```的方法。一个即将到来的 prop 转变可能会导致一个 state 变化,但是反之不是。如果你需要实现一个对 state 变化相应的操作,使用 ```componentWillUpdate()```。 - - -如果 shouldComponentUpdate () 返回false, render() 会在下次state变化前被完全跳过。另外componentWillUpdate () 和 componentDidUpdate() 将不会被调用。 - -默认情况下shouldComponentUpdate() 总是返回 true 来阻止当 state 突变时的细微bug。 - - -### 页面跳转 - -初始化第一个页面: - -```javascript - import SeatPageComponent from './SeatPageComponent'; - import MainPageComponent from './MainPageComponent'; - import TrainListComponent from './TrainListComponent'; - - class MainPage extends React.Component { - render() { - let defaultName = 'MainPageComponent'; - let defaultComponent = MainPageComponent; - return ( - { - return Navigator.SceneConfigs.VerticalDownSwipeJump; - }} - // 初始化默认页面 - renderScene={(route, navigator) => { - let Component = route.component; - // 将navigator作为props传递到下一个页面 - return - }} /> - ); - } - } - -``` - -跳转到下一页面: - -```javascript - jumpToNext(){ - const { navigator } = this.props;// 由上一个页面传递过来 - if(navigator) { - navigator.push({ - name: 'SeatPageComponent', - component: SeatPageComponent,// 下一个页面 - }); - } - } -``` - -返回上一个页面: - -```javascript - _back(){ - const { navigator } = this.props; - if(navigator) { - navigator.pop(); - } - } -``` - -页面间通信 - -例如:从A页面打开B页面 -A通过route.params将参数传递给B: - -```javascript - jumpToNext(){ - const { navigator } = this.props;// 由上一个页面传递过来 - if(navigator) { - navigator.push({ - name: 'SeatPageComponent', - component: SeatPageComponent,// 下一个页面 - params: { // 需要传递个下一个页面的参数,第二个页面使用this.props.xxx获取参数 - id: 123, - title: this.state.title, - }, - }); - } - } -``` - -A通过route.params传递回调方法或者A的引用来让B将数据传回给A: - -```javascript - // A页面 - jumpToNext(){ - const { navigator } = this.props;// 由上一个页面传递过来 - if(navigator) { - let that = this;// this作用域,参见下文函数绑定 - navigator.push({ - name: 'SeatPageComponent', - component: SeatPageComponent,// 下一个页面 - params: { // 需要传递个下一个页面的参数,第二个页面使用this.props.xxx获取参数 - title: '测试', - getName: function(name) {that.setState({ name: name })} - }, - }); - } - } - - // B页面 - _back(){ - const { navigator } = this.props; - if(this.props.getName){ - this.props.getName('测试'); - } - if(navigator) { - navigator.pop(); - } - } -``` - - -### flexbox布局 -##### 什么是flexbox布局 -React中引入了flexbox概念,flexbox是属于web前端领域CSS的一种布局方案,是2009年W3C提出了一种新的布局方案,可以简便、完整、响应式地实现各种页面布局。 -RN利用flexBox模型布局, 也就是在手机屏幕上对组件进行排列.利用flexBox模型,开发者可以开发出动态宽高的自适应的UI布局。 - -##### flexbox中的样式主要有以下几类: -1. 位置及宽、高相关的样式键 -2. 容器属性,决定子组件排列规则的键 -3. 元素属性,决定组件显示规则的键 -4. 边框、空隙与填充 - -#####布局样式 -- position - ```relative```(默认) 表示当前描述的位置是相对定位,不可以使用``` bottom```和```right```。```top```和```left```表示当前组件距离上一个同级组件的最上(左)距离 - ```absolute``` 表示当前描述的位置是绝对定位,``` top``` 、```bottom```、``` left```、 ```right```,描述当前组件的位置距离父组件最(上下、左、右)的距离 -- width - ```width```、```height```、```maxHeight```、```maxWidth```、```minHeight```、```minWidth``` 组件的宽和高是可以动态改变的,所以可以设置宽和高的最大和最小值 -- flexDirection - ```row```:横向排列,主轴为水平方向; - ```?column```:竖直排列,主轴为垂直方向。 -- flexWrap - ```?wrap ```?和 ```?nowrap ```?(默认值)?,当水平或垂直布局时,如果子View放不下可选 ```?wrap ```?实现自动换行, -- justifyContent -子布局在主轴方向位置 enum(```flex- start```,```flex-end```,```center```,```space-between```,```space-around```) -- alignItems - 子布局在侧轴方向位置 enum(```flex-start```,```flex-end```,```center```,```stretch``` ) -- flex - 权重,默认值是0当它的值为1时,子组件将自动缩放以适应父组件剩下的空白空间。 -- alignSelf - 忽略它的父组件样式中的```alignItems```的取值,而对该组件使用```alignSelf```键对应的规则。 -enum(```auto```,```flex-start```,```flex-end```,```center```,```stretch```) -- padding -- margin - - -![盒子模型示意图](http://upload-images.jianshu.io/upload_images/1132780-3e6d1a45fb4550ce.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) - - diff --git "a/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/React Native \351\241\271\347\233\256\351\227\256\351\242\230\346\200\273\347\273\223.md" "b/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/React Native \351\241\271\347\233\256\351\227\256\351\242\230\346\200\273\347\273\223.md" deleted file mode 100644 index d3e7a8b..0000000 --- "a/React Native \351\241\271\347\233\256\345\256\236\350\267\265\346\200\273\347\273\223/React Native \351\241\271\347\233\256\351\227\256\351\242\230\346\200\273\347\273\223.md" +++ /dev/null @@ -1,161 +0,0 @@ -#React Native学习总结 -##React Native是什么? -React Native是一个框架,一个中间层,通过这套框架我们可以完成IOS和Android的开发。 -##布局FlexBox -问题1:使用top时在iOS设备上布局没有问题,在Andorid上会出现位置偏移错位 - -解决:使用margin-top就没有问题,因为margin的相对定位,是指相对相邻元素的定位。top这些在绝对定位的前提下,这个绝对定位,相对父级元素的绝对定位。 - -问题2:设置不同的flexDirection,居中总是不确定使用alignItems还是justifyContent - -解决:justifyContent 根据flexDirection而居中,比如row,就是水平居中,column就是垂直居中,alignItems就是相反 -___ -___ -##图片加载 -网络资源 - -`` - -本地静态资源 - -`` - -问题1:需要使用共能的方法或组件,然后根据不同的图片传人相应的参数,遇到加载本地图片的格式问题 - -解决:先定义一个如:type的变量,在使用组件的时候 - -`` - -注意:等于号后面要使用{} - -在方法内部这样写:`` - -例子: - -``` -//调用 - - - -var Cell = React.createClass({ - render: function(){ - return ( - - - {this.props.title} - - - ); - } -}); -``` -___ -___ -##第三方库 -问题:在个人界面,头像选择弹出一个alerView,并且实现跳转相机或相册然后选择图片回调等,如果自己实现会很麻烦而且耗时,这里我们使用第三方react-native-image-picker是一个不错的选择 - -解决:首先安装 npm install react-native-image-picker@latest --save,然后将node_modules中的RNImagePicker.xcodeproj添加到xcode工程中,在添加依赖等,然后运行,这里集成的时候遇到问题就是报找不文件,路径不对,最后把node_modules删除,重新npm install解决问题,使用的时候根据Options参数结合需求相应的配置即可 - -github地址:[react-native-image-picker](https://github.com/marcshilling/react-native-image-picker) -___ -___ -##React Native原生模块调用(iOS) -问题:在项目中遇到地图,拨打电话,清除缓存等iOS与Andiorid机制不同的功能,就需要调用原生的界面或功能,这里说下React Native与iOS混编,Andiorid也是大同小异 - -解决: - -1 创建原生模块,实现“RCTBridgeModule”协议 - -`#import ` - -` #import "RCTBridgeModule.h"` - -`@interface KSDMapManager : NSObject ` - -`@end` - -2 导出模块,导出方法 - -`@implementation KSDMapManager` - -//导出模块 - -`RCT_EXPORT_MODULE();` - -``` -RCT_EXPORT_METHOD(gotoIM:(RCTResponseSenderBlock)callback) -{ - __weak typeof(self) weakSelf = self; - self.callback = callback; - UIViewController *controller = (UIViewController*)[[[UIApplication sharedApplication] keyWindow] rootViewController]; - KSDMapLocationViewController *mapVc = [[KSDMapLocationViewController alloc] init]; - mapVc.handle = ^(NSString *address) { - weakSelf.itemValue = address; - NSArray *events = [[NSArray alloc] initWithObjects:self.itemValue, nil]; - callback(events); - }; - [controller presentViewController:mapVc animated:YES completion:nil]; -} -``` -3 js文件中调用 - -//创建原生模块实例 - -var KSDMapManager = NativeModules.KSDMapManager; - -//方法调用 - -``` -KSDMapManager.gotoIM( - (events)=>{ - this._inputReceiveAddress(events); - console.log(events); - }) -``` -___ -___ -##热部署 -###配置 -H5的一大特点就是热部署,React Native同样也可以,本项目使用的是CodePush - -首先安装客户端,创建CodePush账户,然后会调到浏览器让选择,这里我选择的是GitHub的账号,然后授权以后就会给一个秘钥,将此秘钥复制粘贴到命令行,最后`code-push app add `到这里账号就配置完毕 - -接下来安装CodePush插件,然后将react-native-code-push文件夹中CodePush.xcodeproj直接拉入项目中Libraries中,添加依赖等,然后在AppDelegate中添加 - -``` -#ifdef DEBUG -// [RCTBundleURLProvider sharedSettings].jsLocation = @"192.168.1.120"; - // [RCTBundleURLProvider sharedSettings].jsLocation = @"192.168.7.120"; - jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; -#else - jsCodeLocation = [CodePush bundleURL]; -#endif -``` - -在命令行下使用code-push deployment ls --displayKeys 查出Staging的值,在info.plist文件中添加CodePushDeploymentKey并且把Staging的值填入。 注意在Info.plist中将Bundle versions string, short的值修改为1.0.0,到此所有配置完毕 - -###调用 -在需要改变的js文件中引入import codePush from "react-native-code-push"; - -在componentDidMount调用sync方法,当你的App启动的时候会在后台更新 - -``` -componentDidMount(){ - codePush.sync(); - } -``` -到此位置,所有的基本配置已经全部完成了,可以运行起你的程序啦,不过注意是Release不是Debug - -###发布更新 -将你修改的js文件打包为二进制文件,放入指定的地方(当前位置为根目录)。 - -`react-native bundle --platform ios --entry-file index.ios.js --bundle-output codepush.js --dev false` - -将二进制文件push到staging 环境中 - -`code-push release ksd_geren_rn index.ios.js 1.0.0` - -`code-push release ksd_geren_rn codepush.js 1.0.0` - -###热部署成功---------------[完整配置链接点击这里](http://blog.csdn.net/u011151353/article/details/50688681) -___ diff --git "a/React Native\344\271\213React\351\200\237\345\255\246\346\225\231\347\250\213/React Native\344\271\213React\351\200\237\345\255\246\346\225\231\347\250\213 (\344\270\212).md" "b/React Native\344\271\213React\351\200\237\345\255\246\346\225\231\347\250\213/React Native\344\271\213React\351\200\237\345\255\246\346\225\231\347\250\213 (\344\270\212).md" deleted file mode 100644 index 86933a4..0000000 --- "a/React Native\344\271\213React\351\200\237\345\255\246\346\225\231\347\250\213/React Native\344\271\213React\351\200\237\345\255\246\346\225\231\347\250\213 (\344\270\212).md" +++ /dev/null @@ -1,454 +0,0 @@ -# React Native之React速学教程(上) -本文出自[《React Native学习笔记》](https://github.com/crazycodeboy/RNStudyNotes/)系列文章。 - -React Native是基于React的,在开发React Native过程中少不了的需要用到React方面的知识。虽然官方也有相应的Document,但篇幅比较多,学起来比较枯燥。 -通过《React Native之React速学教程》你可以对React有更系统和更深入的认识。为了方便大家学习,我将《React Native之React速学教程》分为[上](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B%20\(%E4%B8%8A\).md)、[中](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B%20\(%E4%B8%AD\)%20.md)、[下](https://github.com/crazycodeboy/RNStudyNotes/blob/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B%20\(%E4%B8%8B\).md)三篇,大家可以根据需要进行阅读学习。 - -## 概述 - -本篇为《React Native之React速学教程》的第一篇。本篇将从React的特点、如何使用React、JSX语法、组件(Component)以及组件的属性,状态等方面进行讲解。 - - -## What's React -React是一个用于组建用户界面的JavaScript库,让你以更简单的方式来创建交互式用户界面。 - -1. 当数据改变时,React将高效的更新和渲染需要更新的组件。声明性视图使你的代码更可预测,更容易调试。 -2. 构建封装管理自己的状态的组件,然后将它们组装成复杂的用户界面。由于组件逻辑是用JavaScript编写的,而不是模板,所以你可以轻松地通过您的应用程序传递丰富的数据,并保持DOM状态。 -3. 一次学习随处可写,学习React,你不仅可以将它用于Web开发,也可以用于React Native来开发Android和iOS应用。 - -不是模板却比模板更加灵活: - -![Component](https://raw.githubusercontent.com/crazycodeboy/RNStudyNotes/master/React%20Native%E4%B9%8BReact%E9%80%9F%E5%AD%A6%E6%95%99%E7%A8%8B/images/Component.jpg) - ->心得:上图是[GitHub Popular](https://github.com/crazycodeboy/GitHubPopular)的首页截图,这个页面是通过不同的组件组装而成的,组件化的开发模式,使得代码在更大程度上的到复用,而且组件之间对的组装很灵活。 - - -## Get Started - -使用React之前需要在页面引入如下js库 。 -- react.js -- react-dom.js -- browser.min.js - -上面一共列举了三个库: react.js 、react-dom.js 和 browser.min.js ,它们必须首先加载。其中,react.js 是 React 的核心库,react-dom.js 是提供与 DOM 相关的功能,browser.min.js 的作用是将 JSX 语法转为 JavaScript 语法,这一步很消耗时间,实际上线的时候,应该将它放到服务器完成。 -你可以从[React官网](https://facebook.github.io/react/downloads.html)下载这些库,也可以将其下载到本地去使用。 - ->心得:在做React Native开发时,这些库作为React Native核心库已经被初始化在node_modules目录下,所以不需要单独下载。 - -### 使用React -解压从上述地址下载的压缩包,在根目录中创建一个包含以下内容的 “helloworld.html” 。 - -```html - - - - - Hello React! - - - - - -
- - - -``` - -在 JavaScript 代码里写着 XML 格式的代码称为 JSX,下文会介绍。为了把 JSX 转成标准的 JavaScript,我们用`