Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit 5a3b79c

Browse files
committed
Merge branch 'wookiem-snowflakeFix'
2 parents 655df19 + eed3d3f commit 5a3b79c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1495
-587
lines changed

.buckconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
[android]
3+
target = Google Inc.:Google APIs:23
4+
5+
[maven_repositories]
6+
central = https://repo1.maven.org/maven2

.flowconfig

Lines changed: 15 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,41 @@
11
[ignore]
22

33
# We fork some components by platform.
4-
.*/*.web.js
54
.*/*.android.js
65

7-
# Some modules have their own node_modules with overlap
8-
.*/node_modules/node-haste/.*
6+
# Ignore templates with `@flow` in header
7+
.*/local-cli/generator.*
98

10-
# Ugh
11-
.*/node_modules/babel.*
12-
.*/node_modules/babylon.*
13-
.*/node_modules/invariant.*
14-
15-
# Ignore react and fbjs where there are overlaps, but don't ignore
16-
# anything that react-native relies on
17-
.*/node_modules/fbjs-haste/.*/__tests__/.*
18-
.*/node_modules/fbjs-haste/__forks__/Map.js
19-
.*/node_modules/fbjs-haste/__forks__/Promise.js
20-
.*/node_modules/fbjs-haste/__forks__/fetch.js
21-
.*/node_modules/fbjs-haste/core/ExecutionEnvironment.js
22-
.*/node_modules/fbjs-haste/core/isEmpty.js
23-
.*/node_modules/fbjs-haste/crypto/crc32.js
24-
.*/node_modules/fbjs-haste/stubs/ErrorUtils.js
25-
.*/node_modules/react-haste/React.js
26-
.*/node_modules/react-haste/renderers/dom/ReactDOM.js
27-
.*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js
28-
29-
# Ignore commoner tests
30-
.*/node_modules/commoner/test/.*
31-
32-
# See https://github.com/facebook/flow/issues/442
33-
.*/react-tools/node_modules/commoner/lib/reader.js
34-
35-
# Ignore jest
36-
.*/node_modules/jest-cli/.*
37-
38-
# Ignore Website
39-
.*/website/.*
9+
# Ignore malformed json
10+
.*/node_modules/y18n/test/.*\.json
4011

4112
[include]
4213

4314
[libs]
4415
node_modules/react-native/Libraries/react-native/react-native-interface.js
16+
node_modules/react-native/flow
17+
flow/
4518

4619
[options]
4720
module.system=haste
4821

22+
esproposal.class_static_fields=enable
23+
esproposal.class_instance_fields=enable
24+
25+
experimental.strict_type_args=true
26+
4927
munge_underscores=true
5028

5129
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
52-
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
30+
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'
5331

5432
suppress_type=$FlowIssue
5533
suppress_type=$FlowFixMe
5634
suppress_type=$FixMe
5735

58-
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
59-
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+
36+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
37+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
6038
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
6139

6240
[version]
63-
0.19.0
41+
^0.27.0

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ project.xcworkspace
2525

2626
# Android/IJ
2727
#
28+
*.iml
2829
.idea
2930
.gradle
3031
local.properties
@@ -36,4 +37,10 @@ node_modules/
3637
# jest
3738
coverage/
3839

39-
src/lib/config.js
40+
src/lib/config.js
41+
42+
# BUCK
43+
buck-out/
44+
\.buckd/
45+
android/app/libs
46+
android/keystores/debug.keystore

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
Snowflake ![snowflake](https://cloud.githubusercontent.com/assets/1282364/11599365/1a1c39d2-9a8c-11e5-8819-bc1e48b30525.png)
42
==================================
53
#### A React-Native starter mobile app, or maybe just an example, or maybe a boilerplate (you decide) for iOS and Android with a single code base.
@@ -10,6 +8,24 @@ Snowflake ![snowflake](https://cloud.githubusercontent.com/assets/1282364/115993
108
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/bartonhammond/snowflake/blob/master/LICENSE)
119

1210
---------------
11+
##BREAKING CHANGES -- Latest version of Snowflake now supports React Native v26.1.
12+
13+
Once you merge the Snowflake updates you'll need to modify any additional react files in your project:
14+
15+
Instead of:
16+
17+
```
18+
import React, { Component, PropTypes, View } from 'react-native';
19+
```
20+
21+
you need to now use:
22+
23+
```
24+
import React, { Component, PropTypes } from 'react';
25+
import { View } from 'react-native';
26+
```
27+
------------
28+
1329
Navigation is handled with [React Native Router Flux](https://github.com/aksonov/react-native-router-flux)
1430

1531
Using [Redux](https://github.com/reactjs/react-redux) and [Immutable](https://facebook.github.io/immutable-js/), the state of the application is testable with Jest, currently at 80% coverage.

android/app/BUCK

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import re
2+
3+
# To learn about Buck see [Docs](https://buckbuild.com/).
4+
# To run your application with Buck:
5+
# - install Buck
6+
# - `npm start` - to start the packager
7+
# - `cd android`
8+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US`
9+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
10+
# - `buck install -r android/app` - compile, install and run application
11+
#
12+
13+
lib_deps = []
14+
for jarfile in glob(['libs/*.jar']):
15+
name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile)
16+
lib_deps.append(':' + name)
17+
prebuilt_jar(
18+
name = name,
19+
binary_jar = jarfile,
20+
)
21+
22+
for aarfile in glob(['libs/*.aar']):
23+
name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile)
24+
lib_deps.append(':' + name)
25+
android_prebuilt_aar(
26+
name = name,
27+
aar = aarfile,
28+
)
29+
30+
android_library(
31+
name = 'all-libs',
32+
exported_deps = lib_deps
33+
)
34+
35+
android_library(
36+
name = 'app-code',
37+
srcs = glob([
38+
'src/main/java/**/*.java',
39+
]),
40+
deps = [
41+
':all-libs',
42+
':build_config',
43+
':res',
44+
],
45+
)
46+
47+
android_build_config(
48+
name = 'build_config',
49+
package = 'com.snowflake',
50+
)
51+
52+
android_resource(
53+
name = 'res',
54+
res = 'src/main/res',
55+
package = 'com.snowflake',
56+
)
57+
58+
android_binary(
59+
name = 'app',
60+
package_type = 'debug',
61+
manifest = 'src/main/AndroidManifest.xml',
62+
keystore = '//android/keystores:debug',
63+
deps = [
64+
':app-code',
65+
],
66+
)

android/app/build.gradle

Lines changed: 74 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
apply plugin: "com.android.application"
22

3+
import com.android.build.OutputFile
4+
35
/**
4-
* The react.gradle file registers two tasks: bundleDebugJsAndAssets and bundleReleaseJsAndAssets.
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
58
* These basically call `react-native bundle` with the correct arguments during the Android build
69
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
710
* bundle directly from the development server. Below you can see all the possible configurations
811
* and their defaults. If you decide to add a configuration block, make sure to add it before the
9-
* `apply from: "react.gradle"` line.
12+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
1013
*
1114
* project.ext.react = [
1215
* // the name of the generated asset file containing your JS bundle
@@ -21,6 +24,15 @@ apply plugin: "com.android.application"
2124
* // whether to bundle JS and assets in release mode
2225
* bundleInRelease: true,
2326
*
27+
* // whether to bundle JS and assets in another build variant (if configured).
28+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+
* // The configuration property can be in the following formats
30+
* // 'bundleIn${productFlavor}${buildType}'
31+
* // 'bundleIn${buildType}'
32+
* // bundleInFreeDebug: true,
33+
* // bundleInPaidRelease: true,
34+
* // bundleInBeta: true,
35+
*
2436
* // the root of your project, i.e. where "package.json" lives
2537
* root: "../../",
2638
*
@@ -43,11 +55,32 @@ apply plugin: "com.android.application"
4355
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
4456
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
4557
* // for example, you might want to remove it from here.
46-
* inputExcludes: ["android/**", "ios/**"]
58+
* inputExcludes: ["android/**", "ios/**"],
59+
*
60+
* // override which node gets called and with what additional arguments
61+
* nodeExecutableAndArgs: ["node"]
62+
*
63+
* // supply additional arguments to the packager
64+
* extraPackagerArgs: []
4765
* ]
4866
*/
4967

50-
apply from: "react.gradle"
68+
apply from: "../../node_modules/react-native/react.gradle"
69+
70+
/**
71+
* Set this to true to create two separate APKs instead of one:
72+
* - An APK that only works on ARM devices
73+
* - An APK that only works on x86 devices
74+
* The advantage is the size of the APK is reduced by about 4MB.
75+
* Upload all the APKs to the Play Store and people will download
76+
* the correct one based on the CPU architecture of their device.
77+
*/
78+
def enableSeparateBuildPerCPUArchitecture = false
79+
80+
/**
81+
* Run Proguard to shrink the Java bytecode in release builds.
82+
*/
83+
def enableProguardInReleaseBuilds = false
5184

5285
android {
5386
compileSdkVersion 23
@@ -63,24 +96,51 @@ android {
6396
abiFilters "armeabi-v7a", "x86"
6497
}
6598
}
66-
99+
splits {
100+
abi {
101+
reset()
102+
enable enableSeparateBuildPerCPUArchitecture
103+
universalApk false // If true, also generate a universal APK
104+
include "armeabi-v7a", "x86"
105+
}
106+
}
67107
buildTypes {
68-
release {
69-
minifyEnabled false // Set this to true to enable Proguard
70-
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
71-
}
72-
}
108+
release {
109+
minifyEnabled enableProguardInReleaseBuilds
110+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
111+
}
112+
}
113+
// applicationVariants are e.g. debug, release
114+
applicationVariants.all { variant ->
115+
variant.outputs.each { output ->
116+
// For each separate APK per architecture, set a unique version code as described here:
117+
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
118+
def versionCodes = ["armeabi-v7a":1, "x86":2]
119+
def abi = output.getFilter(OutputFile.ABI)
120+
if (abi != null) { // null for the universal-debug, universal-release variants
121+
output.versionCodeOverride =
122+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
123+
}
124+
}
125+
}
73126
}
74127

75128
dependencies {
76129
compile fileTree(dir: "libs", include: ["*.jar"])
77130
compile "com.android.support:appcompat-v7:23.0.1"
78-
compile "com.facebook.react:react-native:0.17.+"
79-
80-
// Add this line:
131+
compile "com.facebook.react:react-native:+" // From node_modules
132+
133+
// Added this line:
81134
compile project(':react-native-vector-icons')
82135

83-
// Add this line:
136+
// Added this line:
84137
compile project(':RNSimpleAlertDialogModule')
85138

86139
}
140+
141+
// Run this once to be able to run the application with BUCK
142+
// puts all compile dependencies into folder libs for BUCK to use
143+
task copyDownloadableDepsToLibs(type: Copy) {
144+
from configurations.compile
145+
into 'libs'
146+
}

android/app/proguard-rules.pro

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@
2626
# See http://sourceforge.net/p/proguard/bugs/466/
2727
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
2828
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29+
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip
2930

3031
# Do not strip any method/class that is annotated with @DoNotStrip
3132
-keep @com.facebook.proguard.annotations.DoNotStrip class *
33+
-keep @com.facebook.common.internal.DoNotStrip class *
3234
-keepclassmembers class * {
3335
@com.facebook.proguard.annotations.DoNotStrip *;
36+
@com.facebook.common.internal.DoNotStrip *;
3437
}
3538

3639
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
@@ -40,17 +43,20 @@
4043

4144
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
4245
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
46+
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
4347
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
44-
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
45-
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
48+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
49+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
50+
51+
-dontwarn com.facebook.react.**
4652

4753
# okhttp
4854

4955
-keepattributes Signature
5056
-keepattributes *Annotation*
51-
-keep class com.squareup.okhttp.** { *; }
52-
-keep interface com.squareup.okhttp.** { *; }
53-
-dontwarn com.squareup.okhttp.**
57+
-keep class okhttp3.** { *; }
58+
-keep interface okhttp3.** { *; }
59+
-dontwarn okhttp3.**
5460

5561
# okio
5662

0 commit comments

Comments
 (0)