Skip to content

Commit a9572c3

Browse files
authored
Merge pull request #29 from wix/rn61
Rn61
2 parents 5ea86bf + ff405ee commit a9572c3

File tree

46 files changed

+4368
-4563
lines changed

Some content is hidden

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

46 files changed

+4368
-4563
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,5 @@ xcuserdata
145145
# Webstorm
146146
#
147147
.idea
148+
149+
example/ios/Pods/
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 = "ReactNativeKeyboardTrackingViewLib"
7+
s.version = package['version']
8+
s.summary = "React Native Keyboard Tracking View"
9+
10+
s.authors = "Wix.com"
11+
s.homepage = package['homepage']
12+
s.license = package['license']
13+
s.platforms = { :ios => "9.0", :tvos => "9.2" }
14+
15+
s.module_name = 'ReactNativeKeyboardTrackingViewLib'
16+
17+
s.source = { :git => "https://github.com/wix/react-native-keyboard-tracking-view", :tag => "#{s.version}" }
18+
s.source_files = "lib/**/*.{h,m}"
19+
20+
s.dependency 'React'
21+
s.frameworks = 'UIKit'
22+
end

example/android/app/BUCK renamed to 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.reactnativekeyboardtrackingview",
4939
)
5040

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

example/android/app/build.gradle

Lines changed: 61 additions & 10 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
*
@@ -73,7 +76,8 @@ import com.android.build.OutputFile
7376
*/
7477

7578
project.ext.react = [
76-
entryFile: "index.js"
79+
entryFile: "index.js",
80+
enableHermes: false, // clean and rebuild if changing
7781
]
7882

7983
apply from: "../../node_modules/react-native/react.gradle"
@@ -93,30 +97,67 @@ def enableSeparateBuildPerCPUArchitecture = false
9397
*/
9498
def enableProguardInReleaseBuilds = false
9599

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+
96122
android {
97123
compileSdkVersion rootProject.ext.compileSdkVersion
98-
buildToolsVersion rootProject.ext.buildToolsVersion
124+
125+
compileOptions {
126+
sourceCompatibility JavaVersion.VERSION_1_8
127+
targetCompatibility JavaVersion.VERSION_1_8
128+
}
99129

100130
defaultConfig {
101-
applicationId "com.example"
131+
applicationId "com.reactnativekeyboardtrackingview"
102132
minSdkVersion rootProject.ext.minSdkVersion
103133
targetSdkVersion rootProject.ext.targetSdkVersion
104134
versionCode 1
105135
versionName "1.0"
106-
ndk {
107-
abiFilters "armeabi-v7a", "x86"
108-
}
109136
}
110137
splits {
111138
abi {
112139
reset()
113140
enable enableSeparateBuildPerCPUArchitecture
114141
universalApk false // If true, also generate a universal APK
115-
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'
116151
}
117152
}
118153
buildTypes {
154+
debug {
155+
signingConfig signingConfigs.debug
156+
}
119157
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
120161
minifyEnabled enableProguardInReleaseBuilds
121162
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
122163
}
@@ -125,21 +166,29 @@ android {
125166
applicationVariants.all { variant ->
126167
variant.outputs.each { output ->
127168
// For each separate APK per architecture, set a unique version code as described here:
128-
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
129-
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]
130171
def abi = output.getFilter(OutputFile.ABI)
131172
if (abi != null) { // null for the universal-debug, universal-release variants
132173
output.versionCodeOverride =
133174
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
134175
}
176+
135177
}
136178
}
137179
}
138180

139181
dependencies {
140182
implementation fileTree(dir: "libs", include: ["*.jar"])
141-
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
142183
implementation "com.facebook.react:react-native:+" // From node_modules
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+
}
143192
}
144193

145194
// Run this once to be able to run the application with BUCK
@@ -148,3 +197,5 @@ task copyDownloadableDepsToLibs(type: Copy) {
148197
from configurations.compile
149198
into 'libs'
150199
}
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/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-
#}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6+
7+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
8+
</manifest>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example">
2+
package="com.reactnativekeyboardtrackingview">
33

44
<uses-permission android:name="android.permission.INTERNET" />
5-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
65

76
<application
87
android:name=".MainApplication"
98
android:label="@string/app_name"
109
android:icon="@mipmap/ic_launcher"
10+
android:roundIcon="@mipmap/ic_launcher_round"
1111
android:allowBackup="false"
1212
android:theme="@style/AppTheme">
1313
<activity

example/android/app/src/main/java/com/example/MainActivity.java

Lines changed: 0 additions & 15 deletions
This file was deleted.

example/android/app/src/main/java/com/example/MainApplication.java

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)