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
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
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
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
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
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
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
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
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
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:
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 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:
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:
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: [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 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
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
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
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
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
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
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