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

24036 Коммитов

Автор SHA1 Сообщение Дата
Nicola Corti bd7caa64f5 Use side-by-side NDK for Android (#32848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32848

If we leverage the side-by-side configuration of the NDK
(see https://developer.android.com/studio/projects/configure-agp-ndk#agp_version_41)
we will not have to specify the NDK Path or Version at all.

We will automatically pick the best NDK version selected by AGP.

Changelog:
[Android] [Changed] - Use side-by-side NDK for Android

Reviewed By: ShikaSD

Differential Revision: D33475818

fbshipit-source-id: 16aa4acfc44b94e2f92df89d71e104bf46d7f162
2022-01-11 10:00:54 -08:00
Nicola Corti 0fccbd53af Leverage Gradle implicit dependency substitution for Gradle Plugin
Summary:
Previously we asked users to specify a dependency substitution
rule to properly use the React Native Gradle Plugin.

Here I'm updating the Gradle Plugins setup to allow to use implicit
dependency substitution. This requires to specify a Maven Group and Artifact
Name (through the project name).

This is backward compatible as users will still be allowed to specify a
dependency substitution rule if they wish.

Changelog:
[Android] [Changed] - Leverage Gradle implicit dependency substitution for Gradle Plugin

Reviewed By: ShikaSD

Differential Revision: D33404948

fbshipit-source-id: 3323f8e0738fd579ce8ae344cbdc0e4356e7dbd8
2022-01-11 07:23:54 -08:00
grgr-dkrk 36037fa81b feat: add `accessibilityLabelledBy` props (#32470)
Summary:
related: https://github.com/facebook/react-native/issues/30846, https://github.com/facebook/react-native/issues/26739

Added `accessibilityLabelledBy` props to find the nativeID of the associated label, it mainly for` <TextInput> `.

The reason for implementing it as `labelledBy` instead of `labelFor` is as follows.
- It was difficult to find a component with `labelFor` because the `<Text>` component does not add the `labelFor` received from her Props to the View's tag.
- The use case looks like the HTML `aria-labelledby`, which is intuitive for web developers. It also seems easy to convert to a web platform.

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

[Android] [Added] - add `accessibilityLabelledBy` props

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

Test Plan:
I checked it with RNTester using an Android11.

https://user-images.githubusercontent.com/40130327/138666856-891d9f4d-52cf-4181-a81f-13b033037db4.mp4

Reviewed By: lunaleaps, kacieb

Differential Revision: D31897112

Pulled By: ShikaSD

fbshipit-source-id: 66361735679560c01834b3a4483adf264098b3e3
2022-01-11 06:51:39 -08:00
Nicola Corti b4b9c54978 Make `test_android_template` work regardless of the version (#32841)
Summary:
Fixes https://github.com/facebook/react-native/issues/32835

## Changelog

[Internal] - Make `test_android_template` work regardless of the version

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

Test Plan: Tested locally. Will wait for `test_android_template` to be green.

Reviewed By: hramos

Differential Revision: D33476511

Pulled By: cortinico

fbshipit-source-id: 29a96683afae64cadc9ae4332410cd4d5d9d3e6d
2022-01-11 02:02:34 -08:00
Ramanpreet Nara 8487470476 Fix SVC for AndroidTextInput
Summary:
## SVC != NVC Failure
```
 LOG  SVC AndroidTextInput Invalid
 LOG  {
  "missing": {
    "validAttributes": {
      "borderBottomLeftRadius": true,
      "borderBottomColor": {
        "process": "[Function processColor]"
      },
      "borderRightColor": {
        "process": "[Function processColor]"
      },
      "borderLeftColor": {
        "process": "[Function processColor]"
      },
      "borderTopRightRadius": true,
      "borderColor": {
        "process": "[Function processColor]"
      },
      "borderBottomRightRadius": true,
      "borderRadius": true,
      "borderStyle": true,
      "borderTopColor": {
        "process": "[Function processColor]"
      },
      "borderTopLeftRadius": true
    }
  },
  "unexpected": {
    "validAttributes": {
      "autoCompleteType": true
    }
  },
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341773

fbshipit-source-id: a3c7f043d6b2ba0e2a4253739826e6f7f68e7ca5
2022-01-11 00:24:41 -08:00
Ramanpreet Nara cb3321e3b0 Refactor: Inline AndroidTextInputViewConfig
Summary:
Putting the static view config into its own file creates the uncertainty that n > 1 files import the static view config. This isn't true for AndroidTextViewConfig. So, let's just inline this static view config in the NativeComponent that uses it.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341776

fbshipit-source-id: 6fb710b8776d7b9276022c5226acefd7cf8395fb
2022-01-11 00:24:41 -08:00
Ramanpreet Nara ae6a84e70d Fix NVC for AndroidProgressBar
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33341772

fbshipit-source-id: eddd344135e6deed60c21eb838a244753e2204b5
2022-01-11 00:24:41 -08:00
Ramanpreet Nara 848e34e753 Fix SVC/NVC for AndroidDrawerLayout
Summary:
## Failures
```
 LOG  SVC AndroidDrawerLayout Invalid
 LOG  {
  "missing": {},
  "unexpected": {
    "directEventTypes": {
      "topDrawerOpened": {
        "registrationName": "onDrawerOpen"
      },
      "topDrawerClosed": {
        "registrationName": "onDrawerClose"
      }
    },
    "validAttributes": {
      "keyboardDismissMode": true,
      "drawerBackgroundColor": {
        "process": "[Function processColor]"
      },
      "statusBarBackgroundColor": {
        "process": "[Function processColor]"
      }
    }
  },
  "unequal": []
}
```

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D33409393

fbshipit-source-id: 9fa5b6cd5c8fc9bc01d825eb8fb7965c5cb691d2
2022-01-11 00:24:41 -08:00
Paige Sun b3a34194c0 5/5 Hook up Bridgeless' UIManager.hasViewManagerConfig with Fabric's native component registry
Summary:
Allow JS to detect if a native UI component is registered to `RCTComponentViewFactory.mm` with JS `UIManager.hasViewManagerConfig(componentName)`.

Fyi, `UIManager.js` is
- `DummyUIManager.js` for Bridgeless,
- `LazyUIManager.js` for Fabric with SVC enabled,
- and `PaperUIManager.js`. for Fabric with SVC disabled.

# How it works in Bridgeless
- `DummyUIManager.hasViewManagerConfig()` checks whether a component exists in the binary. It is hooked up to `unstable_hasComponent()`,
- which is hooked up to the native function `RCTInstallNativeComponentRegistryBinding()`,
- which returns whether a component has been registered to `RCTComponentViewFactory`
- (and also registers the native component if hasn't been registered yet).

Changelog: [Bridgeless][JS] Hook up Venice's UIManager.hasViewManagerConfig with Fabric's native component registry

Reviewed By: RSNara

Differential Revision: D33511659

fbshipit-source-id: 14519378ce3e4247516fcf5a6f83a82aa87c7919
2022-01-10 17:26:37 -08:00
Paige Sun a620d7dc85 4/5 Minor: Move unstable_hasComponent out of NativeComponentRegistry
Summary:
Without moving this, we would get this warning about a require cycle on the next diff, because DummyUIManager and LazyUIManager both need unstable_hasComponent.

```
(NOBRIDGE) WARN  Require cycle: react-native-github/Libraries/NativeComponent/NativeComponentRegistry.js -> react-native-github/Libraries/ReactNative/UIManager.js -> react-native-github/Libraries/ReactNative/DummyUIManager.js -> react-native-github/Libraries/NativeComponent/NativeComponentRegistry.js

Require cycles are allowed, but can result in uninitialized values. Consider refactoring to remove the need for a cycle.
```

Changelog: [Internal]

Reviewed By: philIip, RSNara

Differential Revision: D33511566

fbshipit-source-id: fd8c9732408d08ab17335273f86168bf30747929
2022-01-10 17:26:37 -08:00
Paige Sun 7c63e0d5bc 3/5 For codegenNativeComponent, with SVC enabled, use UIManager hasViewManagerConfig instead of getViewManagerConfig
Summary:
With SVC enabled for codegenNativeComponent, use `UIManager.hasViewManagerConfig(viewManagerName)` instead of `UIManager.getViewManagerConfig(viewManagerName)` to check for whether the native component is in the app BUCK binary.

This is safe because `global.__fbStaticViewConfig` is gated with MC, and the purpose of SVCs is to stop using `getViewManagerConfig` to get view configs from the Paper view managers. Currently no QEs have SVCs enabled.

Changelog:
[Fabric][JS] For codegenNativeComponent, with SVC enabled, use UIManager hasViewManagerConfig instead of getViewManagerConfig

Reviewed By: RSNara

Differential Revision: D33511365

fbshipit-source-id: 58c7020903137e2b5c80ef34a956be04de51628b
2022-01-10 17:26:37 -08:00
Kacie Bawiec 85ecb0043f React Native sync for revisions a049aa0...fe905f1
Summary:
This sync includes the following changes:
- **[fe905f152](https://github.com/facebook/react/commit/fe905f152 )**: Update package.json ([#22954](https://github.com/facebook/react/pull/22954)) //<Jack Works>//
- **[3dc41d8a2](https://github.com/facebook/react/commit/3dc41d8a2 )**: fix: parseExportNamesInto specifiers typo ([#22537](https://github.com/facebook/react/pull/22537)) //<btea>//
- **[bd0a5dd68](https://github.com/facebook/react/commit/bd0a5dd68 )**: #22988 - Fix Bug: license header in React 18 bundles contains vundefined ([#23004](https://github.com/facebook/react/pull/23004)) //<Vitalie>//
- **[ceee524a8](https://github.com/facebook/react/commit/ceee524a8 )**: Remove unnecessary clearContainer call ([#22979](https://github.com/facebook/react/pull/22979)) //<Sebastian Markbåge>//
- **[cd1a3e9b5](https://github.com/facebook/react/commit/cd1a3e9b5 )**: Build both a partial renderer and fizz renderer of the legacy API for FB ([#22933](https://github.com/facebook/react/pull/22933)) //<Sebastian Markbåge>//

Changelog:
[General][Changed] - React Native sync for revisions a049aa0...fe905f1

jest_e2e[run_all_tests]

Reviewed By: rickhanlonii

Differential Revision: D33512179

fbshipit-source-id: c2df06c8af6bb674ea0c5524538259e6d6d98f78
2022-01-10 14:30:56 -08:00
Paige Sun 6be46b0bb5 Comments only. Clarify a few Venice and SVC methods
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D33468276

fbshipit-source-id: bcc62ba1e728bba2492dbbbb0e4569285effeca7
2022-01-07 17:41:55 -08:00
Paige Sun 9daae5a5f2 For Fabric with StaticViewConfigs, fix UIManager to use LazyUImanager, not PaperUIManager
Summary: Changelog: [JS] For Fabric with StaticViewConfigs, fix UIManager to use LazyUImanager, not PaperUIManager

Reviewed By: fkgozali

Differential Revision: D33459937

fbshipit-source-id: 4298be7e1e455856cbcf3162b100099cd8c9ce09
2022-01-07 16:16:16 -08:00
Lulu Wu 705236e363 Remove unused import of JMessageQueueThread.h
Summary:
As title.

Changelog:
[Android][Changed] - Remove unused import of JMessageQueueThread.h

Reviewed By: philIip

Differential Revision: D33477760

fbshipit-source-id: a62bd9bb34f5a08446a59fbd7fd1b0cd27dd6606
2022-01-07 15:54:18 -08:00
Ramanpreet Nara ca5aaa7663 Remove {eventName}: true from ViewConfig validAttributes
Summary:
For every direct and bubbling event, RCTComponentData (iOS-only) creates a {eventName}: true entry in the component's ViewConfig validAttributes. This entry is unnecessary, and creates a discrepancy between ViewConfigs on iOS vs Android.

This diff removes this entry for all events to:
1. Reduce bloat in native ViewConfigs
2. Create consistency betweeen Android and iOS.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D33303950

fbshipit-source-id: 870c8a2a6d41156ac89bd8554eb09f292bb6108e
2022-01-06 19:09:53 -08:00
Nicola Corti 252b2a63c5 Updating Yarn Cache path to fix broken CI (#32834)
Summary:
The CI is currently failing with:
```
Error extracting tarball /tmp/cache1419328940 : tar: root/.cache/yarn: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6
```

The problem is that we're sharing the Yarn cache between two jobs (`test_js` and `test_ios_unit_jsc`) which are executed on two difference executors (a Machine vs a Docker container).

I've update the cache key to be `v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}` so the job name is accounted when computing the Cache Key.

Moreover the `test_js` test was also failing on `flow check` as one of the library we depend on (`resolve`) added a test with a malformed JSON. I'm fixing this failure as well so the CI is back green.

## Changelog

[Internal] - Updating Yarn Cache path to fix broken CI

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

Test Plan: Verified that the external CI is green: https://github.com/facebook/react-native/pull/32834

Reviewed By: lunaleaps

Differential Revision: D33453702

Pulled By: cortinico

fbshipit-source-id: 52bf42db583eaf6aa913f1bb164566f8c3563d36
2022-01-06 10:46:15 -08:00
Nicola Corti cd4c6659d3 Bump Gradle, AGP and Download plugins
Summary:
Let's keep our Gradle infra deps up to date.
I'm bumping Gradle to 7.3.3 which fixes several Log4j CVEs,
AGP to 7.0.4 and the Download Task plugin to 4.1.2

Changelog:
[Android] [Changed] - Bump Gradle to 7.3.3 and AGP to 7.0.4

Reviewed By: mdvacca

Differential Revision: D33430789

fbshipit-source-id: b8f260beb4a9cc962ea3743610bfb4ead004d6cb
2022-01-06 10:37:28 -08:00
Mengke Ding a03bd2f13e A quick fix for inital fb4a_debug launch crashes due to fetching string `com.facebook.react.R.string.catalyst_sample_profiler_enable`
Summary: Changelog: [Android][Internal] - a quick fix for inital fb4a_debug launch crashes due to fetching string `com.facebook.react.R.string.catalyst_sample_profiler_enable`

Reviewed By: paveldudka

Differential Revision: D33410712

fbshipit-source-id: f63e4b7e9aba3e79d4aa11983d68fee7341972bb
2022-01-05 16:37:59 -08:00
Pieter De Baets 78614de1cb Revert D32559015: Support setting hitSlop with single value (JS changes)
Differential Revision:
D32559015 (589b129581)

Original commit changeset: c0409e6e5dd9

Original Phabricator Diff: D32559015 (589b129581)

fbshipit-source-id: 91cfcc86582c4716fc531a73bd8e06dea1406abd
2022-01-05 14:06:54 -08:00
Samuel Susla bdd25ed6a3 Clean up ShadowTree::progressState
Summary:
changelog: [internal]

Use std::vector access operator without bounds checking.

Trying to resolve T108113554 and discovered this inefficiency.

Reviewed By: mdvacca

Differential Revision: D33349619

fbshipit-source-id: e9000a054ba9e7e6835105b7558dbf1a9a04deff
2022-01-05 09:10:06 -08:00
Samuel Susla 681ed402de Turning on clang tidy performance-*
Summary:
changelog: [internal]

Enable performance related clang tidy rules.

Reviewed By: javache

Differential Revision: D33350556

fbshipit-source-id: 486446ed0a1ac88af21b691ac6905b4f2359dafc
2022-01-05 05:53:13 -08:00
Ramanpreet Nara d016766303 Attach "default events" to all ViewConfigs
Summary:
## Context
Default events are only attached to the first-loaded component.

## Problem
This complicates SVC == NVC reconciliation:
- The Static ViewConfigs of all components contain these default events.
- The native ViewConfig of *only the first component that loads* has these default events.

## FAQ
**Question:** If default events were only attached to the first loaded component, how come all components could emit these default events?

In short, if one component declares an event, React Native can dispatch that event to **all** components:
1. The ReactFabric-dev renderer invokes [ReactNativeViewConfigRegistry.get](https://fburl.com/code/468l3zp7) to get the ViewConfig of a component.
2. ReactNativeViewConfigRegistry.get inserts a component's the Bubbling/Direct events into [two **global** maps: ReactNativeViewConfigRegistry.customBubblingEventTypes, ReactNativeViewConfigRegistry.customDirectEventTypes](https://www.internalfb.com/code/fbsource/[00ccc3c7a1b76e55986a6d753b8748327397e5eb]/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js?lines=20-34%2C57-72%2C117).
3. When the ReactFabric-dev renderer needs to dispatch events, it just [does a lookup on these two **global** maps](https://www.internalfb.com/code/fbsource/[2de1e1d59f6e0316868a6c4d9bca5fe673210106]/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.js?lines=2426%2C2439-2440) to create/dispatch the SyntheticEvents.

**Question:** Should we gate these changes?
This change should be safe to land without gating. This diff just creates duplicate entries for bubbling/direct events across components, which should [just get ignored by ReactNativeViewConfigRegistry](https://www.internalfb.com/code/fbsource/[4c57b02a0edccfd8a5fcc3a63ed2dd622efea320]/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js?lines=42%2C57-72%2C117).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33303417

fbshipit-source-id: fa777ca92e57b82eafb94f7d05ef4064ed5060ed
2022-01-04 16:04:16 -08:00
Ramanpreet Nara 4b9e4fa1ef Codemod: Make Android native ViewConfigs inherit parents' bubbling/direct events
Summary:
# Problem
1. Static ViewConfigs on **both platforms** contain their parent component's inherited bubbling/direct events (and props).
2. On Android, native ViewConfigs for child components **do not** inherit bubbling/direct events from their parent. (They do inherit the props, however).

# Cause

How child components inherit props from their parent component on Android:
1. A ViewManager's native props are calculated by [calling ViewManager.getNativeProps()](https://www.internalfb.com/code/fbsource/[5769b6d6ca123b2bed31dc2bc6bc8e4701581891]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java?lines=139)
2. Which [calls into ViewManagerPropertyUpdater.getNativeProps()](https://www.internalfb.com/code/fbsource/[11f0031c5e83d4d8903112d7d720b58981d3613f]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java?lines=278-280)
3. Which [calls into a code-generated $$PropsSetter object](https://www.internalfb.com/code/fbsource/[11f0031c5e83d4d8903112d7d720b58981d3613f]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.java?lines=73-74%2C112)
4. The ReactProp annotation processor [code-generates a $$PropsSetter object](https://www.internalfb.com/code/fbsource/[cbc8ca6036219069ad52fb6aec66488b7a06a879]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java?lines=265) by [visiting the ViewManager’s *entire class hierarchy* in search of ReactProp annotations](https://www.internalfb.com/code/fbsource/[cbc8ca6036219069ad52fb6aec66488b7a06a879]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java?lines=203-230).

Why child components don't inherit direct/bubbling events from their parents:
1. When we get the bubbling/direct events for a component on Android, we just call into the child ViewManager, which didn't forward its parent's props (until this diff):

https://www.internalfb.com/code/fbsource/[5769b6d6ca123b2bed31dc2bc6bc8e4701581891]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java?lines=113%2C122

# Fix

Codemod all components to manually forward the bubbling/direct events from their parents.

Why Not:
- Leads to a lot of boilerplate code.
- Feels like a bandaid solution.
- Doesn’t scale to open source. There’s more process when authoring new components.
- Are thre more idiomatic alternative solutions? (See alternatives considered).

Why:
- It’s a bandaid solution, yes. And it doesn’t scale well to other components, true. But, we’re only bloating deprecated APIs. Long term, we’re going to kill off getExportedCustomBubblingEventTypeConstants() and getExportedCustomDirectEventTypeConstants().
- Our goal is to just unblock Static ViewConfigs. This is the simplest/safest/least intrusive way to accomplish our goal.

# FAQ
**If child components don't contain their parents bubbling/direct events, how can they can respond to their parent's bubbling/direct events?**
- Bubbling/direct events are stored in a [global map](https://www.internalfb.com/code/fbsource/[2de1e1d59f6e0316868a6c4d9bca5fe673210106]/xplat/js/react-native-github/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js?lines=20-34). Once *one* component registers a bubbling/direct event, all components [can respond to that event](https://www.internalfb.com/code/fbsource/[2de1e1d59f6e0316868a6c4d9bca5fe673210106]/xplat/js/react-native-github/Libraries/Renderer/implementations/ReactFabric-dev.js?lines=2439-2440).

**How does this component prop/event inheriting work on iOS?**
1. On iOS, ViewConfigs have a baseViewConfig property.
2. All components at least have baseViewConfig = RCTViewManager.
3. To create the native ViewConfig for the component, JavaScript runs this loop:

https://www.internalfb.com/code/fbsource/[058bc6c4976d4cebb442dd2675a2a0570a214403]/xplat/js/react-native-github/Libraries/ReactNative/getNativeComponentAttributes.js?lines=42-61

# Alternative Solutions
***Solution 1:** Make Android components leverage baseViewConfig, like iOS.*

Why Not:
- baseViewConfig leads to unnecessary round trips from JS → Native (see [this TODO](https://www.internalfb.com/code/fbsource/[a88c9751494f1ee863a76238b532fca2b134032d]/xplat/js/react-native-github/Libraries/ReactNative/getNativeComponentAttributes.js?lines=34-35) that tells us we should avoid this on iOS).

***Solution 2:** In [UIManagerModuleConstantsHelper](https://www.internalfb.com/code/fbsource/[6717cba1e0db71777cf11dcf7b861b171bfd0c84]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java?lines=105-145), which generates the native ViewConfig for Android components, use Java reflection APIs to visit the class hierarchy of all ViewManagers when collecting bubbling/direct events.*

Complications:
- **Challenging to Implement**: Have to rely on advanced Java reflection APIs. You can’t just do getSuperclass().getDeclaredMethod(...).invoke(object) to invoke an overridden method.
- **Challenging to Ship**: Would lead to a penalties when creating native view configs: either performance, or memory. This negatively impacts VR and legacy React Native android.

***Solution 3:** Create a deprecated ReactProp-like annotation (e.g: ReactEvent) but for declaring bubbling/direct events in Java ViewManagers for zero runtime cost event declaration.*

Details:
- Legacy React Native infra will be code-modded to newer ReactEvent annotation infra.
- The ReactEvent annotation processor will navigate the ViewManager’s class hierarchy at build-time to generate a class that returns the ViewManager’s bubbling/direct events.
- UIManagerModuleConstantsHelper will call into this class to get the bubbling/direct events.
- **Aside:** The component codegen can also generate these annotations. This way, all you need to do is hook up your ViewManagers to codegen to guarantee that your native component exports the right bubbling/direct events to JavaScript.

Why Not:
- This is a lot of throwaway work for just making the SVC === NVC check pass, which we're only doing to unblock the SVC migration.

Why is this throwaway work?
- Java ViewManagers don’t do anything special in native with the Bubbling/Direct events. They declare the Bubbling/Direct events for JavaScript consumption. If JavaScript is the source of truth, then there’s no value in sending these Bubbling/Direct events to Java ViewManagers.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D33303418

fbshipit-source-id: 8d99fe80f83244443406bcfdc6cfea43b26f9c75
2022-01-04 16:04:16 -08:00
Samuel Susla d639fe1f3d Make iterators const in LayoutAnimationKeyFrameManager
Summary:
changelog: [internal]

Just making more stuff const.

Reviewed By: mdvacca

Differential Revision: D33254016

fbshipit-source-id: 9a170b025c065845432933bd851148599124b525
2022-01-04 11:42:16 -08:00
Pieter De Baets 589b129581 Support setting hitSlop with single value (JS changes)
Summary:
JS changes to support D32138347 (a96bdb7154)

Changelog: [Android][Fixed] Enable hitSlop to be set using a single number.

Reviewed By: yungsters

Differential Revision: D32559015

fbshipit-source-id: c0409e6e5dd95b35a2a4605b16cfb48104be2858
2022-01-04 10:39:43 -08:00
Krzysztof Piaskowy c68c47d2ba Added missing constructor to WritableNativeArray (#32796)
Summary:
`WritableNativeMap` has two constructors:
```c++
WritableNativeMap();
WritableNativeMap(folly::dynamic &&val);
```
but `WritableNativeMap` has only one constructor:
```c++
WritableNativeMap();
```
Without a second constructor, I am not able to create `WritableNativeMap` from the existing array. I added this second constructor because I need it for `react-native-reanimated`.

## Changelog

[Android] [Added] - Added missing constructor to WritableNativeArray

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

Test Plan:
```c++
std::shared_ptr<jsi::Runtime> rt = facebook::hermes::makeHermesRuntime();
jsi::Value value;
WritableNativeMap::newObjectCxxArgs(jsi::dynamicFromValue(*rt.get(), value));
```

Reviewed By: cortinico

Differential Revision: D33285316

Pulled By: lunaleaps

fbshipit-source-id: 1bbd816892f34ae6fef747066893fe3b803c088d
2022-01-02 16:17:05 -08:00
Andres Suarez e22b760e59 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33372796

fbshipit-source-id: 51a515be3d570b53b238302a22975ec91099df06
2021-12-31 14:42:42 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Samuel Susla 8c6a98400e Introduce TextInput.onChangeSync
Summary:
changelog: [internal]

Add experimental `TextInput.onChangeSync` which delivers onChange event synchronously.

Reviewed By: ShikaSD

Differential Revision: D33188083

fbshipit-source-id: 1e1dcd0d71c7eec98d3d5f69967659e07ac4e6a6
2021-12-30 06:38:50 -08:00
David Vacca f3d0a67a73 Add logs in RN Android
Summary:
Easy diff that adds logs in RN Android

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D33350749

fbshipit-source-id: 301702ce94b684431de3c0a1bafcf318be7aecd6
2021-12-29 10:32:52 -08:00
CodemodService FBSourceClangFormatLinterBot 725bffce51 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D33316567

fbshipit-source-id: cfeb96eb2adc7539b97d3a8f0de6710cd5f6ce5b
2021-12-25 08:28:35 -08:00
Richard Howell e60f0f5034 cast implicit int to CGFloat conversions [3/3]
Summary: Insert casts for implicit int -> CGFloat conversions. This warning category is generally benign and explicitly casting will preserve existing behavior.

Reviewed By: NSProgrammer

Differential Revision: D33303887

fbshipit-source-id: b21adbcf754e707adfe3f8eaa0fe9c3a65380cc5
2021-12-24 09:19:42 -08:00
Andrei Shikov a7104b03e7 Remember preallocated views on mounting layer
Summary:
Adds an experimental replacement for preallocation revision checks on Android mounting layer. Instead of checking revisions of props, we remember tags of preallocated/previously allocated views and use this as a filter to avoid issuing extra create and preallocate commands on copy.
This method is a bit more expensive on memory, but is more precise than relying on revisions.

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D33038768

fbshipit-source-id: fc98c2a7912e162a3845ca80488635bffaf8cc7f
2021-12-23 18:56:51 -08:00
Samuel Susla f85273d484 Enable modernize-use-transparent-functors clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-transparent-functors.html

Reviewed By: rubennorte

Differential Revision: D33297509

fbshipit-source-id: 4b5c38e6fe0eab9aa39131f0200cf9c5654ec19f
2021-12-23 10:21:10 -08:00
Samuel Susla b76a488199 Enable modernize-use-using clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-using.html

Reviewed By: rubennorte

Differential Revision: D33297576

fbshipit-source-id: 1124c410f0b950b0eb37e1b0e950ba9e76925dce
2021-12-23 10:21:10 -08:00
Samuel Susla 8d9101e578 Enable modernize-use-override clang tidy rule
Summary:
changelog: [internal]

You can read more about this on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html

Reviewed By: rubennorte

Differential Revision: D33297524

fbshipit-source-id: 259aa6f0b3ceb0ef065497199f72760449634ffc
2021-12-23 10:21:10 -08:00
Samuel Susla 1d0495e0a2 Enable modernize-use-equals-delete clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-delete.html

Reviewed By: rubennorte

Differential Revision: D33296068

fbshipit-source-id: 72e7ae199da39527476494729b1ab862e7e989e4
2021-12-23 10:21:10 -08:00
Samuel Susla 76af846c1d Enable modernize-use-noexcept clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html

Reviewed By: rubennorte

Differential Revision: D33296107

fbshipit-source-id: 5a27b3e1c9e2da71a0eee149f25d9d70ca83b443
2021-12-23 10:21:10 -08:00
Samuel Susla 52b7828cdc Enable modernize-use-default-member-init clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html

Reviewed By: rubennorte

Differential Revision: D33296545

fbshipit-source-id: e6813542b76e50db0a4b3ae9fdfafde2dbd8ac5b
2021-12-23 10:21:10 -08:00
Samuel Susla d8d4e95697 Enable modernize-use-nullptr clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html

Reviewed By: rubennorte

Differential Revision: D33296118

fbshipit-source-id: ba9de4611c0f0459db9cea56722385e2541b155e
2021-12-23 10:21:09 -08:00
Samuel Susla bf9872a7b5 Enable modernize-use-equals-default clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html

Reviewed By: rubennorte

Differential Revision: D33295116

fbshipit-source-id: d7da62c35e141fc2bf5a83c28f80f4f8d355c4cb
2021-12-23 10:21:09 -08:00
Samuel Susla 1251b2f993 Enable modernize-shrink-to-fix clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-shrink-to-fit.html

Reviewed By: rubennorte

Differential Revision: D33280814

fbshipit-source-id: f7b17e57b540cf4461dca1f3fa266b02f24ce455
2021-12-23 10:21:09 -08:00
Samuel Susla 9c5518f77e Enable modernize-use-emplace clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html

Reviewed By: rubennorte

Differential Revision: D33295156

fbshipit-source-id: 91a7bd34d689506ea9a68462b050c41fdb3faa4e
2021-12-23 10:21:09 -08:00
Samuel Susla 6c7581c6b3 Enable modernize-unary-static-assert clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-unary-static-assert.html#:~:text=The%20check%20diagnoses%20any%20static_assert,%2B%2B17%20and%20later%20code.

Reviewed By: rubennorte

Differential Revision: D33281759

fbshipit-source-id: 0399229947dce5f9297c4f65567b299dc0dca7ba
2021-12-23 10:21:09 -08:00
Samuel Susla b9cbd5a104 Enable modernize-replace-random-shuffle clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-replace-random-shuffle.html

Reviewed By: rubennorte

Differential Revision: D33279255

fbshipit-source-id: 0802cbafee448cfd5eed7f866a44ae3f3c5eb0fd
2021-12-23 10:21:09 -08:00
Samuel Susla 9419bebb98 Enable modernize-use-bool-literals clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html

Reviewed By: feedthejim

Differential Revision: D33295106

fbshipit-source-id: 34e68153a6796d5b9120166aeca6461ae0936e1e
2021-12-23 07:53:50 -08:00
Samuel Susla 474682dab7 Enable modernize-replace-auto-ptr clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-replace-auto-ptr.html

Reviewed By: fkgozali

Differential Revision: D33279163

fbshipit-source-id: b04c7fb4ff4caa0320c312ae187a7bcfe42cb3d3
2021-12-23 07:53:49 -08:00
Samuel Susla 028fb20e4b Enable modernize-raw-string-literal clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html

Reviewed By: fkgozali

Differential Revision: D33277859

fbshipit-source-id: 2a1c980f72fee36451cc84ee0255c2e90a8f810a
2021-12-23 07:53:49 -08:00
Samuel Susla 5fa6c5a941 Enable modernize-pass-by-value clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html

# Isn't it wasteful to copy? Isn't reference more efficient?

This rule of thumb is no longer true since C++11 with move semantics. Let's look at some examples.

# Option one

```
class TextHolder
{
public:
   TextBox(std::string const &text) : text_(text) {}
private:
   std::string text_;
};
```

By using reference here, we prevent the caller from using rvalue to and avoiding copy. Regardless of what the caller passes in, copy always happens.

# Option two

```
class TextHolder
{
public:
   TextBox(std::string const &text) : text_(text) {}
   TextBox(std::string &&text) : text_(std::move(text)) {}
private:
   std::string text_;
};
```
Here, we provide two constructors, one for const reference and one for rvalue reference. This gives the caller option to avoid copy. But now we have two constructors, which is not ideal.

# Option three (what we do in this diff)

```
class TextHolder
{
public:
   TextBox(std::string text) : text_(std::move(text)) {}
private:
   std::string text_;
};
```
Here, the caller has option to avoid copy and we only have single constructor.

Reviewed By: fkgozali, JoshuaGross

Differential Revision: D33276841

fbshipit-source-id: 619d5123d2e28937b22874650366629f24f20a63
2021-12-23 07:53:48 -08:00