Skip to content

Commit 889dad5

Browse files
authored
Merge pull request #62 from wix/R61
Upgrade to RN61
2 parents fae563c + 473d10a commit 889dad5

Some content is hidden

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

51 files changed

+6858
-4163
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,5 @@ build/
155155
.idea
156156
.gradle
157157
local.properties
158+
android/.project
159+
android/.settings/*
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
require 'json'
2+
3+
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4+
5+
Pod::Spec.new do |s|
6+
s.name = "ReactNativeAutogrowTextinput"
7+
s.version = package['version']
8+
s.summary = package['description']
9+
10+
s.authors = package['author']
11+
s.homepage = package['homepage']
12+
s.license = package['license']
13+
s.platforms = { :ios => "9.0", :tvos => "9.2" }
14+
15+
s.module_name = 'ReactNativeAutogrowTextinput'
16+
17+
s.source = { :git => "https://github.com/wix/react-native-autogrow-textinput", :tag => "#{s.version}" }
18+
s.source_files = "./ios/**/*.{h,m}"
19+
20+
s.dependency 'React'
21+
s.frameworks = 'UIKit'
22+
end

android/build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "25.0.3"
4+
compileSdkVersion 28
5+
buildToolsVersion "28.0.3"
66
defaultConfig {
77
minSdkVersion 16
8-
targetSdkVersion 25
8+
targetSdkVersion 28
99
versionCode 1
1010
versionName "1.0"
1111
}
@@ -18,10 +18,9 @@ android {
1818
}
1919

2020
dependencies {
21-
compile fileTree(dir: 'libs', include: ['*.jar'])
21+
implementation fileTree(dir: 'libs', include: ['*.jar'])
2222

23-
compile 'com.android.support:appcompat-v7:25.3.1'
24-
compile 'com.facebook.react:react-native:+'
23+
implementation 'com.facebook.react:react-native:+'
2524

26-
testCompile 'junit:junit:4.12'
25+
testImplementation 'junit:junit:4.12'
2726
}

example/.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23-
project.xcworkspace
2423

2524
# Android/IntelliJ
2625
#
@@ -29,6 +28,8 @@ build/
2928
.gradle
3029
local.properties
3130
*.iml
31+
android/.project
32+
android/.settings/*
3233

3334
# node.js
3435
#
@@ -40,17 +41,21 @@ yarn-error.log
4041
buck-out/
4142
\.buckd/
4243
*.keystore
44+
!debug.keystore
4345

4446
# fastlane
4547
#
4648
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
4749
# screenshots whenever they are needed.
4850
# For more information about the recommended setup visit:
49-
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
51+
# https://docs.fastlane.tools/best-practices/source-control/
5052

5153
*/fastlane/report.xml
5254
*/fastlane/Preview.html
5355
*/fastlane/screenshots
5456

5557
# Bundle artifact
5658
*.jsbundle
59+
60+
# CocoaPods
61+
/ios/Pods/

example/android/app/BUCK

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,13 @@
88
# - `buck install -r android/app` - compile, install and run application
99
#
1010

11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
1113
lib_deps = []
1214

13-
for jarfile in glob(['libs/*.jar']):
14-
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
15-
lib_deps.append(':' + name)
16-
prebuilt_jar(
17-
name = name,
18-
binary_jar = jarfile,
19-
)
15+
create_aar_targets(glob(["libs/*.aar"]))
2016

21-
for aarfile in glob(['libs/*.aar']):
22-
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
23-
lib_deps.append(':' + name)
24-
android_prebuilt_aar(
25-
name = name,
26-
aar = aarfile,
27-
)
17+
create_jar_targets(glob(["libs/*.jar"]))
2818

2919
android_library(
3020
name = "all-libs",
@@ -45,12 +35,12 @@ android_library(
4535

4636
android_build_config(
4737
name = "build_config",
48-
package = "com.example",
38+
package = "com.autogrowtextinput",
4939
)
5040

5141
android_resource(
5242
name = "res",
53-
package = "com.example",
43+
package = "com.autogrowtextinput",
5444
res = "src/main/res",
5545
)
5646

example/android/app/build.gradle

Lines changed: 72 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import com.android.build.OutputFile
1818
* // the entry file for bundle generation
1919
* entryFile: "index.android.js",
2020
*
21+
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
22+
* bundleCommand: "ram-bundle",
23+
*
2124
* // whether to bundle JS and assets in debug mode
2225
* bundleInDebug: false,
2326
*
@@ -33,6 +36,13 @@ import com.android.build.OutputFile
3336
* // bundleInPaidRelease: true,
3437
* // bundleInBeta: true,
3538
*
39+
* // whether to disable dev mode in custom build variants (by default only disabled in release)
40+
* // for example: to disable dev mode in the staging build type (if configured)
41+
* devDisabledInStaging: true,
42+
* // The configuration property can be in the following formats
43+
* // 'devDisabledIn${productFlavor}${buildType}'
44+
* // 'devDisabledIn${buildType}'
45+
*
3646
* // the root of your project, i.e. where "package.json" lives
3747
* root: "../../",
3848
*
@@ -58,13 +68,18 @@ import com.android.build.OutputFile
5868
* inputExcludes: ["android/**", "ios/**"],
5969
*
6070
* // override which node gets called and with what additional arguments
61-
* nodeExecutableAndArgs: ["node"]
71+
* nodeExecutableAndArgs: ["node"],
6272
*
6373
* // supply additional arguments to the packager
6474
* extraPackagerArgs: []
6575
* ]
6676
*/
6777

78+
project.ext.react = [
79+
entryFile: "index.js",
80+
enableHermes: false, // clean and rebuild if changing
81+
]
82+
6883
apply from: "../../node_modules/react-native/react.gradle"
6984

7085
/**
@@ -82,30 +97,67 @@ def enableSeparateBuildPerCPUArchitecture = false
8297
*/
8398
def enableProguardInReleaseBuilds = false
8499

100+
/**
101+
* The preferred build flavor of JavaScriptCore.
102+
*
103+
* For example, to use the international variant, you can use:
104+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
105+
*
106+
* The international variant includes ICU i18n library and necessary data
107+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
108+
* give correct results when using with locales other than en-US. Note that
109+
* this variant is about 6MiB larger per architecture than default.
110+
*/
111+
def jscFlavor = 'org.webkit:android-jsc:+'
112+
113+
/**
114+
* Whether to enable the Hermes VM.
115+
*
116+
* This should be set on project.ext.react and mirrored here. If it is not set
117+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
118+
* and the benefits of using Hermes will therefore be sharply reduced.
119+
*/
120+
def enableHermes = project.ext.react.get("enableHermes", false);
121+
85122
android {
86123
compileSdkVersion rootProject.ext.compileSdkVersion
87-
buildToolsVersion rootProject.ext.buildToolsVersion
124+
125+
compileOptions {
126+
sourceCompatibility JavaVersion.VERSION_1_8
127+
targetCompatibility JavaVersion.VERSION_1_8
128+
}
88129

89130
defaultConfig {
90-
applicationId "com.example"
131+
applicationId "com.autogrowtextinput"
91132
minSdkVersion rootProject.ext.minSdkVersion
92133
targetSdkVersion rootProject.ext.targetSdkVersion
93134
versionCode 1
94135
versionName "1.0"
95-
ndk {
96-
abiFilters "armeabi-v7a", "x86"
97-
}
98136
}
99137
splits {
100138
abi {
101139
reset()
102140
enable enableSeparateBuildPerCPUArchitecture
103141
universalApk false // If true, also generate a universal APK
104-
include "armeabi-v7a", "x86"
142+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
143+
}
144+
}
145+
signingConfigs {
146+
debug {
147+
storeFile file('debug.keystore')
148+
storePassword 'android'
149+
keyAlias 'androiddebugkey'
150+
keyPassword 'android'
105151
}
106152
}
107153
buildTypes {
154+
debug {
155+
signingConfig signingConfigs.debug
156+
}
108157
release {
158+
// Caution! In production, you need to generate your own keystore file.
159+
// see https://facebook.github.io/react-native/docs/signed-apk-android.
160+
signingConfig signingConfigs.debug
109161
minifyEnabled enableProguardInReleaseBuilds
110162
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
111163
}
@@ -114,22 +166,29 @@ android {
114166
applicationVariants.all { variant ->
115167
variant.outputs.each { output ->
116168
// 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]
169+
// https://developer.android.com/studio/build/configure-apk-splits.html
170+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
119171
def abi = output.getFilter(OutputFile.ABI)
120172
if (abi != null) { // null for the universal-debug, universal-release variants
121173
output.versionCodeOverride =
122174
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
123175
}
176+
124177
}
125178
}
126179
}
127180

128181
dependencies {
129182
implementation fileTree(dir: "libs", include: ["*.jar"])
130-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
131183
implementation "com.facebook.react:react-native:+" // From node_modules
132-
implementation project(':react-native-autogrow-textinput')
184+
185+
if (enableHermes) {
186+
def hermesPath = "../../node_modules/hermes-engine/android/";
187+
debugImplementation files(hermesPath + "hermes-debug.aar")
188+
releaseImplementation files(hermesPath + "hermes-release.aar")
189+
} else {
190+
implementation jscFlavor
191+
}
133192
}
134193

135194
// Run this once to be able to run the application with BUCK
@@ -138,3 +197,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
138197
from configurations.compile
139198
into 'libs'
140199
}
200+
201+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

example/android/app/build_defs.bzl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Helper definitions to glob .aar and .jar targets"""
2+
3+
def create_aar_targets(aarfiles):
4+
for aarfile in aarfiles:
5+
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
6+
lib_deps.append(":" + name)
7+
android_prebuilt_aar(
8+
name = name,
9+
aar = aarfile,
10+
)
11+
12+
def create_jar_targets(jarfiles):
13+
for jarfile in jarfiles:
14+
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
15+
lib_deps.append(":" + name)
16+
prebuilt_jar(
17+
name = name,
18+
binary_jar = jarfile,
19+
)

example/android/app/debug.keystore

2.2 KB
Binary file not shown.

example/android/app/proguard-rules.pro

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,3 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11-
12-
# If your project uses WebView with JS, uncomment the following
13-
# and specify the fully qualified class name to the JavaScript interface
14-
# class:
15-
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16-
# public *;
17-
#}

0 commit comments

Comments
 (0)