Skip to content

Commit ec8c359

Browse files
Update deps, remove code for ios < 11
1 parent d5fab0b commit ec8c359

38 files changed

+6008
-8874
lines changed

.prettierrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"singleQuote": true,
33
"trailingComma": "all",
44
"bracketSpacing": true,
5-
"jsxBracketSameLine": false
5+
"bracketSameLine": false
66
}

babel.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ module.exports = {
99
},
1010
},
1111
],
12+
'react-native-reanimated/plugin',
1213
],
1314
};
File renamed without changes.

example/android/app/build.gradle

+38-24
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,15 @@ import com.android.build.OutputFile
7777
* ]
7878
*/
7979

80+
def nodeModulesRoot = "../../../node_modules"
81+
8082
project.ext.react = [
83+
cliPath: "$nodeModulesRoot/react-native/cli.js",
8184
entryFile: "example/index.js",
82-
enableHermes: false, // clean and rebuild if changing
85+
enableHermes: true, // clean and rebuild if changing
8386
]
8487

85-
apply from: "../../../node_modules/react-native/react.gradle"
88+
apply from: "$nodeModulesRoot/react-native/react.gradle"
8689

8790
/**
8891
* Set this to true to create two separate APKs instead of one:
@@ -115,19 +118,21 @@ def jscFlavor = 'org.webkit:android-jsc:+'
115118
/**
116119
* Whether to enable the Hermes VM.
117120
*
118-
* This should be set on project.ext.react and mirrored here. If it is not set
121+
* This should be set on project.ext.react and that value will be read here. If it is not set
119122
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
120123
* and the benefits of using Hermes will therefore be sharply reduced.
121124
*/
122125
def enableHermes = project.ext.react.get("enableHermes", false);
123126

127+
/**
128+
* Architectures to build native code for in debug.
129+
*/
130+
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
131+
124132
android {
125-
compileSdkVersion rootProject.ext.compileSdkVersion
133+
ndkVersion rootProject.ext.ndkVersion
126134

127-
compileOptions {
128-
sourceCompatibility JavaVersion.VERSION_1_8
129-
targetCompatibility JavaVersion.VERSION_1_8
130-
}
135+
compileSdkVersion rootProject.ext.compileSdkVersion
131136

132137
defaultConfig {
133138
applicationId "com.safeareaviewexample"
@@ -144,9 +149,22 @@ android {
144149
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
145150
}
146151
}
152+
signingConfigs {
153+
debug {
154+
storeFile file('debug.keystore')
155+
storePassword 'android'
156+
keyAlias 'androiddebugkey'
157+
keyPassword 'android'
158+
}
159+
}
147160
buildTypes {
148161
debug {
149162
signingConfig signingConfigs.debug
163+
if (nativeArchitectures) {
164+
ndk {
165+
abiFilters nativeArchitectures.split(',')
166+
}
167+
}
150168
}
151169
release {
152170
// Caution! In production, you need to generate your own keystore file.
@@ -162,24 +180,16 @@ android {
162180
variant.outputs.each { output ->
163181
// For each separate APK per architecture, set a unique version code as described here:
164182
// https://developer.android.com/studio/build/configure-apk-splits.html
183+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
165184
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
166185
def abi = output.getFilter(OutputFile.ABI)
167186
if (abi != null) { // null for the universal-debug, universal-release variants
168187
output.versionCodeOverride =
169-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
188+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
170189
}
171190

172191
}
173192
}
174-
175-
packagingOptions {
176-
pickFirst '**/armeabi-v7a/libc++_shared.so'
177-
pickFirst '**/x86/libc++_shared.so'
178-
pickFirst '**/arm64-v8a/libc++_shared.so'
179-
pickFirst '**/x86_64/libc++_shared.so'
180-
pickFirst '**/x86/libjsc.so'
181-
pickFirst '**/armeabi-v7a/libjsc.so'
182-
}
183193
}
184194

185195
dependencies {
@@ -188,22 +198,26 @@ dependencies {
188198
implementation "com.facebook.react:react-native:+" // From node_modules
189199

190200
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
201+
191202
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
192-
exclude group:'com.facebook.fbjni'
203+
exclude group:'com.facebook.fbjni'
193204
}
205+
194206
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
195207
exclude group:'com.facebook.flipper'
208+
exclude group:'com.squareup.okhttp3', module:'okhttp'
196209
}
210+
197211
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
198212
exclude group:'com.facebook.flipper'
199213
}
200214

201215
if (enableHermes) {
202-
def hermesPath = "../../../node_modules/hermesvm/android/";
203-
debugImplementation files(hermesPath + "hermes-debug.aar")
204-
releaseImplementation files(hermesPath + "hermes-release.aar")
216+
def hermesPath = "../../../node_modules/hermes-engine/android/";
217+
debugImplementation files(hermesPath + "hermes-debug.aar")
218+
releaseImplementation files(hermesPath + "hermes-release.aar")
205219
} else {
206-
implementation jscFlavor
220+
implementation jscFlavor
207221
}
208222

209223
implementation project(":react-native-community-async-storage")
@@ -217,6 +231,6 @@ dependencies {
217231
// Run this once to be able to run the application with BUCK
218232
// puts all compile dependencies into folder libs for BUCK to use
219233
task copyDownloadableDepsToLibs(type: Copy) {
220-
from configurations.compile
234+
from configurations.implementation
221235
into 'libs'
222236
}

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application
8+
android:usesCleartextTraffic="true"
9+
tools:targetApi="28"
10+
tools:ignore="GoogleAppIndexingWarning">
11+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
12+
</application>
813
</manifest>

example/android/app/src/debug/java/com/safeareaviewexample/ReactNativeFlipper.java

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* directory of this source tree.
66
*/
77
package com.safeareaviewexample;
8+
89
import android.content.Context;
910
import com.facebook.flipper.android.AndroidFlipperClient;
1011
import com.facebook.flipper.android.utils.FlipperUtils;
@@ -22,15 +23,18 @@
2223
import com.facebook.react.bridge.ReactContext;
2324
import com.facebook.react.modules.network.NetworkingModule;
2425
import okhttp3.OkHttpClient;
26+
2527
public class ReactNativeFlipper {
2628
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
2729
if (FlipperUtils.shouldEnableFlipper(context)) {
2830
final FlipperClient client = AndroidFlipperClient.getInstance(context);
31+
2932
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
3033
client.addPlugin(new ReactFlipperPlugin());
3134
client.addPlugin(new DatabasesFlipperPlugin(context));
3235
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
3336
client.addPlugin(CrashReporterPlugin.getInstance());
37+
3438
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
3539
NetworkingModule.setCustomClientBuilder(
3640
new NetworkingModule.CustomClientBuilder() {
@@ -41,6 +45,7 @@ public void apply(OkHttpClient.Builder builder) {
4145
});
4246
client.addPlugin(networkFlipperPlugin);
4347
client.start();
48+
4449
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
4550
// Hence we run if after all native modules have been initialized
4651
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();

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

-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,5 @@
2121
<category android:name="android.intent.category.LAUNCHER" />
2222
</intent-filter>
2323
</activity>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2524
</application>
26-
2725
</manifest>

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

+7
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import com.swmansion.gesturehandler.react.RNGestureHandlerPackage;
1515
import com.swmansion.reanimated.ReanimatedPackage;
1616
import com.reactnativecommunity.asyncstorage.AsyncStoragePackage;
17+
import com.facebook.react.bridge.JSIModulePackage;
18+
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
1719

1820
import java.lang.reflect.InvocationTargetException;
1921
import java.util.Arrays;
@@ -38,6 +40,11 @@ protected List<ReactPackage> getPackages() {
3840
new SafeAreaContextPackage());
3941
}
4042

43+
@Override
44+
protected JSIModulePackage getJSIModulePackage() {
45+
return new ReanimatedJSIModulePackage();
46+
}
47+
4148
@Override
4249
protected String getJSMainModuleName() {
4350
return "example/index";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2014 The Android Open Source Project
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<inset xmlns:android="http://schemas.android.com/apk/res/android"
17+
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18+
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19+
android:insetTop="@dimen/abc_edit_text_inset_top_material"
20+
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
21+
22+
<selector>
23+
<!--
24+
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
25+
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
26+
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
27+
28+
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
29+
30+
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
31+
-->
32+
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
33+
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
34+
</selector>
35+
36+
</inset>

example/android/app/src/main/res/values-v28/styles.xml

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">Hello App Display Name</string>
2+
<string name="app_name">SafeAreaViewExample</string>
33
</resources>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
55
<!-- Customize your theme here. -->
6-
<item name="android:textColor">#000000</item>
6+
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
77
</style>
88

99
</resources>

example/android/build.gradle

+14-9
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "29.0.2"
6-
minSdkVersion = 16
7-
compileSdkVersion = 29
8-
targetSdkVersion = 29
5+
buildToolsVersion = "30.0.2"
6+
minSdkVersion = 21
7+
compileSdkVersion = 30
8+
targetSdkVersion = 30
9+
ndkVersion = "21.4.7075529"
910
}
1011
repositories {
1112
google()
12-
jcenter()
13+
mavenCentral()
1314
}
1415
dependencies {
15-
classpath("com.android.tools.build:gradle:3.5.3")
16+
classpath("com.android.tools.build:gradle:4.2.2")
1617
// NOTE: Do not place your application dependencies here; they belong
1718
// in the individual module build.gradle files
1819
}
1920
}
2021

2122
allprojects {
2223
repositories {
23-
mavenLocal()
2424
maven {
2525
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
2626
url("$rootDir/../../node_modules/react-native/android")
@@ -29,9 +29,14 @@ allprojects {
2929
// Android JSC is installed from npm
3030
url("$rootDir/../../node_modules/jsc-android/dist")
3131
}
32-
32+
mavenCentral {
33+
// We don't want to fetch react-native from Maven Central as there are
34+
// older versions over there.
35+
content {
36+
excludeGroup "com.facebook.react"
37+
}
38+
}
3339
google()
34-
jcenter()
3540
maven { url 'https://www.jitpack.io' }
3641
}
3742
}

example/android/gradle.properties

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# Specifies the JVM arguments used for the daemon process.
1111
# The setting is particularly useful for tweaking memory settings.
12-
# Default value: -Xmx10248m -XX:MaxPermSize=256m
12+
# Default value: -Xmx1024m -XX:MaxPermSize=256m
1313
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
1414

1515
# When configured, Gradle will run in incubating parallel mode.
@@ -23,5 +23,6 @@
2323
android.useAndroidX=true
2424
# Automatically convert third-party libraries to use AndroidX
2525
android.enableJetifier=true
26+
2627
# Version of flipper SDK to use with React Native
27-
FLIPPER_VERSION=0.33.1
28+
FLIPPER_VERSION=0.99.0
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

example/android/gradlew

+2
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

0 commit comments

Comments
 (0)