Summary:
This is part of a series of tasks to make the React Native Gradle Plugin (RNGP) variant-aware.
Here I'm creating some tasks that will take care of doing the .so cleanup of the Apk/AppBundle.
Historically we used to use a error prone mechanism which was relying on assumptions on file paths and was breaking the variant-aware assumptions.
I'm going to use those tasks in a subsequent diff.
Changelog:
[Internal] [Changed] - RNGP - RNGP - Setup tasks to cleanup the Apk/Aab from unused .so
Reviewed By: cipolleschi
Differential Revision: D40512100
fbshipit-source-id: 649999dc8d126e7c939b61a5cec608d39cd7f688
Summary:
This is part of a series of tasks to make the React Native Gradle Plugin (RNGP) variant-aware.
Here I'm extending the GenerateCodegenSchemaTask to make sure we exclude the generated build/ASSETS and build/RES folders from execution avoidance.
Changelog:
[Internal] [Changed] - RNGP - Make sure GenerateCodegenSchemaTask is not considering generated assets/res for execution avoidance
Reviewed By: cipolleschi
Differential Revision: D40512103
fbshipit-source-id: 193f4fd241a0fd973863beb6ff0dd1128dcee1d7
Summary:
This diff adds explicit type arguments to polymorphic function calls that do not constrain their types. This codemod will reduce the error burden that will come in a future version of flow.
This specific diff was generated by running:
```
flow codemod annotate-implicit-instantiations --write .
flow --json --pretty | jq '.errors | .[] | .message | .[] | .loc |.source' | sort | uniq | sed -e 's/"//g' | xargs hg revert
hg st -n | xargs grep "generated" | sed -e 's/:.*//g' | xargs hg revert
arc f
```
So these are the codemod results that introduced no new errors and no generated files.
Changelog: [Internal]
drop-conflicts
Reviewed By: SamChou19815
Differential Revision: D40413074
fbshipit-source-id: 42b52719978f1098169662b503dbcfd8cefdad53
Summary:
The `template/android/app/build_defs.bzl` file can be removed as it's unused in the Template.
## Changelog
[Internal] - Remove build_defs.bzl from Android Template
Pull Request resolved: https://github.com/facebook/react-native/pull/35020
Test Plan: n/a
Reviewed By: cipolleschi
Differential Revision: D40506250
Pulled By: cortinico
fbshipit-source-id: 14d8522a995a4b19b5b6610fcb2c5b1dda3374c8
Summary:
I've just realized we have a typo in the `OsRule`. This is actually causing those tests to fail if run locally on M1 (but not on CI as it runs on a `amd64` architecture).
## Changelog
[Internal] - Fix typo in OsRule
Pull Request resolved: https://github.com/facebook/react-native/pull/35024
Test Plan: Not much to test other than it's green locally, previously it was red. CI should be green regardless
Reviewed By: cipolleschi
Differential Revision: D40507320
Pulled By: cortinico
fbshipit-source-id: 75600014a515b2cb76debbd6e1d79ecd78ea5092
Summary:
This configuration was stale and has no effect on the Gradle Plugin, I'm removing it then 👍
## Changelog
[Internal] - Remove useJavaGenerator key from ReactAndroid/build.gradle file
Pull Request resolved: https://github.com/facebook/react-native/pull/35021
Test Plan: n/a
Reviewed By: cipolleschi
Differential Revision: D40506375
Pulled By: cortinico
fbshipit-source-id: 2bcdc67686b1ac9fc77091d9324f5ad585df8818
Summary:
A super small PR to bump CLI to latest available of the 9.x stream, to make available in main the asset image fix (https://github.com/react-native-community/cli/pull/1290) and to be able to cherry pick it back in 0.70 branch.
## 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] - bump CLI to 9.2.1
Pull Request resolved: https://github.com/facebook/react-native/pull/35022
Test Plan: CI is green
Reviewed By: dmytrorykun
Differential Revision: D40507344
Pulled By: huntie
fbshipit-source-id: 7c3753e9df154eb5835f021cdfe1b476499afb9a
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts `UnsupportedFunctionReturnTypeAnnotationParserError` exception to a separate function inside an `error-utils.js` file
## Changelog
[Internal] [Changed] - Extract `UnsupportedFunctionReturnTypeAnnotationParserError` to a seperate function inside `error-utils.js`
Pull Request resolved: https://github.com/facebook/react-native/pull/34965
Test Plan:
```sh
yarn jest react-native-codegen
```
Added unit case in `error-utils-test.js` file
<img width="939" alt="Screenshot 2022-10-13 at 11 46 54 AM" src="https://user-images.githubusercontent.com/86605635/195517350-dcb7a26d-434c-4e45-a174-ce82931073e5.png">
Reviewed By: dmytrorykun
Differential Revision: D40338048
Pulled By: cipolleschi
fbshipit-source-id: baa41e0e96c9e17a35f316433c8d80c9bf88d334
Summary:
This PR extracts the content of the codegen case 'String' into a single `emitString` 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 `emitString` function.
ref: https://github.com/facebook/react-native/pull/34936
## 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] - Extract the content of the case 'StringTypeAnnotation' into a single emitString function
Pull Request resolved: https://github.com/facebook/react-native/pull/34981
Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green
Reviewed By: cortinico
Differential Revision: D40376836
Pulled By: cipolleschi
fbshipit-source-id: feb1b07ec7fc2c333f5054f8cd8d18457d985257
Summary:
https://github.com/facebook/react-native/pull/34933 has been merged just after I pushed a new commit to the branch to improve tests of `assertGenericTypeAnnotationHasExactlyOneTypeParameter` function, but the last commit was not imported to the internal repository.
The `assertGenericTypeAnnotationHasExactlyOneTypeParameter` can throw different types of Error, and I believe that `.toThrow(Error)` is not specific enough. So I replaced it with `toThrowErrorMatchingInlineSnapshot()`.
## 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] - Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests in parsers-commons
Pull Request resolved: https://github.com/facebook/react-native/pull/34942
Test Plan: Some test cases were ok because the assertGenericTypeAnnotationHasExactlyOneTypeParameter function threw an Error, but for the wrong reason. I've made sure that the error displayed in the inline snapshot is the one we expect.
Reviewed By: cortinico
Differential Revision: D40384993
Pulled By: cipolleschi
fbshipit-source-id: aaa943be1e808af2c5131f7d06baf24bc3bffa31
Summary:
This PR is a part of https://github.com/facebook/react-native/issues/34872.
Extracted the UnsupportedObjectPropertyValueTypeAnnotationParserError in its own throwing function and reuse that function passing a proper type.
## Changelog
[Internal] [Changed] - Extract the UnsupportedObjectPropertyValueTypeAnnotationParserError in its own throwing function and reuse that function passing a proper type.
Pull Request resolved: https://github.com/facebook/react-native/pull/34917
Test Plan:
Output of yarn jest react-native-codegen.
<img width="451" alt="Screenshot 2022-10-10 at 12 55 39 PM" src="https://user-images.githubusercontent.com/32268377/194816863-5220dbaa-3b63-42bf-8e62-9d7b915f7cbd.png">
Reviewed By: cortinico
Differential Revision: D40424885
Pulled By: cipolleschi
fbshipit-source-id: 08d4d13ee3959391261fe13c190a4bb893970757
Summary:
[`Share`](https://reactnative.dev/docs/share) currently does not support the `anchor` option in iOS, so share sheets will always be displayed in the middle of the screen on iPads and on the top left corner of the window on Mac Catalyst.
This PR utilizes the `anchor` functionality already implemented in [`ActionSheetIOS`](https://reactnative.dev/docs/actionsheetios) to bring this support to `Share` on iOS.
## Changelog
[iOS] [Changed] - type definition for the `options` parameter of `Share.share` (added optional `anchor` property)
[iOS] [Added] - `anchor` option support for `Share`
Pull Request resolved: https://github.com/facebook/react-native/pull/35008
Test Plan:
Tested with modified `rn-tester` that utilizes the `anchor` option on iPad simulator. Marked all 3 changes in code.

```js
const SharedAction = () => {
const [shared, setShared] = React.useState();
const ref = React.useRef(); /* create ref (1/3) */
const sharedAction = async () => {
try {
const result = await Share.share(
{
title: 'Create native apps',
message:
('React Native combines the best parts of native development with React, a best-in-class JavaScript library for building user interfaces.': string),
url: 'https://reactnative.dev/',
},
{
subject: 'MUST READ: Create native apps with React Native',
dialogTitle: 'Share React Native Home Page',
tintColor: 'blue',
anchor: ref.current?._nativeTag, /* add anchor in options (2/3) */
},
);
if (result.action === Share.sharedAction) {
setShared(result.action);
} else if (result.action === Share.dismissedAction) {
//iOS only, if dialog was dismissed
setShared(null);
}
} catch (e) {
console.error(e);
}
};
return (
<View style={styles.container}>
<Text>action: {shared ? shared : 'null'}</Text>
<Text style={styles.title}>Create native apps</Text>
<Text>
React Native combines the best parts of native development with React, a
best-in-class JavaScript library for building user interfaces.
</Text>
{/* supply ref to Node (3/3) */}
<Text ref={ref} style={styles.button} onPress={sharedAction}>
SHARE
</Text>
</View>
);
};
```
Reviewed By: cipolleschi
Differential Revision: D40459336
Pulled By: skinsshark
fbshipit-source-id: 72fbb3905ea0b982bb7f4b99967d121cd482181a
Summary:
circleci analyze_code errors: https://app.circleci.com/pipelines/github/facebook/react-native/16638/workflows/76804803-ceb5-4fb3-bd24-26bbb9826827/jobs/321696
- __Image.flow and Image.ios:__ requires needed to be sorted alphabetically
- __error-utils-test.js:__ duplicate describe block title is used, i believe this was a typo
Changelog:
[Internal][Fixed] - fix circleci:analyze_code errors
Reviewed By: lunaleaps
Differential Revision: D40491001
fbshipit-source-id: a1df6ded77374f92e297d0a8866a2c4096e1196a
Summary:
Add full functionality for `Symbol`s and `BigInt`s in the debugger. Note- using the [protocol monitor](https://umaar.com/dev-tips/166-protocol-monitor/) was the most reliable way of figuring out which fields exactly need to be set for these types to play nicely in DevTools. I brought up the monitor and then used the regular, standard chrome console with the functionality I wanted:
- Evaluating `Symbol` and `BigInt` literals, like `Symbol.for("a")` and `1n`
- Right-click save the resulting expressions
From there, I inspected the CDP messages being sent. Then I was able to fill in the correct fields from there, and be confident that those were correct, given that I was copying the exact behavior of Chrome itself.
Changelog:
[General][Fixed] Support properly sending BigInts and Symbols over the Chrome DevTools Protocol.
Reviewed By: neildhar, jpporto
Differential Revision: D40442228
fbshipit-source-id: 98a514edbeb35fcbd427a25475f435e22956f2db
Summary:
Changelog:
[Internal][ErrorHandling] 3/n Add a gate for parsing unhandled JS errors in C++
Gate this just in case it causes issues. Enabling this is definitely a better behavior than before, because we want the JS stack when there is a JS error, not the native stack.
Reviewed By: sammy-SC
Differential Revision: D40397393
fbshipit-source-id: 586b4d7bcf710edb048b5c643646ba2f3c4c302a
Summary:
checking for background == null to fix this error:
```java.lang.NullPointerException: Attempt to invoke virtual method 'android.graphics.drawable.Drawable$ConstantState android.graphics.drawable.Drawable.getConstantState()' on a null object reference
at com.facebook.react.views.textinput.ReactTextInputManager.setUnderlineColor(:4)
```
Changelog:
[Internal][Fixed] - check for null background in Android TextInput setUnderlineColor
Reviewed By: beatthat
Differential Revision: D40451369
fbshipit-source-id: 8618d5ff73f517f714c26a0b17af078493822244
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35013
Previously, release builds were only built for stable RN releases. This creates a discrepancy between CI jobs that run on commits versus CI jobs that run on releases. We are working on reducing these differences in order to limit the number of issues we may face when cutting a React Native release.
Now, build_hermes_macos will be run as a matrix of Debug/Release builds in every workflow.
Updated build_hermes_macos to take 'flavor' as a Enum, not a string.
Store hermesc in separate directories as Circle CI does not allow two different jobs (e.g. build_hermes_macosDebug and build_hermes_macosRelease) to write to the same path when storing artifacts.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D40308952
fbshipit-source-id: b96b9a6c7cf8d0becafcf2fdcb761540816ae336
Summary:
In this diff I'm shipping and deleting mapBufferSerialization for Text measurement
changelog: [internal] internal
Reviewed By: NickGerleman
Differential Revision: D40348982
fbshipit-source-id: 7336cbe055a55d7d8d4f0a723049842bae1defb5
Summary:
This diff refactors the initialization of MapBuffer so
changelog: [internal] internal
Reviewed By: NickGerleman
Differential Revision: D40348981
fbshipit-source-id: 88bbf4f2370373c20f805c3b23d0ecbe8a26bb86
Summary:
Recently this PR got merged https://github.com/facebook/react-native/pull/34919 that aligned the info.plist to the current default. Problem: the variable `MARKETING_VERSION` was not set in the template, so generating a new project and testing on iOS would fail accordingly:
<img width="1400" alt="Screenshot 2022-10-18 at 15 27 27" src="https://user-images.githubusercontent.com/16104054/196461640-470079f5-0f64-471f-8221-0d17f2b0114f.png">
This PR takes care of setting the variable so that the app can build successfully.
## 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
-->
[iOS] [Fixed] - add MARKETING_VERSION to template project
Pull Request resolved: https://github.com/facebook/react-native/pull/35012
Test Plan: Run `yarn test-e2e-local -t RNTestProject`, apps builds correctly and runs on simulator.
Reviewed By: cipolleschi
Differential Revision: D40472420
Pulled By: cortinico
fbshipit-source-id: 18ddd57ce54186a101321583a7a8391e97ca9511
Summary:
This is the second diffs that backs out the Custom Native State from the Codegen. The reason why we are backing it out are:
1. It forces users to create new types in JS that are not ctually used there. For example, the NativeState you define, and eventually exports, in JS is not used anywhere in your JS code.
2. You need to put in the JS native state some types that does not exists in JS, only to have them generated by the Codegen. ImageRequest, for example, does not exists in JS, but you need it in your (iOS) state to load images
3. There are a lot of edge cases due to how C++ handles variables. Some variables needs to be created as pointers. Some others as `const &`. It does not scale to hard code all of them and there is the risk to have the same type that needs to be a pointer in some case and something else in others.
4. It is better to instruct the users on how to properly create a component with Custom State, Shadow Node and Descriptor.
## Changelog:
[General][Removed] - Back out parsing and generation of Custom Native State from Codegen
Reviewed By: cortinico
Differential Revision: D40426134
fbshipit-source-id: c368e122cc31ee8df056fe1bf6cecaab482140a4
Summary:
This is the first diffs that backs out the Custom Native State from the Codegen. The reason why we are backing it out are:
1. It forces users to create new types in JS that are not ctually used there. For example, the NativeState you define, and eventually exports, in JS is not used anywhere in your JS code.
2. You need to put in the JS native state some types that does not exists in JS, only to have them generated by the Codegen. ImageRequest, for example, does not exists in JS, but you need it in your (iOS) state to load images
3. There are a lot of edge cases due to how C++ handles variables. Some variables needs to be created as pointers. Some others as `const &`. It does not scale to hard code all of them and there is the risk to have the same type that needs to be a pointer in some case and something else in others.
4. It is better to instruct the users on how to properly create a component with Custom State, Shadow Node and Descriptor.
## Changelog
[General][Removed] - Back out components with native state in RNTester
Reviewed By: cortinico
Differential Revision: D40419254
fbshipit-source-id: 1895c7050f01f76a8901a97e9700f74cae707b79
Summary:
Changelog:
[General][Added] - Introduce `useAnimatedValue` hook to make it easier working with `Animated.Value`s in function components.
Reviewed By: javache
Differential Revision: D40434219
fbshipit-source-id: 3caf6ad98d11a534b8cc6816820bc1d125150380
Summary:
This change starts adding more coverage to GitHub Actions. Existing workflows are split up to be per-platform, and stale scripts, etc are removed.
We are currently limited a bit by issues with the build itself, but this still adds a good bit of coverage that readily works, and adds places to inject more.
Another option would have been to move these to CircleCI where we have more credits, or used docker images instead of manual setup steps. etc, The Yoga build and number of changes is very light though, so we don't really need the complexity yet.
Some TODOs:
1. Fix the Apple Builds (pod lint and pod install return errors seen by the community)
2. Add working Android UTs
3. Add C++ UTs
4. Add Apple Publish
5. Add version stamping
Changelog:
[Internal][Added] - Start Adding Yoga GitHub Actions
X-link: https://github.com/facebook/yoga/pull/1165
Reviewed By: cortinico
Differential Revision: D40386426
Pulled By: NickGerleman
fbshipit-source-id: c540dd25bfec6ac8c05e461c1236ef7fe6cb8598
Summary:
We found this feature crashing the app during hot reload, and as there is no user code dependent on it so far, we decided to disable it until we find the root cause.
changelog: [internal] internal
Reviewed By: mdvacca
Differential Revision: D40445312
fbshipit-source-id: fe28b58c5dca6c91389ad38675ca37669a4965a0
Summary:
Changelog: [RNTester][Internal] - Add PointerOver/PointerOut handling test
This diff adds another platform test based on WPT testcase for mouseover/mouseout events but instead applied to pointerover/pointerout events recently implemented for RN.
Reviewed By: lunaleaps
Differential Revision: D40359286
fbshipit-source-id: 672f413f56faca55b9d838150fb66de66d78d6f2
Summary:
iOS did not support the implementation of Korean word-wrap(line-break) before iOS14.
If the attribute applied, the word-wrap of Korean will works.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
[iOS] [Added] - Line break strategy for Text and TextInput components
Pull Request resolved: https://github.com/facebook/react-native/pull/31272
Test Plan:
1. Test build and run on above iOS 14.
2. Test it does not affect existing text components when set default(none) strategy.
3. Test whether word-wrap works with Korean when set hangul-word strategy.
<img src="https://user-images.githubusercontent.com/26326015/112963967-d7f70c00-9182-11eb-9a34-8c758b80c219.png" width="300" height="" style="max-width:100%;">
Reviewed By: javache
Differential Revision: D39824809
Pulled By: lunaleaps
fbshipit-source-id: 42cb0385221a38c84e80d3494d1bfc1934ecf32b
Summary:
This PR is the follow up to the conversation started here by SimenB: https://github.com/react-native-community/discussions-and-proposals/issues/509
Basically, we want to move RN to use its own custom environment so that we can tweak it going forward - this PR in fact only sets up the groundwork for that; robhogan mentioned that with this in place, Meta engineers can
> iterate on it (with jest-environment-node as a starting point) against our internal product tests
This is also connected to Rob's work to bring Jest 29 into the codebase https://github.com/facebook/react-native/pull/34724 and my "mirror" PR to bring template in main up to the same version (https://github.com/facebook/react-native/pull/34972)
## 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] - move Jest config to use a custom react-native Jest env
Pull Request resolved: https://github.com/facebook/react-native/pull/34971
Test Plan: Tested that `yarn test` in main works fine after the changes; CI and Meta's internal CI will also serve the purpose of verifying that it works (but there's no reason not to since it's still pretty much just relying on `node`).
Reviewed By: huntie
Differential Revision: D40379760
Pulled By: robhogan
fbshipit-source-id: 2c6d0bc86d337fda9befce0799bda2f56cc4466c
Summary:
Breaks the runtime dependency cycle introduced in D40259791 (https://github.com/facebook/react-native/commit/971599317b7bdf1152157206f9503a23ac8c4162) by converting a value import to a type import. (Unlike runtime dependency cycles, type-level cycles are OK as long as they are reasonably small.)
Changelog:
[General][Fixed] - Fix require cycle warning in VirtualizedList
Reviewed By: javache
Differential Revision: D40412019
fbshipit-source-id: 33bf3af12be64a1932549a0d11f2ce8b3c483218