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

22842 Коммитов

Автор SHA1 Сообщение Дата
Luna Wei 52b51f0886 Update CONTRIBUTING.md (#31590)
Summary:
Add more detail about requesting review in the contribution guide.
In the GAAD initiative it's particularly useful to know when certain PRs need our attention so wanted to highlight the code review process to remind contributors to request reviewers.

## Changelog

[General] [Added] - Added more detail about the review process

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

Test Plan: Grammar, clarity review

Reviewed By: TheSavior

Differential Revision: D28719869

Pulled By: lunaleaps

fbshipit-source-id: 9213fefbe602588f9e5cee7ba240b93bc7f291b5
2021-05-26 13:41:44 -07:00
Evgen Filatov 34b8d07bfb Back out "iOS: 6/7 JS only. Remove logic for visible prop in JS, and pass it to native"
Summary:
Changelog: [Internal]

back out D28138741 (40706e0546)

Differential Revision: D28709374

fbshipit-source-id: c7085588ab4573c0ca18a2324f8e1ed40384753c
2021-05-26 10:35:10 -07:00
Samuel Susla 0ee8e292a4 Fix for ScrollView race condition between C++ state update and onScroll
Summary:
Changelog: [internal]

There is a possibility of race between updating scrollview's state and virtualised list asking for layout of individual cells.
To make sure the race doesn't happen, state must be updated before dispatching onScroll event.

Android has implemented a different mechanism to tackle this issue in D28558380 (b161241db2).

Reviewed By: JoshuaGross

Differential Revision: D28642737

fbshipit-source-id: 33874beac69fc5a66eeb7f459fd89cd0b00dafcf
2021-05-26 03:32:03 -07:00
Andrew Coates 6b91ae73cd localeIdentifier missing from flow type of I18nManager (#31589)
Summary:
23d9bf1a24 looks like it accidently removed `localeIdentifier` from I18nManager.

## 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] [Fixed] - Re-added localeIdentifier to I18nManager constants

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

Reviewed By: GijsWeterings

Differential Revision: D28690202

Pulled By: fkgozali

fbshipit-source-id: 543a491f89789bca5629e1251c94fd055ec4a801
2021-05-26 00:04:19 -07:00
Samuel Susla 925af8ddea Add collapsable to RCTViewManager as property
Summary:
Changelog: [internal]

collapsable was not passed to Fabric because view configs are built using Paper' ViewManagers.

Reviewed By: p-sun

Differential Revision: D27944688

fbshipit-source-id: 73a5646e25b3dd7a1a9dfc1079406047ab483d88
2021-05-25 12:52:34 -07:00
David Vacca 4efd603b26 Update customDirectEvent types for ReactVitoImageManager
Summary:
This diff updates the customDirectEvent types for ReactVitoImageManager

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D28682669

fbshipit-source-id: 3341a7d6dbd5ec90f274f0770c6e883bd82f0a2d
2021-05-25 11:31:47 -07:00
Rick Hanlon f684d99a50 React Native sync for revisions 459c34f...1e4c353
Summary:
This sync includes the following changes:
- **[2d8d133e1](https://github.com/facebook/react/commit/2d8d133e1 )**: Turn on enableSyncDefaultUpdates everywhere ([#21548](https://github.com/facebook/react/pull/21548)) //<Ricky>//

Changelog:
[General][Changed] - React Native sync for revisions 459c34f...2d8d133

jest_e2e[run_all_tests]

Reviewed By: gaearon

Differential Revision: D28654355

fbshipit-source-id: c245f272e7f8d4215539fa90602b76cad67632fe
2021-05-25 10:24:00 -07:00
Paige Sun 2c4eba7b9c iOS: 7/7 Test Modal onDismiss with Jest
Summary:
Changelog: [Internal]

Add onDismiss tests for Modal

Reviewed By: fkgozali, sammy-SC, nadiia

Differential Revision: D28074384

fbshipit-source-id: 464c63cc9fe2d3e1709687369eea8cefd78d8356
2021-05-25 10:07:10 -07:00
Paige Sun 40706e0546 iOS: 6/7 JS only. Remove logic for visible prop in JS, and pass it to native
Summary: Changelog: [Fabric][iOS] Use non-global event emitter for onDismiss event for <Modal>

Reviewed By: fkgozali

Differential Revision: D28138741

fbshipit-source-id: df9069e523f2e8bd1b85f3d9be55cfd300f89d66
2021-05-25 10:07:10 -07:00
Samuel Susla fa899cb51f Use getter instead of directly accessing ivar
Summary:
Changelog: [internal]

Use getter function instead of accessing ivar. This makes for clearer APIs.

React part is implemented in https://github.com/facebook/react/pull/21553

Reviewed By: JoshuaGross

Differential Revision: D28675372

fbshipit-source-id: cf99f8482067bfc0fd57d39fda9656abd665bb69
2021-05-25 09:56:32 -07:00
Eric Rozell 917f83c940 Use transform prop in PanResponderExample
Summary:
Replaces deprecated `translateX` and `translateY` props with `transform` prop in PanResponderExample. This fixes the RNTester example for react-native-windows, which doesn't support the deprecated props.

Changelog:
[General][Fixed] - [RNTester] Use transform prop in PanResponderExample

Reviewed By: kacieb

Differential Revision: D28676164

fbshipit-source-id: 437912b5abf6ca74f0043ded7a902a5938bcf93a
2021-05-25 09:10:53 -07:00
Samuel Susla 3a9e14e8a9 Add synchronous access to the runtime to RuntimeScheduler
Summary:
Changelog: [internal]

Introduces synchronous access to the runtime from RuntimeScheduler.
At the moment, this is not used anywhere.

In case RuntimeScheduler isn't defined (controlled by MC), falls back to RuntimeExecutor.

Reviewed By: mdvacca

Differential Revision: D28024380

fbshipit-source-id: 90be36dd390202540ed51940a4396040f043cd90
2021-05-25 07:42:06 -07:00
Samuel Susla 2016460528 Pass event priority to React
Summary:
Changelog: [internal]

This is a mechanism that will guess event's React priority based on other events ongoing on the platform.

If an event happens within span of ContinuousStart -> ContinuousEnd and its category is unspecified, we deduce it's React priority to be default. All other events are discrete.

Special case: `onScroll`, which is always treated as "Default".

Reviewed By: JoshuaGross

Differential Revision: D28485060

fbshipit-source-id: d2eae63dbcf03271dfed97128a1590dd165a3ce2
2021-05-25 01:16:04 -07:00
Samuel Susla 1866566d52 Introduce a way to specify React priority for events
Summary:
Changelog: [internal]

Introduce a way to specify React priority for events.
These APIs will be called from React here: 0e100ed00f/packages/react-native-renderer/src/ReactFabricHostConfig.js (L345)

React does similar thing on the web: 8ea11306ad/packages/react-dom/src/client/ReactDOMHostConfig.js (L378)

Take a look at D28483983 that shows how React will be calling these APIs.

Reviewed By: JoshuaGross

Differential Revision: D28481260

fbshipit-source-id: c965a8aa0ba5192246c216046d49bcb046152a5a
2021-05-25 01:16:04 -07:00
Samuel Susla 285406103d Introduce EventQueueProcessor
Summary:
Changelog: [internal]

Pulling out event queue processing to its separate class. We will be adding more logic there so it makes sense to separate it for simplicity and testability purposes.

Alternative names that came to mind: `EventsProcessor`, `EventsDispatcher`.

Reviewed By: JoshuaGross

Differential Revision: D28572283

fbshipit-source-id: 1cb2459f616b9995f66da80d50c401e68002da7f
2021-05-25 01:16:04 -07:00
Joshua Gross 5a9b6fc49b Simplify LockFreeEventDispatcherImpl further
Summary:
TL;DR: simplify and delete a bunch of stuff that shouldn't be necessary in Fabric.

I discovered that this event dispatcher (and the older one this is based on) is triple-queueing: we queue events into "staging", and then post "dispatch events" to only run /on the JS thread/. Even in Fabric. Then, each of these events is emitted into C++ where they are queued /again/! This refactor eliminates one more level of queueing - instead of scheduling dispatch for the JS thread, we just emit them directly to C++ when they're received in Java.

Unfortunately, the EventDispatcher is also used to drive AsyncEventBeat in C++:

1. EventBeatManager.onBatchEventDispatched: https://fburl.com/diffusion/qf6dyhsw
   In the C++ impl, it indirectly will drive the AsyncEventBeat/AsyncEventBeatV2.
2. onBatchEventDispatched is ONLY called from EventDispatcherImpl: https://fburl.com/codesearch/mxk8ifyj
3. Which is queued and only runs on the JS thread: https://fburl.com/codesearch/czvbst4u

This means the AsyncEventBeat is only ticked when the JS thread is free, and ticks will be skipped when the JS thread is occupied for long periods.

Now, in this refactor, when this class is used it will drive AsyncEventBeat on every UI tick. This is also potentially not correct. On iOS (Fabric), AsyncEventBeat is driven when the UI thread is "about to sleep".

For now I'm not going to worry about that detail - it is significant, but Fabric+Android is currently /not doing the right thing/ and it's not clear that we want to maintain iOS behavior. This is something we need to discuss further and figure out.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28654033

fbshipit-source-id: b3cb9b706343c8dd3c4cf84f24388908c57e2138
2021-05-24 20:14:46 -07:00
Rick Hanlon d2a6d88790 React Native sync for revisions 3169430...459c34f
Summary:
This sync includes the following changes:
- **[459c34fde](https://github.com/facebook/react/commit/459c34fde )**: Add flag concurrent root ([#21552](https://github.com/facebook/react/pull/21552)) //<Samuel Susla>//

Changelog:
[General][Changed] - React Native sync for revisions 3169430...459c34f

jest_e2e[run_all_tests]

Reviewed By: mdvacca

Differential Revision: D28641463

fbshipit-source-id: 0930a8f82e49b222582995e4c8b2c8a41564bf53
2021-05-24 17:58:40 -07:00
Rick Hanlon 1c5d0dc605 React Native sync for revisions b8fda6c...ebcec3c
Summary:
This sync includes the following changes:
- **[316943091](https://github.com/facebook/react/commit/316943091 )**: Make StrictMode double rendering flag static for FB/www ([#21517](https://github.com/facebook/react/pull/21517)) //<Brian Vaughn>//
- **[e0f89aa05](https://github.com/facebook/react/commit/e0f89aa05 )**: Clean up Scheduler forks ([#20915](https://github.com/facebook/react/pull/20915)) //<Ricky>//
- **[5890e0e69](https://github.com/facebook/react/commit/5890e0e69 )**: Remove data-reactroot from server rendering and hydration heuristic ([#20996](https://github.com/facebook/react/pull/20996)) //<Sebastian Markbåge>//
- **[46491dce9](https://github.com/facebook/react/commit/46491dce9 )**: [Bugfix] Prevent already-committed setState callback from firing again during a rebase ([#21498](https://github.com/facebook/react/pull/21498)) //<Andrew Clark>//
- **[b770f7500](https://github.com/facebook/react/commit/b770f7500 )**: lint-build: Infer format from artifact filename ([#21489](https://github.com/facebook/react/pull/21489)) //<Andrew Clark>//
- **[2bf4805e4](https://github.com/facebook/react/commit/2bf4805e4 )**: Update entry point exports ([#21488](https://github.com/facebook/react/pull/21488)) //<Brian Vaughn>//

Changelog:
[General][Changed] - React Native sync for revisions b8fda6c...ebcec3c

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D28572047

fbshipit-source-id: eb09c0358edb7fbf241333ea9c08724748906fea
2021-05-24 17:58:40 -07:00
Kudo Chien 341f061ce3 Upgrade jsc-android to 250230.2.1 (#31304)
Summary:
Upgrade jsc-android to latest stable version. Hopefully this should finally fix https://github.com/facebook/react-native/issues/25494.
Before Hermes totally replaced JSC, it should be worth to have this and make JSC stable

## Changelog

[Android] [Changed] - Upgrade jsc-android to 250230.2.1

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

Test Plan: Launch app with new jsc-android and see everything works fine.

Reviewed By: TheSavior

Differential Revision: D28630503

Pulled By: yungsters

fbshipit-source-id: 84510f91c81d4aaefe265d5492677ad6ff10e0fe
2021-05-24 15:06:07 -07:00
Andrei Shikov fed6ad5bad Pass correct action name in the props callback
Summary:
JS side expects the property name to be "actionName", and this change updates it to that.

Changelog:
[iOS][Fixed] - Use actionName in accessibility event callback

Reviewed By: JoshuaGross

Differential Revision: D28645999

fbshipit-source-id: 0e7a6c3e6c1b6c998f4b53fd89c744c84083dfb1
2021-05-24 14:25:55 -07:00
Joshua Gross 900fed576b Events: Remove default `getCoalescingKey` impls
Summary:
Event.java's default implementation of `getCoalescingKey` returns 0. Most overrides of getCoalescingKey just return 0. Delete them.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28650792

fbshipit-source-id: 374591fb4ba2305df934de412790b3397ca2fa1c
2021-05-24 13:41:19 -07:00
Andrei Shikov faaeb778df Parse accessibilityAction props into object
Summary:
Android was using rawProps received from JS, so no updates needed.
Updated iOS callsite to use the name of the action.

Changelog:
[General][Fixed] - Parse accessibilityAction props into object instead of string

Reviewed By: mdvacca

Differential Revision: D28614407

fbshipit-source-id: 209134f8fac65ca8516039e10ea502e57d52a7a7
2021-05-24 10:27:27 -07:00
CodemodService FBSourceClangFormatLinterBot dd9655503b Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D28634989

fbshipit-source-id: 9e6397bfc0c4059877643bea7dcda6c42a4f4133
2021-05-24 04:11:25 -07:00
Andrew Coates 7aeac4236f Move isColorMeaningful to platform specific code (#31557)
Summary:
`isColorMeaningful` is the only place in xplat code that currently uses `colorComponentsFromColor`, which assumes that a color is an RGBA value.  When implementing `PlatformColor` for windows, where colors might be complex patterns or effects, I'd like to keep the details of `SharedColor` isolated within `SharedColor`.  This change moves `isColorMeaningful` into `color.cpp`, where each platform can provide an implementation that takes into account its platform specific color capabilities.

See https://github.com/microsoft/react-native-windows/pull/7801 for an example of window's SharedColor which can be either an RGBA value, or a name of a native color/brush.

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

[Internal] [Changed] - Move isColorMeaningful to platform specific code

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

Test Plan: This shouldn't change any of the code, its just moving the existing function - normal CI/automation should be plenty of validation.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D28557698

Pulled By: mdvacca

fbshipit-source-id: 2a94850fe9c5037598107e1307f4153cee6491fb
2021-05-22 23:24:14 -07:00
Samuel Susla ffa533a19d Add option to use unbatched queues only
Summary:
Changelog: [internal]

My suggestion is to simplify event dispatching to only two options, synchronous and asynchronous.

Why?
- Fabric has only been using one queue, `AsynchronousBatched`.
- Batching happens even on `AsynchronousUnbatched`. It just batches events until JS thread starts processing them instead of waiting for the main run loop.
- It will make it easier to reason about the code in the future once we start utilising different priorities for Concurrent Mode.

Reviewed By: JoshuaGross

Differential Revision: D28603472

fbshipit-source-id: 14e3a9c15a012c550dc16a044c31d722051a2bdc
2021-05-22 12:19:05 -07:00
Samuel Susla 4bec099f7e Add option to disable sending scroll events to Paper
Summary:
Changelog: [internal]

Originally added in D17814260 (ffc7ec992c) to make parallax effect work in Dating.

This diff hides it behind a flag so we can properly evaluate what's the cost of sending scroll events to Paper.

Reviewed By: JoshuaGross

Differential Revision: D28608283

fbshipit-source-id: fa4d8944ad6b5e767363e231942f13fec9d18cb5
2021-05-22 12:19:05 -07:00
Joshua Gross 0510821170 Replace EventDispatcherImpl with LockFreeEventDispatcherImpl
Summary:
EventDispatcherImpl uses synchronized blocks all over to make it thread-safe. I'm concerned about the perf implications of this and creating contention between JS and UI threads.

This is locked behind a feature flag.

Enabled only for Fabric in StaticViewConfig mode, and a feature flag, for now.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D28591331

fbshipit-source-id: ea8f93a2e1343ce37fa78690dcb62fe03594120f
2021-05-21 17:22:41 -07:00
Ramanpreet Nara a2ab3fccd0 Migrate RCTNativeAnimatedTurboModule to initialize
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28595948

fbshipit-source-id: a12207f8e0c11e1e105225404450ff335242aba7
2021-05-21 14:49:51 -07:00
Ramanpreet Nara 8aa85241a4 Migrate RCTDevSettings to initialize
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28595955

fbshipit-source-id: e61c2d321826eafb60fdac820b76d0f7d100796a
2021-05-21 14:49:51 -07:00
Ramanpreet Nara ed86891d01 Migrate NativeModules to initialize
Summary:
This migrates all ObjC NativeModule setBridge: calls to the bridge compatible initialize: call. I filtered out ViewManagers.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28595520

fbshipit-source-id: b0e5dd681fb3563894f1aa3da1728f0c694f04bb
2021-05-21 14:49:51 -07:00
Sladyn Nunes 35dd86180b Fix/30842 - Add accessibilityState prop in slider (#31145)
Summary:
Accessibility service does not announce "selected" on accessibilityState = {selected: true} of the Button Component.
Issue link - https://github.com/facebook/react-native/issues/30956

## 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] [Added] - Add accessibilityState prop to Slider component

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

Test Plan:
Verified accessibility states are read by voiceover and talkback. Some state values aren't handled by iOS and have been identified.

Added snapshot tests to test accessibilityState.disabled = disabled values

`js1 test Slider-test`

Reviewed By: yungsters

Differential Revision: D28337723

Pulled By: lunaleaps

fbshipit-source-id: 72a54d8d9dcf1fafb9785c81da99f32a21f3df00
2021-05-21 13:35:56 -07:00
Joshua Selbo 0aa1aa6cc2 Convert remaining targets to wrapper
Summary: Changelog: [Internal]

Differential Revision: D28479823

fbshipit-source-id: 997c6ac137d85d22ee5052d69dae006a1a0a7aac
2021-05-21 12:47:26 -07:00
Joshua Gross cd4bebb6c6 Make sure that touch events have a SurfaceId only in Fabric
Summary:
Could fix some infrequent crashes in non-Fabric.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D28605773

fbshipit-source-id: 57555e013657e61cfb02b25d9fd14c9c15774e0e
2021-05-21 11:32:02 -07:00
Samuel Susla 118489f6e5 Make LeakChecker available on Android
Summary:
Changelog: [internal]

Extend LeakChecker so it is available on Android (or any other platform as it is completely in C++ now).

Reviewed By: JoshuaGross

Differential Revision: D28600243

fbshipit-source-id: c77a003e3ffc6171e61c998508c9f34f10bb65ca
2021-05-21 10:39:43 -07:00
Andres Suarez ffab8e3f46 Apply clang-format
Reviewed By: igorsugak

Differential Revision: D28477074

fbshipit-source-id: f15dfc45b9fb30c661ebe2899cd882676d0fdf2a
2021-05-20 21:24:25 -07:00
Ramanpreet Nara a657c2655f Call RCTInitializing initialize on TurboModules
Summary:
After D28435078, TurboModules can conform to the RCTInitializing protocol, and implement the `-(void)initialize` method. This diff makes the TurboModule system execute the module's initialize method after the infra is done setting it up.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28435429

fbshipit-source-id: fe945d616b97ed89f48b914b064e518b122a7b7b
2021-05-20 19:19:57 -07:00
Ramanpreet Nara 269fefb065 Call RCTInitializing initialize on NativeModules
Summary:
After D28435078, NativeModules can conform to the RCTInitializing protocol, and implement the `-(void)initialize` method. This diff makes the NativeModule system execute the module's initialize method after the infra is done setting it up.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28435430

fbshipit-source-id: 1ce00c3fb3c63b024d7e24895ff96c541a6fa654
2021-05-20 19:19:57 -07:00
Ramanpreet Nara 9b45df1fce Introduce RCTInitializing
Summary:
## Motivation
NativeModules need a way to execute custom initialization code. The current way to achieve this is by overriding the setBridge: method. This doesn't work in bridgeless mode, because in bridgeless mode, the TurboModule system doesn't (and shouldn't) invoke the setBridge: method.

## Changes
This diff introduces a new protocol RCTInitializing that NativeModules can conform to. Once they conform to this protocol, they can implement the `- (void)initialize;` method. Both the NativeModule and TurboModule infra will execute this method towards the end of NativeModule setup.

## Questions
Why don't we just override the NativeModule init method?
1. **Backwards compatibility:** The legacy NativeModule infra requires that [modules that override their init method](https://www.internalfb.com/code/fbsource/[8098212b4e3733f0b469f11f3e61c5249a47f9f5]/xplat/js/react-native-github/React/Base/RCTModuleData.mm?lines=82-83) [must be initialized on the main thread](https://www.internalfb.com/code/fbsource/[8098212b4e3733f0b469f11f3e61c5249a47f9f5]/xplat/js/react-native-github/React/Base/RCTModuleData.mm?lines=85). We ported this over [to the TurboModule system](https://www.internalfb.com/code/fbsource/[d58a07e9ae90951d382224c28cb78c32c7cda80d]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm?lines=684%2C686). *We cannot require all NativeModules that need custom initialization to be initialized on the main thread.*
2. **More flexibility:** A custom `- (void)initialize` hook can be invoked by the NativeModule infra after the NativeModule is prepared (i.e: the bridge, module registry, view registry, etc. is attached). The same isn't true of an overriden init method, which has to be invoked when the object is created. This means that a custom `- (void)initialize` hook can use the bridge/method queue, etc., but an overriden init method cannot.

What about Android?
- After this diff, NativeModules can implement the `initialize` method to initialize themselves, and the `invalidate` method to invalidate themselves. This unifies initialization/invalidation across both iOS and Android, because on Android, TurboModules can also implement the same methods:

https://www.internalfb.com/code/fbsource/[d58a07e9ae90951d382224c28cb78c32c7cda80d]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java?lines=11-17

Changelog: [iOS][Added] - Introduce RCTInitializing to allow NativeModules to initialize themselves

Reviewed By: fkgozali

Differential Revision: D28435078

fbshipit-source-id: 1a4a95e30f0a8b32b0844e9b9beee274afcbb577
2021-05-20 19:19:57 -07:00
Tim Yung 883e0d5752 RN: Suppress Warning-Like Errors
Summary:
Changes `ExceptionsManager` in React Native so that errors with a `type` property equal to `'warn'` are not reported.

This change is banking on the fact that `type` is a non-standard and uncommon property on `Error` instances. If this ends up being problematic, we can instead change this to use a `unstable_type` or `unstable_level` property instead.

Changelog:
[General][Changed] - ExceptionsManager will no longer report exceptions with `type === 'warn'`.

Reviewed By: motiz88

Differential Revision: D28421692

fbshipit-source-id: 3ca19e29f32c8c5cad6dac637dcb930944fb24ed
2021-05-20 19:08:25 -07:00
Thibault Malbranche 59abb5f378 fix(hermes): fixed hermes build on iOS (#31559)
Summary:
While testing 0.65, we noticed issues with hermes on iOS in the template projects
These changes create a subspec to the react-core pod so that it can access hermes header correctly.

## Changelog

Not applicable

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

Test Plan: I've ran e2e manual test. Tested RNTester manually also. Then tested a project inited with hermes and the default template

Reviewed By: mhorowitz

Differential Revision: D28564642

Pulled By: Huxpro

fbshipit-source-id: cfcb3363254f62a0e514ec99159b32f841ee4463
2021-05-20 15:23:07 -07:00
Joshua Gross b161241db2 Proposed fix for ScrollView race condition between C++ state update and onScroll
Summary:
FlatList relies heavily on onScroll events + the measure API. In Fabric, usage of `measure` relies on C++ having an accurate view of the current scroll position of the ScrollView.

We already have a mechanism for updating the scroll position in C++ using UpdateState. But, it is only used currently at the /beginning/ and /end/ of scrolling, and UpdateState is not called /during/ scrolling at all.

This means that we will see a series of events like this while scrolling:

```
Scrolling begins
UPDATE C++ STATE: scrollLeft = 0, scrollTop = 0
JS event: onScroll x=0, y=0
JS event: onScroll x=0, y=100
JS event: onScroll x=0, y=200
...
JS event: onScroll x=0, y=1000
UPDATE C++ STATE: scrollLeft = 0, scrollTop = 1000
```

Notably, not many C++ state updates are queued; and the last one is queued AFTER the JS event is sent. The last JS event and UpdateState will race, which means that sometimes the C++ update will /lose/ and C++ will have an inaccurate view of the world when FlatList receives the onScroll event and calls `measure`.

My proposed solution, gated behind a feature flag, is to delay /some/ onScroll events until the C++ UpdateState has made its way back to Java, and send UpdateStates more frequently. The balance here is that UpdateState is a relatively expensive operation, so we probably still want to call it /less/ than we call onScroll. This means that `measure` will still return some incorrect results but will return correct results more frequently. Win?

Changelog: [Internal[

Reviewed By: mdvacca

Differential Revision: D28558380

fbshipit-source-id: 11c7cd714fae67ee5a94c4413be988481413ec03
2021-05-20 12:53:39 -07:00
Erich Graham fa4045e4dd Add ios_assume_nonnull flag to react native codegen library (#31543)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31543

Changelog:
[iOS][Added] - Description

When compiling iOS apps with flag `-Wnullability-completeness` (like Lightspeed app and soon Instagram), Objective-C headers are required to either have full *explicit* nullability annotations on all members of its public API, or none at all; partially annotated headers will fail to build that module.

RN native modules are currently generated with *partial* annotations.  This works today because most apps are not compiled with `-Wnullability-completeness` turned on. But when we flip the switch for Instagram, the app doesn't build due to importing these RN partially annotated modules.

JavsScript Flow types are implied nonnull, and the current RN codegen translates Flow's [maybe/optional](https://flow.org/en/docs/types/maybe/) type to Obj-C `_Nullable` annotation, and everything else without an explicit Obj-C annotation. However this creates a mismatch with the Obj-C type system, where the implied default is *unannotated*, which is handled differently from nonnull when built with the nullability compiler flags.

There is a simple Obj-C macro that automatically adds *explicit nonnull* annotations to all members in a header: `NS_ASSUME_NONNULL_BEGIN` / `NS_ASSUME_NONNULL_END`. If we add this to *all* RN-generated headers, however, we run into issues:
1) We may erroneously assume any previously-unannotated header was meant to be nonnull and cause future bugs
2) Another compiler flag (`-Wnullable-to-nonnull-conversion`) statically analyzes Obj-C implementation code to prevent us from ever passing null to one of these headers. Much existing Obj-C code will break here, and it's ambiguous if these are true or false positives because of the first point.

Instead, in this diff we add a new BUCK flag `ios_assume_nonnull` to let module authors opt into automatic nonnull for unannotated members so that Obj-C headers are generated correctly in alignment with Flow's type system. We can migrate all libraries individually as needed and eventually make this the RN native codegen default.

Reviewed By: RSNara

Differential Revision: D28396446

fbshipit-source-id: ad3a3a97ab19183df4ef504b1c3140596c8f69ca
2021-05-20 10:07:37 -07:00
Joshua Gross d670381fac Reduce FabricUIManager soft errors further
Summary:
Reduce soft error volume; see comments.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D28551214

fbshipit-source-id: 7e6aa1ee7cad812650bd6219d0cbe568c3cdd3de
2021-05-20 09:49:11 -07:00
Ramanpreet Nara b2ec89fdfc Fix react-native-oss-ios by bumping Xcode to 12.4.0 (#31554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31554

## Changes
This diff bumps Xcode to 12.4.0 both internally, and in Circle CI.

- According to [Circle CI docs](https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions), their environments support Xcode 12.4.0.
- According to the [Apple Docs](https://developer.apple.com/support/xcode/), Xcode 12.4.0 matches iOS 14.4.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D28547839

fbshipit-source-id: c9edde6a5825ae597bf56225d1b017c3af0f52ae
2021-05-19 14:18:50 -07:00
Joshua Gross d393cc4814 Ship new differ on iOS
Summary:
While we are still waiting for Android results, we can safely ship this on iOS.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28542478

fbshipit-source-id: 2673cc4bea0edbc7e4211be7bfec9779205d721b
2021-05-19 13:04:43 -07:00
Tim Yung ede74e5936 RN: Cleanup `ExtendedError` Type
Summary:
Cleans up the `ExtendedError` internal type and moves it into a separate module instead of burying it in `parseErrorStack.js`.

Also, this resolves some unnecessary Flow type suppressions.

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D28470299

fbshipit-source-id: 04093243f06f67f41567270ef9778f01c7549b05
2021-05-19 12:30:41 -07:00
Tim Yung 0dba0aff18 ExceptionsManager: Minor Code Cleanup
Summary:
Cleans up `reactConsoleErrorHandler` in `ExceptionsManager` using modern language features, and fixes a minor edge case with how warning-like errors are handled.

Changelog:
[General][Fixed] - Avoid downgrading `console.error` when passed warning-like objects.

Reviewed By: GijsWeterings

Differential Revision: D28418488

fbshipit-source-id: 394e8608c2c81c794c9a0fc155142dcfcfe1c661
2021-05-19 12:30:41 -07:00
Connor Tumbleson eeb8e5829e feat: add Android 12 BLUETOOTH_[CONNECT/SCAN] to PermissionsAndroid (#31488)
Summary:
This PR adds BLUETOOTH_CONNECT / BLUETOOTH_SCAN, which showed up in the latest Android 12 Preview build as new `dangerous` permissions requiring approval for them.

https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_CONNECT
https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_SCAN

## Changelog

[Android] [Changed] - Add BLUETOOTH_CONNECT and BLUETOOTH_SCAN to PermissionsAndroid

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

Test Plan:
```
PermissionsAndroid.BLUETOOTH_CONNECT === 'android.permission.BLUETOOTH_CONNECT'
PermissionsAndroid.BLUETOOTH_SCAN === 'android.permission.BLUETOOTH_SCAN'
```

Reviewed By: yungsters

Differential Revision: D28449023

Pulled By: mdvacca

fbshipit-source-id: 000fc31f5db2996d04a2a5ec7db7c71d0425f52a
2021-05-19 12:23:39 -07:00
Neil Dhar 2c5f68df46 Disable WITH_FBREMAP
Summary:
WITH_FBREMAP was an experiment that is no longer needed. Just disabling the flag for now, the code will be deleted in a separate commit.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D28467996

fbshipit-source-id: cb7bc00ea0b9d6e82219dda5148ab29978ddc83d
2021-05-19 12:23:39 -07:00
Luna Wei ec2dc9e4f2 Fix TextInput-cursorPlacement test
Summary:
Changelog:
[Internal] -  In internal e2e testing, json.stringify is unstable and will occasionally re-order keys. Fix so it's consistent across tests

Reviewed By: kacieb

Differential Revision: D28397174

fbshipit-source-id: 0f2db697d245654c88c3dff3d083bc82890d4bc1
2021-05-18 18:19:24 -07:00