Permalink
Browse files

update to rn v0.18.1

  • Loading branch information...
1 parent aaee5b0 commit 61cae569b2af48ba1833ab7a1b36a0dffebdd564 @soliury committed Jan 26, 2016
View
@@ -7,22 +7,38 @@
# Some modules have their own node_modules with overlap
.*/node_modules/node-haste/.*
-# Ignore react-tools where there are overlaps, but don't ignore anything that
-# react-native relies on
-.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
-.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
-.*/node_modules/react-tools/src/browser/ui/React.js
-.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
-.*/node_modules/react-tools/src/event/EventPropagators.js
+# Ugh
+.*/node_modules/babel.*
+.*/node_modules/babylon.*
+.*/node_modules/invariant.*
+
+# Ignore react and fbjs where there are overlaps, but don't ignore
+# anything that react-native relies on
+.*/node_modules/fbjs/lib/Map.js
+.*/node_modules/fbjs/lib/Promise.js
+.*/node_modules/fbjs/lib/fetch.js
+.*/node_modules/fbjs/lib/ExecutionEnvironment.js
+.*/node_modules/fbjs/lib/isEmpty.js
+.*/node_modules/fbjs/lib/crc32.js
+.*/node_modules/fbjs/lib/ErrorUtils.js
+
+# Flow has a built-in definition for the 'react' module which we prefer to use
+# over the currently-untyped source
+.*/node_modules/react/react.js
+.*/node_modules/react/lib/React.js
+.*/node_modules/react/lib/ReactDOM.js
# Ignore commoner tests
-.*/node_modules/react-tools/node_modules/commoner/test/.*
+.*/node_modules/commoner/test/.*
# See https://github.com/facebook/flow/issues/442
.*/react-tools/node_modules/commoner/lib/reader.js
# Ignore jest
-.*/react-native/node_modules/jest-cli/.*
+.*/node_modules/jest-cli/.*
+
+# Ignore Website
+.*/website/.*
[include]
@@ -31,3 +47,19 @@ node_modules/react-native/Libraries/react-native/react-native-interface.js
[options]
module.system=haste
+
+munge_underscores=true
+
+module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
+module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
+
+suppress_type=$FlowIssue
+suppress_type=$FlowFixMe
+suppress_type=$FixMe
+
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
+suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
+suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
+
+[version]
+0.20.1
View
@@ -22,19 +22,13 @@ DerivedData
*.xcuserstate
project.xcworkspace
+# Android/IJ
+#
+.idea
+.gradle
+local.properties
+
# node.js
#
node_modules/
npm-debug.log
-
-.idea
-
-app/mocks/user.js
-
-react-packager-cache**
-.rnplay
-tmp
-iOS/main.jsbundle
-test.js
-
-
View
@@ -0,0 +1 @@
+{}
@@ -1,5 +1,7 @@
apply plugin: "com.android.application"
+import com.android.build.OutputFile
+
/**
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
* These basically call `react-native bundle` with the correct arguments during the Android build
@@ -49,6 +51,22 @@ apply plugin: "com.android.application"
apply from: "react.gradle"
+/**
+ * Set this to true to create three separate APKs instead of one:
+ * - A universal APK that works on all devices
+ * - 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"
@@ -63,16 +81,37 @@ android {
abiFilters "armeabi-v7a", "x86"
}
}
+ splits {
+ abi {
+ enable enableSeparateBuildPerCPUArchitecture
+ universalApk true
+ reset()
+ include "armeabi-v7a", "x86"
+ }
+ }
buildTypes {
release {
- minifyEnabled false // Set this to true to enable Proguard
+ 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:0.16.+"
+ compile "com.facebook.react:react-native:0.18.+"
}
@@ -40,10 +40,13 @@
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
+-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
+-dontwarn com.facebook.react.**
+
# okhttp
-keepattributes Signature
@@ -58,3 +61,7 @@
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
+
+# stetho
+
+-dontwarn com.facebook.stetho.**
@@ -74,14 +74,33 @@ task bundleReleaseJsAndAssets(type: Exec) {
enabled config.bundleInRelease ?: true
}
+void runBefore(String dependentTaskName, Task task) {
+ Task dependentTask = tasks.findByPath(dependentTaskName);
+ if (dependentTask != null) {
+ dependentTask.dependsOn task
+ }
+}
+
gradle.projectsEvaluated {
+
// hook bundleDebugJsAndAssets into the android build process
+
bundleDebugJsAndAssets.dependsOn mergeDebugResources
bundleDebugJsAndAssets.dependsOn mergeDebugAssets
- processDebugResources.dependsOn bundleDebugJsAndAssets
+
+ runBefore('processArmeabi-v7aDebugResources', bundleDebugJsAndAssets)
+ runBefore('processX86DebugResources', bundleDebugJsAndAssets)
+ runBefore('processUniversalDebugResources', bundleDebugJsAndAssets)
+ runBefore('processDebugResources', bundleDebugJsAndAssets)
// hook bundleReleaseJsAndAssets into the android build process
+
bundleReleaseJsAndAssets.dependsOn mergeReleaseResources
bundleReleaseJsAndAssets.dependsOn mergeReleaseAssets
- processReleaseResources.dependsOn bundleReleaseJsAndAssets
+
+ runBefore('processArmeabi-v7aReleaseResources', bundleReleaseJsAndAssets)
+ runBefore('processX86ReleaseResources', bundleReleaseJsAndAssets)
+ runBefore('processUniversalReleaseResources', bundleReleaseJsAndAssets)
+ runBefore('processReleaseResources', bundleReleaseJsAndAssets)
+
}
@@ -1,78 +1,39 @@
package com.noder;
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.KeyEvent;
-
-import com.facebook.react.LifecycleState;
-import com.facebook.react.ReactInstanceManager;
-import com.facebook.react.ReactRootView;
-import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
+import com.facebook.react.ReactActivity;
+import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
-import com.facebook.soloader.SoLoader;
-
-public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
-
- private ReactInstanceManager mReactInstanceManager;
- private ReactRootView mReactRootView;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- mReactRootView = new ReactRootView(this);
-
- mReactInstanceManager = ReactInstanceManager.builder()
- .setApplication(getApplication())
- .setBundleAssetName("index.android.bundle")
- .setJSMainModuleName("index.android")
- .addPackage(new MainReactPackage())
- .setUseDeveloperSupport(BuildConfig.DEBUG)
- .setInitialLifecycleState(LifecycleState.RESUMED)
- .build();
- mReactRootView.startReactApplication(mReactInstanceManager, "noder", null);
+import java.util.Arrays;
+import java.util.List;
- setContentView(mReactRootView);
- }
+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
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_MENU && mReactInstanceManager != null) {
- mReactInstanceManager.showDevOptionsDialog();
- return true;
- }
- return super.onKeyUp(keyCode, event);
+ protected String getMainComponentName() {
+ return "noder";
}
+ /**
+ * Returns whether dev mode should be enabled.
+ * This enables e.g. the dev menu.
+ */
@Override
- public void onBackPressed() {
- if (mReactInstanceManager != null) {
- mReactInstanceManager.onBackPressed();
- } else {
- super.onBackPressed();
- }
+ protected boolean getUseDeveloperSupport() {
+ return BuildConfig.DEBUG;
}
+ /**
+ * A list of packages used by the app. If the app uses additional views
+ * or modules besides the default ones, add more packages here.
+ */
@Override
- public void invokeDefaultOnBackPressed() {
- super.onBackPressed();
- }
-
- @Override
- protected void onPause() {
- super.onPause();
-
- if (mReactInstanceManager != null) {
- mReactInstanceManager.onPause();
- }
- }
-
- @Override
- protected void onResume() {
- super.onResume();
-
- if (mReactInstanceManager != null) {
- mReactInstanceManager.onResume(this, this);
- }
+ protected List<ReactPackage> getPackages() {
+ return Arrays.<ReactPackage>asList(
+ new MainReactPackage());
}
}
@@ -16,8 +16,5 @@ allprojects {
repositories {
mavenLocal()
jcenter()
- jcenter {
- url "http://dl.bintray.com/mkonicek/maven"
- }
}
}
View
@@ -8,30 +8,30 @@ devIp = require 'dev-ip'
child_process = require 'child_process'
appDelegateSrc = './ios/noder/AppDelegate.m'
-port = 8080
+port = 8081
gulp.task 'replace', ->
- ip = devIp()[0]
- reg = ///
+ ip = devIp()[0]
+ reg = ///
jsCodeLocation\s=\s
\[NSURL\sURLWithString:
@"http:.*\n
///g
- # ip = 'localhost'
- gulp.src appDelegateSrc
- .pipe replace reg, "jsCodeLocation = [NSURL URLWithString:@\"http://#{ip}:#{port}/index.ios.bundle\"];\n"
- .pipe gulp.dest './ios/noder'
+ # ip = 'localhost'
+ gulp.src appDelegateSrc
+ .pipe replace reg, "jsCodeLocation = [NSURL URLWithString:@\"http://#{ip}:#{port}/index.ios.bundle\"];\n"
+ .pipe gulp.dest './ios/noder'
gulp.task 'package', (cb)->
- cmd = "./node_modules/react-native/packager/packager.sh"
- start = child_process.spawn cmd, ['--port', port]
- start.stdout.on 'data', (data)->
- gutil.log data.toString()
- start.stderr.on 'data', (data)->
- gutil.log data.toString()
+ cmd = "react-native"
+ start = child_process.spawn cmd, ['start', '--port', port]
+ start.stdout.on 'data', (data)->
+ gutil.log data.toString()
+ start.stderr.on 'data', (data)->
+ gutil.log data.toString()
gulp.task 'start', ->
- runSequence 'replace', 'package'
+ runSequence 'replace', 'package'
Oops, something went wrong.

0 comments on commit 61cae56

Please sign in to comment.