Skip to content

Commit d868050

Browse files
authored
react-native example: update to react-native 0.75.3 boilerplate code (#292)
* react-native example: update to newest react-native boilerplate code * react-native example: change attach to RN app type in launch.json * react-native example: rename app name to reactNative * react-native example: remove @backtrace/react dep * react-native example: restore Android .java classes, remove Kotlin * react-native example: remove debug test method * react-native example: remove SuppressWarnings and comments from MainApplication.getPackages --------- Co-authored-by: Sebastian Alex <sebastian.alex@saucelabs.com>
1 parent 5413463 commit d868050

35 files changed

+8422
-17380
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "Attach to react native app",
66
"cwd": "${workspaceFolder}/examples/sdk/reactNative",
7-
"type": "reactnative",
7+
"type": "reactnativedirect",
88
"request": "attach",
99
"skipFiles": ["<node_internals>/**", "${workspaceFolder}/node_modules/tslib/**/*.js"]
1010
},

examples/sdk/reactNative/.gitignore

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

2525
# Android/IntelliJ
2626
#
@@ -56,11 +56,19 @@ yarn-error.log
5656
*.jsbundle
5757

5858
# Ruby / CocoaPods
59-
/ios/Pods/
59+
**/Pods/
6060
/vendor/bundle/
6161

6262
# Temporary files created by Metro to check the health of the file watcher
6363
.metro-health-check*
6464

6565
# testing
6666
/coverage
67+
68+
# Yarn
69+
.yarn/*
70+
!.yarn/patches
71+
!.yarn/plugins
72+
!.yarn/releases
73+
!.yarn/sdks
74+
!.yarn/versions

examples/sdk/reactNative/Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.12'
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,35 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
CFPropertyList (3.0.6)
4+
CFPropertyList (3.0.7)
5+
base64
6+
nkf
57
rexml
6-
activesupport (6.1.7.4)
8+
activesupport (7.1.4)
9+
base64
10+
bigdecimal
711
concurrent-ruby (~> 1.0, >= 1.0.2)
12+
connection_pool (>= 2.2.5)
13+
drb
814
i18n (>= 1.6, < 2)
915
minitest (>= 5.1)
16+
mutex_m
1017
tzinfo (~> 2.0)
11-
zeitwerk (~> 2.3)
12-
addressable (2.8.5)
13-
public_suffix (>= 2.0.2, < 6.0)
18+
addressable (2.8.7)
19+
public_suffix (>= 2.0.2, < 7.0)
1420
algoliasearch (1.27.5)
1521
httpclient (~> 2.8, >= 2.8.3)
1622
json (>= 1.5.1)
1723
atomos (0.1.3)
24+
base64 (0.2.0)
25+
bigdecimal (3.1.8)
1826
claide (1.1.0)
19-
cocoapods (1.12.1)
27+
cocoapods (1.15.2)
2028
addressable (~> 2.8)
2129
claide (>= 1.0.2, < 2.0)
22-
cocoapods-core (= 1.12.1)
30+
cocoapods-core (= 1.15.2)
2331
cocoapods-deintegrate (>= 1.0.3, < 2.0)
24-
cocoapods-downloader (>= 1.6.0, < 2.0)
32+
cocoapods-downloader (>= 2.1, < 3.0)
2533
cocoapods-plugins (>= 1.0.0, < 2.0)
2634
cocoapods-search (>= 1.0.0, < 2.0)
2735
cocoapods-trunk (>= 1.6.0, < 2.0)
@@ -33,8 +41,8 @@ GEM
3341
molinillo (~> 0.8.0)
3442
nap (~> 1.0)
3543
ruby-macho (>= 2.3.0, < 3.0)
36-
xcodeproj (>= 1.21.0, < 2.0)
37-
cocoapods-core (1.12.1)
44+
xcodeproj (>= 1.23.0, < 2.0)
45+
cocoapods-core (1.15.2)
3846
activesupport (>= 5.0, < 8)
3947
addressable (~> 2.8)
4048
algoliasearch (~> 1.0)
@@ -45,7 +53,7 @@ GEM
4553
public_suffix (~> 4.0)
4654
typhoeus (~> 1.0)
4755
cocoapods-deintegrate (1.0.5)
48-
cocoapods-downloader (1.6.3)
56+
cocoapods-downloader (2.1)
4957
cocoapods-plugins (1.0.0)
5058
nap
5159
cocoapods-search (1.0.1)
@@ -54,47 +62,51 @@ GEM
5462
netrc (~> 0.11)
5563
cocoapods-try (1.2.0)
5664
colored2 (3.1.2)
57-
concurrent-ruby (1.2.2)
65+
concurrent-ruby (1.3.4)
66+
connection_pool (2.4.1)
67+
drb (2.2.1)
5868
escape (0.0.4)
5969
ethon (0.16.0)
6070
ffi (>= 1.15.0)
61-
ffi (1.15.5)
71+
ffi (1.17.0)
6272
fourflusher (2.3.1)
6373
fuzzy_match (2.0.4)
6474
gh_inspector (1.1.3)
6575
httpclient (2.8.3)
66-
i18n (1.14.1)
76+
i18n (1.14.6)
6777
concurrent-ruby (~> 1.0)
68-
json (2.6.3)
69-
minitest (5.19.0)
78+
json (2.7.2)
79+
minitest (5.25.1)
7080
molinillo (0.8.0)
81+
mutex_m (0.2.0)
7182
nanaimo (0.3.0)
7283
nap (1.1.0)
7384
netrc (0.11.0)
85+
nkf (0.2.0)
7486
public_suffix (4.0.7)
75-
rexml (3.2.6)
87+
rexml (3.3.8)
7688
ruby-macho (2.5.1)
77-
typhoeus (1.4.0)
89+
typhoeus (1.4.1)
7890
ethon (>= 0.9.0)
7991
tzinfo (2.0.6)
8092
concurrent-ruby (~> 1.0)
81-
xcodeproj (1.22.0)
93+
xcodeproj (1.25.0)
8294
CFPropertyList (>= 2.3.3, < 4.0)
8395
atomos (~> 0.1.3)
8496
claide (>= 1.0.2, < 2.0)
8597
colored2 (~> 3.1)
8698
nanaimo (~> 0.3.0)
87-
rexml (~> 3.2.4)
88-
zeitwerk (2.6.11)
99+
rexml (>= 3.3.2, < 4.0)
89100

90101
PLATFORMS
91102
ruby
92103

93104
DEPENDENCIES
94-
cocoapods (~> 1.12)
105+
activesupport (>= 6.1.7.5, != 7.1.0)
106+
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
95107

96108
RUBY VERSION
97-
ruby 2.6.10p210
109+
ruby 2.7.8p225
98110

99111
BUNDLED WITH
100-
1.17.2
112+
2.1.4

examples/sdk/reactNative/android/app/build.gradle

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ apply plugin: "com.facebook.react"
77
*/
88
react {
99
/* Folders */
10-
// The root of your project, i.e. where "package.json" lives. Default is '..'
11-
// root = file("../")
12-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
13-
// reactNativeDir = file("../node_modules/react-native")
14-
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
15-
// codegenDir = file("../node_modules/@react-native/codegen")
16-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
17-
// cliFile = file("../node_modules/react-native/cli.js")
10+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
11+
// root = file("../../")
12+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
13+
// reactNativeDir = file("../../node_modules/react-native")
14+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
15+
// codegenDir = file("../../node_modules/@react-native/codegen")
16+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
17+
// cliFile = file("../../node_modules/react-native/cli.js")
1818

1919
/* Variants */
2020
// The list of variants to that are debuggable. For those we're going to
2121
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
2222
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
23-
debuggableVariants = ["release"]
23+
// debuggableVariants = ["liteDebug", "prodDebug"]
2424

2525
/* Bundling */
2626
// A list containing the node command and its flags. Default is just 'node'.
@@ -48,6 +48,9 @@ react {
4848
//
4949
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5050
// hermesFlags = ["-O", "-output-source-map"]
51+
52+
/* Autolinking */
53+
autolinkLibrariesWithApp()
5154
}
5255

5356
/**
@@ -70,8 +73,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
7073

7174
android {
7275
ndkVersion rootProject.ext.ndkVersion
73-
74-
compileSdkVersion rootProject.ext.compileSdkVersion
76+
buildToolsVersion rootProject.ext.buildToolsVersion
77+
compileSdk rootProject.ext.compileSdkVersion
7578

7679
namespace "com.reactnative"
7780
defaultConfig {
@@ -107,17 +110,9 @@ dependencies {
107110
// The version of react-native is set by the React Native Gradle Plugin
108111
implementation("com.facebook.react:react-android")
109112

110-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
111-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
112-
exclude group:'com.squareup.okhttp3', module:'okhttp'
113-
}
114-
115-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
116113
if (hermesEnabled.toBoolean()) {
117114
implementation("com.facebook.react:hermes-android")
118115
} else {
119116
implementation jscFlavor
120117
}
121118
}
122-
123-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

examples/sdk/reactNative/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 5 deletions
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>

examples/sdk/reactNative/android/app/src/debug/java/com/reactnative/ReactNativeFlipper.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

examples/sdk/reactNative/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
android:icon="@mipmap/ic_launcher"
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
11-
android:theme="@style/AppTheme">
11+
android:theme="@style/AppTheme"
12+
android:supportsRtl="true">
1213
<activity
1314
android:name=".MainActivity"
1415
android:label="@string/app_name"

examples/sdk/reactNative/android/app/src/main/java/com/reactnative/BacktraceDemoPackage.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,18 @@
1010
import java.util.List;
1111

1212
public class BacktraceDemoPackage implements ReactPackage {
13+
@Override
14+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
15+
return Collections.emptyList();
16+
}
1317

14-
@Override
15-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
16-
return Collections.emptyList();
17-
}
18+
@Override
19+
public List<NativeModule> createNativeModules(
20+
ReactApplicationContext reactContext) {
21+
List<NativeModule> modules = new ArrayList<>();
1822

19-
@Override
20-
public List<NativeModule> createNativeModules(
21-
ReactApplicationContext reactContext) {
22-
List<NativeModule> modules = new ArrayList<>();
23+
modules.add(new ErrorGenerator(reactContext));
2324

24-
modules.add(new ErrorGenerator(reactContext));
25-
26-
return modules;
27-
}
28-
29-
}
25+
return modules;
26+
}
27+
}

0 commit comments

Comments
 (0)