Skip to content

Commit

Permalink
chore(rn): update to latest react native version (#449)
Browse files Browse the repository at this point in the history
* chore(rn): update to latest react native version
* fix(lint): replace unmaintained sort keys with stable sort
* chore(deps): update deps
* update testing
  • Loading branch information
JeremyDolle authored Nov 12, 2024
1 parent d5d2571 commit 3cc133d
Show file tree
Hide file tree
Showing 57 changed files with 2,934 additions and 2,875 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build/
.gradle
local.properties
*.iml
.vscode

# node.js
#
Expand Down
4 changes: 2 additions & 2 deletions template/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
module.exports = {
singleQuote: true,
plugins: ['@ianvs/prettier-plugin-sort-imports'],
importOrder: [
'<TYPES>^(node:)',
'<TYPES>',
Expand All @@ -25,4 +23,6 @@ module.exports = {
'^[.]', // relative imports
],
importOrderTypeScriptVersion: '5.0.0',
plugins: ['@ianvs/prettier-plugin-sort-imports'],
singleQuote: true,
};
1 change: 1 addition & 0 deletions template/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ ruby ">= 2.6.10"
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
4 changes: 2 additions & 2 deletions template/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (>= 6.1.7.5, < 7.1.0)
cocoapods (>= 1.13, < 1.15)
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)

RUBY VERSION
ruby 2.6.10p210
Expand Down
2 changes: 1 addition & 1 deletion template/__mocks__/libs/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@testing-library/jest-native/extend-expect';
import '@testing-library/react-native/extend-expect';
// LOCAL
import './react-native-reanimated';
import './react-native-safe-area-context';
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class MainActivity : ReactActivity() {
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)

//react-native-screens override
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {
Expand All @@ -34,7 +35,7 @@ class MainApplication : Application(), ReactApplication {

override fun onCreate() {
super.onCreate()
SoLoader.init(this, false)
SoLoader.init(this, OpenSourceMergedSoMapping)
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
Expand Down
6 changes: 3 additions & 3 deletions template/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
buildToolsVersion = "35.0.0"
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
Expand Down
2 changes: 1 addition & 1 deletion template/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
newArchEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
Expand Down
Binary file modified template/android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion template/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion template/android/gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions template/android/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
6 changes: 3 additions & 3 deletions template/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
presets: ['module:@react-native/babel-preset'],
plugins: [
[
'module-resolver',
{
root: ['./src'],
extensions: ['.js', '.json'],
alias: {
'@': './src',
},
extensions: ['.js', '.json'],
root: ['./src'],
},
],
'inline-dotenv',
'react-native-reanimated/plugin', // needs to be last
],
presets: ['module:@react-native/babel-preset'],
};
51 changes: 37 additions & 14 deletions template/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import importPlugin from 'eslint-plugin-import';
import jest from 'eslint-plugin-jest';
import perfectionist from 'eslint-plugin-perfectionist';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import typescriptSortKeys from 'eslint-plugin-typescript-sort-keys';
import testingLibrary from 'eslint-plugin-testing-library';
import unicorn from 'eslint-plugin-unicorn';
import unusedImports from 'eslint-plugin-unused-imports';
import tsEslint from 'typescript-eslint';
Expand All @@ -15,27 +16,28 @@ const __dirname = dirname(__filename);
export default [
...tsEslint.configs.strict,
{
files: ['**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
files: ['**/*.mjs', '**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx'],
plugins: {
import: importPlugin,
jest,
perfectionist,
react,
'react-hooks': reactHooks,
unicorn,
'unused-imports': unusedImports,
jest,
},
rules: {
'import/no-unresolved': 0, // handled by TypeScript
'unicorn/prefer-top-level-await': 0, // not valid on RN for the moment
curly: 2,
// `import/default`, `import/namespace` and `import/no-duplicates` are slow.
curly: 2,
'import/default': 0,
'import/named': 0,
'import/namespace': 0,
'import/no-duplicates': 0,
'import/no-extraneous-dependencies': 2,
'import/no-named-as-default-member': 0,
'import/no-unresolved': 0,
'import/order': 0,
'no-console': 2,
'no-const-assign': 2,
'no-constant-binary-expression': 2,
'no-extra-parens': [2, 'functions'],
Expand All @@ -46,14 +48,30 @@ export default [
'no-unused-vars': 0,
'no-useless-rename': 2,
'no-var': 2,
'no-console': 2,
'no-warning-comments': [2, { terms: ['@nocommit'] }],
'object-curly-spacing': 0,
'object-shorthand': 2,
'perfectionist/sort-array-includes': 'error',
'perfectionist/sort-classes': 'error',
'perfectionist/sort-enums': 'error',
'perfectionist/sort-exports': 'error',
'perfectionist/sort-imports': 0,
'perfectionist/sort-interfaces': 'error',
'perfectionist/sort-intersection-types': 'error',
'perfectionist/sort-jsx-props': 'error',
'perfectionist/sort-maps': 'error',
'perfectionist/sort-named-exports': 'error',
'perfectionist/sort-named-imports': 'error',
'perfectionist/sort-object-types': 'error',
'perfectionist/sort-objects': 'error',
'perfectionist/sort-sets': 'error',
'perfectionist/sort-switch-case': 'error',
'perfectionist/sort-union-types': 'error',
'perfectionist/sort-variable-declarations': 'error',
'prefer-arrow-callback': [2, { allowNamedFunctions: true }],
'prefer-const': 2,
'react-hooks/exhaustive-deps': 2,
'react/jsx-sort-props': 2,
'react/jsx-sort-props': 0, // Handled by perfectionist
'react/prop-types': 2,
'react/react-in-jsx-scope': 0,
'react/require-default-props': [
Expand Down Expand Up @@ -92,10 +110,15 @@ export default [
'unicorn/prefer-string-slice': 2,
'unicorn/prefer-structured-clone': 2,
'unicorn/prefer-ternary': 2,
'unicorn/prefer-top-level-await': 0, // not valid on RN for the moment
'unicorn/text-encoding-identifier-case': 2,
'unused-imports/no-unused-imports': 0,
},
settings: {
perfectionist: {
partitionByComment: true,
type: 'alphabetical',
},
react: {
version: 'detect',
},
Expand All @@ -105,35 +128,35 @@ export default [
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parser: tsEslint.parser,
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: __dirname,
},
sourceType: 'module',
},
plugins: {
'@typescript-eslint': tsEslint.plugin,
'typescript-sort-keys': typescriptSortKeys,
},
rules: {
'import/no-unresolved': 0, // handled by TypeScript
'@typescript-eslint/consistent-type-imports': 2,
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/consistent-type-imports': 2,
'@typescript-eslint/no-dynamic-delete': 0,
'@typescript-eslint/no-invalid-void-type': 0,
'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-var-requires': 0,
'import/no-unresolved': 0, // handled by TypeScript
'react/prop-types': 0,
'typescript-sort-keys/interface': 2,
'typescript-sort-keys/string-enum': 2,
},
},
{
files: ['./**/*.test.{ts,tsx}'],
plugins: {
'testing-library': testingLibrary,
},
rules: {
'@typescript-eslint/no-unsafe-assignment': 0,
'@typescript-eslint/no-unsafe-call': 0,
Expand Down
9 changes: 5 additions & 4 deletions template/ios/Boilerplate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"$(inherited)",
);
INFOPLIST_FILE = BoilerplateTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -466,7 +466,7 @@
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = BoilerplateTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -504,6 +504,7 @@
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = tcm.app.boilerplate;
PRODUCT_NAME = Boilerplate;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -589,7 +590,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD = "";
LDPLUSPLUS = "";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -670,7 +671,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD = "";
LDPLUSPLUS = "";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
Loading

0 comments on commit 3cc133d

Please sign in to comment.