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

23565 Коммитов

Автор SHA1 Сообщение Дата
Luna Wei 678f2cb936 Publish npm, re-order nightly build version
Summary: Changelog: [Internal] - Reorder nightly versioning to better support ordering

Reviewed By: hramos

Differential Revision: D31643453

fbshipit-source-id: 3f1b82085179b435d6920d9e5ae2350419154920
2021-10-14 12:02:34 -07:00
Marshall Roch b2e6483876 deploy v0.162.0 to xplat
Summary: Changelog: [Internal]

Reviewed By: vrama628

Differential Revision: D31640841

fbshipit-source-id: 783200913d06baca5b1d32d07b8ed5f4ecde7e1e
2021-10-14 09:50:04 -07:00
Pieter De Baets ad0d4534a7 Remove jsMessageQueueThread from Fabric binding
Summary:
This seems like a remnant of an old refactor. This is passed in, we wrap it with a JMessageQueueThread and then never use it again.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31506280

fbshipit-source-id: aca01439dcddbe2b44ce80342fa8664f827919c9
2021-10-14 05:29:02 -07:00
Andrei Shikov a2feaeb5f1 Refactor touch event dispatch
Summary:
Updates touch events in Fabric to be dispatched through the same pipeline as the rest of events, instead of relying on custom dispatch behavior.

Previous method of handling touches was reusing Paper behavior which required:
1. Transform event into a Paper-compatible form of WritableArray and dispatch it to `RCTEventEmitter.receiveTouches`.
2. Intercept `receiveTouches` for Fabric and redirect it to `FabricEventEmitter`
3. Perform transformations copied from Paper JS renderer in Java, transform it to the final form and dispatch this event as usual after.

The new behavior uses emitter's `receiveEvent` method directly to dispatch events. Additionally, it should decrease allocations done when transforming events during step 3 above, as `WritableNativeMap`-based operations performed many re-allocations when reading/re-creating arrays.

Changelog:
[Android][Changed] - Added an experimental touch dispatch path

Reviewed By: JoshuaGross

Differential Revision: D31280052

fbshipit-source-id: 829c2646ac6b0ebff0f0106159e76d84324ac732
2021-10-14 05:19:17 -07:00
Andrei Shikov 53fd0f4026 Retrieve touch dispatch information from event directly
Summary:
Simplifies logic of touch dispatch by retrieving surface id and other require info from the event directly.

Changelog: [Android][Internal] - Simplify logic of dispatching touches

Reviewed By: cortinico

Differential Revision: D31583314

fbshipit-source-id: c6b6e131a759c2ebe0cf4441c3aeb1a8b9f5781e
2021-10-14 05:19:17 -07:00
CodemodService FBSourceKtfmtLinterBot 689bfed9f1 Daily `arc lint --take KTFMT`
Reviewed By: zertosh

Differential Revision: D31647300

fbshipit-source-id: b0374baa40ff01d3ef6174d348e1c7793cb7bcaf
2021-10-14 04:47:38 -07:00
Desmond Ng 943f86272d Revert D31636434: Daily `arc lint --take KTFMT`
Differential Revision:
D31636434 (2bced60851)

Original commit changeset: 4632cdc1bfd3

fbshipit-source-id: 7810fcba547d091e5014d6a3f70af7779e9a2aa1
2021-10-13 20:37:57 -07:00
CodemodService FBSourceKtfmtLinterBot 2bced60851 Daily `arc lint --take KTFMT`
Reviewed By: zertosh

Differential Revision: D31636434

fbshipit-source-id: 4632cdc1bfd3eb398079fa3c7c3791783f30515f
2021-10-13 19:55:30 -07:00
Joel Arvidsson d1a33cd139 Fix Android border positioning regression (#32398)
Summary:
https://github.com/facebook/react-native/issues/29099 introduced a regression where non-rounded borders on Android would render partly outside of the bounds of the view as I reported in https://github.com/facebook/react-native/issues/32393. This PR addresses that by rendering the borders completely inside the view like it works on iOS, previous version of RN and for rounded corners.

## 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] [Fixed] - Fix Android border positioning regression

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

Test Plan:
Rendering the following code (as reported in the issue) in the RN Tester app:

```jsx
<View
  style={{
    aspectRatio: 1,
    backgroundColor: 'green',
    borderWidth: 8,
    borderColor: 'black',
    borderStyle: 'dashed',
  }}
/>
```

|Before|After|
|--|--|
|![before](https://user-images.githubusercontent.com/378279/137178113-dd2fea7e-48c8-450b-be3a-92706ef93194.png)|![after](https://user-images.githubusercontent.com/378279/137178140-b5ce7b3d-d455-48a9-a57f-0f3194a65c9a.png)|

Reviewed By: yungsters

Differential Revision: D31623647

Pulled By: lunaleaps

fbshipit-source-id: c38d172ae4a9dc48f800c63258223a59e2f621ed
2021-10-13 17:00:33 -07:00
Luna Wei 046a7d2286 Fix artifacts link
Summary: Changelog: [Internal] - Fix artifacts link in PR commitly comment

Reviewed By: hramos

Differential Revision: D31624488

fbshipit-source-id: cef7c79f1f8d290aa9541c3c955c9a68dc5fd643
2021-10-13 15:05:46 -07:00
Geraint White 91adb761cf Add hermesFlagsForVariant and deleteDebugFilesForVariant (#32281)
Summary:
Ref https://github.com/facebook/react-native/issues/25601#issuecomment-510856047.

From https://github.com/facebook/react-native/pull/31040.

The `hermesFlagsRelease` option only works with the release build type, but not with other build types.

This PR allows hermes flags on a per variant basis to be specified using the `hermesFlagsForVariant` lambda.

It also allows the hermes debugger cleanup to be run on a per variant basis using the `deleteDebugFilesForVariant` lambda.

## 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] [Fixed] - Fix hermesFlags not working with multiple variants

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

Test Plan:
Set the following options in `android/app/build.gradle` and ensure warnings are hidden when running `./gradlew assembleRelease` and `./gradlew assembleLive`.

```
    hermesFlagsForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('live') ? ['-w'] : []
    },
    deleteDebugFilesForVariant: {
        def v -> v.name.toLowerCase().contains('release') || v.name.toLowerCase().contains('live')
    },
```

Reviewed By: cortinico

Differential Revision: D31234241

Pulled By: ShikaSD

fbshipit-source-id: 2cb3dd63adbcd023061076b5a3b262a87b470518
2021-10-13 12:50:25 -07:00
Andrei Shikov 8ba4a2f127 Define event category in Event class
Summary:
Propagate event category definition to every event that is using `dispatchModernV2` (gated in production), providing opportunity to override categories of some events if needed. No events are meaningfully affected by this change, as coalesced events (e.g. scroll) are always dispatched as continuous and touch events are handled separately.

Changelog:
[Internal] Expose event category in Event class

Reviewed By: cortinico

Differential Revision: D31276249

fbshipit-source-id: f9a756b3a5cf5897e17209f3d0aed6a1c16cbd2e
2021-10-13 08:23:03 -07:00
svbutko 9ae3367431 Bump Kotlin and Gradle versions (#32319)
Summary:
Bump Kotlin version to 1.5.31 to include following changes:

https://kotlinlang.org/docs/whatsnew15.html
https://kotlinlang.org/docs/whatsnew1520.html
https://kotlinlang.org/docs/whatsnew1530.html

Primarily:
- Native support for Apple silicon
- Kotlin/JS IR backend reaches Beta
- Improved Gradle plugin experience
- Performance improvements

## 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] [Changed] - Bump Kotlin version to 1.5.31
[Android] [Changed] - Bump Gradle version to 7.2

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

Reviewed By: yungsters

Differential Revision: D31365479

Pulled By: cortinico

fbshipit-source-id: 1ffaef1222a6ada8ebc746267b2a22561c3c770f
2021-10-13 06:02:18 -07:00
Nicola Corti 2f8e52b52a Restrict mavenCentral to exclude react-native older packages
Summary:
This Diff is restricting the scope of `mavenCentral` to do not
include react-native packages. This will make us sure we don't pickup older
versions of react-native.
This specifically is a problem if you're building on a nightly as the version
of RN nightly is `0.0.0.xxx` which is lower than then version on maven central.
More on this here https://github.com/facebook/react-native/pull/32326#issuecomment-933368880

Changelog:
[Internal] [Changed] - Restrict mavenCentral to exclude react-native older packages

Reviewed By: ShikaSD

Differential Revision: D31571803

fbshipit-source-id: d7ce7e82825cbebda2e4e534565d7ab15dba2624
2021-10-13 05:34:40 -07:00
David Vacca 4790146374 Fix link in View.js
Summary:
https://reactnative.dev/docs/view.html doesn't work, this diff replaces the url for the new link

[Changelog]
[General][Fixed] - Updated documentation link in `View`.

Reviewed By: yungsters

Differential Revision: D31519836

fbshipit-source-id: c93feee4652caf4ef8390a047599149fc547db48
2021-10-12 18:27:47 -07:00
Xin Chen 55392f65a6 Fix issue with setting shadow node state data after scrolling programmatically
Summary:
This issue is found when investigating T101563978 with IOS platform. When animation is off, the x position measurement is off after `scrollToItem` is called.

The android fix is checked in at D31492685 (1a9e2d5d55). For IOS, the correct state data is updated only for animated cases, but not for instant scroll cases. This diff unified them.

Changelog
[IOS][Fixed] Fixed an edge case when scroll to item/index is called without animation, the offset position is not updated. This caused the measurement of the position to be wrong.

Reviewed By: sammy-SC

Differential Revision: D31564169

fbshipit-source-id: 89f47d8054afb03c2ace1d595163b160e5bb2036
2021-10-12 17:43:26 -07:00
Luna Wei 8581661e84 Support fbt for accessibilityValue
Summary: Changelog: [Internal] - Change accessibilityValue.text type to allow for Stringish type

Reviewed By: yungsters

Differential Revision: D31577860

fbshipit-source-id: af12505794037a68850a16ce139359e2f8a879e4
2021-10-12 17:39:47 -07:00
Lulu Wu 24ac66984c Add more logs
Summary:
Added more logs to understand what's the root cause for https://fburl.com/logview/kgknonri

```java.lang.IllegalStateException: Message queue threads already initialized
	at X.5y2.A0I(:64)
	at com.facebook.venice.ReactInstance.<init>(:112)
	at X.PrB.EgB(:33)
	at X.2pN.run(:4)
	at X.2pA.execute(:32)
	at X.2p6.A00(:30)
	at X.2p6.A08(:2)
	at X.PrC.EgB(:26)
	at X.Pr7.run(:4)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:919)
```

Changelog:
[Android][Changed] - Add some logs

Reviewed By: RSNara

Differential Revision: D31584264

fbshipit-source-id: 11b8bb2c6c9af2266688e3dae95e09f0160de79a
2021-10-12 14:18:42 -07:00
Andrei Shikov c75ad2cdb1 React Native sync for revisions e8feb11...afcb9cd
Summary:
This sync includes the following changes:
- **[579c008a7](https://github.com/facebook/react/commit/579c008a7 )**: [Fizz/Flight] pipeToNodeWritable(..., writable).startWriting() -> renderToPipeableStream(...).pipe(writable) ([#22450](https://github.com/facebook/react/pull/22450)) //<Sebastian Markbåge>//
- **[f2c381131](https://github.com/facebook/react/commit/f2c381131 )**: fix: useSyncExternalStoreExtra ([#22500](https://github.com/facebook/react/pull/22500)) //<Daishi Kato>//
- **[0ecbbe142](https://github.com/facebook/react/commit/0ecbbe142 )**: Sync hydrate discrete events in capture phase and dont replay discrete events ([#22448](https://github.com/facebook/react/pull/22448)) //<salazarm>//
- **[a724a3b57](https://github.com/facebook/react/commit/a724a3b57 )**: [RFC] Codemod invariant -> throw new Error ([#22435](https://github.com/facebook/react/pull/22435)) //<Andrew Clark>//
- **[201af81b0](https://github.com/facebook/react/commit/201af81b0 )**: Release pooled cache reference in complete/unwind ([#22464](https://github.com/facebook/react/pull/22464)) //<Joseph Savona>//
- **[033efe731](https://github.com/facebook/react/commit/033efe731 )**: Call get snapshot in useSyncExternalStore server shim ([#22453](https://github.com/facebook/react/pull/22453)) //<salazarm>//
- **[7843b142a](https://github.com/facebook/react/commit/7843b142a )**: [Fizz/Flight] Pass in Destination lazily to startFlowing instead of in createRequest ([#22449](https://github.com/facebook/react/pull/22449)) //<Sebastian Markbåge>//
- **[d9fb383d6](https://github.com/facebook/react/commit/d9fb383d6 )**: Extract queueing logic into shared functions ([#22452](https://github.com/facebook/react/pull/22452)) //<Andrew Clark>//
- **[9175f4d15](https://github.com/facebook/react/commit/9175f4d15 )**: Scheduling Profiler: Show Suspense resource .displayName ([#22451](https://github.com/facebook/react/pull/22451)) //<Brian Vaughn>//
- **[eba248c39](https://github.com/facebook/react/commit/eba248c39 )**: [Fizz/Flight] Remove reentrancy hack ([#22446](https://github.com/facebook/react/pull/22446)) //<Sebastian Markbåge>//
- **[66388150e](https://github.com/facebook/react/commit/66388150e )**: Remove usereducer eager bailout ([#22445](https://github.com/facebook/react/pull/22445)) //<Joseph Savona>//
- **[d3e086932](https://github.com/facebook/react/commit/d3e086932 )**: Make root.unmount() synchronous  ([#22444](https://github.com/facebook/react/pull/22444)) //<Andrew Clark>//
- **[2cc6d79c9](https://github.com/facebook/react/commit/2cc6d79c9 )**: Rename onReadyToStream to onCompleteShell ([#22443](https://github.com/facebook/react/pull/22443)) //<Sebastian Markbåge>//
- **[c88fb49d3](https://github.com/facebook/react/commit/c88fb49d3 )**: Improve DEV errors if string coercion throws (Temporal.*, Symbol, etc.) ([#22064](https://github.com/facebook/react/pull/22064)) //<Justin Grant>//
- **[05726d72c](https://github.com/facebook/react/commit/05726d72c )**: [Fix] Errors should not "unsuspend" a transition ([#22423](https://github.com/facebook/react/pull/22423)) //<Andrew Clark>//
- **[3746eaf98](https://github.com/facebook/react/commit/3746eaf98 )**: Packages/React/src/ReactLazy ---> changing -1 to unintialized ([#22421](https://github.com/facebook/react/pull/22421)) //<BIKI DAS>//
- **[04ccc01d9](https://github.com/facebook/react/commit/04ccc01d9 )**: Hydration errors should force a client render ([#22416](https://github.com/facebook/react/pull/22416)) //<Andrew Clark>//
- **[029fdcebb](https://github.com/facebook/react/commit/029fdcebb )**: root.hydrate -> root.isDehydrated ([#22420](https://github.com/facebook/react/pull/22420)) //<Andrew Clark>//
- **[af87f5a83](https://github.com/facebook/react/commit/af87f5a83 )**: Scheduling Profiler marks should include thrown Errors ([#22417](https://github.com/facebook/react/pull/22417)) //<Brian Vaughn>//
- **[d47339ea3](https://github.com/facebook/react/commit/d47339ea3 )**: [Fizz] Remove assignID mechanism ([#22410](https://github.com/facebook/react/pull/22410)) //<Sebastian Markbåge>//
- **[3a50d9557](https://github.com/facebook/react/commit/3a50d9557 )**: Never attach ping listeners in legacy Suspense ([#22407](https://github.com/facebook/react/pull/22407)) //<Andrew Clark>//
- **[82c8fa90b](https://github.com/facebook/react/commit/82c8fa90b )**: Add back useMutableSource temporarily ([#22396](https://github.com/facebook/react/pull/22396)) //<Andrew Clark>//
- **[5b57bc6e3](https://github.com/facebook/react/commit/5b57bc6e3 )**: [Draft] don't patch console during first render ([#22308](https://github.com/facebook/react/pull/22308)) //<Luna Ruan>//
- **[cf07c3df1](https://github.com/facebook/react/commit/cf07c3df1 )**: Delete all but one `build2` reference ([#22391](https://github.com/facebook/react/pull/22391)) //<Andrew Clark>//
- **[bb0d06935](https://github.com/facebook/react/commit/bb0d06935 )**: [build2 -> build] Local scripts //<Andrew Clark>//
- **[0c81d347b](https://github.com/facebook/react/commit/0c81d347b )**: Write artifacts to `build` instead of `build2` //<Andrew Clark>//
- **[4da03c9fb](https://github.com/facebook/react/commit/4da03c9fb )**: useSyncExternalStore React Native version ([#22367](https://github.com/facebook/react/pull/22367)) //<salazarm>//
- **[48d475c9e](https://github.com/facebook/react/commit/48d475c9e )**: correct typos ([#22294](https://github.com/facebook/react/pull/22294)) //<Bowen>//
- **[cb6c619c0](https://github.com/facebook/react/commit/cb6c619c0 )**: Remove Fiber fields that were used for hydrating useMutableSource ([#22368](https://github.com/facebook/react/pull/22368)) //<Sebastian Silbermann>//
- **[64e70f82e](https://github.com/facebook/react/commit/64e70f82e )**: [Fizz] add avoidThisFallback support ([#22318](https://github.com/facebook/react/pull/22318)) //<salazarm>//
- **[3ee7a004e](https://github.com/facebook/react/commit/3ee7a004e )**: devtools: Display actual ReactDOM API name in root type ([#22363](https://github.com/facebook/react/pull/22363)) //<Sebastian Silbermann>//
- **[79b8fc667](https://github.com/facebook/react/commit/79b8fc667 )**: Implement getServerSnapshot in userspace shim ([#22359](https://github.com/facebook/react/pull/22359)) //<Andrew Clark>//
- **[86b3e2461](https://github.com/facebook/react/commit/86b3e2461 )**: Implement useSyncExternalStore on server ([#22347](https://github.com/facebook/react/pull/22347)) //<Andrew Clark>//
- **[8209de269](https://github.com/facebook/react/commit/8209de269 )**: Delete useMutableSource implementation ([#22292](https://github.com/facebook/react/pull/22292)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions e8feb11...afcb9cd

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D31541359

fbshipit-source-id: c35941bc303fdf55cb061e9996200dc868a6f2af
2021-10-12 08:32:48 -07:00
Aditya Wasan 79db483568 Add `ACCESS_MEDIA_LOCATION` permission (#32282)
Summary:
This PR adds `ACCESS_MEDIA_LOCATION` permission to the PermissionsAndroid library. It fixes https://github.com/facebook/react-native/issues/31953.

It's a `dangerous` permission added in API level 29.

https://developer.android.com/reference/android/Manifest.permission#ACCESS_MEDIA_LOCATION

## 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 ACCESS_MEDIA_LOCATION permission to PermisionsAndroid library.

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

Test Plan:
```
PermissionsAndroid.ACCESS_MEDIA_LOCATION === 'android.permission.ACCESS_MEDIA_LOCATION'
```

Reviewed By: yungsters

Differential Revision: D31235523

Pulled By: cortinico

fbshipit-source-id: 45fa86b1cdf8bc76453e9df6198c1f7ed923db7c
2021-10-12 04:00:25 -07:00
Luna Wei d47c487f7e install_github_bot_deps for posting link
Summary: Changelog: [Internal] - Install dependencies for posting as bot

Reviewed By: hramos

Differential Revision: D31552246

fbshipit-source-id: 83e4953730cbd8dc5f3475ced20fb6556f97a4c6
2021-10-11 21:25:11 -07:00
Oleksandr Melnykov f788aab45b Back out "Make runtime initialization from React renderers a no-op"
Summary: Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D31552508

fbshipit-source-id: 1821f97393e3b9c40bd484a0831eb8fbdfc4bb82
2021-10-11 15:51:54 -07:00
Kræn Hansen 1ad45f5160 Update build.gradle (#32382)
Summary:
This is a proposal to adjust the in-code documentation to clarify the semantics of the `enableHermes` variable.

This fixes https://github.com/facebook/react-native-website/issues/2813.

## 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] [Fixed] - Clarified in-code documentation in the template's `android/app/build.gradle`.

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

Test Plan: This is just an update to documentation, no need for tests.

Reviewed By: yungsters

Differential Revision: D31550133

Pulled By: Huxpro

fbshipit-source-id: d60e5d256e1ffaf8556710b75582f1ae1c0f1fd3
2021-10-11 14:16:42 -07:00
Andrei Shikov e9440508e1 Correctly apply elevation barriers to Android views
Summary:
The elevation barriers that limited view reordering were applied incorrectly, disabling elevation completely for some combinations of views. This change ensures the order of barriers is correct and only disables elevation reorder between the children and not on them.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D31541961

fbshipit-source-id: 2fa4dc6906790053bd4445c841aeda0e2b3830e5
2021-10-11 11:55:06 -07:00
Héctor Ramos 232d02c5f6 Move Docker test to GitHub Actions
Summary:
The test_docker_android job on Circle CI has a simple function: verify the base community RN Android image can be downloaded, and verify that we can use it to build a container with a compiled Android test app.

Since the job is not strictly running a suite of tests, it can be moved to GitHub Actions. It will run on GitHub Actions as a Check on commits to main and pull requests.

As building the test image requires the use of the base React Native Android image, we can skip downloading the base container and go straight to building the test image.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D31521978

fbshipit-source-id: ca8372a1464054e37f2da28a3ecfbc8f84db0408
2021-10-09 11:37:53 -07:00
Xin Chen 1a9e2d5d55 Fix issue with scrollTo method in ScrollViews to set actual scroll position
Summary:
The `scrollTo` method in ScrollViews are using the `(x, y)` position they got from upperstream to scroll, and to set the state for Fabric. This diff fixes an edge case where the scroll result is not ended up to `(x, y)`. For example, if we are going to scroll to the last item in the list, the item may not scroll to the `(x, y)` position, but stay at the end position of the view.

- Change `scrollTo` method to use the actual `scrollX` and `scrollY` position after scrolling to set current state.

Changelog:
[Android][Fixed] - scrollTo API in ScrollView will check the actual scroll position before setting the scroll state

Reviewed By: JoshuaGross

Differential Revision: D31492685

fbshipit-source-id: e5513fb735ea68c5014b5c47fadffe461cad5c94
2021-10-08 18:57:34 -07:00
Luna Wei 2a605c30e4 Comment on PR with link to PR artifact
Summary: Changelog: [Internal] Configure circleCI to comment on PR after building tarball

Reviewed By: hramos

Differential Revision: D31387660

fbshipit-source-id: 28902148cf5e2ea15320333b90a6a7fa9d553c3b
2021-10-08 17:55:00 -07:00
Neil Dhar aae93553d0 Remove libstdc++ dependency (#32247)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32247

I don't think we need both libc++ and libstdc++.

allow-large-files

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30950943

fbshipit-source-id: d0669815ff59c3e9ac45954a4a11930d1bc3959f
2021-10-08 14:16:54 -07:00
Samuel Susla c99a0212a0 Fix failing assert in EventTarget
Summary:
changelog: [internal]

calling `setEnabled(true)` needs to have a matching `setEnabled(false)` in order for `eventTarget_` to be deallocated correctly.

Also, retaining `eventTarget_` longer, does not mean instanceHandle will be available later on.

Reviewed By: p-sun

Differential Revision: D31503119

fbshipit-source-id: 324e16fe0f6ad937ab2c38be9a536bdf14851172
2021-10-08 13:44:37 -07:00
Lulu Wu c901c43d11 Remove shared responsibility between LogBox and ExceptionsManager native module
Summary:
## Context
Right now we are using both LogBox and ExceptionsManager native module to report JS errors in ExceptionsManager.js, from below code we can tell they have some overlapping - when ```__DEV__ === true``` both could report the error.

https://www.internalfb.com/code/fbsource/[5fb44bc926de87e62e6e538082496f22017698eb]/xplat/js/react-native-github/Libraries/Core/ExceptionsManager.js?lines=109-141

## Changes
In this diff overlapping is removed: in ```ExceptionsManager.js``` LogBox will be responsible for showing the error with dialog when ```__DEV__ === true```, when it's prod we'll use ExceptionsManager native module to report the error. As a result LogBox and ExceptionsManager native module don't share responsibilities any more.

Changelog:
[General][Changed] - Remove shared responsibility between LogBox and ExceptionsManager native module

Reviewed By: philIip

Differential Revision: D30942433

fbshipit-source-id: 8fceaaa431e5a460c0ccd151fe9831dcccbcf237
2021-10-08 11:08:43 -07:00
Rubén Norte b14b34b232 Make runtime initialization from React renderers a no-op
Summary:
This module is imported by all flavors of the React Native renderers (dev/prod, Fabric/Paper, etc.), which itself imports `InitializeCore`. This is effectively a no-op in most React Native apps because Metro adds it as a module to execute before the entrypoint of the bundle.

This import would be harmless if all React Native apps included all polyfills and globals, but some of them don't want to include everything and instead of importing `InitializeCore` they import individual setup functions (like `setupXhr`). Having this automatic import in the renderer defeats that purpose (most importantly for app size), so we should remove it.

The main motivation for this change is to increase the number (and spec-compliance) of Web APIs that are supported out of the box without adding that cost to apps that choose not to use some of them (see https://github.com/facebook/react-native/pull/30188#issuecomment-929352747).

Changelog: [General][Removed] Breaking: Removed initialization of React Native polyfills and global variables from React renderers.

Note: this will only be a breaking change for apps not using the React Native CLI, Expo nor have a Metro configuration that executes `InitializeCore` automatically before the bundle EntryPoint.

Reviewed By: yungsters

Differential Revision: D31472153

fbshipit-source-id: 92eb113c83f77dbe414869fbce152a22f3617dcb
2021-10-08 07:39:11 -07:00
Rubén Norte a101fc768c Remove unnecessary global variable named GLOBAL
Summary:
We are defining an alias for the global variable in React Native called `GLOBAL`, which is not used at all at Facebook and it doesn't seem it's used externally either. This alias is not standard nor common in the JS ecosystem, so we can just remove it to reduce the pollution of the global scope.

Changelog: [General][Removed] - Removed unnecessary global variable `GLOBAL`.

Reviewed By: yungsters

Differential Revision: D31472154

fbshipit-source-id: 127c3264848b638f85fb2e39e17ed2006372d2dd
2021-10-08 07:39:11 -07:00
AntoineDoubovetzky ec614c16b3 Update Modal's mock to not render its children when it is not visible (#32346)
Summary:
The Modal's mock always render its children (whether it is visible or not), whereas in reality the Modal renders `null` when the Modal is not visible.
This causes troubles when trying to test whether the Modal is visible or not. Instead of testing if the children are rendered (using getByText from React Native Testing Library for instance), we are forced to test the value of the visible prop directly (see https://github.com/callstack/react-native-testing-library/issues/508 and https://github.com/callstack/react-native-testing-library/issues/659).
This is not ideal because we are forced to test implementation detail and can't test from the user perspective. I also believe the mock should be closest as possible from reality.

I had 2 options:
  1. Rendering the Modal without its children
  2. Not rendering the Modal at all

The latter has the advantage of being closer to the reality, but I chose the former to still be able to test the Modal through the visible prop, so there is no breaking change (only snapshots update will be required).

## Changelog

[General] [Changed] - Update Modal's mock to not render its children when it is not visible

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

Test Plan:
I added a test case when visible is false, then updated the mock so the children are not rendered. The before / after is here:
![image](https://user-images.githubusercontent.com/17070498/136256142-a351d002-8b77-490a-ba65-1e8ad0d6eb55.png)

Reviewed By: yungsters

Differential Revision: D31445964

Pulled By: lunaleaps

fbshipit-source-id: 08501921455728cde6befd0103016c95074cc1df
2021-10-07 22:44:19 -07:00
Samuel Susla 27304fcd0b Add error handling to RuntimeScheduler
Summary:
changelog: [internal]

Catch JavaScript errors and forward them to `ErrorUtils` in *RuntimeScheduler*. This makes sure that JS errors are handled by ErrorUtils and do not bubble up to bridge.

Reviewed By: philIip

Differential Revision: D31429001

fbshipit-source-id: 50f865872e4cd3ba180056099ff40f5962ee7a77
2021-10-07 15:23:11 -07:00
Wes Johnson e612d3a116 fix(logging): avoid logging sensitive param values (#31522)
Summary:
We noticed that by default when the RootView / ReactView calls runApplication, we're logging at an info level any props ("params") passed to that component. In our case, one of these props was sensitive in nature, causing the value to leak out in logs for our release builds. This is especially problematic on Android where device logs can be accessed by any app which requests that permission.

This is probably more of a concern for brownfield react-native apps, but it seems worthwhile locking this down in non-dev builds.

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

[General] [Security] - Avoiding logging root view params outside of dev / debug mode builds

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

Test Plan: * build app in release mode on Android and verified I could not see: `Running "my app" with { sensitive: 'thing' }` in logcat in Android Studio with a tethered device

Reviewed By: yungsters

Differential Revision: D31064902

Pulled By: charlesbdudley

fbshipit-source-id: 8b10a46d92a9ec44243dd74384299087260c7d83
2021-10-07 12:06:43 -07:00
Gijs Weterings 7bbf549ae5 fix viewconfig for AndroidHorizontalScrollViewNativeComponent
Summary: Changelog:  [Android][Fix] Fix viewconfig for AndroidHorizontalScrollViewNativeComponent by adding snapToAlignment

Reviewed By: mdvacca

Differential Revision: D31476885

fbshipit-source-id: 89a4e16bd3d2cac0cc3c70c8a948deadababd488
2021-10-07 11:21:56 -07:00
Xiankun Cheng 22801870f0 Fix: multiline textinput start "jerking" when trying to move cursor. (#32179)
Summary:
Fixes https://github.com/facebook/react-native/issues/30748: on iOS 14, when trying to hold down the space bar and move the cursor on a multi-line TextInput with lots of lines, the cursor could not be scrolled to the desired point. It works as expected on iOS 13 and before.

Figured out that iOS14 acting as expected without `[setContentOffset:animated:]`, so exclude it when iOS version is and above 14.

Credit to efstathiosntonas for the finding and solution provides.

## Related issue
- https://github.com/facebook/react-native/issues/30748

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fixed the issue when moving cursor in multi-line TextInput.

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

Test Plan:
1. Launch RNTester app on iOS
2. Open `TextInput` in tab `Components`
3. Scroll to `Multiline` section and focus on the first child
4. Input lots of dummy texts
5. Hold the space bar (on device) or press down the mouse inside `TextInput` (simulator without showing keyboard)

### **Video Before:**
https://user-images.githubusercontent.com/6382178/132800651-fb7cd2ac-fbd1-4ec4-9e3b-c06ab5b6a114.MP4

### **Video After:**
https://user-images.githubusercontent.com/6382178/132800677-f349fe7f-5902-40ff-8b93-ecc96ce29166.MP4

Reviewed By: philIip

Differential Revision: D31404248

Pulled By: lunaleaps

fbshipit-source-id: 74a39106e628602c5177fc243783288fcb7782fa
2021-10-06 12:43:36 -07:00
Juan Tejada 356236471a Update React DevTools from 4.13.0 -> 4.19.1
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Sonar, etc.

`js1 upgrade react-devtools -v 4.19.1`

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.19.1

Reviewed By: bvaughn

Differential Revision: D31345135

fbshipit-source-id: dae06a18699df19a6e8422460effd48f715e395b
2021-10-06 08:35:59 -07:00
Manoj Kumar 72ef5e280f Update gradle.properties example (#32314)
Summary:
Fixed incorrect default mentioned in the comment

Changelog:
[Internal] Update gradle.properties example

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

Reviewed By: yungsters

Differential Revision: D31365465

Pulled By: cortinico

fbshipit-source-id: 82383c9c50495575698e27350cbf181f6effa0ee
2021-10-06 04:09:08 -07:00
Pieter De Baets cd4bef97d0 Add toString to all MountItem subclasses
Summary:
Useful when Fabric debug logging is enabled

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D31399518

fbshipit-source-id: b5907084604adf1f7093798315147ac63b5876f2
2021-10-06 04:05:00 -07:00
Brent Kelly 25a2c608f7 Addressing various issues with the Appearance API (#28823) (#29106)
Summary:
This PR fixes a few issues with the Appearance API (as noted here https://github.com/facebook/react-native/issues/28823).

1. For the Appearance API to work correctly on Android you need to call `AppearanceModule.onConfigurationChanged` when the current Activity goes through a configuration change. This was being called in the RNTester app but not in `ReactActivity` so it meant the Appearance API wouldn't work for Android in newly generated RN projects (or ones upgraded to the latest version of RN).

2. The Appearance API wasn't working correctly for brownfield scenarios on Android. It's possible to force an app light or dark natively on Android by calling `AppCompatDelegate.setDefaultNightMode()`. The Appearance API wasn't picking up changes from this function because it was using the Application context instead of the current Activity context.

3. The Appearance API wasn't working correctly for brownfield scenarios on iOS. Just like on Android its possible to force an app light or dark natively by setting `window.overrideUserInterfaceStyle`. The Appearance API didn't work with this override because we were overwriting `_currentColorScheme` back to default as soon as we set it.

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

### Fixed

https://github.com/facebook/react-native/issues/28823

* [Android] [Fixed] - Appearance API now works on Android
* [Android] [Fixed] - Appearance API now works correctly when calling `AppCompatDelegate.setDefaultNightMode()`
* [iOS] [Fixed] - Appearance API now works correctly when setting `window.overrideUserInterfaceStyle`

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

Test Plan: Ran RNTester on iOS and Android and verified the Appearance examples still worked [correctly.](url)

Reviewed By: hramos

Differential Revision: D31284331

Pulled By: sota000

fbshipit-source-id: 45bbe33983e506eb177d596d33ddf15f846708fd
2021-10-05 20:23:48 -07:00
Luna Wei 52809688d2 Remove ProgressBar from examples and fix XHRDownloadExample
Summary:
Changelog: [Internal] - Remove usage of ProgressViewIOS and ProgressBarAndroid from RNTester

Note: Android example doesn't properly update progress. Filing an issue here: TODO

Reviewed By: yungsters

Differential Revision: D31328094

fbshipit-source-id: 5afa3bb1079b91bb98fa51587e96402fb1565f82
2021-10-05 17:24:45 -07:00
Frieder Bluemle 046b02628d Move mavenCentral repo below local paths (#32326)
Summary:
In https://github.com/facebook/react-native/issues/31609, the deprecated `jcenter()` was replaced with `mavenCentral()`. In the template build.gradle, it _also changed the order of repos_. I am not sure if this was done intentionally or not (dulmandakh please confirm). Instead of appearing right _after_ `google()`, `mavenCentral()` was put **first** in the list, even before the local repos (that, for example, contain the `react-native` artifacts fetched by npm). Now, under normal circumstance, this _might_ not cause issues because of latency, but there is chance that Gradle could resolve incorrect versions (or at least look in the wrong repo first). The last version of `react-native` published to the public repo was [`0.20.1`](https://mvnrepository.com/artifact/com.facebook.react/react-native/0.20.1), uploaded in February 2016!

This PR changes the order of `mavenCentral()` so that is consistent with both the repo's current [root level build.gradle](https://github.com/facebook/react-native/blob/main/build.gradle.kts#L34), as well as other default Android templates. Putting the local repos first will ensure they have the highest priority when looking for artifacts. `react-native` should _always_ come from the locally downloaded `node_modules/` folder, not from a remote repo.

## Changelog

[Android] [Changed] - Move mavenCentral repo below local paths

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

Test Plan: Create new app from template, ensure local repos appear before remote repos; `react-native` resolves to correct version.

Reviewed By: yungsters

Differential Revision: D31375678

Pulled By: cortinico

fbshipit-source-id: e47737262b4eebb06e22a955cacd6114059bb2f4
2021-10-05 12:55:47 -07:00
Rob Hogan 7923804c28 Use newer metro language: `blacklistRE` -> `blockList` (#30342)
Summary:
An [update to `metro`](94c0b541b4 (diff-1a3c1a959bb8c4e2e9743c03cb7a6d0c56648ffcfe129a11b9090bfc139622dd)) which landed in metro 0.60 (RN 0.64+) deprecates the config `blacklistRE`, renaming it to `blockList`. Although the former is still supported it now generates a deprecation warning.

## Changelog

[General] [Fixed] - Update metro config language to `blockList`

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

Test Plan: Confirm that the config is still respected (`/buck-out/` should be excluded), and that no deprecation warning is issued.

Reviewed By: lunaleaps

Differential Revision: D31380163

Pulled By: motiz88

fbshipit-source-id: f64cff30690f0252fafd4eac254a8c2278c4ac2f
2021-10-05 02:26:26 -07:00
Xin Chen 93beb83abe Allow overflow scroll to clip the view instead of let it be visible
Summary:
When the overflow style set to 'scroll', React ViewGroup does nothing to the container. Instead it should be clipped just like hidden.

Changelog:
[Android][Changed] - Setting `overflow: scroll` in View component style will clip the children in the View container

Reviewed By: javache

Differential Revision: D31350605

fbshipit-source-id: e0d618f5e872fec9cf9ecb2d4cfe7af9a2f3c063
2021-10-04 17:52:38 -07:00
Samuel Susla 36f3bf2f58 Add option to use raw pointer instead of shared_ptr in EventEmitterWrapper
Summary:
changelog: [internal]

Retaining `EventEmitter` beyond runtime triggers a crash. Let's try to use raw pointer in `EventEmitterWrapper` to see if it fixes some crashes.

Reviewed By: philIip

Differential Revision: D31307332

fbshipit-source-id: cd059b6c56f8dffe985b3ecb62cdafe823ba1462
2021-10-02 09:03:58 -07:00
CodemodService FBSourceClangFormatLinterBot 2372e7a008 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D31362458

fbshipit-source-id: e26b6b5e1c99dd6adbd661240d6979160633c10b
2021-10-02 08:33:02 -07:00
Gustavo Sverzut Barbieri 57aa70c06c Introduce Gemfile, ruby-version (#32303)
Summary:
Implement par of the discussion https://github.com/react-native-community/discussions-and-proposals/discussions/411, except the `.nvmrc` part, this includes:
 - Setting `.ruby-version` in the main project and also `template/`
 - Fixing the CocoaPods version with a project-level `Gemfile` and also `template/Gemfile`
 - Using all `pod` executions from `bundle exec pod`, using the determined version
 - Script to manage and update the ruby version

## Changelog

[iOS] [Added] - Gemfile with CocoaPods 1.11 and ruby-version (2.7.4)

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

Test Plan: Build for iOS and run all CircleCI tests to see if nothing changed

Reviewed By: RSNara

Differential Revision: D31344686

Pulled By: fkgozali

fbshipit-source-id: 25c63131ca9b16d3cf6341019548e0d63bdcaefe
2021-10-01 21:22:26 -07:00
Phillip Pan d8931e2f94 provide public hook to programatically turn on voiceover
Summary:
Changelog: [Internal]

https://fb.workplace.com/groups/rn.support/posts/6677051292343429

ax team is building a tool to extract information about the views for design reviewers, and RN has some AX information that is not working atm because of dependency on whether voiceover is on or not. so, this will give them the ability to programmatically set that field and hopefully be able to get accurate ax info

Reviewed By: ikenwoo

Differential Revision: D31010566

fbshipit-source-id: 4c8a33fce40266b270dd5994442c8472ca88f5dd
2021-10-01 21:17:07 -07:00
Samuel Susla ea53d3a9c2 Pass reference instead of shared_ptr to getInspectorDataForInstance
Summary:
changelog: [internal]

This is a pre-condition to get rid of `shared_ptr` from `EventEmitterWrapper`. Also saves us a few copies of shared_ptr, this is negligible though.

Reviewed By: mdvacca

Differential Revision: D31307048

fbshipit-source-id: b84654bed2359b66faf3995795e135e88fe51cb6
2021-10-01 17:47:20 -07:00