Граф коммитов

26248 Коммитов

Автор SHA1 Сообщение Дата
Tim Yung 744f633197 TextInput: Create `ref` Methods w/ `Object.assign`
Summary:
Straightforward refactor of how `TextInput` augments the exported `ref` with instance methods.

This change is in preparation for additional refactors to eliminate `setAndForwadRefs`.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D41191441

fbshipit-source-id: 30560ce489c48409003a9f92875e5096d3f1130e
2022-11-12 09:17:00 -08:00
Kacper Kafara 4c1d5ad9c6 Fix variable expansion in ReactNative-application.cmake (#35306)
Summary:
Hi, while adjusting [react-native-screens](https://github.com/software-mansion/react-native-screens) to `0.71.0-rc.0` I encountered the same problems as reported [here](https://github.com/reactwg/react-native-releases/discussions/41#discussioncomment-4085694) by WoLewicki.

Basically inside `CMake`'s `foreach` loop iterator variable is not being expanded to the actual value:

```cmake
foreach(autolinked_library ${AUTOLINKED_LIBRARIES})
    target_link_libraries(autolinked_library common_flags) // <-- here we are literally linking to "autolinked_library".
endforeach()
```

## Changelog

[Android] [Fixed] - Fix Android autolinking failing because of not expanded variable

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

Reviewed By: christophpurrer, cipolleschi

Differential Revision: D41220408

Pulled By: rshest

fbshipit-source-id: 12ce993f0c5227ca7d3c2cc272fe3739126930b3
2022-11-12 09:11:46 -08:00
Tim Yung 99381de753 ScrollView: Cleanup Jest Tests
Summary:
Cleans up `ScrollView-test.js` to be easier to read and to include a unit test for `ref`.

This prepares the Jest test suite to be extended with an additional test to validate a bug with `ref` invalidation.

Changelog:
[Internal]

Reviewed By: sammy-SC

Differential Revision: D41208894

fbshipit-source-id: 6d79adf131602292f7aa3180b1c230643e9baf16
2022-11-12 08:35:29 -08:00
Mike Vitousek 8c2a4d0d26 Annotate React hooks in xplat, defaulting to any
Summary:
Add explicit annotations to React hook callbacks as required for Flow's Local Type Inference project. This codemod prepares the codebase to match Flow's new typechecking algorithm. The new algorithm will make Flow more reliable and predictable.

This diff adds `any` or `$FlowFixMe` in cases where more precise types could not be determined.

Details:
- Codemod script: `.facebook/flowd codemod annotate-react-hooks ../../xplat/js --default-any --write`
- Local Type Inference announcement: [post](https://fb.workplace.com/groups/flowlang/posts/788206301785035)
- Support group: [Flow Support](https://fb.workplace.com/groups/flow)

drop-conflicts
bypass-lint

Reviewed By: SamChou19815

Differential Revision: D41231214

fbshipit-source-id: d5f5ce8d61020baa1138292c9e9f1c69dffd324c
2022-11-11 17:04:38 -08:00
Mike Vitousek 2c7e89d17c Fix haste module reference
Summary:
Fix a haste module reference inserted by D41226960 (ed02d4baf0)

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D41231733

fbshipit-source-id: e3bcdc220946b7dd1783aa321c024972b3bc8e17
2022-11-11 14:14:21 -08:00
Mike Vitousek ed02d4baf0 Annotate implicit instantiations in xplat, defaulting to any
Summary:
Add explicit annotations to underconstrained implicit instantiations as required for Flow's Local Type Inference project. This codemod prepares the codebase to match Flow's new typechecking algorithm. The new algorithm will make Flow more reliable and predictable.

This diff adds `any` or `$FlowFixMe` in cases where more precise types could not be determined.

Details:
- Codemod script: `.facebook/flowd codemod annotate-implicit-instantiations ../../xplat/js --default-any --write`
- Local Type Inference announcement: [post](https://fb.workplace.com/groups/flowlang/posts/788206301785035)
- Support group: [Flow Support](https://fb.workplace.com/groups/flow)

drop-conflicts
bypass-lint

Reviewed By: SamChou19815

Differential Revision: D41226960

fbshipit-source-id: e5e3edbb1aed849f90cc683a4d416a9a2f8f3a19
2022-11-11 12:54:51 -08:00
Tianyu Yao 5fb67b0fb2 Fix checking pointer event feature flag
Summary:
Changelog: [Internal]

The feature flag is a function not a boolean, flow didn't caught it..

Reviewed By: rbalicki2

Differential Revision: D41172775

fbshipit-source-id: b8a3365ab65049706b59e7e859f5f931ecab8360
2022-11-11 10:37:55 -08:00
Arushi Kesarwani 1a4fa92b25 Abstracting Activity logic from Dev Loading View (#35256)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35256

Changelog:
    [General][Added] - Making Dev Loading View cross platform by abstracting out the activity/context logic from the controller in a polymorph class.

Reviewed By: rshest

Differential Revision: D40908923

fbshipit-source-id: db8e94f8ded5ffe0deeb88335cd7f3d1bf87243a
2022-11-11 05:12:02 -08:00
Sharon Zheng 29caed22cc rounded Views with borders shows small gap
Summary:
When a __rounded__ View on Android has a border, a small gap appears between the border and the center of the view (most noticeably when the background and border colors are the same)

Since the border is drawn on top of the other layers, the approach here is to make the center of the View slightly larger so that there is an overlap with the border, and closing the visible gap

There are 2 cases for a View with a border:
1. `borderWidth` is set for a consistent border width around all 4 edges
2. Uneven border widths are set (using `borderTopWidth`, `borderLeftWidth, ...)

**How is a rounded rectangle drawn?**
__Case 1__: `borderWidth` is set for a consistent border width around all 4 edges
- Before:
  - first, `mInnerClipPathForBorderRadius` was used to draw the center of the View
  - then the border is drawn along the path of `mCenterDraw` with a stroke width of the border width
- Now:
  - `mBackgroundColorRenderPath` is used to draw the center of the View and is exactly a slightly enlarged version of `mInnerClipPathForBorderRadius`

__Case 2__: Uneven border widths are set (using borderTopWidth, borderLeftWidth, ...)
- Before:
  - `mInnerClipPathForBorderRadius` was used to draw the center of the View
  - for each edge, a quadrilateral is drawn
  - `mOuterClipPathForBorderRadius` clips the outer edge of the border
  - `mInnerClipPathForBorderRadius` (same is used to draw the center of the View) clips the inner edge of the border
- Now:
  - `mBackgroundColorRenderPath` is used to draw the center of the View, allowing `mInnerClipPathForBorderRadius` to persist as the path that clips the inner edge of the border

When `mGapBetweenPaths` = 0, `mBackgroundColorRenderPath` == `mInnerClipPathForBorderRadius`, which is exactly the original implementation

Changelog:
[Internal][Fixed] - rounded Views with borders shows small gap

Reviewed By: mdvacca

Differential Revision: D39979567

fbshipit-source-id: 6db71d14ead6256e1b7becf73862e0a537c6a47b
2022-11-10 19:09:51 -08:00
Pieter Vanderwerff 6743d15329 Enforce empty array providers in arvr/js
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D41206042

fbshipit-source-id: 0d6a87fdb693a01a97783f5428111f428a94f80e
2022-11-10 18:52:53 -08:00
Oleksandr Melnykov c84cc4b46c Add POST_NOTIFICATIONS permission to AndroidManifest of RNTester
Summary:
In D38850138 (63a4539e4d) I added a new example of the runtime permission `POST_NOTIFICATIONS` to RNTester, but forgot to add this permission to AndroidManifest.xml.

Changelog:
[Android][Added] - Add POST_NOTIFICATIONS permission to AndroidManifest of RNTester

Reviewed By: fkgozali

Differential Revision: D41204931

fbshipit-source-id: 80e5d526406715fd7570cc94cbf384858ff05aed
2022-11-10 17:49:32 -08:00
Zihan Chen (MSFT) 813fd04118 Add intersection types in react-native-codegen for TypeScript (#35247)
Summary:
Refer to "Support intersection of object types, `{...a, ...b, ...}` in Flow is equivalent to `a & b & {...}` in TypeScript, the order and the form is not important." in https://github.com/facebook/react-native/issues/34872

In this change I also extract the common part from `getTypeAnnotation` and `getTypeAnnotationForArray` into `getCommonTypeAnnotation`. Most of the differences are about `default` in the schema. After a schema is generated from `getCommonTypeAnnotation` successfully, `getTypeAnnotation` will fill `default` if necessary, while `getTypeAnnotationForArray` does nothing.

## Changelog

[General] [Changed] - Add intersection types in react-native-codegen for TypeScript

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

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

Reviewed By: cipolleschi

Differential Revision: D41105744

Pulled By: lunaleaps

fbshipit-source-id: cd250a9594a54596a20ae26e57a1c801e2047703
2022-11-10 15:28:17 -08:00
Oleksandr Melnykov 63a4539e4d Add POST_NOTIFICATION runtime permission to Catalyst and RNTester for Android
Summary:
Android 13 adds a new `POST_NOTIFICATION` runtime permission, which can only be requested if the `targetSdkVersion` of the app is set to 33. Since we upgrading Catalyst to SDK 33, let's add it as one of the permission examples.

Changelog:
[Android][Changed] - Add POST_NOTIFICATION runtime permission to RNTester

Reviewed By: fkgozali

Differential Revision: D38850138

fbshipit-source-id: 4cf7a5f60dd0891d7ada40aca37f0489d9d0d190
2022-11-10 15:17:24 -08:00
Samuel Susla 045595a81e React Native sync for revisions 4bd245e...d1e35c7
Summary:
This sync includes the following changes:
- **[d1e35c703](https://github.com/facebook/react/commit/d1e35c703 )**: Don't disappear layout effects unnecessarily ([#25660](https://github.com/facebook/react/pull/25660)) //<Samuel Susla>//
- **[1e3e30dae](https://github.com/facebook/react/commit/1e3e30dae )**: Fix useSyncExternalStore dropped update when state is dispatched in render phase ([#25578](https://github.com/facebook/react/pull/25578)) //<Aurélien Chivot-Buhler>//

Changelog:
[General][Changed] - React Native sync for revisions 4bd245e...d1e35c7

jest_e2e[run_all_tests]

Reviewed By: GijsWeterings

Differential Revision: D41187776

fbshipit-source-id: 9c82b79458487191f4a26cf643321603d30cea5a
2022-11-10 13:16:01 -08:00
Joshua Selbo 0cae91489b Replace testing-support-lib with androidx target
Summary: Changelog: [Internal] - codemod testing library Buck redirect to actual dependency

Reviewed By: hick209

Differential Revision: D41194082

fbshipit-source-id: 5f4815613fda53a213feb78de2cf4430b7eef9c7
2022-11-10 13:06:19 -08:00
Samuel Susla 1b1b26a099 Call setNativeView anytime node changes
Summary:
changelog: [internal]

Call `AnimatedProps.setNativeView` any time `AnimatedProps` node changes to make sure it is always connected to underlaying host component.

Reviewed By: yungsters

Differential Revision: D41122065

fbshipit-source-id: 1d10fdd44933ff82d9bfc424cecb2640b7a66837
2022-11-10 10:43:47 -08:00
Antoine Doubovetzky edc4ea0a67 Use parser instead of language in MissingTypeParameterGenericParserError and MoreThanOneTypeParameterGenericParserError (#35294)
Summary:
Part of https://github.com/facebook/react-native/issues/34872:
> Update the [IncorrectlyParameterizedGenericParserError](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/errors.js#L134) error in the error.js file to accept a Parser instead of a ParserType parameter. Use the nameForGenericTypeAnnotation method of the parser to extract the genericName and delete the ternary operator.

Since the task was added to the issue we split the IncorrectlyParameterizedGenericParserError into 2 errors: MissingTypeParameterGenericParserError and MissingTypeParameterGenericParserError (https://github.com/facebook/react-native/pull/35134/), so I applied the change on both errors.

## 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] - Use parser instead of language in MissingTypeParameterGenericParserError and MoreThanOneTypeParameterGenericParserError

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

Test Plan: I tested using Flow and Jest commands. More specifically, the tests that cover this change are the ones I renamed.

Reviewed By: christophpurrer

Differential Revision: D41181069

Pulled By: cipolleschi

fbshipit-source-id: 3412e29b1319a28b3ec6afb38b1eda448055fa6a
2022-11-10 10:12:15 -08:00
Lorenzo Sciandra 9fed9cdab3 deps(cli): "backport" CLI bump into main from 0.71 (#35260)
Summary:
This is just a PR to realign main branch (and put it ahead) of a local change we did in 0.71: 741d102476

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

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D41122011

Pulled By: cipolleschi

fbshipit-source-id: 8f01ed94bfd39d58b2e54cd2945fcca5bb8ebd18
2022-11-10 09:56:50 -08:00
Gabriel Donadel Dall'Agnol f849f49525 chore: Add getKeyName function to codegen Parser class (#35202)
Summary:
This PR adds a  `getKeyName`  function to the codegen Parser class and implements it in the Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872.

## Changelog

[Internal] [Added] - Add `getKeyName` function to codegen Parser class

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

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

![image](https://user-images.githubusercontent.com/11707729/200028600-87e9c1d7-d56d-4cf7-bdbc-18bdf1b03fc5.png)

Reviewed By: cipolleschi

Differential Revision: D41081711

Pulled By: jacdebug

fbshipit-source-id: 7ad2953a0e2f90f04d03270bda40d669d4d0d50a
2022-11-10 09:04:48 -08:00
Nicola Corti 90b6735c3b Invoke closeAndReleaseSonatypeStagingRepository in the publish gradle invocation (#35272)
Summary:
This PR ports back into main the changes required to properly close the SonaType repository on Maven

## Changelog

[General] [Fixed] - Close the Maven repository properly

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

Test Plan: We tested these changed in 0.71-stable branch when releasing 0.71.0-RC.0

Reviewed By: christophpurrer

Differential Revision: D41154965

Pulled By: cipolleschi

fbshipit-source-id: 74dd46e8fabf3baef544342282829c70d92f671f
2022-11-10 08:57:07 -08:00
Lorenzo Sciandra 37fbc1606c chore(issue templates): small tweaks + clear mention of support window (#35304)
Summary:
During the outage it become clear that we are not doing enough to communicate what the release support policy/window is. This is one of the tweaks I'm doing to help with that

## 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] - small tweaks to issue templates + clear mention of support window

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D41183435

Pulled By: cipolleschi

fbshipit-source-id: 32519c52616fb1903507fad291200eb959d451b4
2022-11-10 08:43:13 -08:00
Tarun Chauhan e97fb466a0 implement checkIfInvalidModule in parsers (#35261)
Summary:
Part of the Codegen umbrella Issue https://github.com/facebook/react-native/issues/34872

> Create a checkIfInvalidModule function in the [parser.js file](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parser.js) and document it. Implement [this logic](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/error-utils.js#L127-L132) in the [FlowParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/parser.js#L15) and [this logic](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/error-utils.js#L136-L141) in the [TypeScriptParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/parser.js#L15). Refactor the [throwIfIncorrectModuleRegistryCallTypeParameterParserError function](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/error-utils.js#L109) to accept a Parser instead of a ParserType and use the newly created function instead of the if (language) logic.

## Changelog

[Internal] [Added] - Add checkIfInvalidModule in the Parser interface and implement it in both parsers. Refactor [throwIfIncorrectModuleRegistryCallTypeParameterParserError](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/error-utils.js#L109) to use this new function.

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

Test Plan:
Run yarn jest react-native-codegen
<img width="788" alt="image" src="https://user-images.githubusercontent.com/34857453/200616752-155d638c-5ef4-4d8b-be79-07a128523910.png">

Reviewed By: christophpurrer

Differential Revision: D41125704

Pulled By: cipolleschi

fbshipit-source-id: 029d5511050dbe975a38a890d0238cb6f3b542ea
2022-11-10 07:56:07 -08:00
Simen Bekkhus 0376aa4856 fix(jest-env): pass `exportConditions` (#35203)
Summary:
Like discussed in https://github.com/react-native-community/discussions-and-proposals/issues/509, RN should override the default `node` and `node-addons` conditions.

You might consider supporting (or just setting) [`customExportConditions`](4670d3be0d/packages/jest-environment-node/src/index.ts (L187-L189)) instead, but the default of the node env should be overwritten 🙂

## 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] - use `'react-native'` export conditions in Jest environment

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

Test Plan: Green CI?

Reviewed By: lunaleaps

Differential Revision: D41081783

Pulled By: jacdebug

fbshipit-source-id: 844c70d92a58c5432ba5b9e5e99c8f50045ef8ac
2022-11-10 06:21:53 -08:00
Marc Rousavy 3d9a3b7af6 fix: Add missing space in method documentation (#35303)
Summary:
probably the smallest PR I ever submitted, but it was bothering me lol

There was a missing space in the method doc.

## Changelog

Add space to the method doc
<!-- 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 missing space in method documentation comment

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

Reviewed By: jacdebug

Differential Revision: D41182765

Pulled By: cipolleschi

fbshipit-source-id: ebe5d56072137547e543a312c66cc3234142db13
2022-11-10 04:55:37 -08:00
Pieter De Baets 8a59153bd7 Remove $TEMPORARY$object types
Summary:
This was left over from an old codemod.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D41154548

fbshipit-source-id: 0b5fb3e78491b66ebaf13555f80e0265a25dc7d8
2022-11-10 04:48:13 -08:00
Ruslan Lesiutin 1453ef1a88 refactor(react-native-github): move ProgressViewIOS to internal (#35277)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35277

# Changelog:
[JS][Removed] - removed ProgressViewIOS module
[iOS][Removed] - removed native iOS sources of ProgressViewIOS

Reviewed By: lunaleaps

Differential Revision: D40937475

fbshipit-source-id: 9060adf3c99727af4eeffc767ccfd0a70574859d
2022-11-09 16:09:31 -08:00
Gabriel Donadel Dall'Agnol ff4a3c2bc7 fix: RNTester TransformExample crash (#35292)
Summary:
As pointed out by kelset on https://github.com/facebook/react-native/pull/34660#issuecomment-1309081429 accessing the `TransformExample` is currently crashing the `RNTester` app due to missing units in one of the transformers. This PR fixes it by updating the transform value to a valid string.

## Changelog

[Internal] [Fixed] - Add missing translate units to  `RNTester` `TransformExample`

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

Test Plan:
1. Open the RNTester app and navigate to the Transforms page
2. Check the transform style through the `Transform using a string` section

https://user-images.githubusercontent.com/11707729/200916399-779b2eeb-2bd8-4642-97a3-f050d6dd4278.mov

Reviewed By: christophpurrer

Differential Revision: D41164541

Pulled By: necolas

fbshipit-source-id: 4aa62980001a6f8ccf0108cb3af1e573b67e02b1
2022-11-09 13:53:51 -08:00
Christoph Purrer c0a06d2e6f react-native code-gen > C++ TurboModules struct support (#35265)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35265

This adds a templating layer for C++ TurboModules to automatically generate struct templates from TurboModule specs.

You have to define concrete types for those templates to use them in your C++ TurboModule.

E.g. for the JS flow type:
```
export type ObjectStruct = {|
  a: number,
  b: string,
  c?: ?string,
|};
```
code-gen will now generate the following template code:
```
#pragma mark - NativeCxxModuleExampleCxxBaseObjectStruct

template <typename P0, typename P1, typename P2>
struct NativeCxxModuleExampleCxxBaseObjectStruct {
  P0 a;
  P1 b;
  P2 c;
  bool operator==(const NativeCxxModuleExampleCxxBaseObjectStruct &other) const {
    return a == other.a && b == other.b && c == other.c;
  }
};

template <typename P0, typename P1, typename P2>
struct NativeCxxModuleExampleCxxBaseObjectStructBridging {
  static NativeCxxModuleExampleCxxBaseObjectStruct<P0, P1, P2> fromJs(
      jsi::Runtime &rt,
      const jsi::Object &value,
      const std::shared_ptr<CallInvoker> &jsInvoker) {
    NativeCxxModuleExampleCxxBaseObjectStruct<P0, P1, P2> result{
      bridging::fromJs<P0>(rt, value.getProperty(rt, "a"), jsInvoker),
      bridging::fromJs<P1>(rt, value.getProperty(rt, "b"), jsInvoker),
      bridging::fromJs<P2>(rt, value.getProperty(rt, "c"), jsInvoker)};
    return result;
  }

  static jsi::Object toJs(
      jsi::Runtime &rt,
      const NativeCxxModuleExampleCxxBaseObjectStruct<P0, P1, P2> &value) {
    auto result = facebook::jsi::Object(rt);
    result.setProperty(rt, "a", bridging::toJs(rt, value.a));
    result.setProperty(rt, "b", bridging::toJs(rt, value.b));
    if (value.c) {
      result.setProperty(rt, "c", bridging::toJs(rt, value.c.value()));
    }
    return result;
  }
};
```
and you can use it in our C++ TurboModule for example as:
```
using ObjectStruct = NativeCxxModuleExampleCxxBaseObjectStruct<
    int32_t,
    std::string,
    std::optional<std::string>>;

template <>
struct Bridging<ObjectStruct>
    : NativeCxxModuleExampleCxxBaseObjectStructBridging<
          int32_t,
          std::string,
          std::optional<std::string>> {};
```
or as
```
using ObjectStruct = NativeCxxModuleExampleCxxBaseObjectStruct<
    float,
    folly::StringPiece,
    std::optional<std::string>>;

template <>
struct Bridging<ObjectStruct>
    : NativeCxxModuleExampleCxxBaseObjectStructBridging<
          float,
          folly::StringPiece,
          std::optional<std::string>> {};
```
Or as
...

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D41133761

fbshipit-source-id: fdf36e51073cb46c5234f6121842c79a884899c7
2022-11-09 13:23:05 -08:00
Marco Fiorito 64ea7ce6c5 Chore: move translateFunctionTypeAnnotation into emitFunction (#35287)
Summary:
Part of https://github.com/facebook/react-native/issues/34872

In this PR was moved the translateFunctionTypeAnnotation invocation ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L362), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L376)) into the emitFunction call so that the case FuntionTypeAnnotation results in a one-liner

## Changelog

[Internal] [Changed] - Move the translateFunctionTypeAnnotation invocation into the emitFunction

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

Test Plan: <img width="266" alt="image" src="https://user-images.githubusercontent.com/18408823/200852605-96c233d9-b524-4b7c-bc41-5543534c296b.png">

Reviewed By: christophpurrer

Differential Revision: D41157574

Pulled By: rshest

fbshipit-source-id: 21f6fe7dcffd30f4009ca91a6dec81bbd4b0902a
2022-11-09 12:18:31 -08:00
Sam Chan 1f0c2c2895 VirtualizedList onViewableItemsChanged won't trigger if first item in data evaluate to false #35280 (#35282)
Summary:
VirtualizedList onViewableItemsChanged won't trigger if first item in data evaluate to false https://github.com/facebook/react-native/issues/35280

Described in https://github.com/facebook/react-native/issues/35280

## Changelog

- [General] [Fixed] Fix VirtualizedList onViewableItemsChanged won't trigger if first item in data evaluate to false

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

Test Plan:
this snack will be able to log `onViewableItemsChanged triggered` after the fix:
https://snack.expo.dev/tmQo_R_3Y

Reviewed By: jacdebug

Differential Revision: D41158485

Pulled By: NickGerleman

fbshipit-source-id: 47434890155abe009c2560b658adc4e067c31027
2022-11-09 11:35:45 -08:00
Samuel Susla 1ad083a138 Postpone call to recordAndRetrieve to fix console.error
Summary: changelog: [internal]

Reviewed By: lunaleaps

Differential Revision: D41120272

fbshipit-source-id: 458a1b8915849ca7548026d9dbbd34e4b85ecfe5
2022-11-09 11:06:32 -08:00
Christoph Purrer d07575b1c6 react-native code-gen > Add a C++ only TurboModule example (for Android/iOS/macOS/Windows) (#35138)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35138

Changelog:

[General][Added] - Add a C++ only TurboModule example (for Android/iOS/macOS/Windows)

react-native@0.69 introduced a new bridging layer to ease integration for pure C++ TurboModules using C++ std:: types directly instead of the lower level jsi:: types:
https://github.com/facebook/react-native/tree/v0.69.0/ReactCommon/react/bridging

This bridging layer can be used in JSI functions or more conveniently in C++ TurboModules.

Here is a example of an C++ only TurboModule which will work on Android and iOS and macOS/Windows (using microsoft/react-native-macos|windows) only using flow/TypeScript and standard C++ types.

C++ only TurboModules are very handy as they do not require to work with JSI APIs - instead std:: or custom C++ can by used.

Reviewed By: javache

Differential Revision: D39011736

fbshipit-source-id: 84c833d8540671fde8505f1aeb0265074b248730
2022-11-09 10:48:49 -08:00
Tianyu Yao bbb3a6146c Fix inspecting on non-fabric
Summary:
Changelog:
[Category][Internal] - Fix inspecting on non-fabric

the pointer events don't work on non-fabric components. In addition to check the pointer events feature flag, we need to check if fabric is on as well.

Reviewed By: rbalicki2

Differential Revision: D41053393

fbshipit-source-id: ab47bd845b578a0859f282ea8ff04ddbff17da02
2022-11-09 10:14:11 -08:00
Pranav Yadav 5744b219c7 Extract `tryParse` (Flow, TypeScript) lambda into `parseObjectProperty` fn (#35076)
Summary:
This PR is a task of https://github.com/facebook/react-native/issues/34872

> Extract the content of the tryParse (Flow, TypeScript)lambda into a proper `parseObjectProperty` function into the parsers-commons.js file.
also,
- added new helper fn `isObjectProperty` in `parsers-commons.js` file.
- added tests for `isObjectProperty` and `parseObjectProperty` fn 's

## Changelog

[Internal] [Changed] - Extracted the content of the `tryParse` ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/modules/index.js#L292-L337), [TypeScript](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/modules/index.js#L306-L351)) lambda into a proper `parseObjectProperty` fn into the `parsers-commons.js` file.

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

Test Plan:
- run
```bash
yarn lint && yarn flow && yarn test-ci
```
- and ensure everything is �

<img width="720" alt="image" src="https://user-images.githubusercontent.com/55224033/200105151-360b9b5e-52c7-4586-89b0-6860e9725f6e.png">

Reviewed By: cortinico

Differential Revision: D40797241

Pulled By: cipolleschi

fbshipit-source-id: 48b8900ead70d5eda2496f9ce044c11a9599a177
2022-11-09 02:11:17 -08:00
Luna Wei 114098d419 Back out "feat: mapped layout props for view component"
Summary:
Changelog: [Internal]

Original commit changeset: 870b9b58a740

Original Phabricator Diff: D41108750 (cf3747957a)

Reviewed By: necolas, makovkastar

Differential Revision: D41145105

fbshipit-source-id: 8e525284d4d6d152fbcf053ec353d40dda3ee8d2
2022-11-08 20:37:27 -08:00
Oleksandr Melnykov 394486eec5 Bump OSS Android build to SDK 33 (#35196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35196

Changelog:
[Android][Changed] - Bump Android compile and target SDK to 33

Reviewed By: cortinico

Differential Revision: D41007003

fbshipit-source-id: e7866107fdcfafa778faa6c7f31835b8dd15647a
2022-11-08 19:12:02 -08:00
Rujin Cao 669318d06f @emails -> @oncall (miscs)
Differential Revision: D41142965

fbshipit-source-id: d65b60d34edc8e8a884d448311e62ba68afb655f
2022-11-08 17:58:53 -08:00
Mayank Sunil Pagar cf3747957a feat: mapped layout props for view component (#34590)
Summary:
This PR adds mapping for layout props, it maps

    marginInlineStart: 'marginStart',
    marginInlineEnd: 'marginEnd',
    marginBlockStart: 'marginTop',
    marginBlockEnd: 'marginBottom',
    marginBlock: 'marginVertical',
    marginInline: 'marginHorizontal',
    paddingInlineStart: 'paddingStart',
    paddingInlineEnd: 'paddingEnd',
    paddingBlockStart: 'paddingTop',
    paddingBlockEnd: 'paddingBottom',
    paddingBlock: 'paddingVertical',
    paddingInline: 'paddingHorizontal',

 as requested on https://github.com/facebook/react-native/issues/34425

## 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][Added] - Added CSS logical properties by mapping layout props.

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

Test Plan:
```js
<View
  style={[
    {
      marginBlockStart: 5,        // maps to "marginTop"
      borderWidth: 1,
      borderRadius: 5,
      padding: 5,
    }
  ]}>
  <Text style={{fontSize: 11}}>Hello World!</Text>
</View>
```

Reviewed By: cipolleschi

Differential Revision: D41108750

Pulled By: necolas

fbshipit-source-id: 870b9b58a740aba12290a0604a9f6b52aa52de4c
2022-11-08 12:53:41 -08:00
fabriziobertoglio1987 082a033fbb Android: using AccessibilityNodeInfo#addAction to announce Expandable/Collapsible State (#34353)
Summary:
>Expandable and Collapsible are unique in the Android Accessibility API, in that they are not represented as properties on the View or AccessibilityNodeInfo, but are only represented as AccessibilityActions on the AccessibilityNodeInfo. This means that Talkback determines whether or not a node is "expandable" or "collapsible", or potentially even both, by looking at the list of AccessibilityActions attached to the AccessibilityNodeInfo.

>When setting the accessibilityState's expandable property, it should correlate to adding an action of either AccessibilityNodeInfoCompat.ACTION_EXPAND or AccessibilityNodeInfoCompat.ACTION_COLLAPSE on the AccessibilityNodeInfo. This work should be done in the ReactAccessibilityDelegate class's

>Currently, this feature is being "faked" by appending to the contentDescription in the BaseViewManager class. This should be removed when this feature is implemented properly.

fixes https://github.com/facebook/react-native/issues/30841

## Changelog

[Android] [Fixed] - using AccessibilityNodeInfo#addAction to announce Expandable/Collapsible State

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

Test Plan:
- On some components, the state expanded/collapsed is properly announced on focus, on some it is not.
- On some components only the expanded/collapsed state is announced, and not other component text.
- Upon change, state change is not always announced.
- The accessibilityState's "expanded" field does not seem to work on all element types (for example, it has no effect on 's).
- using accessibilityActions it is possible to add an action for expand/collapse, but these are treated as custom actions and must have their own label defined, rather than using Androids built in expand/collapse actions, which Talkback has predefined labels for.

https://snack.expo.io/0YOQfXFBi

Tests  15th August 2022:
- Paper [Tests](https://github.com/facebook/react-native/pull/34353#issuecomment-1217425302)
- Fabric [Tests](https://github.com/facebook/react-native/pull/34353#issuecomment-1217781734)

Tests 6th September 2022:
- [Button which keeps control of extended/collapsed state in JavaScript with onAccessibilityAction, accessibilityActions and accessibiltyState (Paper)](https://github.com/facebook/react-native/pull/34353#issuecomment-1237601847)
- [TouchableWithoutFeedback keeps control of extended/collapsed state in Android Widget (Paper)](https://github.com/facebook/react-native/pull/34353#issuecomment-1237616304)
- [TouchableWithoutFeedback keeps control of extended/collapsed state in Android Widget (Fabric)](https://github.com/facebook/react-native/pull/34353#issuecomment-1237624755)
- [TouchableOpacity announces visible text and triggers expanded/collapsed with onPress and accessiblity menu (Fabric)](https://github.com/facebook/react-native/pull/34353#issuecomment-1237627857)

Announcing state with custom actions on Fabric (FAIL).
The issue is not a regression from this PR, as documented in https://github.com/facebook/react-native/pull/34353#issuecomment-1207744977. It will be fixed in a separate PR.

Reviewed By: NickGerleman

Differential Revision: D39893863

Pulled By: blavalla

fbshipit-source-id: f6af78b1839ba7d97eca052bd258faae00cbd27b
2022-11-08 12:26:59 -08:00
Antoine Doubovetzky 8a847a30e1 Replace ternary in assertGenericTypeAnnotationHasExactlyOneTypeParameter with typeParameterInstantiation attribute in parser (#35157)
Summary:
Part of https://github.com/facebook/react-native/issues/34872:
> Create a new function typeParameterInstantiation in the [parsers.js file](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parser.js) and add documentation to it. Implement it properly in the [FlowParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/parser.js#L15) and in the [TypeScriptParser.js](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/parser.js#L15). Update the signature of [assertGenericTypeAnnotationHasExactlyOneTypeParameter](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L67) function to take the Parser instead of the language and use the new function in place of the [ternary operator ?:](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/parsers-commons.js#L83).

There are 3 things I'm not sure about:
1. The issue suggests to create a new function. For this case I believe an attribute is simpler. Is there a reason to prefer a function ?
2. To update the tests I had to create a mocked parser. I created a new file `parserMock` (I took example on [AnimatedMock](https://github.com/facebook/react-native/blob/main/Libraries/Animated/AnimatedMock.js)). Does it seem ok ?
3. I'm not sure what to add in the documentation of `typeParameterInstantiation`

## 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] - Replace ternary in assertGenericTypeAnnotationHasExactlyOneTypeParameter with typeParameterInstantiation attribute in parser

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D40889856

Pulled By: cipolleschi

fbshipit-source-id: 8d9a8e087852f98dcc3fc0ecf1d4a7153f482ce7
2022-11-08 11:55:23 -08:00
generatedunixname89002005287564 22456038df supermodule:xplat/default/public.react_native.infra
Reviewed By: jkeljo

Differential Revision: D41113685

fbshipit-source-id: e8f21fcca95da58290f18a053563d648ad8e1893
2022-11-08 11:38:42 -08:00
Mike Vitousek 1bf610d06c Manual fixes to cycles for xplat
Summary:
Add annotations to xplat to break cycles

Changelog:
[internal]

Reviewed By: SamChou19815

Differential Revision: D41111962

fbshipit-source-id: f268871cbaae5bc51d6f576d9c0697e637dea5d1
2022-11-08 10:54:05 -08:00
Robert Balicki f4098a5acc Fix broken bishop build
Summary:
* When I build the latest bishop (using buck), I get a failure and a suggestion:

```
Rule //fbobjc/Apps/Bishop:BishopPackage (//fbobjc/Apps/Bishop:BishopPlatform) FAILED because Command failed with exit code 1.

command: [/bin/bash, -e, /data/sandcastle/boxes/fbsource/buck-out/tmp/genrule-15268472800256890202.sh]

stderr: The target:  fbsource//fbobjc/Apps/Bishop:BishopShareExtension is an App Extension, and must only use APIs available in App Extensions. However, it contains dependencies that do not set 'extension_api_only = True' in their BUCK files:
 - //xplat/js/react-native-github:RCTSettingsApple

This command may be able automatically to fix this issue:
  arc buildozer 'set extension_api_only True' //xplat/js/react-native-github:RCTSettingsApple

```
* This diff is the result of running that command

Reviewed By: christophpurrer

Differential Revision: D41121880

fbshipit-source-id: b1ecd077270d7f3909739364237af32dbc617f52
2022-11-08 10:45:00 -08:00
Lorenzo Sciandra cfa25e0a4a fix(release scripts): backport fixes from 0.71 into main (#35258)
Summary:
This PR backport two fixes we did in 0.71 to unblock the release process:
* the change in `publish-npm` is needed because of the introduction of .strict() from 4f3ca8facf
* the removal of the other script (added originally here e4b5d3eec9) is because:
  1) that step is not needed anymore (we don't publish/upload hermes artifacts to the GH release)
  2) by the time this job gets run the release crew has already setup the GH release
  3) the logic for the versioning was broken and even on the 0.71-rc pipeline it was tagging stuff as 1000.0.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
-->

[Internal] [Fixed] - Fix release scripts for "release" pipeline scenario

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

Test Plan: The fact that 0.71-rc0 was released is the  for this.

Reviewed By: jacdebug

Differential Revision: D41120888

Pulled By: cipolleschi

fbshipit-source-id: 06d108f0659ad1db53c6324fe1d735f52c34a3c5
2022-11-08 10:03:29 -08:00
Ruslan Shestopalyuk ea73a66936 Scaffolding for the PerformanceObserver TurboModule (C++ side) (#35226)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35226

Changelog: [Internal]

This adds scaffolding for the C++ side of NativePerformanceObserver module.

Thanks to christophpurrer for helping set this up, as this is the first one of this kind inside core/OSS.

Reviewed By: rubennorte

Differential Revision: D41028555

fbshipit-source-id: 4acf0e71a254a42044cbbe5f94f40938342c6aa2
2022-11-08 10:01:21 -08:00
Riccardo Cipolleschi ea1d72921d Back out "Oncall for BUCK project xplat/js/react-native-github/BUCK"
Summary:
Original commit changeset: 8f3e37917646

Original Phabricator Diff: D40460041 (dac6806559)

Reviewed By: GijsWeterings, arushikesarwani94

Differential Revision: D41119700

fbshipit-source-id: 5de6808a721efd0b9b765e52586155dd375c0fee
2022-11-08 08:02:09 -08:00
Riccardo Cipolleschi 25a00520d8 Refactor subclassing of RCTEventEmitter (#35106)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35106

This Diff remove the assert on the initializer in the EventEmitter in place of a more idiomatic check when the method is invoked.

It aims to solve an internal error and promotes best practices for the iOS platform.

## Changelog:
[iOS][Changed] Refactor RCTEventEmitter initialization

Reviewed By: sammy-SC

Differential Revision: D40762253

fbshipit-source-id: 83d26616ce147914948e536e9e4b1010758fb690
2022-11-08 07:06:07 -08:00
Riccardo Cipolleschi ddba780c0c fix: Change checkout cache strategy (#35259)
Summary:
This PR updates he cache strategy for the `checkout_with_cache command`.

The previous strategy was using three keys in descending priority order to restore from the cache:
* `<< parameters.checkout_base_cache_key >>-{{ arch }}-{{ .Branch }}-{{ .Revision }}`
* `<< parameters.checkout_base_cache_key >>-{{ arch }}-{{ .Branch }}`
*`<< parameters.checkout_base_cache_key >>-{{ arch }}`

When it saves, it always saves using the first key.

The restore works as it follows:
1. It tries to restore the cache using the first key
2. If it fails, it checks whether there is a cache hit for a key that matches the second key as a pattern
3. If it fails, it checks whether there is a cache hit for a key that matches the third pattern
4. Otherwise, it is a cache miss.

This does not work well. Imagine that you submit some code in commit `xxxx` for branch `abc`.
The CI run the first time, it misses all the three keys and checks out the code normally.
Then, it stores the checked out code in the `checkout_key-abc-xxxx` key.

Then, you submit a commit `yyyy` in the same branch.
The CI starts, it tries with the key `checkout_key-abc-yyyy` but it misses
It tries with the key `checkout_key-abc` and it finds the cache for `checkout_key-abc-xxxx` and it restores it, forgetting about your changes.

While doing the release, we created a tag in a commit X. Then we manually had to remove it, but the CI had a cached version of .git with the tag for
the `0.71-stable` branch. And the release failed because the tag was already existing.

### Why this should work

With this solution, we are going to cache using the commit. If there is no cache for a specific commit, it will be a miss. It won't try to be smart and
retrieve the code from previous caches.

This should prevent stale caches and if we manually remove a tag, and then we do a new commit, it should work.

This is a good trade-off that allows to pay the checkout cost only for the first batch of jobs of the pipeline.

**NOTE:** This still won't work if we don't do a new commit.

## Changelog

[General] [Fixed] - Change Cache strategy to avoid cache bumps in Release

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

Test Plan: 1. CircleCI must be green

Reviewed By: jacdebug

Differential Revision: D41120895

Pulled By: cipolleschi

fbshipit-source-id: 2b45da01803197dbe4a25a313a9dfc53a976d096
2022-11-08 06:50:25 -08:00
Christoph Purrer 9cb02613e6 Provide easy registration of C++ TurboModules in rn-tester Android (#35225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35225

Changelog:
[Android] [Changed] - Provide easy registration of C++ TurboModules in rn-tester Android

Reviewed By: javache

Differential Revision: D41069277

fbshipit-source-id: 450de9302df2916acf324d4c316996b185b2833f
2022-11-08 05:12:19 -08:00
Stanley Shi dac6806559 Oncall for BUCK project xplat/js/react-native-github/BUCK (#35255)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35255

Reviewed By: huntie, cipolleschi

Differential Revision: D40460041

fbshipit-source-id: 8f3e37917646e3571398faf04be317c149b7a0ec
2022-11-08 01:53:13 -08:00