Skip to content

Commit 3610d2f

Browse files
committed
chore: upgrade to 0.68.2
1 parent 1e0f184 commit 3610d2f

File tree

62 files changed

+9083
-890
lines changed

Some content is hidden

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

62 files changed

+9083
-890
lines changed

.bundle/config

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUNDLE_PATH: "vendor/bundle"
2+
BUNDLE_FORCE_RUBY_PLATFORM: 1

.eslintrc.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ module.exports = {
33
extends: '@react-native-community',
44
parser: '@typescript-eslint/parser',
55
plugins: ['@typescript-eslint'],
6-
rules: {
7-
'react/react-in-jsx-scope': 0
8-
}
6+
overrides: [
7+
{
8+
files: ['*.ts', '*.tsx'],
9+
rules: {
10+
'@typescript-eslint/no-shadow': ['error'],
11+
'no-shadow': 'off',
12+
'no-undef': 'off',
13+
},
14+
},
15+
],
916
};

.expo/packager-info.json

-6
This file was deleted.

.gitignore

+3-8
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ build/
2828
.gradle
2929
local.properties
3030
*.iml
31-
32-
# Visual Studio Code
33-
#
34-
.vscode/
31+
*.hprof
3532

3633
# node.js
3734
#
@@ -59,8 +56,6 @@ buck-out/
5956
# Bundle artifact
6057
*.jsbundle
6158

62-
# CocoaPods
59+
# Ruby / CocoaPods
6360
/ios/Pods/
64-
lib
65-
node_modules
66-
yarn.lock
61+
/vendor/bundle/

.prettierrc.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
module.exports = {
2-
bracketSpacing: true,
3-
jsxBracketSameLine: true,
2+
printWidth: 80,
3+
tabWidth: 2,
4+
useTabs: false,
5+
semi: true,
46
singleQuote: true,
5-
trailingComma: 'all',
7+
jsxSingleQuote: false,
8+
trailingComma: 'es5',
9+
bracketSameLine: false,
10+
bracketSpacing: true,
11+
arrowParens: 'always',
12+
requirePragma: false,
13+
insertPragma: false,
14+
proseWrap: 'preserve',
15+
endOfLine: 'lf',
16+
embeddedLanguageFormatting: 'auto',
617
};

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.4

Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby '2.7.4'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

__tests__/App-test.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @format
3+
*/
4+
5+
import 'react-native';
6+
import React from 'react';
7+
import App from '../App';
8+
9+
// Note: test renderer must be required after react-native.
10+
import renderer from 'react-test-renderer';
11+
12+
it('renders correctly', () => {
13+
renderer.create(<App />);
14+
});

android/app/BUCK android/app/_BUCK

File renamed without changes.

android/app/build.gradle

+114-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: "com.android.application"
22

33
import com.android.build.OutputFile
4+
import org.apache.tools.ant.taskdefs.condition.Os
45

56
/**
67
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -20,7 +21,7 @@ import com.android.build.OutputFile
2021
* // default. Can be overridden with ENTRY_FILE environment variable.
2122
* entryFile: "index.android.js",
2223
*
23-
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
24+
* // https://reactnative.dev/docs/performance#enable-the-ram-format
2425
* bundleCommand: "ram-bundle",
2526
*
2627
* // whether to bundle JS and assets in debug mode
@@ -114,33 +115,111 @@ def jscFlavor = 'org.webkit:android-jsc:+'
114115
/**
115116
* Whether to enable the Hermes VM.
116117
*
117-
* This should be set on project.ext.react and mirrored here. If it is not set
118+
* This should be set on project.ext.react and that value will be read here. If it is not set
118119
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
119120
* and the benefits of using Hermes will therefore be sharply reduced.
120121
*/
121122
def enableHermes = project.ext.react.get("enableHermes", false);
122123

124+
/**
125+
* Architectures to build native code for.
126+
*/
127+
def reactNativeArchitectures() {
128+
def value = project.getProperties().get("reactNativeArchitectures")
129+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
130+
}
131+
123132
android {
124-
compileSdkVersion rootProject.ext.compileSdkVersion
133+
ndkVersion rootProject.ext.ndkVersion
125134

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

131137
defaultConfig {
132138
applicationId "com.reactnativeintersectionobserver"
133139
minSdkVersion rootProject.ext.minSdkVersion
134140
targetSdkVersion rootProject.ext.targetSdkVersion
135141
versionCode 1
136142
versionName "1.0"
143+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
144+
145+
if (isNewArchitectureEnabled()) {
146+
// We configure the NDK build only if you decide to opt-in for the New Architecture.
147+
externalNativeBuild {
148+
ndkBuild {
149+
arguments "APP_PLATFORM=android-21",
150+
"APP_STL=c++_shared",
151+
"NDK_TOOLCHAIN_VERSION=clang",
152+
"GENERATED_SRC_DIR=$buildDir/generated/source",
153+
"PROJECT_BUILD_DIR=$buildDir",
154+
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
155+
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
156+
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
157+
cppFlags "-std=c++17"
158+
// Make sure this target name is the same you specify inside the
159+
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
160+
targets "reactnativeintersectionobserver_appmodules"
161+
162+
// Fix for windows limit on number of character in file paths and in command lines
163+
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
164+
arguments "NDK_APP_SHORT_COMMANDS=true"
165+
}
166+
}
167+
}
168+
if (!enableSeparateBuildPerCPUArchitecture) {
169+
ndk {
170+
abiFilters (*reactNativeArchitectures())
171+
}
172+
}
173+
}
137174
}
175+
176+
if (isNewArchitectureEnabled()) {
177+
// We configure the NDK build only if you decide to opt-in for the New Architecture.
178+
externalNativeBuild {
179+
ndkBuild {
180+
path "$projectDir/src/main/jni/Android.mk"
181+
}
182+
}
183+
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
184+
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
185+
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
186+
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
187+
into("$buildDir/react-ndk/exported")
188+
}
189+
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
190+
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
191+
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
192+
into("$buildDir/react-ndk/exported")
193+
}
194+
afterEvaluate {
195+
// If you wish to add a custom TurboModule or component locally,
196+
// you should uncomment this line.
197+
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
198+
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
199+
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
200+
201+
// Due to a bug inside AGP, we have to explicitly set a dependency
202+
// between configureNdkBuild* tasks and the preBuild tasks.
203+
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
204+
configureNdkBuildRelease.dependsOn(preReleaseBuild)
205+
configureNdkBuildDebug.dependsOn(preDebugBuild)
206+
reactNativeArchitectures().each { architecture ->
207+
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
208+
dependsOn("preDebugBuild")
209+
}
210+
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
211+
dependsOn("preReleaseBuild")
212+
}
213+
}
214+
}
215+
}
216+
138217
splits {
139218
abi {
140219
reset()
141220
enable enableSeparateBuildPerCPUArchitecture
142221
universalApk false // If true, also generate a universal APK
143-
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
222+
include (*reactNativeArchitectures())
144223
}
145224
}
146225
signingConfigs {
@@ -157,30 +236,24 @@ android {
157236
}
158237
release {
159238
// Caution! In production, you need to generate your own keystore file.
160-
// see https://facebook.github.io/react-native/docs/signed-apk-android.
239+
// see https://reactnative.dev/docs/signed-apk-android.
161240
signingConfig signingConfigs.debug
162241
minifyEnabled enableProguardInReleaseBuilds
163242
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
164243
}
165244
}
166245

167-
packagingOptions {
168-
pickFirst "lib/armeabi-v7a/libc++_shared.so"
169-
pickFirst "lib/arm64-v8a/libc++_shared.so"
170-
pickFirst "lib/x86/libc++_shared.so"
171-
pickFirst "lib/x86_64/libc++_shared.so"
172-
}
173-
174246
// applicationVariants are e.g. debug, release
175247
applicationVariants.all { variant ->
176248
variant.outputs.each { output ->
177249
// For each separate APK per architecture, set a unique version code as described here:
178250
// https://developer.android.com/studio/build/configure-apk-splits.html
251+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
179252
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
180253
def abi = output.getFilter(OutputFile.ABI)
181254
if (abi != null) { // null for the universal-debug, universal-release variants
182255
output.versionCodeOverride =
183-
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
256+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
184257
}
185258

186259
}
@@ -189,17 +262,19 @@ android {
189262

190263
dependencies {
191264
implementation fileTree(dir: "libs", include: ["*.jar"])
265+
192266
//noinspection GradleDynamicVersion
193267
implementation "com.facebook.react:react-native:+" // From node_modules
194268

195269
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
196270

197271
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
198-
exclude group:'com.facebook.fbjni'
272+
exclude group:'com.facebook.fbjni'
199273
}
200274

201275
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
202276
exclude group:'com.facebook.flipper'
277+
exclude group:'com.squareup.okhttp3', module:'okhttp'
203278
}
204279

205280
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
@@ -215,11 +290,31 @@ dependencies {
215290
}
216291
}
217292

293+
if (isNewArchitectureEnabled()) {
294+
// If new architecture is enabled, we let you build RN from source
295+
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
296+
// This will be applied to all the imported transtitive dependency.
297+
configurations.all {
298+
resolutionStrategy.dependencySubstitution {
299+
substitute(module("com.facebook.react:react-native"))
300+
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
301+
}
302+
}
303+
}
304+
218305
// Run this once to be able to run the application with BUCK
219306
// puts all compile dependencies into folder libs for BUCK to use
220307
task copyDownloadableDepsToLibs(type: Copy) {
221-
from configurations.compile
308+
from configurations.implementation
222309
into 'libs'
223310
}
224311

225312
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
313+
314+
def isNewArchitectureEnabled() {
315+
// To opt-in for the New Architecture, you can either:
316+
// - Set `newArchEnabled` to true inside the `gradle.properties` file
317+
// - Invoke gradle with `-newArchEnabled=true`
318+
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
319+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
320+
}

android/app/debug.keystore

-1.52 KB
Binary file not shown.

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" android:exported="false" />
12+
</application>
813
</manifest>

android/app/src/debug/java/com/reactnativeintersectionobserver/ReactNativeFlipper.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
2+
* Copyright (c) Meta Platforms, Inc. and affiliates.
33
*
44
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
55
* directory of this source tree.
@@ -19,6 +19,7 @@
1919
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
2020
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
2121
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
22+
import com.facebook.react.ReactInstanceEventListener;
2223
import com.facebook.react.ReactInstanceManager;
2324
import com.facebook.react.bridge.ReactContext;
2425
import com.facebook.react.modules.network.NetworkingModule;
@@ -51,7 +52,7 @@ public void apply(OkHttpClient.Builder builder) {
5152
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
5253
if (reactContext == null) {
5354
reactInstanceManager.addReactInstanceEventListener(
54-
new ReactInstanceManager.ReactInstanceEventListener() {
55+
new ReactInstanceEventListener() {
5556
@Override
5657
public void onReactContextInitialized(ReactContext reactContext) {
5758
reactInstanceManager.removeReactInstanceEventListener(this);

android/app/src/main/AndroidManifest.xml

+3-4
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@
1313
<activity
1414
android:name=".MainActivity"
1515
android:label="@string/app_name"
16-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
16+
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
1717
android:launchMode="singleTask"
18-
android:windowSoftInputMode="adjustResize">
18+
android:windowSoftInputMode="adjustResize"
19+
android:exported="true">
1920
<intent-filter>
2021
<action android:name="android.intent.action.MAIN" />
2122
<category android:name="android.intent.category.LAUNCHER" />
2223
</intent-filter>
2324
</activity>
24-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2525
</application>
26-
2726
</manifest>

0 commit comments

Comments
 (0)