Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ packages/*/dist
packages/*/types_generated
packages/debugger-frontend/dist/**/*
packages/react-native-codegen/lib
tools/eslint/rules/sort-imports.js
**/Pods/*
**/*.macos.js
**/*.windows.js
64 changes: 42 additions & 22 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @noflow
* @format
*/

'use strict';

const path = require('node:path');

require('eslint-plugin-lint').load(path.join(__dirname, 'tools/eslint/rules'));

module.exports = {
root: true,

extends: ['@react-native'],

plugins: ['@react-native/eslint-plugin-specs', 'lint'],
plugins: ['@react-native/monorepo', '@react-native/specs'],

overrides: [
// overriding the JS config from @react-native/eslint-config to ensure
Expand All @@ -27,22 +24,34 @@ module.exports = {
files: ['*.js', '*.js.flow', '*.jsx'],
parser: 'hermes-eslint',
rules: {
'@react-native/monorepo/sort-imports': 'warn',
'eslint-comments/no-unlimited-disable': 'off',
'ft-flow/require-valid-file-annotation': ['error', 'always'],
'no-extra-boolean-cast': 'off',
'no-void': 'off',
// These rules are not required with hermes-eslint
'ft-flow/define-flow-type': 0,
'ft-flow/use-flow-type': 0,
'lint/sort-imports': 1,
// flow handles this check for us, so it's not required
'no-undef': 0,
'ft-flow/define-flow-type': 'off',
'ft-flow/use-flow-type': 'off',
// Flow handles these checks for us, so they aren't required
'no-undef': 'off',
'no-unreachable': 'off',
},
},
{
files: ['*.js', '*.jsx', '*.ts', '*.tsx'],
rules: {
'@react-native/no-deep-imports': 'off',
},
},
{
files: [
'./packages/react-native/**/*.{js,flow}',
'./packages/react-native/Libraries/**/*.{js,flow}',
'./packages/react-native/src/**/*.{js,flow}',
'./packages/assets/registry.js',
],
parser: 'hermes-eslint',
rules: {
'lint/no-commonjs-exports': 1,
'@react-native/monorepo/no-commonjs-exports': 'warn',
},
},
{
Expand All @@ -52,15 +61,17 @@ module.exports = {
{
files: ['package.json'],
rules: {
'lint/react-native-manifest': 2,
'@react-native/monorepo/react-native-manifest': 'error',
},
},
{
files: ['flow-typed/**/*.js'],
files: ['flow-typed/**/*.js', 'packages/react-native/flow/**/*'],
rules: {
'lint/valid-flow-typed-signature': 2,
'no-unused-vars': 0,
quotes: 0,
'@react-native/monorepo/valid-flow-typed-signature': 'error',
'ft-flow/require-valid-file-annotation': 'off',
'no-shadow': 'off',
'no-unused-vars': 'off',
quotes: 'off',
},
},
{
Expand All @@ -69,11 +80,14 @@ module.exports = {
'packages/react-native/src/**/*.js',
],
rules: {
'@react-native/platform-colors': 2,
'@react-native/specs/react-native-modules': 2,
'lint/no-haste-imports': 2,
'lint/no-react-native-imports': 2,
'lint/require-extends-error': 2,
'@react-native/monorepo/no-haste-imports': 'error',
'@react-native/monorepo/no-react-default-imports': 'error',
'@react-native/monorepo/no-react-named-type-imports': 'error',
'@react-native/monorepo/no-react-native-imports': 'error',
'@react-native/monorepo/no-react-node-imports': 'error',
'@react-native/monorepo/require-extends-error': 'error',
'@react-native/platform-colors': 'error',
'@react-native/specs/react-native-modules': 'error',
},
},
{
Expand Down Expand Up @@ -124,5 +138,11 @@ module.exports = {
],
},
},
{
files: ['**/__tests__/**'],
rules: {
'@react-native/monorepo/no-react-native-imports': 'off',
},
},
],
};
16 changes: 12 additions & 4 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
; Ignore build cache folder
<PROJECT_ROOT>/packages/react-native/sdks/.*

; Ignore fb_internal modules
<PROJECT_ROOT>/packages/react-native/src/fb_internal/.*

; Ignore the codegen e2e tests
<PROJECT_ROOT>/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeEnumTurboModule.js

; Ignore the Dangerfile
<PROJECT_ROOT>/packages/react-native-bots/dangerfile.js
<PROJECT_ROOT>/private/react-native-bots/dangerfile.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
Expand All @@ -24,7 +27,7 @@
<PROJECT_ROOT>/packages/.*/dist

; helloworld
<PROJECT_ROOT>/packages/helloworld/ios/Pods/
<PROJECT_ROOT>/private/helloworld/ios/Pods/

; Ignore rn-tester Pods
<PROJECT_ROOT>/packages/rn-tester/Pods/
Expand All @@ -41,11 +44,12 @@
flow-typed/
packages/react-native/interface.js
packages/react-native/flow/
packages/react-native/src/types/

[options]
enums=true
experimental.pattern_matching=true
casting_syntax=both
component_syntax=true

emoji=true

Expand All @@ -67,6 +71,10 @@ module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/packages/react-nat
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/packages/dev-middleware'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\)$' -> '<PROJECT_ROOT>/packages/react-native/Libraries/Image/RelativeImageStub'

module.system.haste.module_ref_prefix=m#

react.runtime=automatic

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
Expand Down Expand Up @@ -96,4 +104,4 @@ untyped-import
untyped-type-import

[version]
^0.262.0
^0.275.0
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Ensure scripts always have Unix newlines, even on Windows.
*.command text eol=lf
*.sh text eol=lf
*.js.flow linguist-language=JavaScript
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ body:
* Please [search for similar issues](https://github.com/facebook/react-native/issues) in our issue tracker.

Make sure that your issue:
* Have a **valid reproducer** (either a [Expo Snack](https://snack.expo.dev/) or a [empty project from template](https://github.com/react-native-community/reproducer-react-native).
* Have a **valid reproducer** (See [How to report a bug](https://reactnative.dev/contributing/how-to-report-a-bug)).
* Is tested against the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.

Due to the extreme number of bugs we receive, we will be looking **ONLY** into issues with a reproducer, and on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native.
🚨 IMPORTANT: Due to the extreme number of bugs we receive, issues **without a reproducer** or for an [**unsupported versions**](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native **will be closed**.
- type: textarea
id: description
attributes:
Expand Down Expand Up @@ -83,7 +83,7 @@ body:
path: /bin/zsh
Binaries:
Node: ...
version: 18.14.0
version: 22.14.0
...
render: text
validations:
Expand All @@ -109,8 +109,8 @@ body:
- type: input
id: reproducer
attributes:
label: Reproducer
description: A link to a Expo Snack or a public repository that reproduces this bug, using [this template](https://github.com/react-native-community/reproducer-react-native). Reproducers are **mandatory**.
label: MANDATORY Reproducer
description: A link to either a failing RNTesterPlayground.js file, an Expo Snack or a public repository from [this template](https://github.com/react-native-community/reproducer-react-native) that reproduces this bug. Reproducers are **mandatory**, issues without a reproducer will be closed.
placeholder: "https://github.com/<myuser>/<myreproducer>"
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/debugger_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ body:
path: /bin/zsh
Binaries:
Node: ...
version: 18.14.0
version: 22.14.0
...
render: text
validations:
Expand Down
10 changes: 5 additions & 5 deletions .github/ISSUE_TEMPLATE/new_architecture_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ body:
Do not attempt to open a bug in this category if you're not using the New Architecture as your bug will be closed.

Make sure that your issue:
* Have a **valid reproducer** (either a [Expo Snack](https://snack.expo.dev/) or a [empty project from template](https://github.com/react-native-community/reproducer-react-native).
* Have a **valid reproducer** (See [How to report a bug](https://reactnative.dev/contributing/how-to-report-a-bug)).
* Is tested against the [**latest stable**](https://github.com/facebook/react-native/releases/) of React Native.

Due to the extreme number of bugs we receive, we will be looking **ONLY** into issues with a reproducer, and on [supported versions](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native.
🚨 IMPORTANT: Due to the extreme number of bugs we receive, issues **without a reproducer** or for an [**unsupported versions**](https://github.com/reactwg/react-native-releases#which-versions-are-currently-supported) of React Native **will be closed**.
- type: textarea
id: description
attributes:
Expand Down Expand Up @@ -95,7 +95,7 @@ body:
path: /bin/zsh
Binaries:
Node: ...
version: 18.14.0
version: 22.14.0
...
render: text
validations:
Expand All @@ -121,8 +121,8 @@ body:
- type: input
id: reproducer
attributes:
label: Reproducer
description: A link to a Expo Snack or a public repository that reproduces this bug, using [this template](https://github.com/react-native-community/reproducer-react-native). Reproducers are **mandatory**.
label: MANDATORY Reproducer
description: A link to either a failing RNTesterPlayground.js file, an Expo Snack or a public repository from [this template](https://github.com/react-native-community/reproducer-react-native) that reproduces this bug. Reproducers are **mandatory**, issues without a reproducer will be closed.
placeholder: "https://github.com/<myuser>/<myreproducer>"
validations:
required: true
Expand Down
22 changes: 4 additions & 18 deletions .github/actions/build-android/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,13 @@ runs:
if: ${{ always() }}
uses: actions/[email protected]
with:
name: rntester-hermes-debug
path: packages/rn-tester/android/app/build/outputs/apk/hermes/debug/
name: rntester-debug
path: packages/rn-tester/android/app/build/outputs/apk/debug/
compression-level: 0
- name: Upload RNTester APK - hermes-release
if: ${{ always() }}
uses: actions/[email protected]
with:
name: rntester-hermes-release
path: packages/rn-tester/android/app/build/outputs/apk/hermes/release/
compression-level: 0
- name: Upload RNTester APK - jsc-debug
if: ${{ always() }}
uses: actions/[email protected]
with:
name: rntester-jsc-debug
path: packages/rn-tester/android/app/build/outputs/apk/jsc/debug/
compression-level: 0
- name: Upload RNTester APK - jsc-release
if: ${{ always() }}
uses: actions/[email protected]
with:
name: rntester-jsc-release
path: packages/rn-tester/android/app/build/outputs/apk/jsc/release/
name: rntester-release
path: packages/rn-tester/android/app/build/outputs/apk/release/
compression-level: 0
2 changes: 2 additions & 0 deletions .github/actions/build-hermesc-apple/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ inputs:
runs:
using: composite
steps:
- name: Setup xcode
uses: ./.github/actions/setup-xcode
- name: Restore Hermes workspace
uses: ./.github/actions/restore-hermes-workspace
- name: Hermes apple cache
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/build-hermesc-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ runs:
shell: bash
run: |
sudo apt update
sudo apt install -y git openssh-client cmake build-essential \
sudo apt install -y git openssh-client build-essential \
libreadline-dev libicu-dev jq zip python3
# Install cmake 3.28.3-1build7
sudo apt-get install cmake=3.28.3-1build7
sudo ln -sf /usr/bin/cmake /usr/local/bin/cmake
- name: Restore Hermes workspace
uses: ./.github/actions/restore-hermes-workspace
- name: Linux cache
Expand Down
7 changes: 5 additions & 2 deletions .github/actions/build-hermesc-windows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ runs:
- name: Windows cache
uses: actions/cache@v4
with:
key: v2-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
key: v3-hermes-${{ github.job }}-windows-${{ inputs.hermes-version }}-${{ inputs.react-native-version }}
path: |
D:\tmp\hermes\win64-bin\
D:\tmp\hermes\hermes\icu\
Expand All @@ -39,6 +39,9 @@ runs:
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\icu
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\deps
New-Item -ItemType Directory -ErrorAction SilentlyContinue $Env:HERMES_WS_DIR\win64-bin
- name: Downgrade CMake
shell: powershell
run: choco install cmake --version 3.31.6 --force
- name: Build HermesC for Windows
shell: powershell
run: |
Expand All @@ -60,7 +63,7 @@ runs:
$Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
$Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"

cmake -S hermes -B build_release -G 'Visual Studio 16 2019' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
cmake -S hermes -B build_release -G 'Visual Studio 17 2022' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
if (-not $?) { throw "Failed to configure Hermes" }
echo "Running windows build..."
cd build_release
Expand Down
9 changes: 9 additions & 0 deletions .github/actions/build-npm-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ runs:
pattern: ReactNativeDependencies*
path: ./packages/react-native/ReactAndroid/external-artifacts/artifacts
merge-multiple: true
- name: Download ReactCore artifacts
uses: actions/download-artifact@v4
with:
pattern: ReactCore*
path: ./packages/react-native/ReactAndroid/external-artifacts/artifacts
merge-multiple: true
- name: Print Artifacts Directory
shell: bash
run: ls -lR ./packages/react-native/ReactAndroid/external-artifacts/artifacts/
Expand All @@ -121,6 +127,9 @@ runs:
- name: Build packages
shell: bash
run: yarn build
- name: Build types
shell: bash
run: yarn build-types --skip-snapshot
# Continue with publish steps
- name: Set npm credentials
if: ${{ inputs.release-type == 'release' ||
Expand Down
23 changes: 23 additions & 0 deletions .github/actions/diff-js-api-breaking-changes/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: diff-js-api-breaking-changes
description: Check for breaking changes in the public React Native JS API
runs:
using: composite
steps:
- name: Fetch snapshot from PR head
shell: bash
env:
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
run: |
mkdir $SCRATCH_DIR
git fetch --depth=1 origin ${{ github.event.pull_request.head.sha }}
git show ${{ github.event.pull_request.head.sha }}:packages/react-native/ReactNativeApi.d.ts > $SCRATCH_DIR/ReactNativeApi-after.d.ts \
|| echo "" > $SCRATCH_DIR/ReactNativeApi.d.ts
- name: Run breaking change detection
shell: bash
env:
SCRATCH_DIR: ${{ runner.temp }}/diff-js-api-breaking-changes
run: |
node ./scripts/diff-api-snapshot \
${{ github.workspace }}/packages/react-native/ReactNativeApi.d.ts \
$SCRATCH_DIR/ReactNativeApi-after.d.ts \
> $SCRATCH_DIR/output.json
Loading
Loading