Skip to content

Commit bc7beee

Browse files
authored
Next version 8.x (#249)
New version 8.x - perf. optimization: add optional React Compiler - reduce bundle size: split web code via `.web` extention - debugging: no anonymous functions - Update example
1 parent f465d0c commit bc7beee

Some content is hidden

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

44 files changed

+12471
-565
lines changed

.eslintrc.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ module.exports = {
22
parser: '@typescript-eslint/parser',
33
extends: [
44
'plugin:react/recommended',
5+
'plugin:react-hooks/recommended-legacy',
56
'plugin:@typescript-eslint/recommended',
67
'plugin:prettier/recommended',
78
],
9+
plugins: ['react-compiler'],
810
parserOptions: {
9-
ecmaVersion: 2023,
11+
ecmaVersion: 2025,
1012
sourceType: 'module',
1113
ecmaFeatures: {jsx: true},
1214
},
@@ -16,6 +18,9 @@ module.exports = {
1618
},
1719
},
1820
rules: {
19-
"@typescript-eslint/no-explicit-any": "off",
20-
}
21+
'@typescript-eslint/no-explicit-any': 'off',
22+
'react-compiler/react-compiler': 'error',
23+
'react-hooks/rules-of-hooks': 'error',
24+
'react-hooks/exhaustive-deps': 'error',
25+
},
2126
};

examples/DemoCodeField/.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
*.xcworkspace/
44
*.zip
55
.DS_Store
6+
.bundle/*
7+
!.bundle/config
68
.gradle/
79
.idea/
810
.vs/
11+
.xcode.env
912
Pods/
1013
build/
11-
dist/
14+
dist/*
15+
!dist/.gitignore
1216
local.properties
1317
msbuild.binlog
1418
node_modules/
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}
958 KB
Binary file not shown.

examples/DemoCodeField/Gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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.6.10"
5+
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'
9+
gem 'xcodeproj', '< 1.26.0'
10+
gem 'concurrent-ruby', '< 1.3.4'

examples/DemoCodeField/android/build.gradle

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,42 @@
11
buildscript {
2-
def androidTestAppDir = "../node_modules/react-native-test-app/android"
3-
apply(from: "${androidTestAppDir}/dependencies.gradle")
4-
apply(from: "${androidTestAppDir}/test-app-util.gradle")
2+
apply(from: {
3+
def searchDir = rootDir.toPath()
4+
do {
5+
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
6+
if (p.toFile().exists()) {
7+
return p.toRealPath().toString()
8+
}
9+
} while (searchDir = searchDir.getParent())
10+
throw new GradleException("Could not find `react-native-test-app`");
11+
}())
512

613
repositories {
714
mavenCentral()
815
google()
916
}
1017

1118
dependencies {
12-
classpath("com.android.tools.build:gradle:${androidPluginVersion}")
13-
14-
if (isNewArchitectureEnabled(project)) {
15-
classpath("com.facebook.react:react-native-gradle-plugin")
16-
classpath("de.undercouch:gradle-download-task:5.1.0")
19+
getReactNativeDependencies().each { dependency ->
20+
classpath(dependency)
1721
}
1822
}
1923
}
2024

2125
allprojects {
2226
repositories {
23-
maven {
24-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
25-
url("${rootDir}/../node_modules/react-native/android")
26-
}
27+
{
28+
def searchDir = rootDir.toPath()
29+
do {
30+
def p = searchDir.resolve("node_modules/react-native/android")
31+
if (p.toFile().exists()) {
32+
maven {
33+
url(p.toRealPath().toString())
34+
}
35+
break
36+
}
37+
} while (searchDir = searchDir.getParent())
38+
// As of 0.80, React Native is no longer installed from npm
39+
}()
2740
mavenCentral()
2841
google()
2942
}

examples/DemoCodeField/android/gradle.properties

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,29 @@ org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryEr
2525
# https://developer.android.com/topic/libraries/support-library/androidx-rn
2626
android.useAndroidX=true
2727
# Automatically convert third-party libraries to use AndroidX
28-
android.enableJetifier=true
29-
30-
# Version of Flipper to use with React Native. Default value is whatever React
31-
# Native defaults to. To disable Flipper, set it to `false`.
32-
#FLIPPER_VERSION=0.125.0
28+
#android.enableJetifier=true
29+
# Jetifier randomly fails on these libraries
30+
#android.jetifier.ignorelist=hermes-android,react-android
31+
32+
# Use this property to specify which architecture you want to build.
33+
# You can also override it from the CLI using
34+
# ./gradlew <task> -PreactNativeArchitectures=x86_64
35+
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
36+
37+
# Use this property to enable support to the new architecture.
38+
# This will allow you to use TurboModules and the Fabric render in
39+
# your application. You should enable this flag either if you want
40+
# to write custom TurboModules/Fabric components OR use libraries that
41+
# are providing them.
42+
# Note that this is incompatible with web debugging.
43+
newArchEnabled=true
44+
#bridgelessEnabled=true
3345

34-
# Enable Fabric at runtime.
35-
#USE_FABRIC=1
46+
# Uncomment the line below to build React Native from source.
47+
#react.buildFromSource=true
3648

37-
# Enable new architecture, i.e. Fabric + TurboModule - implies USE_FABRIC=1.
38-
# Note that this is incompatible with web debugging.
39-
#newArchEnabled=true
49+
# Version of Android NDK to build against.
50+
#ANDROID_NDK_VERSION=26.1.10909125
4051

41-
# Uncomment the line below if building react-native from source
42-
#ANDROID_NDK_VERSION=21.4.7075529
52+
# Version of Kotlin to build against.
53+
#KOTLIN_VERSION=1.8.22
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

examples/DemoCodeField/android/gradlew

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,13 +80,11 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
87-
88-
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89-
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86+
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87+
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
9088

9189
# Use the maximum available, or set MAX_FD != -1 to use that value.
9290
MAX_FD=maximum
@@ -133,22 +131,29 @@ location of your Java installation."
133131
fi
134132
else
135133
JAVACMD=java
136-
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134+
if ! command -v java >/dev/null 2>&1
135+
then
136+
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137137
138138
Please set the JAVA_HOME variable in your environment to match the
139139
location of your Java installation."
140+
fi
140141
fi
141142

142143
# Increase the maximum file descriptors if we can.
143144
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144145
case $MAX_FD in #(
145146
max*)
147+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
148+
# shellcheck disable=SC2039,SC3045
146149
MAX_FD=$( ulimit -H -n ) ||
147150
warn "Could not query maximum file descriptor limit"
148151
esac
149152
case $MAX_FD in #(
150153
'' | soft) :;; #(
151154
*)
155+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
156+
# shellcheck disable=SC2039,SC3045
152157
ulimit -n "$MAX_FD" ||
153158
warn "Could not set maximum file descriptor limit to $MAX_FD"
154159
esac
@@ -193,18 +198,28 @@ if "$cygwin" || "$msys" ; then
193198
done
194199
fi
195200

196-
# Collect all arguments for the java command;
197-
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198-
# shell script including quotes and variable substitutions, so put them in
199-
# double quotes to make sure that they get re-expanded; and
200-
# * put everything else in single quotes, so that it's not re-expanded.
201+
202+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204+
205+
# Collect all arguments for the java command:
206+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207+
# and any embedded shellness will be escaped.
208+
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209+
# treated as '${Hostname}' itself on the command line.
201210

202211
set -- \
203212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
204213
-classpath "$CLASSPATH" \
205214
org.gradle.wrapper.GradleWrapperMain \
206215
"$@"
207216

217+
# Stop when "xargs" is not available.
218+
if ! command -v xargs >/dev/null 2>&1
219+
then
220+
die "xargs is not available"
221+
fi
222+
208223
# Use "xargs" to parse quoted args.
209224
#
210225
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

0 commit comments

Comments
 (0)