Skip to content

Commit fce7cbc

Browse files
author
cnilton
committed
migrated from react-native-reanimated 1 to 2
1 parent 6cf9e8d commit fce7cbc

Some content is hidden

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

50 files changed

+4595
-31
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,6 @@ buck-out/
6363

6464
# CocoaPods
6565
/ios/Pods/
66+
67+
# ignore test files
68+
/src/app.js

Diff for: android/app/_BUCK

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# To learn about Buck see [Docs](https://buckbuild.com/).
2+
# To run your application with Buck:
3+
# - install Buck
4+
# - `npm start` - to start the packager
5+
# - `cd android`
6+
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
7+
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
8+
# - `buck install -r android/app` - compile, install and run application
9+
#
10+
11+
load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")
12+
13+
lib_deps = []
14+
15+
create_aar_targets(glob(["libs/*.aar"]))
16+
17+
create_jar_targets(glob(["libs/*.jar"]))
18+
19+
android_library(
20+
name = "all-libs",
21+
exported_deps = lib_deps,
22+
)
23+
24+
android_library(
25+
name = "app-code",
26+
srcs = glob([
27+
"src/main/java/**/*.java",
28+
]),
29+
deps = [
30+
":all-libs",
31+
":build_config",
32+
":res",
33+
],
34+
)
35+
36+
android_build_config(
37+
name = "build_config",
38+
package = "com.react_native_floating_label_input",
39+
)
40+
41+
android_resource(
42+
name = "res",
43+
package = "com.react_native_floating_label_input",
44+
res = "src/main/res",
45+
)
46+
47+
android_binary(
48+
name = "app",
49+
keystore = "//android/keystores:debug",
50+
manifest = "src/main/AndroidManifest.xml",
51+
package_type = "debug",
52+
deps = [
53+
":app-code",
54+
],
55+
)

Diff for: android/app/build.gradle

+224
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
apply plugin: "com.android.application"
2+
3+
import com.android.build.OutputFile
4+
5+
/**
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
8+
* These basically call `react-native bundle` with the correct arguments during the Android build
9+
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10+
* bundle directly from the development server. Below you can see all the possible configurations
11+
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12+
* `apply from: "../../node_modules/react-native/react.gradle"` line.
13+
*
14+
* project.ext.react = [
15+
* // the name of the generated asset file containing your JS bundle
16+
* bundleAssetName: "index.android.bundle",
17+
*
18+
* // the entry file for bundle generation. If none specified and
19+
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
20+
* // default. Can be overridden with ENTRY_FILE environment variable.
21+
* entryFile: "index.android.js",
22+
*
23+
* // https://reactnative.dev/docs/performance#enable-the-ram-format
24+
* bundleCommand: "ram-bundle",
25+
*
26+
* // whether to bundle JS and assets in debug mode
27+
* bundleInDebug: false,
28+
*
29+
* // whether to bundle JS and assets in release mode
30+
* bundleInRelease: true,
31+
*
32+
* // whether to bundle JS and assets in another build variant (if configured).
33+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
34+
* // The configuration property can be in the following formats
35+
* // 'bundleIn${productFlavor}${buildType}'
36+
* // 'bundleIn${buildType}'
37+
* // bundleInFreeDebug: true,
38+
* // bundleInPaidRelease: true,
39+
* // bundleInBeta: true,
40+
*
41+
* // whether to disable dev mode in custom build variants (by default only disabled in release)
42+
* // for example: to disable dev mode in the staging build type (if configured)
43+
* devDisabledInStaging: true,
44+
* // The configuration property can be in the following formats
45+
* // 'devDisabledIn${productFlavor}${buildType}'
46+
* // 'devDisabledIn${buildType}'
47+
*
48+
* // the root of your project, i.e. where "package.json" lives
49+
* root: "../../",
50+
*
51+
* // where to put the JS bundle asset in debug mode
52+
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
53+
*
54+
* // where to put the JS bundle asset in release mode
55+
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
56+
*
57+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
58+
* // require('./image.png')), in debug mode
59+
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
60+
*
61+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
62+
* // require('./image.png')), in release mode
63+
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
64+
*
65+
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
66+
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
67+
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
68+
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
69+
* // for example, you might want to remove it from here.
70+
* inputExcludes: ["android/**", "ios/**"],
71+
*
72+
* // override which node gets called and with what additional arguments
73+
* nodeExecutableAndArgs: ["node"],
74+
*
75+
* // supply additional arguments to the packager
76+
* extraPackagerArgs: []
77+
* ]
78+
*/
79+
80+
project.ext.react = [
81+
entryFile: "index.js" ,
82+
enableHermes: true
83+
]
84+
85+
apply from: "../../node_modules/react-native/react.gradle"
86+
87+
/**
88+
* Set this to true to create two separate APKs instead of one:
89+
* - An APK that only works on ARM devices
90+
* - An APK that only works on x86 devices
91+
* The advantage is the size of the APK is reduced by about 4MB.
92+
* Upload all the APKs to the Play Store and people will download
93+
* the correct one based on the CPU architecture of their device.
94+
*/
95+
def enableSeparateBuildPerCPUArchitecture = false
96+
97+
/**
98+
* Run Proguard to shrink the Java bytecode in release builds.
99+
*/
100+
def enableProguardInReleaseBuilds = false
101+
102+
/**
103+
* The preferred build flavor of JavaScriptCore.
104+
*
105+
* For example, to use the international variant, you can use:
106+
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
107+
*
108+
* The international variant includes ICU i18n library and necessary data
109+
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
110+
* give correct results when using with locales other than en-US. Note that
111+
* this variant is about 6MiB larger per architecture than default.
112+
*/
113+
def jscFlavor = 'org.webkit:android-jsc:+'
114+
115+
/**
116+
* Whether to enable the Hermes VM.
117+
*
118+
* This should be set on project.ext.react and mirrored here. If it is not set
119+
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
120+
* and the benefits of using Hermes will therefore be sharply reduced.
121+
*/
122+
def enableHermes = project.ext.react.get("enableHermes", true);
123+
124+
android {
125+
packagingOptions {
126+
pickFirst '**/libjsc.so'
127+
pickFirst '**/libc++_shared.so'
128+
}
129+
compileSdkVersion rootProject.ext.compileSdkVersion
130+
131+
compileOptions {
132+
sourceCompatibility JavaVersion.VERSION_1_8
133+
targetCompatibility JavaVersion.VERSION_1_8
134+
}
135+
136+
defaultConfig {
137+
applicationId "com.react_native_floating_label_input"
138+
minSdkVersion rootProject.ext.minSdkVersion
139+
targetSdkVersion rootProject.ext.targetSdkVersion
140+
versionCode 1
141+
versionName "1.0"
142+
}
143+
splits {
144+
abi {
145+
reset()
146+
enable enableSeparateBuildPerCPUArchitecture
147+
universalApk false // If true, also generate a universal APK
148+
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
149+
}
150+
}
151+
signingConfigs {
152+
debug {
153+
storeFile file('debug.keystore')
154+
storePassword 'android'
155+
keyAlias 'androiddebugkey'
156+
keyPassword 'android'
157+
}
158+
}
159+
buildTypes {
160+
debug {
161+
signingConfig signingConfigs.debug
162+
}
163+
release {
164+
// Caution! In production, you need to generate your own keystore file.
165+
// see https://reactnative.dev/docs/signed-apk-android.
166+
signingConfig signingConfigs.debug
167+
minifyEnabled enableProguardInReleaseBuilds
168+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
169+
}
170+
}
171+
172+
// applicationVariants are e.g. debug, release
173+
applicationVariants.all { variant ->
174+
variant.outputs.each { output ->
175+
// For each separate APK per architecture, set a unique version code as described here:
176+
// https://developer.android.com/studio/build/configure-apk-splits.html
177+
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
178+
def abi = output.getFilter(OutputFile.ABI)
179+
if (abi != null) { // null for the universal-debug, universal-release variants
180+
output.versionCodeOverride =
181+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
182+
}
183+
184+
}
185+
}
186+
}
187+
188+
dependencies {
189+
implementation fileTree(dir: "libs", include: ["*.jar"])
190+
//noinspection GradleDynamicVersion
191+
implementation "com.facebook.react:react-native:+" // From node_modules
192+
implementation'com.facebook.soloader:soloader:0.9.0+'
193+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
194+
195+
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
196+
exclude group:'com.facebook.fbjni'
197+
}
198+
199+
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
200+
exclude group:'com.facebook.flipper'
201+
exclude group:'com.squareup.okhttp3', module:'okhttp'
202+
}
203+
204+
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
205+
exclude group:'com.facebook.flipper'
206+
}
207+
208+
if (enableHermes) {
209+
def hermesPath = "../../node_modules/hermes-engine/android/";
210+
debugImplementation files(hermesPath + "hermes-debug.aar")
211+
releaseImplementation files(hermesPath + "hermes-release.aar")
212+
} else {
213+
implementation jscFlavor
214+
}
215+
}
216+
217+
// Run this once to be able to run the application with BUCK
218+
// puts all compile dependencies into folder libs for BUCK to use
219+
task copyDownloadableDepsToLibs(type: Copy) {
220+
from configurations.compile
221+
into 'libs'
222+
}
223+
224+
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

Diff for: android/app/build_defs.bzl

+19
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+
)

Diff for: android/app/debug.keystore

2.2 KB
Binary file not shown.

Diff for: android/app/proguard-rules.pro

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:

Diff for: android/app/src/debug/AndroidManifest.xml

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

0 commit comments

Comments
 (0)