Skip to content

Commit bc494b7

Browse files
authored
Merge pull request #1738 from GetStream/khushal87-rn-upgrade
chore: upgrade SampleApp and TypescriptMessagingApp React Native version to 0.70.1
2 parents a168336 + 86d8595 commit bc494b7

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

+1968
-1780
lines changed

docusaurus/docs/reactnative/basics/getting_started.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ To be able to use the Stream Chat React Native SDK, a few dependencies must meet
9191

9292
| react-native | stream-chat-react-native (min required) | react-native-reanimated (min required) |
9393
| ------------ | --------------------------------------- | -------------------------------------- |
94+
| 0.70 | 5.3.1 | 2.10.0 |
9495
| 0.69 | 4.13.0 | 2.9.1 |
9596
| 0.68 | 4.11.0 | 2.7.0 |
9697
| 0.67 | 4.2.0 | 2.4.0 |

examples/SampleApp/.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23+
ios/.xcode.env.local
2324

2425
# Android/IntelliJ
2526
#
@@ -29,6 +30,7 @@ build/
2930
local.properties
3031
*.iml
3132
*.hprof
33+
.cxx/
3234

3335
# node.js
3436
#
@@ -49,9 +51,11 @@ buck-out/
4951
# For more information about the recommended setup visit:
5052
# https://docs.fastlane.tools/best-practices/source-control/
5153

52-
*/fastlane/report.xml
53-
*/fastlane/Preview.html
54-
*/fastlane/screenshots
54+
55+
**/fastlane/report.xml
56+
**/fastlane/Preview.html
57+
**/fastlane/screenshots
58+
**/fastlane/test_output
5559

5660
# Bundle artifact
5761
*.jsbundle

examples/SampleApp/android/app/build.gradle

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apply plugin: 'com.google.gms.google-services'
33
apply plugin: 'com.google.firebase.crashlytics'
44

55
import com.android.build.OutputFile
6+
import org.apache.tools.ant.taskdefs.condition.Os
67

78
/**
89
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -81,9 +82,6 @@ import com.android.build.OutputFile
8182

8283
project.ext.react = [
8384
enableHermes: true, // clean and rebuild if changing
84-
entryFile: "index.js",
85-
bundleAssetName: "index.android.bundle",
86-
bundleInRelease: true
8785
]
8886

8987
apply from: "../../node_modules/react-native/react.gradle"
@@ -128,7 +126,10 @@ def enableHermes = project.ext.react.get("enableHermes", true);
128126
/**
129127
* Architectures to build native code for in debug.
130128
*/
131-
def nativeArchitectures = project.getProperties().get("reactNativeDebugArchitectures")
129+
def reactNativeArchitectures() {
130+
def value = project.getProperties().get("reactNativeArchitectures")
131+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
132+
}
132133

133134
android {
134135
ndkVersion rootProject.ext.ndkVersion
@@ -138,32 +139,22 @@ android {
138139
defaultConfig {
139140
applicationId "com.sampleapp"
140141
minSdkVersion rootProject.ext.minSdkVersion
141-
targetSdkVersion rootProject.ext.targetSdkVersion
142142
multiDexEnabled true
143+
targetSdkVersion rootProject.ext.targetSdkVersion
143144
vectorDrawables.useSupportLibrary = true
144145
versionCode 22
145146
versionName "0.0.22"
146-
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
147-
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
148147
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
149148

150149
if (isNewArchitectureEnabled()) {
151-
// We configure the NDK build only if you decide to opt-in for the New Architecture.
150+
// We configure the CMake build only if you decide to opt-in for the New Architecture.
152151
externalNativeBuild {
153-
ndkBuild {
154-
arguments "APP_PLATFORM=android-21",
155-
"APP_STL=c++_shared",
156-
"NDK_TOOLCHAIN_VERSION=clang",
157-
"GENERATED_SRC_DIR=$buildDir/generated/source",
158-
"PROJECT_BUILD_DIR=$buildDir",
159-
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
160-
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
161-
"NODE_MODULES_DIR=$rootDir/../node_modules"
162-
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
163-
cppFlags "-std=c++17"
164-
// Make sure this target name is the same you specify inside the
165-
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
166-
targets "rndiffapp_appmodules"
152+
cmake {
153+
arguments "-DPROJECT_BUILD_DIR=$buildDir",
154+
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
155+
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
156+
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
157+
"-DANDROID_STL=c++_shared"
167158
}
168159
}
169160
if (!enableSeparateBuildPerCPUArchitecture) {
@@ -177,8 +168,8 @@ android {
177168
if (isNewArchitectureEnabled()) {
178169
// We configure the NDK build only if you decide to opt-in for the New Architecture.
179170
externalNativeBuild {
180-
ndkBuild {
181-
path "$projectDir/src/main/jni/Android.mk"
171+
cmake {
172+
path "$projectDir/src/main/jni/CMakeLists.txt"
182173
}
183174
}
184175
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
@@ -200,15 +191,15 @@ android {
200191
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
201192

202193
// Due to a bug inside AGP, we have to explicitly set a dependency
203-
// between configureNdkBuild* tasks and the preBuild tasks.
194+
// between configureCMakeDebug* tasks and the preBuild tasks.
204195
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
205-
configureNdkBuildRelease.dependsOn(preReleaseBuild)
206-
configureNdkBuildDebug.dependsOn(preDebugBuild)
196+
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
197+
configureCMakeDebug.dependsOn(preDebugBuild)
207198
reactNativeArchitectures().each { architecture ->
208-
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
199+
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
209200
dependsOn("preDebugBuild")
210201
}
211-
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
202+
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
212203
dependsOn("preReleaseBuild")
213204
}
214205
}
@@ -220,7 +211,7 @@ android {
220211
reset()
221212
enable enableSeparateBuildPerCPUArchitecture
222213
universalApk false // If true, also generate a universal APK
223-
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
214+
include (*reactNativeArchitectures())
224215
}
225216
}
226217
signingConfigs {
@@ -235,17 +226,12 @@ android {
235226
debug {
236227
signingConfig signingConfigs.debug
237228
}
238-
if (nativeArchitectures) {
239-
ndk {
240-
abiFilters nativeArchitectures.split(',')
241-
}
242-
}
229+
243230
release {
244231
// Caution! In production, you need to generate your own keystore file.
245232
// see https://reactnative.dev/docs/signed-apk-android.
246233
signingConfig signingConfigs.debug
247234
minifyEnabled enableProguardInReleaseBuilds
248-
shrinkResources enableProguardInReleaseBuilds
249235
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
250236
}
251237
}
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
<?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">
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
43

5-
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
4+
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
65

7-
<application
8-
android:usesCleartextTraffic="true"
9-
tools:targetApi="28"
10-
tools:ignore="GoogleAppIndexingWarning">
6+
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning">
117
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
128
</application>
13-
</manifest>
9+
</manifest>

examples/SampleApp/android/app/src/debug/java/com/sampleapp/ReactNativeFlipper.java

Lines changed: 1 addition & 1 deletion
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 its 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.
Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,27 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.sampleapp">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sampleapp">
32

4-
<uses-permission android:name="android.permission.INTERNET" />
5-
<uses-permission android:name="android.permission.CAMERA" />
6-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
7-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.CAMERA" />
5+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
87

9-
<queries>
10-
<intent>
11-
<action android:name="android.intent.action.VIEW" />
12-
<data android:scheme="http" android:host="*" />
13-
</intent>
14-
<intent>
15-
<action android:name="android.intent.action.VIEW" />
16-
<data android:scheme="https" android:host="*" />
17-
</intent>
18-
</queries>
8+
<queries>
9+
<intent>
10+
<action android:name="android.intent.action.VIEW" />
11+
<data android:scheme="http" android:host="*" />
12+
</intent>
13+
<intent>
14+
<action android:name="android.intent.action.VIEW" />
15+
<data android:scheme="https" android:host="*" />
16+
</intent>
17+
</queries>
1918

20-
<application
21-
android:usesCleartextTraffic="true"
22-
android:name=".MainApplication"
23-
android:label="@string/app_name"
24-
android:icon="@mipmap/ic_launcher"
25-
android:roundIcon="@mipmap/ic_launcher_round"
26-
android:allowBackup="false"
27-
android:requestLegacyExternalStorage="true"
28-
android:networkSecurityConfig="@xml/network_security_config"
29-
android:theme="@style/AppTheme">
30-
<activity
31-
android:name=".MainActivity"
32-
android:label="@string/app_name"
33-
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
34-
android:screenOrientation="portrait"
35-
android:launchMode="singleTask"
36-
android:windowSoftInputMode="adjustResize"
37-
android:exported="true">
38-
<intent-filter>
39-
<action android:name="android.intent.action.MAIN" />
40-
<category android:name="android.intent.category.LAUNCHER" />
41-
</intent-filter>
42-
</activity>
43-
</application>
44-
</manifest>
19+
<application android:usesCleartextTraffic="true" android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:requestLegacyExternalStorage="true" android:networkSecurityConfig="@xml/network_security_config" android:theme="@style/AppTheme">
20+
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:screenOrientation="portrait" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true">
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
<category android:name="android.intent.category.LAUNCHER" />
24+
</intent-filter>
25+
</activity>
26+
</application>
27+
</manifest>

examples/SampleApp/android/app/src/main/java/com/sampleapp/MainActivity.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
public class MainActivity extends ReactActivity {
99

1010
/**
11-
* Returns the name of the main component registered from JavaScript. This is used to schedule
11+
* Returns the name of the main component registered from JavaScript. This is
12+
* used to schedule
1213
* rendering of the component.
1314
*/
1415
@Override
@@ -17,18 +18,15 @@ protected String getMainComponentName() {
1718
}
1819

1920
/**
20-
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
21-
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
21+
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView
22+
* is created and
23+
* you can specify the renderer you wish to use - the new renderer (Fabric) or
24+
* the old renderer
2225
* (Paper).
23-
*/
26+
*/
2427
@Override
2528
protected ReactActivityDelegate createReactActivityDelegate() {
26-
return new ReactActivityDelegate(this, getMainComponentName()) {
27-
@Override
28-
protected ReactRootView createRootView() {
29-
return new RNGestureHandlerEnabledRootView(MainActivity.this);
30-
}
31-
};
29+
return new MainActivityDelegate(this, getMainComponentName());
3230
}
3331

3432
public static class MainActivityDelegate extends ReactActivityDelegate {
@@ -40,16 +38,16 @@ public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
4038
protected ReactRootView createRootView() {
4139
ReactRootView reactRootView = new ReactRootView(getContext());
4240
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
43-
reactRootView.setIsFabric(false);
41+
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
4442
return reactRootView;
4543
}
4644

4745
@Override
4846
protected boolean isConcurrentRootEnabled() {
49-
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
47+
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e.
48+
// React 18).
5049
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
5150
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
5251
}
5352
}
54-
}
55-
53+
}

0 commit comments

Comments
 (0)