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

25684 Коммитов

Автор SHA1 Сообщение Дата
Tim Yung 1ec69b1823 RN: Move `no-haste-imports` ESLint Rule into Repository
Summary:
Moves the `no-haste-imports` ESLint rule into the React Native repository because it was only intended to be used for internal development of React Native.

This will change `react-native/eslint-plugin` to no longer provide the `no-haste-imports` rule.

Changelog:
[General][Removed] - `react-native/eslint-plugin` no longer provides the `no-haste-imports` rule.

Reviewed By: lunaleaps

Differential Revision: D39858883

fbshipit-source-id: b8d91ce5996b615341cf60c6f839afac1e26dac9
2022-09-27 14:37:29 -07:00
Nicola Corti 49b14cc603 Move `react_render_debug` to be consumed via prefab (#34802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34802

This removes the old way of consuming `libreact_render_debug.so` from
`Android-prebuilt.cmake` to using Prefab which is natively supported
by the Android pipeline.

Changelog:
[Internal] [Changed] - Move `react_render_debug` to be consumed via prefab

Reviewed By: cipolleschi

Differential Revision: D39849622

fbshipit-source-id: 45451dfe92ecce94d1b466094baae05a75ed803f
2022-09-27 09:30:50 -07:00
Tim Yung 80b8cefb26 RN: Lint for Internal Package Imports
Summary:
Creates an ESLint rule that prohibits (and autofixes) imports from `react-native` or `react-native/path/to/file`, within the React Native repository.

The ESLint rule is configured using the `eslint-plugin-lint` package instead of `react-native/eslint-plugin` because the rule is only applicable to the React Native repository. The rule does not (and should not) be publicly facing, and changes to the rule should not require publishing new versions of `react-native/eslint-plugin`. (As a follow-up, the `no-haste-imports` rule should be migrated over from `react-native/eslint-plugin`.)

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D39831222

fbshipit-source-id: 566330e6df77fdff5ce755324b9f592b9365019e
2022-09-27 09:22:58 -07:00
Tim Yung 7c08d07115 RN: Change Internal Imports to Relative Paths
Summary:
Fixes all internal import statements directly referencing the `react-native` package to instead use relative paths.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D39831223

fbshipit-source-id: 510123e5fc8f6845f96d1b55c67e0e59cb401beb
2022-09-27 09:22:58 -07:00
Tim Yung 908571de2f RN: Fix Existing Lint Warnings
Summary:
Fixes all existing lint warnings in React Native.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D39831224

fbshipit-source-id: 6ad3fc3fc7dbb9c24cdb4ff4a99639bad27c1901
2022-09-27 09:22:58 -07:00
Nick Gerleman bf05df1723 Remove flexlayout from react-native
Summary: We have decided not to go forward yet with using flexlayout in react-native. This change removes it for now.

Reviewed By: JTYim

Differential Revision: D39822037

fbshipit-source-id: 726e8657b62e6b4e55e5f72be3ca5539d317348e
2022-09-27 07:46:55 -07:00
Nick Gerleman b788b6e1c9 Fix `analyze_code` CircleCI Job (#34801)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34801

D39796598 (8cdc9e7f04) broke this CircleCI job, causing failures for `dtslint` and `prettier`. This fixes both issues, by upating formatting, and removing types from `legacy-properties.d.ts` that we no longer export.

These were not flagged by sandcastle. It looks like this is because:
1. We run eslint, but not dtslint internally
2. Arcanist will ignore anything under a "vendor" directory, while we do not exlude anything from the prettier check in OSS.

I also updated the eslint config to lint any TypeScript that appears outside the types directory, since typings are now spread out.

Changelog:
[Internal][Fixed] - Fix `analyze_code` CircleCI Job

Reviewed By: cipolleschi

Differential Revision: D39848604

fbshipit-source-id: 844dfe26e4b618059542b29df163402079c39322
2022-09-27 07:11:10 -07:00
Zihan Chen (MSFT) 8dc6bec719 Fix interface support in turbo module TypeScript codegen (component only) (#34778)
Summary:
Interface was supported in component, but it only allows interfaces in limited cases.

In this change, I extended interface support to all places where object literal type is supported.

I also refactor the code so that properties and events are able to share the same implementation.

In order not to mess up the diff, I noticed that implementations are repeated in processing array properties and non-array properties. But I leave it without refactoring. I will do it in future PRs.

I also commented potential problems I found in the code.

## Changelog

[General] [Changed] - Fix interface support in turbo module TypeScript codegen (component only)

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

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

Reviewed By: cortinico

Differential Revision: D39809230

Pulled By: cipolleschi

fbshipit-source-id: cfb51ce915249b5abceafee1c08b7e5762d03519
2022-09-27 06:59:57 -07:00
Thibault Malbranche e78a495900 add 0.69.6 changelog (#34798)
Summary:
Adds changelog for new patch.

## 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] - add changelog entry for 0.69.6

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D39848387

Pulled By: dmytrorykun

fbshipit-source-id: a8448f5bb1d3c65337038b9ac270416d34d88cfc
2022-09-27 06:34:10 -07:00
Nicola Corti 6125f1f866 Fix crash on release versions after AGP 7.3 bump (#34797)
Summary:
Release versions are currently broken on `main`. This happened once we bumped the AGP version to 7.3. It seems like that the path we used to use for assets has changed.

The app build successfully but it fails to start as it can't load the bundle.

This is also causing the hermes e2e test to fail: https://github.com/facebook/hermes/pull/821

## Changelog

[Android] [Fixed] - Fix crash on release versions after AGP 7.3 bump

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

Test Plan:
Tested this locally and it works fine with RN Tester (can run a release version of it).

Plus, inspecting the zip:

### Before

```
$ unzip -l packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-arm64-v8a-release.apk | grep android.bundle
  1248608  01-01-1981 01:01   assets/mergeHermesReleaseAssets/RNTesterApp.android.bundle
```

### After

```
$ unzip -l packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-arm64-v8a-release.apk | grep android.bundle
  1248608  01-01-1981 01:01   assets/RNTesterApp.android.bundle
```

Reviewed By: cipolleschi

Differential Revision: D39847369

Pulled By: cortinico

fbshipit-source-id: 0e21c0b6e58b49ac097c59223649b74b2879b5e5
2022-09-27 06:19:47 -07:00
evanbacon 5933b6a3ba Use monospace font for RCTRedBox.mm message (#34780)
Summary:
The format is crunching spaces:

![Simulator Screen Shot - iPhone 14 Pro Max - 2022-09-24 at 16 25 33](https://user-images.githubusercontent.com/9664363/192119593-30d5c82f-9f8c-465d-af29-6914d4111351.png)

Now it preserves the space and makes the error look a little less scary:

![Simulator Screen Shot - iPhone 14 Pro Max - 2022-09-24 at 16 25 02](https://user-images.githubusercontent.com/9664363/192119603-8214a38b-6511-413b-b999-5d2739cd0293.png)

## Changelog

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

[iOS] [Fixed] - RedBox title font by using a monospace font on iOS +13.

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

Test Plan: See pictures. You can repro by applying changes and starting a project with a misc `>` character. The first load triggers the error message.

Reviewed By: cipolleschi

Differential Revision: D39798262

Pulled By: robhogan

fbshipit-source-id: d836e50f3e95865a6482accf4aea5b0e6cf24995
2022-09-27 04:51:52 -07:00
Gabriel Donadel Dall'Agnol 14c91cdf59 feat: Add string support for aspectRatio (#34629)
Summary:
This updates `aspectRatio` to support string values and ratio formats, i.e., `'16 / 9'`, thus aligning it with the [CSS Box Sizing Module Level 4](https://drafts.csswg.org/css-sizing-4/#aspect-ratio) specification as requested on https://github.com/facebook/react-native/issues/34425. This also adds unit tests to the `processAspectRatio` function ensuring the style processing works as expected.

## Changelog

[General] [Added] - Add string support for aspectRatio

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

Test Plan:
This can be tested either through `processAspectRatio-tests` or by using the following code:

```js
 <View
   style={{
     backgroundColor: '#527FE4',
     aspectRatio: '16 / 9',
  }} />
```

https://user-images.githubusercontent.com/11707729/189029904-da1dc0a6-85de-46aa-8ec2-3567802c8719.mov

Reviewed By: jacdebug

Differential Revision: D39423304

Pulled By: cipolleschi

fbshipit-source-id: d323de93d6524e411e7ab9943335a8ca323b6e61
2022-09-27 04:05:52 -07:00
Gabriel Donadel Dall'Agnol 71fda5e0c2 feat: Add alt prop to Image component (#34550)
Summary:
This adds the `alt` prop to the `Image` component as requested on https://github.com/facebook/react-native/issues/34424. Using this new `alt` prop enables the `accessibility` prop and passes down the alt text to `accessibilityLabel`. This PR also updates RNTester ImageExample in order to facilitate the manual QA.

#### Open questions
 - ~~On web `alt` text is displayed on the page if the image can't be loaded for some reason, should we implement this same behavior if the `Image` component fails to load `source`?~~ Not for now

## Changelog

[General] [Added] - Add alt prop to Image component

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

Test Plan:
1. Open the RNTester app and navigate to the Image page
2. Test the `alt` prop through the `Accessibility Label via alt prop` section, this can be tested either by enabling Voice Over if you're using a real device or through the Accessibility Inspector if you're using a simulator

https://user-images.githubusercontent.com/11707729/187790249-0d851363-c30e-41b6-8c24-73e72467f4ba.mov

Reviewed By: lunaleaps

Differential Revision: D39618453

Pulled By: cipolleschi

fbshipit-source-id: 0e26b2574514e76ce7e98ddb578f587a9cc30ee9
2022-09-27 04:05:15 -07:00
Pavol Fulop f85e2ecc40 Include existing height when calculating new one for KeyboardAvoidingView (#34749)
Summary:
Currently, height is sometimes the only valid option for pushing `TextInput` up in the layout on Android. The problem is when switching keyboards. For instance, switching from ABC to emojis. This will trigger keyboard show events and recalculate the height for the `KeyboardAvoidingView`. Since the keyboard is still showing, the view has the height that was previously calculated and thus `frame` represents that. This means the `frame.height` has adjustments for the keyboard calculated in it, but it is used the same way as if the keyboard was not showing. This results in wrong calculation and the input showing at the incorrect place in the layout (mostly hidden under the keyboard)

This fix simply uses the previous calculation to offset `frame.height`, resulting in the correct height and smooth switching between keyboards. It's also scoped only to height mode since that's where the problem shows.

_Note: I mention android here, but it fixes it for both platforms. It's just that iOS usually works best with different behaviour so it's rarely used there._

## Changelog

[General] [Added] - Include `this.state.bottom` when calculating new keyboard height to fix android keyboard switching

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

Test Plan:
With simple code:

```jsx
import { StatusBar } from "expo-status-bar";
import React from "react";
import {
  KeyboardAvoidingView,
  StyleSheet,
  Text,
  TextInput,
  View,
} from "react-native";

export default function App() {
  return (
    <KeyboardAvoidingView style={styles.container} behavior="height">
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
      <TextInput style={{ backgroundColor: "red", width: "100%" }} />
    </KeyboardAvoidingView>
  );
}

const styles = StyleSheet.create({
  container: {
    padding: 32,
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "space-between",
  },
});
```

Notice the consistency of the TextInput after the changes, while before it would just move around more you switch the keyboards.

|  Before  | After  |
|---|---|
| ![2022-09-21 13-59-09 2022-09-21 14_01_44](https://user-images.githubusercontent.com/3984319/191499509-b41280a0-2969-4fe6-8796-c5695b999f27.gif)  | ![2022-09-21 14-03-33 2022-09-21 14_04_30](https://user-images.githubusercontent.com/3984319/191499628-a5832b88-e511-448d-8081-ac48d3a3690a.gif)  |

Reviewed By: cipolleschi

Differential Revision: D39718812

Pulled By: NickGerleman

fbshipit-source-id: 2550182e846f3f8e719d727fa8e6d87165faebf6
2022-09-26 15:10:27 -07:00
Luna 70d86e7647 Updates to ecosystem.md do clarify community roles (#34341)
Summary:
Changelog: [Internal] - Update Ecosystem.md to clarify community roles

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

Reviewed By: cortinico

Differential Revision: D39774550

Pulled By: lunaleaps

fbshipit-source-id: 00f8f58e901f1e35be6f395053fccfb6d841ce55
2022-09-26 14:27:11 -07:00
Nicola Corti 5fb0639e0b Bump react-native-gradle-plugin to 0.71.2
Summary:
We need to bump & publish a new version of the Gradle Plugin.
This is needed otherwise the template will break as I start to remove
entries from the `Android-prebuilt.cmake` file

Changelog:
[Internal] [Changed] - Bump react-native-gradle-plugin to 0.71.2

Reviewed By: lunaleaps, mdvacca

Differential Revision: D39815785

fbshipit-source-id: b140187971e2f963ef459e9c83ce9a76e67c89bd
2022-09-26 13:35:48 -07:00
Rachit Mishra 3f3394a566 fix: handle webview provider missing exception (#34456)
Summary:
The [existing fix](fb936dfffb/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java (L151)) to handle missing WebView provider uses string comparison based checks to handle the exception gracefully, or otherwise simply throw the exception. This ends up crashing the app for the end user.

<img width="1319" alt="Screenshot 2022-08-19 at 4 33 31 PM" src="https://user-images.githubusercontent.com/933314/185605137-24757dad-806e-4cca-b000-7d6ce2d191e1.png">

Fatal exceptions are bad in any case and not good user experience, we can gracefully handle this by [returning](https://github.com/facebook/react-native/compare/main...rachitmishra:react-native-1:patch-2#diff-f7ca1976002c4612051e4949395e64511b6f769e347c488e9a0d15cb5331fe76R141) `null` for all cases when WebView provider is not found.

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

[Android] [Fixed] - Gracefully handle crash if no WebView provider is found on the device

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

Test Plan: IMO no testing is required as we were already returning null in certain cases after handling the exception message, also `ForwardingCookieManager::getCookieManager` is already marked `Nullable` so we are safe there.

Reviewed By: lunaleaps

Differential Revision: D39809020

Pulled By: cortinico

fbshipit-source-id: 54b290ad7740859bdc84401904236c32761a4631
2022-09-26 13:30:14 -07:00
Nick Gerleman 8cdc9e7f04 Place TypeScript Declarations Alongside Source Files
Summary:
React Native's TS definitions are currently mostly stored in one monolithic file. This change splits the definitions up to correspond to the source files they came from, and are placed next to the source files. I think this should help inform, and make it easy to update the TS declarations when touching the Flow file.

I noticed as part of the change that the typings have not yet removed many APIs that were removed from RN. This is bad, since it means using the removed/non-functional API doesn't cause typechecker errors. Locating typings next to source should prevent that from being able to happen.

The organization here means individual TS declarations can declare what will be in the RN entrypoint, which is a little confusing. Seems like a good potential next refactor, beyond the literal translation I did.

Changelog:
[General][Changed] - Place TS Declarations Alongside Source Files

Reviewed By: lunaleaps, rshest

Differential Revision: D39796598

fbshipit-source-id: b36366466fd1976bdd2d4c8f7a4104a33c457a07
2022-09-26 12:09:45 -07:00
Sharon Zheng 77e79d6308 Animated.ScrollView with RefreshControl applying Animated transform twice
Summary:
There was a bug on Android when an Animated.ScrollView had a RefreshControl while an Animated style was applied, ie `transform`:
```
<Animated.ScrollView
  refreshControl={<RefreshControl />}
  style={{
    transform: [{
      translateY: new Animated.Value(200, {useNativeDriver: true})
    }]
  }}
/>
```

The transform value was being incorrectly applied twice. Since the styles were applied once on RefreshControl and once on NativeScrollView, the transform style is effectively applied twice:

**1. ScrollView.js**
- RefreshControl gets the transform through Fabric commit
- [The RefreshControl gets wrapped around ScrollView](https://fburl.com/code/k60krxbj) while on iOS there is no change in the parent/child relationship. [Outer/inner styles are split and applied to RefreshControl/ScrollView](https://fburl.com/code/b2to75er), and transform styles are applied on the parent (RefreshControl)

**2. createAnimatedComponent.js**
- NativeScrollView gets the transform through Animated
- [ScrollView forwards its ref to NativeScrollView](https://fburl.com/code/w1whtl5f), which means AnimatedComponent is setting the transform styles on NativeScrollView and not RefreshControl as ScrollView.js did

This diff fixes this bug by using the `useAnimatedProps` hook which makes both RefreshControl and ScrollView components into animated components. Otherwise, the components don't know what to do with Animated values.
 ---
Changelog:
[Internal][Fixed] - Animated transform style properties were being applied twice when used on an Animated.ScrollView with RefreshControl on Android

Reviewed By: javache

Differential Revision: D38815633

fbshipit-source-id: 2b76639d2237176b6aae4fb1e22cf1a1ec70a69a
2022-09-26 11:28:56 -07:00
Tim Yung 8edf4e9e3a Pressability: Eliminate Unit Test Timing Flakiness
Summary:
Currently, it is possible in one of the "minimum press duration" unit tests for certain instructions to take longer than expected, skewing the return value of `Date.now()` by at least 10ms.

This changes the unit test to mock `Date.now()` more accurately so that the test is no longer flakey.

Changelog: [Internal]

Reviewed By: jacdebug

Differential Revision: D39804152

fbshipit-source-id: ab62fd1921bd015d969da9595bd3267c38c6e59c
2022-09-26 08:49:51 -07:00
Nicola Corti bf55a3a392 Make sure ccache is considered as part of the CMake build
Summary:
I've just realized that CMake is ignoring `ccache`, even if you have it
installed. This is the necessary change needed to verify if the user
has `ccache` installed and eventually use it.

While not a necessary change for Prefab supprot, this is a nice to have
that I've discovered while working on it.

Changelog:
[Internal] [Changed] - Make sure ccache is considered as part of the CMake build

Reviewed By: cipolleschi

Differential Revision: D39815089

fbshipit-source-id: be62e5fe98954593fd907ec21c41950a967cff04
2022-09-26 08:48:04 -07:00
Nicola Corti 61e82aa462 Add the PreparePrefabHeadersTask.kt inside the Gradle Plugin
Summary:
This is part of the preparatory work for Prefab support for React Native.
I've added a task that will help us copy, filter and prepare the headers to
be consumed by Prefab.

It's not used at the moment. I will use it in the next commit.

Changelog:
[Internal] [Changed] - Add the PreparePrefabHeadersTask.kt inside the Gradle Plugin

Reviewed By: cipolleschi

Differential Revision: D39815101

fbshipit-source-id: 73e48666efa372a1647d08a7586083434d9ebbbb
2022-09-26 08:47:28 -07:00
Tim Yung 63903af1f1 msggen: Dependencies Cleanup (#34782)
Summary:
Cleans up the dependencies in `ReactCommon/hermes/inspector/tools/msggen` by

- Analyzing and removing any dependencies that are never referenced.
- Upgrading all dependencies to their latest versions (by deleting `yarn.lock` and re-running `yarn`).
  - I only upgraded Babel dependencies to the same version used by the rest of `react-native`.

Notably, this resolves 13 vulnerabilities reported by Dependabot.

## Changelog

[Internal]

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

Test Plan:
Ran the following successfully:

```
$ cd ReactCommon/hermes/inspector/tools/msggen
$ yarn
$ yarn test
$ yarn build
```

Reviewed By: cortinico, cipolleschi

Differential Revision: D39804478

fbshipit-source-id: c673e80b64fcf49c3f903c5d7f0a68c77d63a4bd
2022-09-26 07:43:13 -07:00
Riccardo Cipolleschi bbb2fb212d Parse custom NativeState in TypeScript (#34786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34786

This diff is the TS equivalent of D39686251.
It introduces the possibility to parse a custom Native State in Typescript.

The parsing follows the exact same rules as props, as initial heuristic. This should allow enough customization for the developers who needs a custom state.

Currently, we only support using `interface` for the state and the interface must contain the `NativeState` string in its name.

This diff introduces also tests for the TypeScript parser and it aligns the tests between Flow and TS.

## Changelog

[General][Added] - Implement custom Native State parsing in TypeScript

Reviewed By: cortinico

Differential Revision: D39811476

fbshipit-source-id: 1e1b86b50b9632c13157ff6c8115f5ebcbada643
2022-09-26 07:33:07 -07:00
Riccardo Cipolleschi 925b15351f Parse custom NativeState in Flow (#34753)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34753

This Diff introduce a the capability to parse custom NativeStates in Flow. To achieve this I also had to define the CodegenSchema.

The parsing follows the exact same rules as props, as initial heuristic. This should allow enough customization for the developers who needs a custom state.

There is only a case I was not able to make it work that is STATE_ALIASED_LOCALLY, from the fixtures. I don't know how diffuse it is and I think we can live with some workarounds for the time being.

This diff also adds tests for the custom Native State Flow Parser.

## Changelog
[General][Added] - Implement custom Native State parsing in Flow

Reviewed By: cortinico

Differential Revision: D39686251

fbshipit-source-id: 446997a39b33b7e9351d5ba12cecaeff33df4d16
2022-09-26 07:33:07 -07:00
Liam Potter 5e79fa8441 Remove usage of UIApplication.sharedApplication (#34787)
Summary:
Brings in line with rest of code base and avoids running into this error
```
‘sharedApplication’ is unavailable: not available on iOS (App Extension) — Use view controller based solutions where appropriate instead.
```
when `Requires Only App-Extension-Safe-API` is set to Yes.

## Changelog

[iOS] [Fixed] - Update usage of UIApplication.sharedApplication in RCTKeyCommands

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

Test Plan: Setting `Requires Only App-Extension-Safe-API` to Yes before this change means the app will not compile, after the change it does.

Reviewed By: dmytrorykun

Differential Revision: D39812410

Pulled By: cipolleschi

fbshipit-source-id: 78d185ba20301b10609e4a387f000f0cfda55663
2022-09-26 07:13:52 -07:00
Lorenzo Sciandra cc13b0273f fix(hermes): change logic in build scripts for Apple to use the right version (#34710)
Summary:
Within the `hermes-engine.podspec` contained in the RN repo (at `react-native/main/sdks/hermes-engine/`), there's a bit of logic that triggers `./utils/build-ios-framework.sh` and `./utils/build-mac-framework.sh` .

The issue is that we all thought that that  `./utils/build-ios-framework.sh` would invoke the React native version of the scripts (since the podspec file lives right next to the `utils` folder) but, in reality, it doesn't. It just so happens that the Hermes repo has a root level `utils` folder which is (you guessed it) where the Hermes variation of those build scripts live.
So, when running the pod install command in a react-native project (build from source), it will go and download the hermes source code (since the `source[:git]` gets set) but then it will use the **hermes** variation of the `build-*.sh` scripts.

[Read more here](https://github.com/facebook/react-native/pull/34513#issuecomment-1248286691).

This PR is taking kudo's proposed [patch here](https://github.com/reactwg/react-native-new-architecture/discussions/68#discussioncomment-3654191) - props for the fix go to him.

## Changelog

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

[iOS] [Fixed] -  Change hermes logic in build scripts for Apple to use the correct files

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

Test Plan: Tested by kudo in his work, and in my PR locally - [see here](https://github.com/facebook/react-native/pull/34513#issuecomment-1249431302).

Reviewed By: cortinico

Differential Revision: D39647057

Pulled By: cipolleschi

fbshipit-source-id: 6520e248801a307ca2f8886a3853dd1ff4af193d
2022-09-26 02:02:32 -07:00
Tim Yung 5d2a400e99 JS: Update Flow Definitions for `yargs` to v17
Summary:
Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D39677869

fbshipit-source-id: 4495b0c6c5e245d20034906fff4547265c7cc157
2022-09-23 18:00:18 -07:00
Paige Sun 9a253d1864 Back out "Back out "[Venice][iOS] Fix: Install Fabric UIManager before main bundle execution""
Summary:
Changelog: [Internal][Bridgeless][iOS]

# Before diff
Be in Venice > run Metro > run FBiOS > navigate to any RN surface.

 `UIManagerBinding createAndInstallIfNeeded` happens After `ReactInstance loadScript -> evaluateJavaScript`: install Fabric UIManager before main bundle execution

Reviewed By: RSNara

Differential Revision: D39760231

fbshipit-source-id: f17bf02e9b1fb0f9b0ff24c86aa6dc9349c42192
2022-09-23 17:32:49 -07:00
Carmi Grushko 47548c1149 Update ktfmt component on FBS:master
Reviewed By: strulovich

Differential Revision: D39766800

fbshipit-source-id: a7a1ef316e3a0a17d3c3020412b025dd62937ecd
2022-09-23 15:20:33 -07:00
Pieter Vanderwerff ff14ff3d92 Add explicit React useState annotations in xplat/js
Reviewed By: SamChou19815

Differential Revision: D39756144

fbshipit-source-id: d34c86b62e82e771723714fb7896058b7f27670f
2022-09-23 15:18:54 -07:00
Héctor Ramos c557f25648 Use PRODUCTION envvar directly in hermes-engine Pod to determine build type (#34776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34776

CocoaPods is not used when Hermes is built in Circle CI, so we cannot rely on the React Native CocoaPods scripts to be loaded.
The get_hermes_build_type function is removed from the RN CocoaPods scripts and in its place, the ENV['PRODUCTION'] envvar is accessed directly.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D39778190

fbshipit-source-id: 12083b7b4533b4ad7bb7a08612883983a0583616
2022-09-23 13:08:15 -07:00
Tianyu Yao 1d7080264e Upgrade React DevTools deps to 4.26.0
Summary:
Changelog:
[General][Changed] - Upgraded react-devtools-core dependency to 4.26.0

Reviewed By: lunaruan

Differential Revision: D39587418

fbshipit-source-id: 1b1841b72329fd3ef4ae8a08095a30a26a0b6455
2022-09-23 12:46:33 -07:00
Héctor Ramos 2fc44ac8e1 Use debug/release tarballs in hermes-engine Pod (#34761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34761

Separate debug and release tarballs are built in CI. Use the appropriate Hermes artifacts tarball when building hermes-engine.

Add hermes.rb tests.

Changelog:
[iOS] [Changed] - Remove debugger from Hermes when building for release

Reviewed By: cipolleschi

Differential Revision: D39698499

fbshipit-source-id: e6b10d34c7f94c2f86fc47d8b97466011aaa75cc
2022-09-23 09:40:24 -07:00
Nicola Corti 996c7a6ad8 Add note on React 18 update to 0.69.0 in the cangelog (#34774)
Summary:
Closes https://github.com/facebook/react-native-website/issues/3339

## Changelog

[Internal] - Add note on React 18 update to 0.69.0 in the cangelog

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

Test Plan: n/a

Reviewed By: cipolleschi

Differential Revision: D39770192

Pulled By: cortinico

fbshipit-source-id: 7cc9ead2b6f84163c7eddec42a4ccf5f0c16cf2a
2022-09-23 09:19:09 -07:00
Ken Tominaga fb1f53f7dc misc: fix remaining NDK comment (#34769)
Summary:
Fix remaining NDK comment for new architecture

## 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] [Fixed] - Fix remaining NDK comment for new architecture

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

Reviewed By: cipolleschi

Differential Revision: D39762860

Pulled By: cortinico

fbshipit-source-id: 35a3c9fed58d32bd6dc16c0d6bb217a3c2849612
2022-09-23 06:30:02 -07:00
Rubén Norte 30fe6b341b Restore flags to disable Fabric background executor
Summary:
We want to fix the order of execution of layout, layout effects and passive effects in React Native, but the use of the Fabric background executor for layout complicates this (and other things).

This brings back a flag to disable this background thread to do layout synchronously in JavaScript, before the execution of layout effects and passive effects.

This is expected to regress performance on some screens, so we need to address the antipatterns in those screens before shipping this.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D39727131

fbshipit-source-id: 4323b089234d3304ca3bfe5697668fb44ac64c12
2022-09-23 05:51:36 -07:00
Chenglin Liu 065db683a2 add link group label to fbios deps
Summary:
Currently, fbios link groups depend on supermodules to generate. To continue supporting
link groups while allowing us to migrate off supermodules, we'll add a `fbios_link_group` label on all fbios targets to persist the current hierarchical information.

Reviewed By: jkeljo

Differential Revision: D39543862

fbshipit-source-id: 2abe5b3ee883e77336076d88436a1c84139b5a97
2022-09-22 22:52:22 -07:00
Héctor Ramos 3046ce2421 Clean up hermes-engine Pod
Summary:
Aside from the log output, these changes do not change the behavior of the hermes-engine Pod.

Removed unused git branch checks.
Use react_native_path var to build filepaths.
Edit Hermes build from source log message to be consistent with other logs.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D39699165

fbshipit-source-id: 7e389eb5315fc5a2510b84eddac2f499a3e65157
2022-09-22 13:41:51 -07:00
Héctor Ramos ce4aa93173 Build separate tarballs for Hermes with and without debugger (#34704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34704

Create separate hermes-engine tarballs for release and debug builds, and only include the debugger in debug builds.
Changes the hermes-engine podspec to use a debug Hermes build by default in order to preserve the inclusion of the debugger.

Upcoming changes should split the hermes-engine Pod to allow Xcode to use release and debug builds as needed.

Changelog:
[iOS][Changed] - Use debug Hermes builds by default

Reviewed By: cipolleschi

Differential Revision: D39326467

fbshipit-source-id: 94c5fe7db80194d22fced6717c5efc7accd36d48
2022-09-22 13:41:51 -07:00
Zihan Chen (MSFT) 205cc9bc3b Handle (T) and undefined properly in turbo module component codegen (#34693)
Summary:
In `buildEventSchema` and `buildPropSchema`, they check into property types to see if the given property could be converted into an event schema or a property schema. The original implementation only handles limited cases, I refactor them and make them easier to maintain.

In `getPropertyType` in `events.js`, it handles `(T)` at a wrong place, fixed.

In `getPropertyType` in `props.js`, it doesn't handle `(T)`, fixed.

And I also fixed some other issues to make the codegen reports error better.

There are many duplicated test cases that cover every piece of the code, I changed some of them so that it tests both original cases and new cases.

## Changelog

[General] [Changed] - Handle (T) and undefined properly in turbo module component codegen

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

Test Plan: `yarn jest` passed in `packages/react-native-codegen`

Reviewed By: NickGerleman

Differential Revision: D39647075

Pulled By: cipolleschi

fbshipit-source-id: 8e1df2b54aab37b7151d0bf74260e2eba0602777
2022-09-22 11:40:38 -07:00
Vincenzo Vitale 10e47b891a Do not depend on an ENV variable when publishing and setting the RN version (#34746)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34746

The changes made in
https://github.com/facebook/react-native/pull/34694
introduced the need to have the env variable TMP_PUBLISH_DIR for the publishing and set-rn-version scripts to work.
This break any usage of set-rn-version when the env variable is not set upfront.

With this change, we are creating a temp folder in the scope that requires it (e.g. set-rn-version.js) and then passing the path to the save/revert functions.

## Changelog
[Internal] [Added] - Do not depend on an ENV variable when publishing and setting the RN version.

Reviewed By: cipolleschi

Differential Revision: D39683565

fbshipit-source-id: 21d85d1c16c4cb7324636ceb5eba626ff8cbb775
2022-09-22 07:34:50 -07:00
Gabriel Donadel Dall'Agnol 34db2d4e93 feat: Add string support to the transform property (#34660)
Summary:
This updates the `transform` property to support string values as requested on https://github.com/facebook/react-native/issues/34425. This also updates the existing unit tests of the `processTransform` function ensuring the style processing works as expected and updates the TransformExample on RNTester in order to facilitate the manual QA of this.

## Changelog

[General] [Added] -  Add string support to the transform property

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

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/189550548-ee3c14dd-11c6-4fd1-bd74-f6b52ecb9eae.mov

Reviewed By: lunaleaps

Differential Revision: D39423409

Pulled By: cipolleschi

fbshipit-source-id: 0d7b79178eb33f34ae55a070ce094360b544361f
2022-09-22 07:30:34 -07:00
Riccardo Cipolleschi b7add0aadb Always generate an EmptyNativeState (#34754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34754

This Diff is the second step of enabling the CodeGen to parse and generate a NativeState for the components.

The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.

## Changelog
[General][Added] - Always generate an empty NativeState for Fabric Components

Reviewed By: cortinico

Differential Revision: D39696435

fbshipit-source-id: e24768af78f59696c0b4db009e8065bb5c89316b
2022-09-22 06:41:44 -07:00
Riccardo Cipolleschi 69f8cf14f0 Always generate the EventEmitters (#34750)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34750

This Diff is the first step of enabling the CodeGen  to parse and generate a NativeState for the components.

The feature has been largely requested by the OSS community but it could be also helpful for people in Meta.

To allow the generation of custom `NativeState`, we first have to always generate a `ViewEventEmitter`: that's because the `ConcreteShadowNode` template lists the Generics with this order: `Name`, `Props`, `EventEmitter`, Others...
If we skip the `EventEmitters` and we put the `State`, React Native would think that the State is actually an `EventEmitter` and the build step will fail.

## Changelog
[General][Added] - Always generate a ViewEventEmitter for Fabric Components

Reviewed By: cortinico

Differential Revision: D39509869

fbshipit-source-id: 390cc146ef013baf1ed09d55a0182a5aeb5b9d9e
2022-09-22 06:41:44 -07:00
Samuel Susla 15dbd9121d Back out "Fix: Install Fabric UIManager before main bundle execution"
Summary:
Original commit changeset: 4491d6de1109

Original Phabricator Diff: D39493654 (447be62909)

changelog: [internal]

Reviewed By: javache

Differential Revision: D39727129

fbshipit-source-id: 412a7fc5e4bf8db26cde7d420e71cf1f314cdc93
2022-09-22 06:36:59 -07:00
fortmarek 22940e4177 Use verdaccio for the template e2e test (#34577)
Summary:
This PR adds [verdaccio](https://github.com/verdaccio/verdaccio) to release packages in the `packages` directory during the E2E test on CI.

The rationale behind this is the following:
- Firstly, we wanted to push the [monorepo RFC](https://github.com/react-native-community/discussions-and-proposals/pull/480). We hit an issue when renaming the packages to follow the same convention caused by the e2e test using the template to fail. This is because the template installs packages from the live version of npm – and if you just rename a package in a given PR without releasing it, the package understandably can't be installed since it's not published, yet – as you can see [here](https://app.circleci.com/pipelines/github/facebook/react-native/15286/workflows/149df51f-f59b-4eb3-b92c-20c513111f04/jobs/282135?invite=true#step-108-283).
- Secondly, the current e2e test on `main` does not actually test the latest code of the packages in the `packages` directory as it simply downloads the latest versions from npm. This creates a divide between what's tested and what users should expect when using nightlies or when a new minor is released.

## 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 verdaccio for template e2e test

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

Test Plan: `test_js` CI check should pass. Additionally, I have temporarily updated the [PR](https://github.com/facebook/react-native/pull/34572) renaming `assets` to `assets-registry` to include the verdaccio changes – the `test_js` passes there, additionally proving merging this PR will unblock us with the rename PRs.

Reviewed By: cipolleschi

Differential Revision: D39723048

Pulled By: cortinico

fbshipit-source-id: aeff3811967360740df3b3dbf1df50e506fb72d8
2022-09-22 05:02:37 -07:00
Kudo Chien 3d7e1380b4 Fix port as -1 if dev server without specifying port on Android (#34705)
Summary:
when specifying dev server without port, e.g. http://www.example.com/, there are some issues.

1. redbox error
<img src="https://user-images.githubusercontent.com/46429/190540390-8ee420f2-7642-427b-9f2e-e0c6d31015f8.png" width="30%">

2. showing -1 in loading view

<img src="https://user-images.githubusercontent.com/46429/190540727-158f35ad-359f-443a-a4b0-768dd2f7e400.png" width="50%">

the root cause is coming from [`java.net.URL.getPort()` will return -1 when the url doesn't have a port](https://developer.android.com/reference/java/net/URL#getPort()). this pr replaces the parser to [`okhttp3.HttpUrl`](https://square.github.io/okhttp/4.x/okhttp/okhttp3/-http-url/#port) that it will have default port 80 for http or port 443 for https. the two call paths should only serve http/https address, not file:// address. it should be safe to change from java.net.URL to okhttp3.HttpUrl.

not fully related, in the case above, android will connect to `ws://www.example.com/:8097` for react-devtools
we should strip the trailing slash in *setUpReactDevTools.js*

## Changelog

[Android] [Fixed] - Fix port as -1 if dev server without specifying port on Android

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

Test Plan:
test on rn-tester with the following steps

1. `yarn start`
2. open another terminal and run `ngrok http 8081` and it will return a tunnel url, e.g. `71a1-114-36-194-97.jp.ngrok.io`
3. open dev setting in app and change the dev server to `71a1-114-36-194-97.jp.ngrok.io`
5. reload the app

Reviewed By: cipolleschi

Differential Revision: D39573988

Pulled By: cortinico

fbshipit-source-id: 397df90ab30533207bd87a3f069132d97c22c7fd
2022-09-22 04:20:44 -07:00
Gabriel Donadel Dall'Agnol c2b699abc5 chore: Fix RNTester typos (#34757)
Summary:
While working on https://github.com/facebook/react-native/pull/34550 I noticed that a couple of words inside the RNTester package were misspelled, this gave me the idea to test other files as well using the VS Code extension [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) which unveiled quite a few other typos.

## Changelog

[Internal] [Fixed] - Fix RNTester typos

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

Test Plan: Shouldn't require much testing as this is just fixing some typos inside the RNTester package.

Reviewed By: dmytrorykun

Differential Revision: D39722889

Pulled By: cortinico

fbshipit-source-id: a575ab8337586c5fe2d68ce73d2aae27d24a6384
2022-09-22 03:14:51 -07:00
Rujin Cao 41c6c69aaa '@emails' -> '@oncall' (*.js)
Differential Revision: D39684030

fbshipit-source-id: 69f281e9e630334ca405a92f75b659795d9ad3e1
2022-09-21 20:47:05 -07:00