Skip to content

Commit 928ccf9

Browse files
committed
chore: update example RN version
1 parent 3025244 commit 928ccf9

File tree

11 files changed

+32
-87
lines changed

11 files changed

+32
-87
lines changed

example/android/app/build.gradle

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
apply plugin: "com.android.application"
22
apply plugin: "com.facebook.react"
33

4-
import com.android.build.OutputFile
5-
64
/**
75
* This is the configuration block to customize your React Native Android app.
86
* By default you don't need to apply any configuration, just uncomment the lines you need.
@@ -52,14 +50,6 @@ react {
5250
// hermesFlags = ["-O", "-output-source-map"]
5351
}
5452

55-
/**
56-
* Set this to true to create four separate APKs instead of one,
57-
* one for each native architecture. This is useful if you don't
58-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
59-
* and want to have separate APKs to upload to the Play Store.
60-
*/
61-
def enableSeparateBuildPerCPUArchitecture = false
62-
6353
/**
6454
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
6555
*/
@@ -78,16 +68,6 @@ def enableProguardInReleaseBuilds = false
7868
*/
7969
def jscFlavor = 'org.webkit:android-jsc:+'
8070

81-
/**
82-
* Private function to get the list of Native Architectures you want to build.
83-
* This reads the value from reactNativeArchitectures in your gradle.properties
84-
* file and works together with the --active-arch-only flag of react-native run-android.
85-
*/
86-
def reactNativeArchitectures() {
87-
def value = project.getProperties().get("reactNativeArchitectures")
88-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
89-
}
90-
9171
android {
9272
ndkVersion rootProject.ext.ndkVersion
9373

@@ -101,15 +81,6 @@ android {
10181
versionCode 1
10282
versionName "1.0"
10383
}
104-
105-
splits {
106-
abi {
107-
reset()
108-
enable enableSeparateBuildPerCPUArchitecture
109-
universalApk false // If true, also generate a universal APK
110-
include (*reactNativeArchitectures())
111-
}
112-
}
11384
signingConfigs {
11485
debug {
11586
storeFile file('debug.keystore')
@@ -130,30 +101,12 @@ android {
130101
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
131102
}
132103
}
133-
134-
// applicationVariants are e.g. debug, release
135-
applicationVariants.all { variant ->
136-
variant.outputs.each { output ->
137-
// For each separate APK per architecture, set a unique version code as described here:
138-
// https://developer.android.com/studio/build/configure-apk-splits.html
139-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
140-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
141-
def abi = output.getFilter(OutputFile.ABI)
142-
if (abi != null) { // null for the universal-debug, universal-release variants
143-
output.versionCodeOverride =
144-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
145-
}
146-
147-
}
148-
}
149104
}
150105

151106
dependencies {
152107
// The version of react-native is set by the React Native Gradle Plugin
153108
implementation("com.facebook.react:react-android")
154109

155-
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
156-
157110
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
158111
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
159112
exclude group:'com.squareup.okhttp3', module:'okhttp'

example/android/app/src/main/java/com/fileaccessexample/MainActivity.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ protected ReactActivityDelegate createReactActivityDelegate() {
2727
this,
2828
getMainComponentName(),
2929
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
30-
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
31-
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
32-
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
33-
);
30+
DefaultNewArchitectureEntryPoint.getFabricEnabled());
3431
}
3532
}

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
mavenCentral()
1616
}
1717
dependencies {
18-
classpath("com.android.tools.build:gradle:7.3.1")
18+
classpath("com.android.tools.build:gradle")
1919
classpath("com.facebook.react:react-native-gradle-plugin")
2020
}
2121
}

example/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ android.useAndroidX=true
2525
android.enableJetifier=true
2626

2727
# Version of flipper SDK to use with React Native
28-
FLIPPER_VERSION=0.125.0
28+
FLIPPER_VERSION=0.182.0
2929

3030
# Use this property to specify which architecture you want to build.
3131
# You can also override it from the CLI using
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

example/android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rootProject.name = 'FileAccessExample'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
4-
includeBuild('../node_modules/react-native-gradle-plugin')
4+
includeBuild('../node_modules/@react-native/gradle-plugin')

example/ios/FileAccessExample.xcodeproj/project.pbxproj

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -601,17 +601,14 @@
601601
);
602602
MTL_ENABLE_DEBUG_INFO = YES;
603603
ONLY_ACTIVE_ARCH = YES;
604+
OTHER_CFLAGS = "$(inherited)";
604605
OTHER_CPLUSPLUSFLAGS = (
605606
"$(OTHER_CFLAGS)",
606607
"-DFOLLY_NO_CONFIG",
607608
"-DFOLLY_MOBILE=1",
608609
"-DFOLLY_USE_LIBCPP=1",
609610
);
610-
OTHER_LDFLAGS = (
611-
"$(inherited)",
612-
"-Wl",
613-
"-ld_classic",
614-
);
611+
OTHER_LDFLAGS = "$(inherited)";
615612
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
616613
SDKROOT = iphoneos;
617614
};
@@ -674,17 +671,14 @@
674671
"\"$(inherited)\"",
675672
);
676673
MTL_ENABLE_DEBUG_INFO = NO;
674+
OTHER_CFLAGS = "$(inherited)";
677675
OTHER_CPLUSPLUSFLAGS = (
678676
"$(OTHER_CFLAGS)",
679677
"-DFOLLY_NO_CONFIG",
680678
"-DFOLLY_MOBILE=1",
681679
"-DFOLLY_USE_LIBCPP=1",
682680
);
683-
OTHER_LDFLAGS = (
684-
"$(inherited)",
685-
"-Wl",
686-
"-ld_classic",
687-
);
681+
OTHER_LDFLAGS = "$(inherited)";
688682
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
689683
SDKROOT = iphoneos;
690684
VALIDATE_PRODUCT = YES;

example/ios/FileAccessExample/AppDelegate.mm

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,4 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
2323
#endif
2424
}
2525

26-
/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
27-
///
28-
/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
29-
/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
30-
/// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
31-
- (BOOL)concurrentRootEnabled
32-
{
33-
return true;
34-
}
35-
3626
@end

example/ios/Podfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
require_relative '../node_modules/react-native/scripts/react_native_pods'
2-
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
1+
# Resolve react_native_pods.rb with node to allow for hoisting
2+
require Pod::Executable.execute_command('node', ['-p',
3+
'require.resolve(
4+
"react-native/scripts/react_native_pods.rb",
5+
{paths: [process.argv[1]]},
6+
)', __dir__]).strip
37

48
platform :ios, min_ios_version_supported
59
prepare_react_native_project!
@@ -49,10 +53,10 @@ target 'FileAccessExample' do
4953
end
5054

5155
post_install do |installer|
56+
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
5257
react_native_post_install(
5358
installer,
54-
# Set `mac_catalyst_enabled` to `true` in order to apply patches
55-
# necessary for Mac Catalyst builds
59+
config[:reactNativePath],
5660
:mac_catalyst_enabled => false
5761
)
5862
__apply_Xcode_12_5_M1_post_install_workaround(installer)

example/metro.config.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
12
const path = require('path');
23
const escape = require('escape-string-regexp');
34
const exclusionList = require('metro-config/src/defaults/exclusionList');
45
const pak = require('../package.json');
56

67
const root = path.resolve(__dirname, '..');
8+
const modules = Object.keys({ ...pak.peerDependencies });
79

8-
const modules = Object.keys({
9-
...pak.peerDependencies,
10-
});
11-
12-
module.exports = {
13-
projectRoot: __dirname,
10+
/**
11+
* Metro configuration
12+
* https://facebook.github.io/metro/docs/configuration
13+
*
14+
* @type {import('metro-config').MetroConfig}
15+
*/
16+
const config = {
1417
watchFolders: [root],
1518

1619
// We need to make sure that only one version is loaded for peerDependencies
@@ -38,3 +41,5 @@ module.exports = {
3841
}),
3942
},
4043
};
44+
45+
module.exports = mergeConfig(getDefaultConfig(__dirname), config);

example/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
},
1212
"dependencies": {
1313
"react": "18.2.0",
14-
"react-native": "0.71.15"
14+
"react-native": "0.72.12"
1515
},
1616
"devDependencies": {
1717
"@babel/core": "^7.20.0",
1818
"@babel/preset-env": "^7.20.0",
1919
"@babel/runtime": "^7.20.0",
20+
"@react-native/metro-config": "^0.72.12",
2021
"babel-plugin-module-resolver": "^4.1.0",
21-
"metro-react-native-babel-preset": "0.73.10"
22+
"metro-react-native-babel-preset": "^0.76.9"
2223
}
2324
}

0 commit comments

Comments
 (0)