Summary:
Changelog:
[General][Changed] - renamed react-native/polyfills -> react-native/js-polyfills and align with other packages versions (0.72.0) as a part of migration to monorepo
Reviewed By: motiz88
Differential Revision: D41553157
fbshipit-source-id: eef70c8e7639080acdeb6716d1a915760a85458a
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.
Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.
Reviewed By: philIip
Differential Revision: D41649337
fbshipit-source-id: 505ba555b6a79113635fdfb35c6fe69c92d82234
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35540
We now don't need to generate .mk files anymore, therefore I'm removing
this logic from the codegen. In RN 0.72 users should be fully migrated
to CMake.
Changelog:
[Android] [Removed] - Remove .mk prebuilt file and .mk file generation from codegen
Reviewed By: rshest
Differential Revision: D41654122
fbshipit-source-id: 3a3c01fa8ab4d48460338e1a9ce2ecbd6df25f47
Summary:
This PR extracts the content of the codegen case `'Array'` and `'ReadOnlyArray'` into a single `emitArrayType` function inside the `parsers-primitives.js` file and uses it in both Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872. This also adds unit tests to the new `emitArrayType` function.
## Changelog
[Internal] [Changed] - Extract the content of the case 'Array' and 'ReadOnlyArray' into a single emitArrayType function
Pull Request resolved: https://github.com/facebook/react-native/pull/35546
Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: christophpurrer
Differential Revision: D41700084
Pulled By: rshest
fbshipit-source-id: 4bfd2d3ab3f1343bb401ba9c278dc0e0e1ea0989
Summary:
The `react-native-xcode` script assumes the that `node_modules` folder are in the same location as the react native project. This adds the ability to declare `CUSTOM_DIR` in `.xcode.env` file to let react-native-xcode know where the react native project is located - required for monorepos
## Issue
At the moment if a project is not using the default react native file structure then when trying to create a build or archive using Xcode it will fail, with the following error:
> File /Users/itxch/Library/Developer/Xcode/DerivedData/app-evgjukoxhuupzzdglopjnhcntvpw/Build/Intermediates.noindex/ArchiveIntermediates/jungul/BuildProductsPath/Release-iphoneos/app.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues
## Background
My project is a monorepo, using `npm` workspaces.
#### This is the relevant file structure

This file structure is incompatible with line 63 of `react-native-xcode.sh`
https://github.com/facebook/react-native/blob/c5a8425fada10b715f356731426db666975569c9/scripts/react-native-xcode.sh#L63
Note: `$REACT_NATIVE_DIR` is the `react-native` package directory inside node modules.
So by default this sets project root to be the parent folder of the `node_modules` folder. However in my case this is not correct, it should actually be:
```sh
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../app"}
```
## Solution
Seeing as hardcoding the value would not work, the simplest solution is to set the directory via a variable
```sh
PROJECT_ROOT=${PROJECT_ROOT:-"$REACT_NATIVE_DIR/../../$CUSTOM_DIR"}
```
`$CUSTOM_DIR` can easily be set via `.xcode.env` file.
## Changelog
[IOS] [Added] - allow for custom project dir in react-native-xcode script
Pull Request resolved: https://github.com/facebook/react-native/pull/35449
Test Plan:
After updating my `.xcode.env` file to include `export CUSTOM_DIR=app`, I can successfully create a build or an archive.
If the variable is not set it will be black, so it will not effect `$PROJECT_ROOT`
Reviewed By: GijsWeterings
Differential Revision: D41529396
Pulled By: cortinico
fbshipit-source-id: 890e9867e31f83a08561df8c2de1069e771726fc
Summary:
`react-native/eslint-config` enables rules for TypeScript and `.js` files (as Flow), but seems to completely no-op if you have a `.jsx` file. Enabling it in an override leads to syntax errors because the config has not been enlightened on how to parse JSX.
This would normally happen if a config extended `plugin:react/recommended`, but we are already cutomizing the React plugin rules. So we instead just directly set `ecmaFeatures: {jsx: true}` as reccomended by https://github.com/jsx-eslint/eslint-plugin-react.
Changelog:
[General][Breaking] - Fix react-native/eslint-config linting of jsx files
Reviewed By: rickhanlonii
Differential Revision: D41654962
fbshipit-source-id: 778da0928fadb86caa6a33254379d3d7dd394892
Summary:
Update `babel/*` dependencies specifying `^7.x.y` where `x > 0` to the latest available semver minor, and corresponding superficial snapshot updates reflecting a small decrease in JS bundle size.
- `babel/core` to `^7.20.0`
- `babel/parser` to `^7.20.0`
- `babel/preset-env` to `^7.20.0`
- `babel/traverse` to `^7.20.0`
- `babel/cli` to `^7.19.0`
- `babel/eslint-parser` to `^7.19.0`
- `babel/preset-flow` to `^7.18.0`
- `babel/preset-syntax-flow` to `^7.18.0`
- Deduplicate / refresh others to take in patch updates
Changelog: [Internal] Bump Babel dependencies to latest 7.x
Reviewed By: JoeyMou
Differential Revision: D41449678
fbshipit-source-id: f04fe837a7961c4e2dde45fed59fcd138c2f8723
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in normalizeColor / processColor.
Changelog: [iOS][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.
Reviewed By: sammy-SC
Differential Revision: D40632443
fbshipit-source-id: 4dfb29edca4b919474408b43c3917ac9406a147a
Summary:
Color support for AnimatedInterpolation was incomplete with native drivers, as only rgba type strings were supported. There was also an issue where color props instead a StyleAnimatedNode would never get applied. We were also potentially duplicating color parsing support, which is already centralized in `normalizeColor` / `processColor`.
Changelog: [Android][Added] Enable AnimatedInterpolation to interpolate arbitrary color types.
Reviewed By: mdvacca
Differential Revision: D40571873
fbshipit-source-id: 41857ab0391279c5307bc31b855ea8fbcb4cccd8
Summary:
This PR is a subtask of https://github.com/facebook/react-native/issues/34872
Moved `translateArrayTypeAnnotation` (Flow,TS) fns to `parsers-primitives.js`
- combined `Flow` and `TS` `translateArrayTypeAnnotation` fn 's into common fn
- moved it to `parsers-primitives.js`
- re-organized imports and exports :)
## Changelog
[Internal] [Changed] - Moved `translateArrayTypeAnnotation` (Flow,TS) fns to `parsers-primitives.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/35479
Test Plan:
- ensure 👇 is `#00ff00`
`yarn lint && yarn flow && yarn test-ci`
Reviewed By: cipolleschi
Differential Revision: D41548046
Pulled By: GijsWeterings
fbshipit-source-id: 8fd7214f8b1e669ba42f326f814674eec179fed5
Summary:
Update `babel/generator` to the latest, which is a semver-minor update within the pre-existing range.
I'm separating this out for ease of review because it brings some noisy snapshot changes, including more granular source maps and fewer empty lines in generated output. The majority of this is a result of https://github.com/babel/babel/pull/14980 (`>=7.19.4`).
This and the previous diff clear the way for a general Babel update, which is currently blocking a perf-boosting Metro PR https://github.com/facebook/metro/pull/854.
Changelog: [Internal] Bump `babel/generator dependency` to `^7.20.0`
Reviewed By: motiz88
Differential Revision: D41438635
fbshipit-source-id: d56853169be22a2197ad53d6320ec6c1faf6b2a7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35508
It turns out that my previous diff hasn't really solved the Windows support.
The problem is that we're not escaping the URI of the Maven Local repository
properly on Windows.
To overcome this, I'll instead use the `toURI()` Api of File to properly
create a valid URI for a given folder.
Changelog:
[Internal] [Changed] - RNGP - Fix DependencyUtils for Windows support
Reviewed By: cipolleschi
Differential Revision: D41581849
fbshipit-source-id: 7905073c6daaf7c6a97405b3e6fb94b8f382234a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35506
In our build we had a mixture of `_` and `-` to separate targets.
Dashes don't play well with Gradle + as we expose them now via Prefab,
let's stick to use only underscores
Changelog:
[Internal] [Changed] - Rename target to don't use dashes
Reviewed By: cipolleschi
Differential Revision: D41578938
fbshipit-source-id: 8aa44aa2dc7bf4822b45e5044532837b989817d2
Summary:
`Promise<T>` is used very often in turbo module as function return types. So `T` is a critical thing for type safety. To enable future generator to produce more specific type for `Promise`, `T` is added to the schema.
## Changelog
[General] [Changed] - Fix codegen to add `T` of `Promise<T>` in CodegenSchema.js
Pull Request resolved: https://github.com/facebook/react-native/pull/35345
Test Plan: `yarn jest react-native-codegen` passed
Reviewed By: lunaleaps
Differential Revision: D41304647
Pulled By: cipolleschi
fbshipit-source-id: 6cdd2357b83d4d8007c881a7090cbb8969f3ae9d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35496
This commit includes a series of fixes needed for better integration with libraries for 0.71:
- I've added an `android/README.md` file as some libraries were failing the build if the folder was missing
- RNGP now applies dep substitution on app and all the libraries project
- RNGP now adds repositories on app and all the libraries project
- I've removed the maven local repo to the `/android` folder as now is empty
- I've fixed the path for the JSC repo for Windows users
- I've added a bit of backward compat by re-adding an empty `project.react.ext` block that libraries might read from.
- I've removed `codegenDir` from the `GenerateCodegenArtifactsTask` which was unused.
Changelog:
[Internal] [Changed] - RNGP - Various improvements needed for 3rd party libs
Reviewed By: cipolleschi
Differential Revision: D41549489
fbshipit-source-id: 2252da0180ac24fd3fe5a55300527da6781f0f8c
Summary:
This pull request migrates the appearance example to using React Hooks.
## Changelog
[General] [Changed] - RNTester: Migrate Appearence to hooks
Pull Request resolved: https://github.com/facebook/react-native/pull/35114
Test Plan: The animation works exactly as it did as when it was a class component
Reviewed By: cortinico
Differential Revision: D41531005
Pulled By: cipolleschi
fbshipit-source-id: a864766a3bb58a7f0c2b9c4ed8f731ee84713b26
Summary:
when I'm defining a turbomodule spec, I tried to extract a common parameter into an interface.
The error I get is this:
```
[Codegen] >>>>> Processing RNSimpleToastSpec
[Codegen] Done.
/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/utils.js:111
throw error;
^
TypeError: Cannot read properties of undefined (reading 'length')
at isModuleInterface (/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/modules/index.js:695:18)
at Array.filter (<anonymous>)
at buildModuleSchema (/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/modules/index.js:709:44)
at /Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/index.js:158:9
at guard (/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/utils.js:108:14)
at buildSchema (/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/index.js:157:22)
at Object.parseFile (/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/index.js:185:10)
```
After the fix I get this:
```
[Codegen] >>>>> Processing RNSimpleToastSpec
[Codegen] Done.
/Users/vojta/_dev/_own/simple-toast/example/node_modules/react-native-codegen/lib/parsers/typescript/utils.js:111
throw error;
^
Invariant Violation: GenericTypeAnnotation 'Styles' must resolve to a TSTypeAliasDeclaration. Instead, it resolved to a 'TSInterfaceDeclaration'
```
Then I know that I should not be using an `interface` but a `type`
## Changelog
[Internal] [Fixed] - TS codegen crash when parsing interfaces
Pull Request resolved: https://github.com/facebook/react-native/pull/35492
Test Plan:
tested locally
let me know if you want an automated test
Reviewed By: cortinico
Differential Revision: D41548015
Pulled By: cipolleschi
fbshipit-source-id: 9acf02dffbb084831690f665357fb80225cbce0d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35482
This change moves the JSCRuntime.h/cpp into a `jsc` folder.
This change is required for several reasons:
1. on iOS, the new `jsi`, `jsidynamic` and `jsc` setup is breaking the `use_frameworks!` with `:linkage => :static` option with the old architecture. So it is a regression.
2. JSCRuntime is required by some libraries and needs to be exposed as a prefab and the current setup makes it hard to achieve.
allow-large-files
## Changelog:
[General][Changed] - Move JSCRuntime into a separate pod/prefab
Reviewed By: cortinico
Differential Revision: D41533778
fbshipit-source-id: 642240c93a6c124280430d4f196049cb67cb130b
Summary:
Normally, when we work with RNTester, we have to install the pods with the `pod install` command. The `pod install` commands has some side effects on the Xcode.project: for example, it installs some build script phases.
In Sandcastle, we do not run that command to avoid network requests and to improve test reliability and reproducibility. This implies that, when we run the sandcastle jobs and/or we update the offline mirrors, we also have to upload the Xcode project associated with the specific JS engine.
This Diff operates in two steps:
1. when updating the offline mirrors, it creates a tarball with the Xcodeproj and stores it in the proper offline mirror folder.
2. when testing, it replaces the current project with the one stored in the offline mirrors before extracting the pods.
allow-large-files
## Changelog
[Internal] - Keep a copy of the Xcodeproj in the offline mirrors
Reviewed By: cortinico
Differential Revision: D41541712
fbshipit-source-id: e6d9633f9245631ab56c8b9689707b537c30075c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35436
Using std::optional as react-native has been using C++17 for quite some time
changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D41415031
fbshipit-source-id: d786647f64b4f90cf75409109830ae0885460c17
Summary:
The [monorepo RFC](https://github.com/react-native-community/discussions-and-proposals/pull/480) calls for renaming:
* `react-native-community/eslint-config` -> `react-native/eslint-config`
* `react-native-community/eslint-plugin` -> `react-native/eslint-plugin`
It also calls for the versions to be aligned with the rest of main -- currently `0.72.0`.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[General][Changed] - Renamed `react-native-community/eslint-config` to `react-native/eslint-config` v0.72.0 to align with other packages
[General][Changed] - Renamed `react-native-community/eslint-plugin` to `react-native/eslint-plugin` v0.72.0 to align with other packages
Pull Request resolved: https://github.com/facebook/react-native/pull/34581
Test Plan:
First test is to run `yarn lint`, and verify that output matches before and after this change.
Second test is to change the ESLint config to use the "old" packages (under `react-native-commnuity`) and run `yarn lint` to make sure that they work as expected. This is what customers will experience, until they manually move to the new ESLint packages.
Reviewed By: cortinico
Differential Revision: D41520500
Pulled By: hoxyq
fbshipit-source-id: a61e5ae15d5aaf11f0143a3b0257a60a03b1550b
Summary:
Build hermesc in Xcode run script phase, so it ends up inside `Pods/hermes-engine/buld_host_hermesc`. All the the housekeeping is now done by CocoaPods and Xcode, and we can get rid of all the setup/cleanup code.
Changelog:
[iOS][Changed] - Build hermesc in Xcode run script phase.
Reviewed By: cipolleschi
Differential Revision: D41521987
fbshipit-source-id: 336854fa23582255cba6d161acf2cc791cac9d00
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35456Fixes#35439
There is a bug in AGP 7.3.x which is causing assets to don't be copied properly inside the
final artifact: issuetracker.google.com/issues/237421684
As AGP 7.4.x is really close to release (is in Beta5, should be released stable in the next weeks)
we should be fine by bumping to beta5.
This also requires a bump of RNGP
Changelog:
[Android] [Changed] - Bump AGP to 7.4.x
allow-large-files
Reviewed By: cipolleschi
Differential Revision: D41519549
fbshipit-source-id: 60d568a3e49798a23f1d7bf4839ab58bd5549aba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35454
Historically, we used to have hermes-executor debug and release as separate dynamic libraries.
This makes it impossible to prefab this library, so I have to reconcile it into a single library.
This will also help keep the setup consistent with the internal (BUCK) where we have a single target.
Changelog:
[Internal] [Changed] - Consolidate hermes-executor-debug and -release inside a single target
Reviewed By: cipolleschi
Differential Revision: D41519119
fbshipit-source-id: d9ddc30b72164daa29c735836ea433fd4d917fc8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35445
As Flipper version is a bit old, let's bump it to the latest stable: 0.174.0.
This is a follow-up from D33583090 (https://github.com/facebook/react-native/commit/50057158ca32842d70160541e3cb5d4bd512f8f5).
At the time, it wasn't possible to update to the latest stable Flipper as crashes were observed due to NDK mismatch.
Changelog:
[Android] [Changed] - Bump Flipper to 0.174.0
Reviewed By: cortinico
Differential Revision: D41492705
fbshipit-source-id: 9ec205bb0b8e4ddcb56355a194cae0a64f3345d6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35455
This little change allows to support Gradle Configuration cache in user projects:
https://docs.gradle.org/current/userguide/configuration_cache.html
It allows to save several seconds on the build time.
We'll keep it disabled for now, but Gradle plans to enable it by default for everyone
in the future, so this changes makes us ready for it.
Changelog:
[Internal] [Changed] - RNGP - Correctly Support Gradle Configuration Cache
Reviewed By: cipolleschi
Differential Revision: D41519506
fbshipit-source-id: 6252546e811deb0777c0aab5332291368be7fa8f
Summary:
i recently made a change to modularize some of our graphics dependencies
i think this codegen will be incorrect now after my diff, so i updated it so we would codegen the correct deps
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D41451842
fbshipit-source-id: 98b5576e9fbd2d693c8bcfeac39d8dfb1b1e0584
Summary:
The order of following calls is irrelevant.
```
__update_pods_and_offline_mirrors "$JS_ENGINE_JSC"
__update_pods_and_offline_mirrors "$JS_ENGINE_HERMES"
```
If execute `__update_pods_and_offline_mirrors "$JS_ENGINE_HERMES"` last, then `prepare_pods "$JS_ENGINE_HERMES"` is redundant.
allow-large-files
Changelog:
[Internal][Changed] - Cleanup offline pod mirrors updating behaviour.
Reviewed By: cipolleschi
Differential Revision: D41346899
fbshipit-source-id: 694713330fb94561d872883a18f97869cd30cd26
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35379
This diff moves the publishing coordinates from:
```
com.facebook.react:react-native
com.facebook.react:hermes-engine
```
to
```
com.facebook.react:react-android
com.facebook.react:hermes-android
```
I've picked those they are the most layout friendly when building from source, but we can discuss if we want others.
I've updated the Gradle plugin to have a dependencySubstitution rule + update the template with those changes.
It should now be possible to still use `implementation("com.facebook.react:react-native:+")` inside libraries
on 0.71+ and RNGP will resolve dependencies correctly.
Changelog:
[Android] [Changed] - Void the Maven coordinates for react-native and hermes-engine
Reviewed By: cipolleschi
Differential Revision: D41380525
fbshipit-source-id: 91e059fa261acb89bee7ca0c79c30c3d856a2c80
Summary:
Jscodeshift has become maintained again in the past year, and has gotten rid of quite a good chunk of old dependencies that are no longer needed!
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - update jscodeshift
Pull Request resolved: https://github.com/facebook/react-native/pull/35356
Reviewed By: cipolleschi
Differential Revision: D41325527
Pulled By: rshest
fbshipit-source-id: 666b25c9bb3b1720479e9e098968b3b983adc2b4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35369
Somwhere between importing https://github.com/facebook/react-native/pull/35017 and running `js1 oss update-pods`, the entire Podfile lock was deleted without me noticing. This change runs `js1 oss prepare-pods` to restore it.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D41343786
fbshipit-source-id: 79abe41b18b8e13b9fba70906b8301b002d0e3db
Summary:
This PR is a task of https://github.com/facebook/react-native/issues/34872
- combined `Flow` and `TS` `buildPropertySchema` fn 's into common fn
- added callback param `resolveTypeAnnotation` to the same
- moved it to `parsers-commons.js`
- re-organized imports and exports
## Changelog
[INTERNAL] [CHANGED] - [Codegen]: Refactored `buildPropertySchema` fn of (Flow, TS) into common fn in `parsers-commons.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/35288
Test Plan:
- ensure 👇 is `#00ff00`
```bash
yarn lint && yarn flow && yarn test-ci
```
Reviewed By: christophpurrer
Differential Revision: D41247738
Pulled By: cipolleschi
fbshipit-source-id: aecc0ed8d07efa1c2c39e8a8e64b4ee73b720b8f
Summary:
Cherry pick https://github.com/microsoft/react-native-macos/commit/19a62d9f57a6fae7a046741e19978a801f69abee to React Native. These style props were being applied to a <Text> element, not a <View> element. They seemingly only worked because of a quirk of iOS.
=== Original change notes ===
The issue with the test is that the react native Text component has its own props for shadows - i.e. [textShadowColor, textShadowRadius, etc](https://reactnative.dev/docs/text-style-props) and the shadow props that View uses does not work on Text (i.e. shadowColor, shadowRadius, etc.). Not entirely sure how this test was passing without any errors before my change, it seems like something about the change is causing (expected) errors to actually show up.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Fixed] - Shadow consistency opacity fix with test updates
Pull Request resolved: https://github.com/facebook/react-native/pull/35360
Test Plan: Tested in our React Native macOS fork on iOS.
Reviewed By: cipolleschi
Differential Revision: D41335366
Pulled By: christophpurrer
fbshipit-source-id: f789b9565ed4e00fa558af8e418dd9e078064f98
Summary:
Rename this helper to make it explicit what it's used for. There's still more to do here to simplify these.
Changelog: [Internal]
Reviewed By: fkgozali
Differential Revision: D41184338
fbshipit-source-id: a33d306978cb9026ebf10b00853042da4aaecd5a