Commit Graph

12270 Commits

Author SHA1 Message Date
Ruslan Lesiutin 48db6be269 refactor(rn-tester): removed usage of AsyncStorage
Summary:
## Changelog:
[Internal][Changed] - removed usage of AsyncStorage inside rn-tester package

Reviewed By: NickGerleman, JTYim

Differential Revision: D40298838

fbshipit-source-id: fb08df690654f3b19e6f64f8893252092f0d8a27
2022-10-21 04:31:11 -07:00
Paige Sun ff398e4e26 4/n Display a RedBox with the JS stack (instead of native stack) when an unhandled JS exceptions occurs
Summary:
Changelog: [iOS][Changed] Display a RedBox with the JS stack (instead of native stack) when an unhandled JS exceptions occurs

-----

# A0) Bridge mode, Unhandled Exception, FBiOS
Unhandled exception goes to FBReactModule, but the JS Stack is not parsed correctly.
https://www.internalfb.com/code/fbsource/[312d5cbdd7278247a84619786b12a44c4400fcc0]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/Exported/FBReactModule.mm?lines=1488%2C1493

See `****** FBReactModule handleFatalError` in the logs P539306390, and compare with correct behavior in (A1) in the Test Plan.

https://pxl.cl/2h6h3

{F782257996}

-----

# A) Before diff, rn-tester
Open to rn-tester -> APIs -> Crash Examples -> JS Crash.

Set `RCTParseUnhandledJSErrorStackNatively` to YES.
https://www.internalfb.com/code/fbsource/[98880e52ee78be3614e5d9a2ce3292f6a7b5e413]/xplat/js/react-native-github/React/Base/RCTConstants.m?lines=73

{F783395297}

Reviewed By: sammy-SC

Differential Revision: D40387938

fbshipit-source-id: 2abea657476d3bf61ad5b1c643f129e44c6f3f35
2022-10-20 21:12:41 -07:00
Sam Zhou 466ba91657 Implicit instantiation codemod
Summary: Changelog: [Internal]

Reviewed By: bradzacher

Differential Revision: D40543059

fbshipit-source-id: 4d10671d8f2734b47d2aa86646be7f543a174515
2022-10-20 19:06:09 -07:00
Nishan 9f3a3e13cc feat: flex gap bindings (#34974)
Summary:
This PR adds React native binding for https://github.com/facebook/yoga/pull/1116

## Changelog

[General] [Added] - Flex gap yoga bindings

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

Pull Request resolved: https://github.com/facebook/react-native/pull/34974

Test Plan:
Run rn tester app and go to view example. You'll find a flex gap example. Example location - `packages/rn-tester/js/examples/View/ViewExample.js`

### Tested on
- [x] iOS Fabric
- [x] iOS non-fabric
- [x] Android Fabric
- [x] Android non-fabric

To test on non-fabric Android, I just switched these booleans. Let me know if there's anything else I might have missed.

<img width="674" alt="Screenshot 2022-10-14 at 3 30 48 AM" src="https://user-images.githubusercontent.com/23293248/195718971-7aee4e7e-dbf0-4452-9d47-7925919c61dc.png">

Reviewed By: mdvacca

Differential Revision: D40527474

Pulled By: NickGerleman

fbshipit-source-id: 81c2c97c76f58fad3bb40fb378aaf8b6ebd30d63
2022-10-20 14:53:32 -07:00
Héctor Ramos a68c418082 Do not build JSI in React-jsi when Hermes is enabled, resolve JSI ODR violation (#35038)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35038

React-jsi provides JSI to allow React Native to interface with JavaScriptCore.
The hermes-engine Pod provides a second copy of JSI, as Hermes is built and linked statically with JSI.
This second copy of JSI would lead to an [ODR Violation](https://en.cppreference.com/w/cpp/language/definition).

To resolve this, when Hermes is enabled:
- React-hermes and hermes-engine are installed.
- React-jsc is not installed.
- React-jsi continues to be installed.
- React-jsi will not build JSI.
- React-jsi will declare a dependency on hermes-engine.

The result is that the JSI dependency for React Native is satisfied by hermes-engine, and there is no duplicate JSI library in the project.

When Hermes is disabled:
- React-jsi and React-jsc are installed.
- React-hermes and hermes-engine are not installed.
- React-jsi will build JSI.

Changelog:
[iOS][Changed] Resolve JSI ODR violation, make hermes-engine the JSI provider when Hermes is enabled

Reviewed By: cipolleschi

Differential Revision: D40334913

fbshipit-source-id: 409407a193a35cbd21b0e8778537b3627e4c54a2
2022-10-20 14:14:23 -07:00
Héctor Ramos 6b129d81ed CocoaPods: Split React-jsc out of React-jsi (#35031)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35031

The React-jsi Pod was serving two purposes: building JSI, and configuring JavaScriptCore as the JS engine.

By splitting the React-jsi Pod into React-jsi and React-jsi, we can start working towards de-coupling the JSI dependency from any particular JS engine.

Pods that depended on React-jsi, now depend on React-jsi and React-jsc.
One exception to this is React-hermes, which is only installed when Hermes is enabled, and thus does not require JavaScriptCore.
Upcoming commits should take care of removing the React-jsc dependency when Hermes is enabled, but it is out of scope for this commit.

Changelog:
[iOS][Changed] - The JSC Runtime is now provided by the React-jsc Pod instead of React-jsi. Libraries that declared a dependency on React-jsi in order to specifically create a JSC runtime (`makeJSCRuntime()`) will need to add React-jsc to their dependencies.

Reviewed By: dmytrorykun

Differential Revision: D40442603

fbshipit-source-id: b9b21146b9deb401f80cfef76a87c9867754a953
2022-10-20 14:14:23 -07:00
Nicola Corti 7383c00dd6 RNGP - Remove deprecated useJavaGenerator and reactRoot properties from extension
Summary:
This is part of a series of diffs to make the React Native Gradle Plugin (RNGP) variant-aware.

Here I'm removing two deprecated properties `useJavaGenerator` and `reactRoot`.

They were both not widely used, we had a deprecation warning and now they're just making the whole setup harder.

Changelog:
[Internal] [Changed] - RNGP - RNGP - Setup tasks to cleanup the Apk/Aab from unused .so

Reviewed By: cipolleschi

Differential Revision: D40547688

fbshipit-source-id: c4b8c1cef3a2abae1060e8ce2540e45d0313a4be
2022-10-20 13:25:55 -07:00
Nicola Corti 8e8e18be5e RNGP - Remove unused applyAppPlugin
Summary:
This is part of a series of tasks to make the React Native Gradle Plugin (RNGP) variant-aware.

Here I'm removing the `applyAppPlugin` property which was never used. The new logic will apply the App Plugin if the `com.android.application` plugin is found.

I've also removed the corresponding tests. New one will follow afterwards

Changelog:
[Internal] [Changed] - RNGP - Remove unused applyAppPlugin

Reviewed By: cipolleschi

Differential Revision: D40547689

fbshipit-source-id: ce1089498a586a43cb5e07950767c2c4b51b4597
2022-10-20 12:46:27 -07:00
Zihan Chen (MSFT) affcfa7bde Refactor codegen: Dispatch props and events from a central place. (#34975)
Summary:
Refer to `In component, props and events pick properties from the component interface by themselves independently, I would like to reverse the direction, to have a function dispatching properties to props and events, to reduce duplicated code.
` in https://github.com/facebook/react-native/issues/34872

## Changelog

[General] [Changed] - Refactor codegen: Dispatch props and events from a central place.

Pull Request resolved: https://github.com/facebook/react-native/pull/34975

Test Plan: `yarn jest react-native-codegen` passed

Reviewed By: cortinico

Differential Revision: D40507917

Pulled By: cipolleschi

fbshipit-source-id: 71988877008ae11a01affd31b34bb3a3b88f96be
2022-10-20 12:06:50 -07:00
Vincent Riemer f5bd272a33 Add pointer event test ensuring that pointerover events are fired when an element appears under the cursor
Summary:
Changelog: [RNTester][Internal] - Add pointer event test ensuring that pointerover events are fired when an element appears under the cursor

This diff adds a port of an existing web platform test that checks if pointerover & pointerenter events are fired for elements that are mounted underneath the cursor.

Reviewed By: lunaleaps

Differential Revision: D40449499

fbshipit-source-id: 393f4325f7a9d9025fe9d0aab38642b1e3ab2612
2022-10-20 11:47:47 -07:00
Rob Hogan 45db65be7e Update Jest to ^29.2.1 (#35014)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35014

X-link: https://github.com/facebook/metro/pull/881

Following on from https://github.com/facebook/react-native/pull/34724 and https://github.com/facebook/react-native/pull/34972, this updates Jest to the latest version 29.2.1 across projects and in the OSS React Native new app template.

Importantly this version includes the [new `jest.now()` API](https://github.com/facebook/jest/pull/13245), which will be useful for exposing internally consistent fake timer mocks of `requestAnimationFrame`, etc., in the new React Native Jest environment.

Changelog:
[General] [Changed] - Upgrade Jest in React Native template to ^29.2.1

Reviewed By: jacdebug

Differential Revision: D40386349

fbshipit-source-id: 43f5a69cf546df09e2f02542ebf50130d65f0436
2022-10-19 12:17:39 -07:00
Nicola Corti 08dafd890c Let the user use the default CMakeList inside the template.
Summary:
I forgot to update the path of the default CMakeLists file for the template.
I'm doing it here.

Changelog:
[Internal] [Changed] - Let the user use the default CMakeList inside the template

Reviewed By: mdvacca, cipolleschi

Differential Revision: D40517207

fbshipit-source-id: 7c02ff5893064dbf54ad573c2984884b1017dacf
2022-10-19 11:50:53 -07:00
Nicola Corti 5ffd6559b2 RNGP - Create DependencyUtil to support with dep version configuration (#35027)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35027

This is part of a series of tasks to make the React Native Gradle Plugin (RNGP) variant-aware.

Here I'm extending preparing classes to handle the Dependency versions and pre-configure the repositories as we wish.

Changelog:
[Internal] [Changed] - RNGP - Create DependencyUtil to support with dep version configuration

Reviewed By: cipolleschi

Differential Revision: D40512101

fbshipit-source-id: 05867a4c3fd341373669ea72d950ec4ee78a158d
2022-10-19 10:59:56 -07:00
Nicola Corti f5bbca50c5 RNGP - Setup tasks to cleanup the Apk/Aab from unused .so
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
2022-10-19 10:59:56 -07:00
Nicola Corti 31df147d64 RNGP - Make sure GenerateCodegenSchemaTask is not considering generated assets/res for execution avoidance
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
2022-10-19 10:59:56 -07:00
Jordan Brown 7884f6cfec Implicit instantiation codemod
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
2022-10-19 10:25:09 -07:00
Marco Fiorito f628edc502 Chore/extract codegen parser more than one module exception (#34920)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts MoreThanOneModuleInterfaceParserError exception to a separate function inside an error-utils.js file

## Changelog

[Internal] [Changed] - Extract MoreThanOneModuleInterfaceParserError to a seperate function inside error-utils.js

Pull Request resolved: https://github.com/facebook/react-native/pull/34920

Test Plan: <img width="297" alt="image" src="https://user-images.githubusercontent.com/18408823/194859284-7d3ff330-c644-472e-9ae0-3b9444bc12e8.png">

Reviewed By: cortinico

Differential Revision: D40226575

Pulled By: cipolleschi

fbshipit-source-id: 01e581abfae1ffe40e92bed8c9bedd6fe09e1aab
2022-10-19 08:54:48 -07:00
Nicola Corti a197a3face Fix typo in OsRule (#35024)
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
2022-10-19 06:25:33 -07:00
Gabriel Donadel Dall'Agnol 376ffac759 chore: Export codegen parseFile function (#35000)
Summary:
This PR export the content of the `parseFile` into a parseFile function accepting a callback to buildSchema properly in `parsers/utils.js` as requested on https://github.com/facebook/react-native/issues/34872.

## Changelog

[Internal] [Changed] - Export ` parseFile` in to a `parseFile` function in `parsers/utils.js`

Pull Request resolved: https://github.com/facebook/react-native/pull/35000

Test Plan:
Run `yarn jest react-native-codegen` and ensure CI is green

![image](https://user-images.githubusercontent.com/11707729/196051689-1b61838c-477c-4be5-8df0-9f5969fcf90d.png)

Reviewed By: cortinico

Differential Revision: D40424857

Pulled By: cipolleschi

fbshipit-source-id: a700033d674b8be8e1af942dedf73155ea3ca025
2022-10-19 01:38:28 -07:00
MaeIg 8f484c3a62 Extract the switch(configType) block from the buildSchema function into a new function in the parsers/utils.js file (#34992)
Summary:
This PR aims to extract  the switch(configType) block from the buildSchema function into a separate function in a shared file between typescript and flow. It is a task of https://github.com/facebook/react-native/issues/34872:
> This task is more advanced than the others. Extract the switch(configType) block ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/index.js#L82-L119), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/index.js#L92-L129)) from the buildSchema function into a new function in the parsers/utils.js file and use it in the two functions. Note that the new function must accept some callbacks to wrapModule/ComponentSchema and to buildModule/ComponentSchema.

## 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 switch(configType) block from the buildSchema function into a new function in the parsers/utils.js file

Pull Request resolved: https://github.com/facebook/react-native/pull/34992

Test Plan:
yarn flow:
<img width="548" alt="image" src="https://user-images.githubusercontent.com/40902940/195980663-a2d0e4bd-d2b8-464e-bbf5-3bcde553f7e8.png">

yarn lint:
<img width="521" alt="image" src="https://user-images.githubusercontent.com/40902940/195980675-a5c67d00-a822-46a8-8bd4-e1fe4f7fb698.png">

yarn jest react-native-codegen:
<img width="415" alt="image" src="https://user-images.githubusercontent.com/40902940/195980681-672e4447-4b33-43e8-a866-9e619ad332b1.png">

I added new tests:
<img width="621" alt="image" src="https://user-images.githubusercontent.com/40902940/195980703-8a68756a-45ad-4931-971f-f1e83ce16a96.png">

Reviewed By: cortinico

Differential Revision: D40429659

Pulled By: cipolleschi

fbshipit-source-id: 7e9875c129fee17c3cc5ef9c6f7990f39bfe2bf0
2022-10-19 01:38:28 -07:00
harshsiriah 32474367c2 Extracted UnsupportedFunctionReturnTypeAnnotationParserError to throwIfUnsupportedFunctionReturnTypeAnnotationParserError (#34965)
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
2022-10-19 01:38:28 -07:00
Ken Tominaga eda90e5181 Extract the content of the case 'StringTypeAnnotation' into a single … (#34981)
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
2022-10-19 01:38:28 -07:00
Antoine Doubovetzky 790f40cfeb Improve assertGenericTypeAnnotationHasExactlyOneTypeParameter tests (#34942)
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
2022-10-19 01:38:28 -07:00
dhruvtailor7 aba6be694e Extract UnsupportedObjectPropertyValueTypeAnnotationParserError to a throwing function (#34917)
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
2022-10-19 01:38:28 -07:00
Sharon Zheng 42b3ab350f fix circleci:analyze_code errors
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
2022-10-18 18:56:19 -07:00
Sam Zhou 82e86c459d Annotate empty arrays in xplat (2/n)
Summary: Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D40460690

fbshipit-source-id: 1e10b0bcf874dc9a3702b4d17d30d448653602ca
2022-10-18 12:49:22 -07:00
Riccardo Cipolleschi 62da9b8ce2 Backout Generate Custom Native State from Codegen
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
2022-10-18 10:30:06 -07:00
Riccardo Cipolleschi aace6626c1 Backout: Components with custom state
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
2022-10-18 10:30:06 -07:00
Vincent Riemer 55fca7fd38 Add PointerOver/PointerOut handling test
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
2022-10-17 15:34:16 -07:00
bang9 048194849b feat(iOS): added lineBreakStrategy attribute to Text/TextInput (#31272)
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
2022-10-17 13:14:17 -07:00
Sam Zhou a0ee6fae5e Annotate empty arrays in xplat
Summary: Changelog: [Internal]

Differential Revision: D40410427

fbshipit-source-id: f819fcb00673e19b21aecb383541850436805a0e
2022-10-17 12:40:57 -07:00
youedd 633498fe9a refactor module's platform verification (#34961)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

> [Assigned to youedd] Extract the nameToValidate logic ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L704-L713), [TypeScript](https://github.com/facebook/react-native/blob/f353119113d6fc85491765ba1e90ac83cb00fd61/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L738-L747)) into a shared function into the parser/utils.js file. Notice that you may need a callback to update the cxx boolean.

## 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
-->

[Changed] [Internal] - refactor parser module platform verification

Pull Request resolved: https://github.com/facebook/react-native/pull/34961

Test Plan:
`yarn jest react-native-codegen`

![image](https://user-images.githubusercontent.com/19575877/195425654-46f9e560-efd3-4945-b913-c6d9f6bb7ec2.png)

Reviewed By: cipolleschi

Differential Revision: D40319245

Pulled By: skinsshark

fbshipit-source-id: bc36cdcfa06047e1acee0d638f5756b6462d76d1
2022-10-17 11:08:06 -07:00
Mohit Charkha 9fb3700d35 Extract MisnamedModuleInterfaceParserError from Flow and Typescript into error-utils.js (#34916)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts MisnamedModuleFlowInterfaceParserError exception to a separate function inside an error-utils.js file

## 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 MisnamedModuleInterfaceParserError to a seperate function inside error-utils.js

Pull Request resolved: https://github.com/facebook/react-native/pull/34916

Test Plan:
yarn jest react-native-codegen
Added unit case in `error-utils-test.js` file

<img width="980" alt="Extract MisnamedModuleInterfaceParserError test Screenshot" src="https://user-images.githubusercontent.com/86604753/194853899-22c1ce05-fe55-4102-a83b-15c707a20000.png">

Reviewed By: cipolleschi

Differential Revision: D40226541

Pulled By: motiz88

fbshipit-source-id: 6698ceff192c592383aa3419ac31de524c605919
2022-10-17 06:47:13 -07:00
Antoine Doubovetzky 3c8d678aad Extract visit function to parsers/utils (#34946)
Summary:
This PR is a task from https://github.com/facebook/react-native/issues/34872:
> Extract the visit function in a shared function in the parsers/utils.js folder. Use the new function in the Flow and TypeScript parsers.

## 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 visit function in a shared function in the parsers/utils.js

Pull Request resolved: https://github.com/facebook/react-native/pull/34946

Test Plan: I tested using jest, flow and eslint commands.

Reviewed By: NickGerleman

Differential Revision: D40276462

Pulled By: cipolleschi

fbshipit-source-id: 299cc2a3aa65a9757b217192a13838d037c497a1
2022-10-17 02:35:27 -07:00
Luna Wei 6733ee1358 Add option to only see failed tests
Summary: Changelog: [Internal] - Add an option to only see failed tests for PointerEvents web platform tests

Reviewed By: mdvacca

Differential Revision: D40281369

fbshipit-source-id: 638879b39ca66c11e722e6140c631dacfc98ee34
2022-10-14 15:10:19 -07:00
Luna Wei 71ae987820 Prefix web platform tests with wpt
Summary:
Changelog: [Internal] Reorder and prefix things with wpt for convenience

Open to other suggestions

Reviewed By: mdvacca

Differential Revision: D40247488

fbshipit-source-id: 4046040d5904b324a9a84dc47f4de858456e7bbc
2022-10-14 15:10:19 -07:00
Héctor Ramos 0db5178688 React-jsidynamic: Move JSIDynamic out of React-jsi
Summary:
The jsi library itself is `jsi/jsi.{h,cpp}`. JSIDynamic provides support for converting between folly::dynamic and jsi::value, independent of the jsi library.

Changelog:
[iOS][Changed] Moved JSIDynamic out of React-jsi and into React-jsidynamic

Reviewed By: cipolleschi, dmytrorykun

Differential Revision: D40334023

fbshipit-source-id: d2c69e7afb7f43f93080301b88c81e1fa46279d7
2022-10-14 12:01:51 -07:00
generatedunixname89002005287564 712fcdec9d supermodule:xplat/default/public.react_native.playground
Reviewed By: jkeljo

Differential Revision: D40377133

fbshipit-source-id: d029452e34edecdf968aa60fb8a3a062bca60d92
2022-10-14 10:27:52 -07:00
Gabriel Donadel Dall'Agnol 55b09da62a fix: Eslint on Danger not matching project config (#34980)
Summary:
I've been noticing this for a while now, every time that someone changes a file inside rn-tester Danger comments a bunch of warnings regarding inline styles, e.g. https://github.com/facebook/react-native/pull/34567#issuecomment-1257956893, even though that is disabled inside .eslintrc https://github.com/facebook/react-native/blob/8edf4e9e3adcc85743e3c86a25ab3748b276a3da/packages/rn-tester/.eslintrc#L3

After some investigation, I realized that the problem was that the Eslint Node.js API used by [seadub/danger-plugin-eslint](https://www.npmjs.com/package/seadub/danger-plugin-eslint) was not able to locate any `.eslintrc` files due to the location of the directory where danger is invoked. By using `process.chdir` we can ensure that eslint will run from the root folder and that it will be able to find all .eslintrc files

## Changelog

[Internal] [Fixed] - fix eslint config when running Danger

Pull Request resolved: https://github.com/facebook/react-native/pull/34980

Test Plan:
run `yarn danger pr https://github.com/facebook/react-native/pull/34976`

After

![image](https://user-images.githubusercontent.com/11707729/195751496-5225a32f-f4b3-4ce2-833f-ae5723f647c0.png)

Before

![image](https://user-images.githubusercontent.com/11707729/195751673-34ba87fc-ce50-4020-9688-a486e3021c4f.png)

Reviewed By: cortinico

Differential Revision: D40384300

Pulled By: yungsters

fbshipit-source-id: e68eeafc42567dc9d7297dde3709a989cc70f4e2
2022-10-14 10:01:25 -07:00
generatedunixname89002005287564 0fcce547dc supermodule:xplat/default/public.react_native.core
Reviewed By: GijsWeterings

Differential Revision: D40376221

fbshipit-source-id: fa5ff5ed3f053ce6958d7dd03d4f86cd88d86a11
2022-10-14 03:56:06 -07:00
mohitcharkha f645404f5c Extracted UnsupportedModulePropertyParserError into throwIfModuleTypeIsUnsupported function in error-utils.js file (#34966)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts `UnsupportedModulePropertyParserError` exception to `throwIfModuleTypeIsUnsupported` function inside `error-utils.js` file

## 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 `UnsupportedModulePropertyParserError` to `throwIfModuleTypeIsUnsupported` function inside `error-utils.js`

Pull Request resolved: https://github.com/facebook/react-native/pull/34966

Test Plan:
`yarn jest react-native-codegen`
Added unit case in `error-utils-test.js` file

<img width="939" alt="Screenshot 2022-10-13 at 12 14 19 PM" src="https://user-images.githubusercontent.com/86604753/195521643-6a197b51-7038-48f1-8b92-2c8c2786d66b.png">

Reviewed By: christophpurrer

Differential Revision: D40337936

Pulled By: cipolleschi

fbshipit-source-id: 74fb116b48634c5e3b6c11f8b71ad59f290d959e
2022-10-14 03:09:51 -07:00
dhruvtailor7 1e15e21348 extracted UntypedModuleRegistryCallParserError to a throwing function in error-utils.js (#34953)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872.
As a part of this PR, `UntypedModuleRegistryCallParserError` is separated into its own throwing function in `error-utils.js` file and is used in both Flow and TypeScript parsers

## Changelog

[Internal] [Changed] - Extract `UntypedModuleRegistryCallParserError` to a separate function inside `error-utils.js` file.

Pull Request resolved: https://github.com/facebook/react-native/pull/34953

Test Plan:
Added unit case in error-utils-test.js file to test the new function.
Output of `yarn jest react-native-codegen` ensures all passed test cases.

<img width="450" alt="Screenshot 2022-10-12 at 12 44 36 PM" src="https://user-images.githubusercontent.com/32268377/195277708-97340db3-f3d8-48a3-9a59-95d2747c67b0.png">

Reviewed By: christophpurrer

Differential Revision: D40297017

Pulled By: cipolleschi

fbshipit-source-id: b02dcf0e110ab903a0d1831783194ae4a543075b
2022-10-14 03:09:51 -07:00
Tarun Chauhan b87d371a38 extract emitMixedTypeAnnotation to parsers-commons (#34954)
Summary:
Create a function emitMixedTypeAnnotation into the parsers-commons.js file to put together this code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L400-L404) and [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L435-L440).

Part of https://github.com/facebook/react-native/issues/34872

## 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 emitMixedTypeAnnotation into the parsers-commons

Pull Request resolved: https://github.com/facebook/react-native/pull/34954

Test Plan:
run ```yarn jest react-native-codegen```

<img width="781" alt="image" src="https://user-images.githubusercontent.com/34857453/195291603-f138c64c-1b49-41af-a133-ee366d02706a.png">

Reviewed By: NickGerleman

Differential Revision: D40297103

Pulled By: cipolleschi

fbshipit-source-id: 3ee3569fbfa850ac50df18b74ecc3eefbeb267c9
2022-10-14 03:09:51 -07:00
mohitcharkha c403cd4f11 Extracted content of the case FunctionTypeAnnotation into emitFunction in parsers-primitives file (#34950)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts the content of the case `FunctionTypeAnnotation` into a single `emitFunction` function inside the parsers-primitives.js file and uses it in both Flow and TypeScript parsers

## 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 `FunctionTypeAnnotation` into a single `emitFunction` function

Pull Request resolved: https://github.com/facebook/react-native/pull/34950

Test Plan:
Run yarn jest react-native-codegen and ensure CI is green
<img width="984" alt="Screenshot 2022-10-12 at 11 18 54 AM" src="https://user-images.githubusercontent.com/86604753/195260414-136f918f-e4b7-4fcf-b0b9-9142872f3cf9.png">

Reviewed By: christophpurrer

Differential Revision: D40296823

Pulled By: cipolleschi

fbshipit-source-id: 3cac407d260481bd6ae7c3e46642e4c16bba3376
2022-10-14 03:09:51 -07:00
dakshbhardwaj 1eaa092daf extracted nullguard function to parsers-util.js file (#34952)
Summary:
This PR is a part of https://github.com/facebook/react-native/issues/34872
This PR extracts Extract the `nullGuard` function ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L74-L76), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L74-L76)) into a function in the `parsers-utils.js` file

## Changelog
[Internal] [Changed] - Extracted `nullGuard` function from flow and typescript to a file `parsers-utils.js`.

Pull Request resolved: https://github.com/facebook/react-native/pull/34952

Test Plan:
yarn jest react-native-codegen
<img width="1042" alt="Screenshot 2022-10-12 at 12 52 02 PM" src="https://user-images.githubusercontent.com/22423684/195277414-dc0122f4-603a-4e93-aef1-2ac0c33a960d.png">

Reviewed By: NickGerleman

Differential Revision: D40296951

Pulled By: cipolleschi

fbshipit-source-id: 4fb305fff2e28025496b65ec697d2a59cff77bde
2022-10-14 03:09:51 -07:00
MaeIg c388e6c689 Wrap the content of the case Array and case $ReadOnlyArray in Flow into a separate function (#34948)
Summary:
This PR aims to extract translateArrayTypeAnnotation logic into a separate function as it is done in typescript folder. This will enable us to extract translateArrayTypeAnnotation function into a shared folder in a later step. It is a task of https://github.com/facebook/react-native/issues/34872:
> Wrap the content of the case Array: and case ReadOnlyArray in [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L106-L107) into a separate function, as it is for the [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L218-L234) parser. This will enable us to unify the two parsers in a later step.

## 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] - Wrap the content of the case Array and case $ReadOnlyArray in Flow into a separate function

Pull Request resolved: https://github.com/facebook/react-native/pull/34948

Test Plan:
yarn flow:
<img width="645" alt="image" src="https://user-images.githubusercontent.com/40902940/195200715-7f60d927-e262-4a94-ad91-a884d37726b8.png">

yarn lint:
<img width="502" alt="image" src="https://user-images.githubusercontent.com/40902940/195200799-7959e068-b5b7-4242-a7b1-7afd80866d7f.png">

yarn jest react-native-codegen:
<img width="381" alt="image" src="https://user-images.githubusercontent.com/40902940/195200775-76957c19-d06d-431c-8555-889a4205374e.png">

Reviewed By: dmytrorykun

Differential Revision: D40296730

Pulled By: cipolleschi

fbshipit-source-id: ad2d965046e25ee000ae6e07075976e5a0c78f1a
2022-10-14 03:09:51 -07:00
harshsiriah bb519ecccb Extracted IncorrectModuleRegistryCallTypeParameterParserError to throwIfIncorrectModuleRegistryCallTypeParameterParserError (#34941)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872.
This PR extracts `IncorrectModuleRegistryCallTypeParameterParserError` exception to a separate function inside an `error-utils.js` file

## Changelog

[Internal] [Changed] - Extract `IncorrectModuleRegistryCallTypeParameterParserError` to a seperate function inside `error-utils.js`

Pull Request resolved: https://github.com/facebook/react-native/pull/34941

Test Plan:
```sh
yarn jest react-native-codegen
```
Added unit case in `error-utils-test.js` file

<img width="940" alt="Screenshot 2022-10-11 at 4 42 03 PM" src="https://user-images.githubusercontent.com/86605635/195076564-3b023c17-661c-4330-805c-0216c4391d59.png">

Reviewed By: dmytrorykun

Differential Revision: D40296642

Pulled By: cipolleschi

fbshipit-source-id: 7c7bba6a4f68e9b8fa4729a7651f22cce6d7ca6e
2022-10-14 03:09:51 -07:00
dakshbhardwaj 76c5b6f7bf Extracted IncorrectModuleRegistryCallArityParserError as a seperate function in error-utils.js (#34940)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts `IncorrectModuleRegistryCallArityParserError` exception to `throwIfIncorrectModuleRegistryCallArityParserError` inside an `error-utils.js` file.

## Changelog
[Internal] [Changed] - Extracted IncorrectModuleRegistryCallArityParserError exception to throwIfIncorrectModuleRegistryCallArityParserError function

Pull Request resolved: https://github.com/facebook/react-native/pull/34940

Test Plan:
Added unit case in error-utils-test.js file

 yarn jest react-native-codegen

<img width="1144" alt="Screenshot 2022-10-11 at 4 04 55 PM" src="https://user-images.githubusercontent.com/22423684/195070498-627d1bb8-53b1-43d3-b410-462e4f0da23a.png">

Reviewed By: dmytrorykun

Differential Revision: D40296626

Pulled By: cipolleschi

fbshipit-source-id: 33a299b1adf6334753c2390a81a54832c9096ec5
2022-10-14 03:09:51 -07:00
Vinay Harwani a33f672625 Extracted UnusedModuleInterfaceParserError to throwIfUnusedModuleInterfaceParserError in error-utils.js (#34939)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts UnusedModuleInterfaceParserError exception to throwIfUnusedModuleInterfaceParserError inside an error-utils.js file.

## 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] - Extracted UnusedModuleInterfaceParserError exception to throwIfUnusedModuleInterfaceParserError function

Pull Request resolved: https://github.com/facebook/react-native/pull/34939

Test Plan:
yarn jest react-native-codegen
Added unit case in error-utils-test.js file
<img width="1173" alt="Screenshot 2022-10-11 at 1 56 50 PM" src="https://user-images.githubusercontent.com/87412080/195039924-5a73283b-a8cf-41a5-bcc4-9f619d381240.png">

Reviewed By: dmytrorykun

Differential Revision: D40296568

Pulled By: cipolleschi

fbshipit-source-id: b5ee4520db9c70a57c0c666d26ff3f63f17e9a59
2022-10-14 03:09:51 -07:00
Mohit Charkha ab22e3a834 Extracted MoreThanOneModuleRegistryCallsParserError exception to throwIfMoreThanOneModuleRegistryCalls inside error-utils.js (#34921)
Summary:
This PR is part of https://github.com/facebook/react-native/issues/34872
This PR extracts MoreThanOneModuleRegistryCallsParserError exception to throwIfMoreThanOneModuleRegistryCalls inside an error-utils.js file

## 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] - Extracted MoreThanOneModuleRegistryCallsParserError exception to throwIfMoreThanOneModuleRegistryCalls function

Pull Request resolved: https://github.com/facebook/react-native/pull/34921

Test Plan:
yarn jest react-native-codegen
Added unit case in the `error-utils-test.js` file

<img width="936" alt="Extracted MoreThanOneModuleRegistryCallsParserError Test" src="https://user-images.githubusercontent.com/86604753/194876724-8beec16d-4b88-4685-b8a7-a2c89208378a.png">

Reviewed By: NickGerleman

Differential Revision: D40296527

Pulled By: cipolleschi

fbshipit-source-id: 8c0d2854f42918b61ce8569cbfbaee5e90b21398
2022-10-14 03:09:51 -07:00