Skip to content

Commit c4ceaf5

Browse files
Update React Native 0.73 (#50)
* Update React Native 0.73
1 parent 52bd5e2 commit c4ceaf5

27 files changed

+1432
-1202
lines changed

template/Gemfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ source 'https://rubygems.org'
22

33
ruby '>= 3.2.2'
44

5-
gem 'cocoapods', '~> 1.12'
5+
gem 'cocoapods', '~> 1.13'
6+
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'

template/__tests__/App.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { describe, it } from '@jest/globals';
2+
import { describe, it, beforeEach, afterEach } from '@jest/globals';
33
import { screen, render, waitFor } from '@testing-library/react-native';
44
import { container, singleton } from 'tsyringe';
55
import App from '../src/App';

template/android/app/build.gradle

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

45
/** You can configure this mapping with different .env files for each of your build variants
@@ -83,7 +84,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
8384
android {
8485
ndkVersion rootProject.ext.ndkVersion
8586

86-
compileSdkVersion rootProject.ext.compileSdkVersion
87+
buildToolsVersion rootProject.ext.buildToolsVersion
88+
compileSdk rootProject.ext.compileSdkVersion
8789

8890
namespace "com.projectname"
8991
defaultConfig {
@@ -122,13 +124,8 @@ android {
122124
dependencies {
123125
// The version of react-native is set by the React Native Gradle Plugin
124126
implementation("com.facebook.react:react-android")
125-
126-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
127-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
128-
exclude group:'com.squareup.okhttp3', module:'okhttp'
129-
}
130-
131-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
127+
implementation("com.facebook.react:flipper-integration")
128+
132129
if (hermesEnabled.toBoolean()) {
133130
implementation("com.facebook.react:hermes-android")
134131
} else {

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
6-
75
<application
86
android:usesCleartextTraffic="true"
97
tools:targetApi="28"
10-
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12-
</application>
8+
tools:ignore="GoogleAppIndexingWarning"/>
139
</manifest>

template/android/app/src/debug/java/com/projectname/ReactNativeFlipper.java

-75
This file was deleted.

template/android/app/src/main/java/com/projectname/MainActivity.java

-33
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.projectname;
2+
3+
import com.facebook.react.ReactActivity
4+
import com.facebook.react.ReactActivityDelegate
5+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6+
import com.facebook.react.defaults.DefaultReactActivityDelegate
7+
8+
class MainActivity : ReactActivity() {
9+
10+
/**
11+
* Returns the name of the main component registered from JavaScript. This is used to schedule
12+
* rendering of the component.
13+
*/
14+
override fun getMainComponentName(): String = "ProjectName"
15+
16+
/**
17+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19+
*/
20+
override fun createReactActivityDelegate(): ReactActivityDelegate =
21+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22+
}

template/android/app/src/main/java/com/projectname/MainApplication.java

-62
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package com.projectname;
2+
3+
import android.app.Application
4+
import com.facebook.react.PackageList
5+
import com.facebook.react.ReactApplication
6+
import com.facebook.react.ReactHost
7+
import com.facebook.react.ReactNativeHost
8+
import com.facebook.react.ReactPackage
9+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11+
import com.facebook.react.defaults.DefaultReactNativeHost
12+
import com.facebook.react.flipper.ReactNativeFlipper
13+
import com.facebook.soloader.SoLoader
14+
15+
class MainApplication : Application(), ReactApplication {
16+
17+
override val reactNativeHost: ReactNativeHost =
18+
object : DefaultReactNativeHost(this) {
19+
override fun getPackages(): List<ReactPackage> {
20+
// Packages that cannot be autolinked yet can be added manually here, for example:
21+
// packages.add(new MyReactNativePackage());
22+
return PackageList(this).packages
23+
}
24+
25+
override fun getJSMainModuleName(): String = "index"
26+
27+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28+
29+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31+
}
32+
33+
override val reactHost: ReactHost
34+
get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
35+
36+
override fun onCreate() {
37+
super.onCreate()
38+
SoLoader.init(this, false)
39+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40+
// If you opted-in for the New Architecture, we load the native entry point for this app.
41+
load()
42+
}
43+
ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
44+
}
45+
}

template/android/app/src/release/java/com/projectname/ReactNativeFlipper.java

-20
This file was deleted.

template/android/build.gradle

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
42
ext {
5-
buildToolsVersion = "33.0.0"
3+
buildToolsVersion = "34.0.0"
64
minSdkVersion = 21
7-
compileSdkVersion = 33
8-
targetSdkVersion = 33
9-
10-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11-
ndkVersion = "23.1.7779620"
5+
compileSdkVersion = 34
6+
targetSdkVersion = 34
7+
ndkVersion = "25.1.8937393"
8+
kotlinVersion = "1.8.0"
129
}
1310
repositories {
1411
google()
@@ -17,5 +14,8 @@ buildscript {
1714
dependencies {
1815
classpath("com.android.tools.build:gradle")
1916
classpath("com.facebook.react:react-native-gradle-plugin")
17+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
2018
}
2119
}
20+
21+
apply plugin: "com.facebook.react.rootproject"

template/android/gradle.properties

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ android.useAndroidX=true
2424
# Automatically convert third-party libraries to use AndroidX
2525
android.enableJetifier=true
2626

27-
# Version of flipper SDK to use with React Native
28-
FLIPPER_VERSION=0.182.0
29-
3027
# Use this property to specify which architecture you want to build.
3128
# You can also override it from the CLI using
3229
# ./gradlew <task> -PreactNativeArchitectures=x86_64
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)