Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit ac5c3a2

Browse files
authored
react native update (#1471)
Fixes #1471
1 parent c43eaa8 commit ac5c3a2

38 files changed

+3433
-2980
lines changed

circle.yml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
working_directory: ~/notes/native
3636
docker:
3737
- image: circleci/android:api-26-node8-alpha
38+
resource_class: medium+
3839
steps:
3940
- checkout
4041

native/.babelrc

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
2-
"presets": ["react-native"],
2+
"presets": [
3+
"module:metro-react-native-babel-preset",
4+
"@babel/preset-flow"
5+
],
36
"plugins": [
4-
"transform-decorators-legacy"
7+
["@babel/plugin-proposal-decorators", { "legacy" : true }]
58
]
69
}

native/.flowconfig

+17-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,23 @@ node_modules/react-native/flow-github/
2929
[options]
3030
emoji=true
3131

32+
esproposal.optional_chaining=enable
33+
esproposal.nullish_coalescing=enable
34+
3235
module.system=haste
36+
module.system.haste.use_name_reducers=true
37+
# get basename
38+
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
39+
# strip .js or .js.flow suffix
40+
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
41+
# strip .ios suffix
42+
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
43+
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
44+
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
45+
module.system.haste.paths.blacklist=.*/__tests__/.*
46+
module.system.haste.paths.blacklist=.*/__mocks__/.*
47+
module.system.haste.paths.blacklist=<PROJECT_ROOT>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
48+
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*
3349

3450
munge_underscores=true
3551

@@ -51,4 +67,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
5167
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
5268

5369
[version]
54-
^0.67.0
70+
^0.78.0

native/android/app/build.gradle

+15-15
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ def enableSeparateBuildPerCPUArchitecture = false
9494
def enableProguardInReleaseBuilds = true
9595

9696
android {
97-
compileSdkVersion 26
98-
buildToolsVersion "26.0.2"
97+
compileSdkVersion rootProject.ext.compileSdkVersion
98+
buildToolsVersion rootProject.ext.buildToolsVersion
9999

100100
defaultConfig {
101101
applicationId "org.mozilla.testpilot.notes"
102-
minSdkVersion 21
103-
targetSdkVersion 26
102+
minSdkVersion rootProject.ext.minSdkVersion
103+
targetSdkVersion rootProject.ext.targetSdkVersion
104104
versionCode 8
105105
versionName "1.2android"
106106
ndk {
@@ -109,6 +109,7 @@ android {
109109
manifestPlaceholders = [
110110
appAuthRedirectScheme: 'testpilot-notes'
111111
]
112+
112113
}
113114
signingConfigs {
114115
release {
@@ -152,24 +153,16 @@ android {
152153

153154
dependencies {
154155
compile project(':react-native-sqlite-2')
155-
compile project(':react-native-google-analytics-bridge')
156156
compile project(':react-native-sentry')
157157
compile project(':react-native-vector-icons')
158158
compile project(':react-native-keychain')
159159
compile project(':react-native-randombytes')
160160
compile project(':react-native-app-auth')
161-
compile fileTree(dir: "libs", include: ["*.jar"])
162-
//compile "com.android.support:appcompat-v7:23.0.1"
163-
//compile "com.android.support:appcompat-v7:26.1.0"
164-
compile "com.facebook.react:react-native:+" // From node_modules
165161
compile "org.mozilla.components:service-firefox-accounts:0.29.0"
166-
}
162+
implementation fileTree(dir: "libs", include: ["*.jar"])
163+
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
164+
implementation "com.facebook.react:react-native:+" // From node_modules
167165

168-
repositories {
169-
maven {
170-
url "https://maven.mozilla.org/maven2"
171-
}
172-
mavenLocal()
173166
}
174167

175168
// Run this once to be able to run the application with BUCK
@@ -179,6 +172,13 @@ task copyDownloadableDepsToLibs(type: Copy) {
179172
into 'libs'
180173
}
181174

175+
repositories {
176+
maven {
177+
url "https://maven.mozilla.org/maven2"
178+
}
179+
mavenLocal()
180+
}
181+
182182
project.afterEvaluate {
183183
apply from: '../../app/react-native-zss-rich-text-editor/htmlCopy.gradle';
184184
copyEditorHtmlToAppAssets(file('../../app/react-native-zss-rich-text-editor'))

native/android/app/src/main/java/com/notes/MainApplication.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
import com.facebook.react.ReactApplication;
66
import dog.craftz.sqlite_2.RNSqlite2Package;
7-
import com.idehub.GoogleAnalyticsBridge.GoogleAnalyticsBridgePackage;
87
import io.sentry.RNSentryPackage;
98

109
import com.notes.advancedwebview.AdvancedWebviewPackage;
1110
import com.notes.fxaclient.FxaClientPackage;
11+
1212
import com.oblador.vectoricons.VectorIconsPackage;
1313
import com.oblador.keychain.KeychainPackage;
1414
import com.bitgo.randombytes.RandomBytesPackage;
15-
import com.reactlibrary.RNAppAuthPackage;
15+
import com.rnappauth.RNAppAuthPackage;
1616
import com.facebook.react.ReactNativeHost;
1717
import com.facebook.react.ReactPackage;
1818
import com.facebook.react.shell.MainReactPackage;
@@ -34,8 +34,7 @@ protected List<ReactPackage> getPackages() {
3434
return Arrays.<ReactPackage>asList(
3535
new MainReactPackage(),
3636
new RNSqlite2Package(),
37-
new GoogleAnalyticsBridgePackage(),
38-
new RNSentryPackage(MainApplication.this),
37+
new RNSentryPackage(),
3938
new VectorIconsPackage(),
4039
new KeychainPackage(),
4140
new RandomBytesPackage(),
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

native/android/build.gradle

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4+
ext {
5+
buildToolsVersion = "27.0.3"
6+
minSdkVersion = 21
7+
compileSdkVersion = 27
8+
targetSdkVersion = 27
9+
supportLibVersion = "27.1.1"
10+
}
411
repositories {
5-
jcenter()
612
google()
13+
jcenter()
714
}
815
dependencies {
916
classpath 'com.android.tools.build:gradle:3.3.2'
@@ -15,12 +22,18 @@ buildscript {
1522

1623
allprojects {
1724
repositories {
18-
maven { url "https://maven.google.com" }
1925
mavenLocal()
26+
google()
2027
jcenter()
2128
maven {
2229
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
2330
url "$rootDir/../node_modules/react-native/android"
2431
}
2532
}
2633
}
34+
35+
36+
task wrapper(type: Wrapper) {
37+
gradleVersion = '4.10.1'
38+
distributionUrl = distributionUrl.replace("bin", "all")
39+
}

native/android/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
# org.gradle.parallel=true
1919

2020
android.useDeprecatedNdk=true
21-
android.enableAapt2=false
21+
#android.enableAapt2=false
2.01 KB
Binary file not shown.

native/android/gradle/wrapper/gradle-wrapper.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#Mon Apr 01 13:25:40 EDT 2019
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME

native/android/gradlew

+43-35
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,43 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
##############################################################################
44
##
55
## Gradle start up script for UN*X
66
##
77
##############################################################################
88

9-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10-
DEFAULT_JVM_OPTS=""
9+
# Attempt to set APP_HOME
10+
# Resolve links: $0 may be a link
11+
PRG="$0"
12+
# Need this for relative symlinks.
13+
while [ -h "$PRG" ] ; do
14+
ls=`ls -ld "$PRG"`
15+
link=`expr "$ls" : '.*-> \(.*\)$'`
16+
if expr "$link" : '/.*' > /dev/null; then
17+
PRG="$link"
18+
else
19+
PRG=`dirname "$PRG"`"/$link"
20+
fi
21+
done
22+
SAVED="`pwd`"
23+
cd "`dirname \"$PRG\"`/" >/dev/null
24+
APP_HOME="`pwd -P`"
25+
cd "$SAVED" >/dev/null
1126

1227
APP_NAME="Gradle"
1328
APP_BASE_NAME=`basename "$0"`
1429

30+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31+
DEFAULT_JVM_OPTS=""
32+
1533
# Use the maximum available, or set MAX_FD != -1 to use that value.
1634
MAX_FD="maximum"
1735

18-
warn ( ) {
36+
warn () {
1937
echo "$*"
2038
}
2139

22-
die ( ) {
40+
die () {
2341
echo
2442
echo "$*"
2543
echo
@@ -30,6 +48,7 @@ die ( ) {
3048
cygwin=false
3149
msys=false
3250
darwin=false
51+
nonstop=false
3352
case "`uname`" in
3453
CYGWIN* )
3554
cygwin=true
@@ -40,31 +59,11 @@ case "`uname`" in
4059
MINGW* )
4160
msys=true
4261
;;
62+
NONSTOP* )
63+
nonstop=true
64+
;;
4365
esac
4466

45-
# For Cygwin, ensure paths are in UNIX format before anything is touched.
46-
if $cygwin ; then
47-
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48-
fi
49-
50-
# Attempt to set APP_HOME
51-
# Resolve links: $0 may be a link
52-
PRG="$0"
53-
# Need this for relative symlinks.
54-
while [ -h "$PRG" ] ; do
55-
ls=`ls -ld "$PRG"`
56-
link=`expr "$ls" : '.*-> \(.*\)$'`
57-
if expr "$link" : '/.*' > /dev/null; then
58-
PRG="$link"
59-
else
60-
PRG=`dirname "$PRG"`"/$link"
61-
fi
62-
done
63-
SAVED="`pwd`"
64-
cd "`dirname \"$PRG\"`/" >&-
65-
APP_HOME="`pwd -P`"
66-
cd "$SAVED" >&-
67-
6867
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
6968

7069
# Determine the Java command to use to start the JVM.
@@ -90,7 +89,7 @@ location of your Java installation."
9089
fi
9190

9291
# Increase the maximum file descriptors if we can.
93-
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
92+
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
9493
MAX_FD_LIMIT=`ulimit -H -n`
9594
if [ $? -eq 0 ] ; then
9695
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -114,6 +113,7 @@ fi
114113
if $cygwin ; then
115114
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116115
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116+
JAVACMD=`cygpath --unix "$JAVACMD"`
117117

118118
# We build the pattern for arguments to be converted via cygpath
119119
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +154,19 @@ if $cygwin ; then
154154
esac
155155
fi
156156

157-
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158-
function splitJvmOpts() {
159-
JVM_OPTS=("$@")
157+
# Escape application args
158+
save () {
159+
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160+
echo " "
160161
}
161-
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162-
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
162+
APP_ARGS=$(save "$@")
163+
164+
# Collect all arguments for the java command, following the shell quoting and substitution rules
165+
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166+
167+
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168+
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169+
cd "$(dirname "$0")"
170+
fi
163171

164-
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
172+
exec "$JAVACMD" "$@"

native/android/gradlew.bat

+4-10
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
@rem Set local scope for the variables with windows NT shell
99
if "%OS%"=="Windows_NT" setlocal
1010

11-
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12-
set DEFAULT_JVM_OPTS=
13-
1411
set DIRNAME=%~dp0
1512
if "%DIRNAME%" == "" set DIRNAME=.
1613
set APP_BASE_NAME=%~n0
1714
set APP_HOME=%DIRNAME%
1815

16+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17+
set DEFAULT_JVM_OPTS=
18+
1919
@rem Find java.exe
2020
if defined JAVA_HOME goto findJavaFromJavaHome
2121

@@ -46,10 +46,9 @@ echo location of your Java installation.
4646
goto fail
4747

4848
:init
49-
@rem Get command-line arguments, handling Windowz variants
49+
@rem Get command-line arguments, handling Windows variants
5050

5151
if not "%OS%" == "Windows_NT" goto win9xME_args
52-
if "%@eval[2+2]" == "4" goto 4NT_args
5352

5453
:win9xME_args
5554
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
6059
if "x%~1" == "x" goto execute
6160

6261
set CMD_LINE_ARGS=%*
63-
goto execute
64-
65-
:4NT_args
66-
@rem Get arguments from the 4NT Shell from JP Software
67-
set CMD_LINE_ARGS=%$
6862

6963
:execute
7064
@rem Setup the command line

native/android/settings.gradle

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
rootProject.name = 'Notes'
22
include ':react-native-sqlite-2'
33
project(':react-native-sqlite-2').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sqlite-2/android')
4-
include ':react-native-google-analytics-bridge'
5-
project(':react-native-google-analytics-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-google-analytics-bridge/android')
64
include ':react-native-sentry'
75
project(':react-native-sentry').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sentry/android')
86
include ':react-native-vector-icons'

0 commit comments

Comments
 (0)