Skip to content

Commit 9eec932

Browse files
committed
Upgrade to RN26.1. Includes a number of breaking changes
1 parent c35e995 commit 9eec932

32 files changed

+1277
-348
lines changed

.buckconfig

+6
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

+46-15
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414

1515
# Ignore react and fbjs where there are overlaps, but don't ignore
1616
# 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
17+
.*/node_modules/fbjs/lib/Map.js
18+
.*/node_modules/fbjs/lib/ErrorUtils.js
19+
20+
# Flow has a built-in definition for the 'react' module which we prefer to use
21+
# over the currently-untyped source
22+
.*/node_modules/react/react.js
23+
.*/node_modules/react/lib/React.js
24+
.*/node_modules/react/lib/ReactDOM.js
25+
26+
.*/__mocks__/.*
27+
.*/__tests__/.*
28+
29+
.*/commoner/test/source/widget/share.js
2830

2931
# Ignore commoner tests
3032
.*/node_modules/commoner/test/.*
@@ -38,26 +40,55 @@
3840
# Ignore Website
3941
.*/website/.*
4042

43+
# Ignore generators
44+
.*/local-cli/generator.*
45+
46+
# Ignore BUCK generated folders
47+
.*\.buckd/
48+
49+
.*/node_modules/is-my-json-valid/test/.*\.json
50+
.*/node_modules/iconv-lite/encodings/tables/.*\.json
51+
.*/node_modules/y18n/test/.*\.json
52+
.*/node_modules/spdx-license-ids/spdx-license-ids.json
53+
.*/node_modules/spdx-exceptions/index.json
54+
.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json
55+
.*/node_modules/resolve/lib/core.json
56+
.*/node_modules/jsonparse/samplejson/.*\.json
57+
.*/node_modules/json5/test/.*\.json
58+
.*/node_modules/ua-parser-js/test/.*\.json
59+
.*/node_modules/builtin-modules/builtin-modules.json
60+
.*/node_modules/binary-extensions/binary-extensions.json
61+
.*/node_modules/url-regex/tlds.json
62+
.*/node_modules/joi/.*\.json
63+
.*/node_modules/isemail/.*\.json
64+
.*/node_modules/tr46/.*\.json
65+
66+
4167
[include]
4268

4369
[libs]
4470
node_modules/react-native/Libraries/react-native/react-native-interface.js
71+
node_modules/react-native/flow
72+
flow/
4573

4674
[options]
4775
module.system=haste
4876

77+
esproposal.class_static_fields=enable
78+
esproposal.class_instance_fields=enable
79+
4980
munge_underscores=true
5081

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

5485
suppress_type=$FlowIssue
5586
suppress_type=$FlowFixMe
5687
suppress_type=$FixMe
5788

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]+
89+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
90+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
6091
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
6192

6293
[version]
63-
0.19.0
94+
0.24.0

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,10 @@ node_modules/
3636
# jest
3737
coverage/
3838

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

README.md

+52
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,58 @@ Snowflake ![snowflake](https://cloud.githubusercontent.com/assets/1282364/115993
1010
[![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/bartonhammond/snowflake/blob/master/LICENSE)
1111

1212
---------------
13+
#BREAKING CHANGES -- Latest version of Snowflake now supports React Native v26.1.
14+
15+
If you are upgrading from a prior version of Snowflake, follow these instructions
16+
17+
* Update package.json, src/snowflake.js, all files in src/containers and all files in src/components
18+
19+
* Update any additional React Native container and component files in your project:
20+
21+
Instead of:
22+
23+
```
24+
import React, { Component, View } from 'react-native';
25+
```
26+
27+
you need to now use:
28+
29+
```
30+
import React, { Component } from 'react';
31+
import { View } from 'react-native';
32+
```
33+
34+
* install dependencies:
35+
```
36+
npm install
37+
```
38+
39+
* Update your iOS or Android project files by running this in a terminal:
40+
```
41+
$ react-native upgrade
42+
```
43+
44+
You can accept all suggested changes
45+
46+
* iOS manual changes after 'react-native upgrade':
47+
- Re-select the app icons in Images.xcasserts after doing the upgrade
48+
- Edit info.plist and add a property called 'Fonts provided by application'. Add 'FontAwesome.ttf' as a sub-item of type 'String'
49+
50+
* Android manual changes after 'react-native upgrade':
51+
- tbd
52+
53+
* Install rnpm globally:
54+
```
55+
npm install -g rnpm
56+
```
57+
58+
* Install rnpm globally:
59+
```
60+
npm install -g rnpm
61+
```
62+
63+
------------
64+
1365
Navigation is handled with [React Native Router Flux](https://github.com/aksonov/react-native-router-flux)
1466

1567
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

+66
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

+63-16
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
*
@@ -47,7 +59,22 @@ apply plugin: "com.android.application"
4759
* ]
4860
*/
4961

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

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

75122
dependencies {
76123
compile fileTree(dir: "libs", include: ["*.jar"])
77124
compile "com.android.support:appcompat-v7:23.0.1"
78-
compile "com.facebook.react:react-native:0.17.+"
79-
80-
// Add this line:
81-
compile project(':react-native-vector-icons')
82-
83-
// Add this line:
84-
compile project(':RNSimpleAlertDialogModule')
125+
compile "com.facebook.react:react-native:+" // From node_modules
126+
}
85127

128+
// Run this once to be able to run the application with BUCK
129+
// puts all compile dependencies into folder libs for BUCK to use
130+
task copyDownloadableDepsToLibs(type: Copy) {
131+
from configurations.compile
132+
into 'libs'
86133
}

android/app/proguard-rules.pro

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@
4040

4141
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
4242
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
43+
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
4344
-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>; }
45+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
46+
-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }
47+
48+
-dontwarn com.facebook.react.**
4649

4750
# okhttp
4851

0 commit comments

Comments
 (0)