Skip to content

Commit 3cc133d

Browse files
authored
chore(rn): update to latest react native version (#449)
* chore(rn): update to latest react native version * fix(lint): replace unmaintained sort keys with stable sort * chore(deps): update deps * update testing
1 parent d5d2571 commit 3cc133d

Some content is hidden

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

57 files changed

+2934
-2875
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ build/
99
.gradle
1010
local.properties
1111
*.iml
12+
.vscode
1213

1314
# node.js
1415
#

template/.prettierrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
module.exports = {
2-
singleQuote: true,
3-
plugins: ['@ianvs/prettier-plugin-sort-imports'],
42
importOrder: [
53
'<TYPES>^(node:)',
64
'<TYPES>',
@@ -25,4 +23,6 @@ module.exports = {
2523
'^[.]', // relative imports
2624
],
2725
importOrderTypeScriptVersion: '5.0.0',
26+
plugins: ['@ianvs/prettier-plugin-sort-imports'],
27+
singleQuote: true,
2828
};

template/Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ ruby ">= 2.6.10"
66
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
77
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
88
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9+
gem 'xcodeproj', '< 1.26.0'

template/Gemfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ PLATFORMS
9393
ruby
9494

9595
DEPENDENCIES
96-
activesupport (>= 6.1.7.5, < 7.1.0)
97-
cocoapods (>= 1.13, < 1.15)
96+
activesupport (>= 6.1.7.5, != 7.1.0)
97+
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
9898

9999
RUBY VERSION
100100
ruby 2.6.10p210

template/__mocks__/libs/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import '@testing-library/jest-native/extend-expect';
1+
import '@testing-library/react-native/extend-expect';
22
// LOCAL
33
import './react-native-reanimated';
44
import './react-native-safe-area-context';

template/android/app/src/main/java/com/boilerplate/MainActivity.kt

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class MainActivity : ReactActivity() {
2121
override fun createReactActivityDelegate(): ReactActivityDelegate =
2222
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
2323

24+
//react-native-screens override
2425
override fun onCreate(savedInstanceState: Bundle?) {
2526
super.onCreate(null);
2627
}

template/android/app/src/main/java/com/boilerplate/MainApplication.kt

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import com.facebook.react.ReactPackage
99
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
1010
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
1111
import com.facebook.react.defaults.DefaultReactNativeHost
12+
import com.facebook.react.soloader.OpenSourceMergedSoMapping
1213
import com.facebook.soloader.SoLoader
1314

1415
class MainApplication : Application(), ReactApplication {
@@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {
3435

3536
override fun onCreate() {
3637
super.onCreate()
37-
SoLoader.init(this, false)
38+
SoLoader.init(this, OpenSourceMergedSoMapping)
3839
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
3940
// If you opted-in for the New Architecture, we load the native entry point for this app.
4041
load()

template/android/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
buildscript {
22
ext {
3-
buildToolsVersion = "34.0.0"
4-
minSdkVersion = 23
5-
compileSdkVersion = 34
3+
buildToolsVersion = "35.0.0"
4+
minSdkVersion = 24
5+
compileSdkVersion = 35
66
targetSdkVersion = 34
77
ndkVersion = "26.1.10909125"
88
kotlinVersion = "1.9.24"

template/android/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
3232
# your application. You should enable this flag either if you want
3333
# to write custom TurboModules/Fabric components OR use libraries that
3434
# are providing them.
35-
newArchEnabled=false
35+
newArchEnabled=true
3636

3737
# Use this property to enable or disable the Hermes JS engine.
3838
# If set to false, you will be using JSC instead.
Binary file not shown.

template/android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

template/android/gradlew

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -84,7 +86,8 @@ done
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
8688
# 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
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
8891

8992
# Use the maximum available, or set MAX_FD != -1 to use that value.
9093
MAX_FD=maximum

template/android/gradlew.bat

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@rem See the License for the specific language governing permissions and
1414
@rem limitations under the License.
1515
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
1618

1719
@if "%DEBUG%"=="" @echo off
1820
@rem ##########################################################################

template/babel.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3-
presets: ['module:@react-native/babel-preset'],
43
plugins: [
54
[
65
'module-resolver',
76
{
8-
root: ['./src'],
9-
extensions: ['.js', '.json'],
107
alias: {
118
'@': './src',
129
},
10+
extensions: ['.js', '.json'],
11+
root: ['./src'],
1312
},
1413
],
1514
'inline-dotenv',
1615
'react-native-reanimated/plugin', // needs to be last
1716
],
17+
presets: ['module:@react-native/babel-preset'],
1818
};

template/eslint.config.mjs

+37-14
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ import { dirname } from 'node:path';
22
import { fileURLToPath } from 'node:url';
33
import importPlugin from 'eslint-plugin-import';
44
import jest from 'eslint-plugin-jest';
5+
import perfectionist from 'eslint-plugin-perfectionist';
56
import react from 'eslint-plugin-react';
67
import reactHooks from 'eslint-plugin-react-hooks';
7-
import typescriptSortKeys from 'eslint-plugin-typescript-sort-keys';
8+
import testingLibrary from 'eslint-plugin-testing-library';
89
import unicorn from 'eslint-plugin-unicorn';
910
import unusedImports from 'eslint-plugin-unused-imports';
1011
import tsEslint from 'typescript-eslint';
@@ -15,27 +16,28 @@ const __dirname = dirname(__filename);
1516
export default [
1617
...tsEslint.configs.strict,
1718
{
18-
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
19+
files: ['**/*.mjs', '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
1920
plugins: {
2021
import: importPlugin,
22+
jest,
23+
perfectionist,
2124
react,
2225
'react-hooks': reactHooks,
2326
unicorn,
2427
'unused-imports': unusedImports,
25-
jest,
2628
},
2729
rules: {
28-
'import/no-unresolved': 0, // handled by TypeScript
29-
'unicorn/prefer-top-level-await': 0, // not valid on RN for the moment
30-
curly: 2,
3130
// `import/default`, `import/namespace` and `import/no-duplicates` are slow.
31+
curly: 2,
3232
'import/default': 0,
3333
'import/named': 0,
3434
'import/namespace': 0,
3535
'import/no-duplicates': 0,
3636
'import/no-extraneous-dependencies': 2,
3737
'import/no-named-as-default-member': 0,
38+
'import/no-unresolved': 0,
3839
'import/order': 0,
40+
'no-console': 2,
3941
'no-const-assign': 2,
4042
'no-constant-binary-expression': 2,
4143
'no-extra-parens': [2, 'functions'],
@@ -46,14 +48,30 @@ export default [
4648
'no-unused-vars': 0,
4749
'no-useless-rename': 2,
4850
'no-var': 2,
49-
'no-console': 2,
5051
'no-warning-comments': [2, { terms: ['@nocommit'] }],
5152
'object-curly-spacing': 0,
5253
'object-shorthand': 2,
54+
'perfectionist/sort-array-includes': 'error',
55+
'perfectionist/sort-classes': 'error',
56+
'perfectionist/sort-enums': 'error',
57+
'perfectionist/sort-exports': 'error',
58+
'perfectionist/sort-imports': 0,
59+
'perfectionist/sort-interfaces': 'error',
60+
'perfectionist/sort-intersection-types': 'error',
61+
'perfectionist/sort-jsx-props': 'error',
62+
'perfectionist/sort-maps': 'error',
63+
'perfectionist/sort-named-exports': 'error',
64+
'perfectionist/sort-named-imports': 'error',
65+
'perfectionist/sort-object-types': 'error',
66+
'perfectionist/sort-objects': 'error',
67+
'perfectionist/sort-sets': 'error',
68+
'perfectionist/sort-switch-case': 'error',
69+
'perfectionist/sort-union-types': 'error',
70+
'perfectionist/sort-variable-declarations': 'error',
5371
'prefer-arrow-callback': [2, { allowNamedFunctions: true }],
5472
'prefer-const': 2,
5573
'react-hooks/exhaustive-deps': 2,
56-
'react/jsx-sort-props': 2,
74+
'react/jsx-sort-props': 0, // Handled by perfectionist
5775
'react/prop-types': 2,
5876
'react/react-in-jsx-scope': 0,
5977
'react/require-default-props': [
@@ -92,10 +110,15 @@ export default [
92110
'unicorn/prefer-string-slice': 2,
93111
'unicorn/prefer-structured-clone': 2,
94112
'unicorn/prefer-ternary': 2,
113+
'unicorn/prefer-top-level-await': 0, // not valid on RN for the moment
95114
'unicorn/text-encoding-identifier-case': 2,
96115
'unused-imports/no-unused-imports': 0,
97116
},
98117
settings: {
118+
perfectionist: {
119+
partitionByComment: true,
120+
type: 'alphabetical',
121+
},
99122
react: {
100123
version: 'detect',
101124
},
@@ -105,35 +128,35 @@ export default [
105128
files: ['**/*.ts', '**/*.tsx'],
106129
languageOptions: {
107130
ecmaVersion: 'latest',
108-
sourceType: 'module',
109131
parser: tsEslint.parser,
110132
parserOptions: {
111133
project: ['./tsconfig.json'],
112134
tsconfigRootDir: __dirname,
113135
},
136+
sourceType: 'module',
114137
},
115138
plugins: {
116139
'@typescript-eslint': tsEslint.plugin,
117-
'typescript-sort-keys': typescriptSortKeys,
118140
},
119141
rules: {
120-
'import/no-unresolved': 0, // handled by TypeScript
121-
'@typescript-eslint/consistent-type-imports': 2,
122142
'@typescript-eslint/ban-ts-comment': 0,
143+
'@typescript-eslint/consistent-type-imports': 2,
123144
'@typescript-eslint/no-dynamic-delete': 0,
124145
'@typescript-eslint/no-invalid-void-type': 0,
125146
'@typescript-eslint/no-namespace': 0,
126147
'@typescript-eslint/no-non-null-assertion': 0,
127148
'@typescript-eslint/no-this-alias': 0,
128149
'@typescript-eslint/no-unused-vars': 0,
129150
'@typescript-eslint/no-var-requires': 0,
151+
'import/no-unresolved': 0, // handled by TypeScript
130152
'react/prop-types': 0,
131-
'typescript-sort-keys/interface': 2,
132-
'typescript-sort-keys/string-enum': 2,
133153
},
134154
},
135155
{
136156
files: ['./**/*.test.{ts,tsx}'],
157+
plugins: {
158+
'testing-library': testingLibrary,
159+
},
137160
rules: {
138161
'@typescript-eslint/no-unsafe-assignment': 0,
139162
'@typescript-eslint/no-unsafe-call': 0,

template/ios/Boilerplate.xcodeproj/project.pbxproj

+5-4
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@
442442
"$(inherited)",
443443
);
444444
INFOPLIST_FILE = BoilerplateTests/Info.plist;
445-
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
445+
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
446446
LD_RUNPATH_SEARCH_PATHS = (
447447
"$(inherited)",
448448
"@executable_path/Frameworks",
@@ -466,7 +466,7 @@
466466
BUNDLE_LOADER = "$(TEST_HOST)";
467467
COPY_PHASE_STRIP = NO;
468468
INFOPLIST_FILE = BoilerplateTests/Info.plist;
469-
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
469+
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
470470
LD_RUNPATH_SEARCH_PATHS = (
471471
"$(inherited)",
472472
"@executable_path/Frameworks",
@@ -504,6 +504,7 @@
504504
"-lc++",
505505
);
506506
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
507+
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = tcm.app.boilerplate;
507508
PRODUCT_NAME = Boilerplate;
508509
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
509510
SWIFT_VERSION = 5.0;
@@ -589,7 +590,7 @@
589590
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
590591
GCC_WARN_UNUSED_FUNCTION = YES;
591592
GCC_WARN_UNUSED_VARIABLE = YES;
592-
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
593+
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
593594
LD = "";
594595
LDPLUSPLUS = "";
595596
LD_RUNPATH_SEARCH_PATHS = (
@@ -670,7 +671,7 @@
670671
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
671672
GCC_WARN_UNUSED_FUNCTION = YES;
672673
GCC_WARN_UNUSED_VARIABLE = YES;
673-
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
674+
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
674675
LD = "";
675676
LDPLUSPLUS = "";
676677
LD_RUNPATH_SEARCH_PATHS = (

0 commit comments

Comments
 (0)