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

6480 Коммитов

Автор SHA1 Сообщение Дата
Tim Yung c47a03563d RN: Change Dimensions to Return EventSubscription
Summary:
Changes `Dimensions.addEventListener` to return an `EventSubscription` object that has a `remove()` method on it.

In an upcoming commit, calling `Dimensions.removeEventListener` will lead to a deprecation warning.

Changelog:
[General][Change] - `Dimensions.addEventListener` now returns an `EventSubscription`.

Reviewed By: kacieb

Differential Revision: D26808827

fbshipit-source-id: 0cfdc65b83c177f60937c1aa3a4cf633592f73d7
2021-03-10 16:06:26 -08:00
Ramanpreet Nara 23d9bf1a24 Make I18nManagerModule TurboModule-compatible
Summary:
This NativeModule will now be type-safe, and TurboModule-compatible.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D26956332

fbshipit-source-id: 6651a003c70819934869dd6a8c664ef984d0efcb
2021-03-10 14:55:29 -08:00
Yan Zhang ffba25c648 add a hide-on-scroll feature to ScrollView
Summary:
Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up
Changelog:
[General][Added] - Add a stickyHeaderHiddenOnScroll option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up

Reviewed By: JoshuaGross

Differential Revision: D26900810

fbshipit-source-id: 6bfb1a4da07fff0763223d60836df187f9d95dd6
2021-03-09 12:36:20 -08:00
David Vacca aba11daff8 Integrate global.__nativeComponentRegistry__hasComponent into NativeComponentRegistry.js
Summary:
This diff creates a new unstable method (unstable_hasComponent) to expose `global.__nativeComponentRegistry__hasComponent` into NativeComponentRegistry.js

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26716903

fbshipit-source-id: 52ff63b2779f41770b292cfc0b9022b1669d59fe
2021-03-09 10:39:20 -08:00
Hans Halverson d477f80113 Deploy Flow v0.146.0
Summary: Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D26835439

fbshipit-source-id: 2607c3185485c8bd2c7e868dd2e3e0c06866f1f9
2021-03-06 11:37:57 -08:00
David Vacca 4c73ab08ed Migrate AndroidDropdownPicker to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates AndroidDropdownPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component
changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26810196

fbshipit-source-id: 7be0396d49d9e1413d424ab1be035cbb6a211706
2021-03-04 13:54:45 -08:00
David Vacca aeed84d361 Migrate AndroidDialogPicker to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates AndroidDialogPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26799476

fbshipit-source-id: d6605f60cc083d1d22b4f0fc0a2f79881502b1b4
2021-03-04 13:54:45 -08:00
David Vacca ce0b7e080b Migrate RCTPicker to use NativeComponentRegistry instead of requireNativeComponent
Summary:
This diff migrates RCTPicker to use NativeComponentRegistry instead of requireNativeComponent. The intention is to unify the way the component is registered and enable StaticViewConfigs for this component

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26799477

fbshipit-source-id: 2f5935e0a4796c7a76921762a087cf7823ebd62e
2021-03-04 13:54:45 -08:00
Samuel Susla 7e81c1d483 Implement caretHidden in multiline text input
Summary:
Changelog: [internal]

Add missing implementation of caretHidden to multiline text input. This will work for both React Native Classic and New React Native Renderer.

Reviewed By: shergin

Differential Revision: D26818087

fbshipit-source-id: 3597604a6bd414a4a3b292d809d63a18efa8acb3
2021-03-04 10:53:35 -08:00
Lulu Wu c7d28bca30 Remove developer tool guard for android
Summary:
Debugging with not having Metro console.log() working in Venice is inconvenient.

After PeteTheHeat's fixes in diff series D26624224 the ground issues should be gone, so I tried removing the guard for Android and it worked.

The only issue I found is that when connected to Hermes Debugger in Flipper it keeps refreshing (reloading?), I posted here https://fb.workplace.com/groups/2308952995990093/permalink/2899448643607189/, with this found, I think it's a good start to iterate on since there are no crashes and this would help us a lot on Venice debugging.

Changelog:
[Android][Changed] - Remove developer tool guard for android

Reviewed By: PeteTheHeat

Differential Revision: D26779418

fbshipit-source-id: 96bb18771e01a25f84f845833a4f71e70433ef2b
2021-03-04 05:02:06 -08:00
Tim Yung 305b4253c2 RN: Change Appearance to Return EventSubscription
Summary:
Changes `Appearance.addChangeListener` to return an `EventSubscription` object that has a `remove()` method on it.

In an upcoming commit, calling `Appearance.removeChangeListener` will lead to a deprecation warning.

Changelog:
[General][Change] - `Appearance.addChangeListener` now returns an `EventSubscription`.

Reviewed By: kacieb

Differential Revision: D26696388

fbshipit-source-id: d0bdeffff3a2a366b3c11b6dc1417dfb2f1455c2
2021-03-03 21:43:48 -08:00
Kacie Bawiec 921c9ff165 Fix sticky header not sticking on first render in ScrollView
Summary:
# The bug
Sticky headers would not "stick" to the top of the ScrollView on initial render. On subsequent redners, all sticking would work correctly.

# Why the bug existed
This code to initialize the animated values used for sticky headers was in `UNSAFE_componentWillMount` prior to D26375818 (1641d46529). `UNSAFE_componentWillMount` is called before `render`.

In D26375818 (1641d46529), I moved the code into `componentDidMount`, which is called after `render`.

This caused a problem because code in `render` was relying on these initializations being done already.

# How I resolved the bug
To resolve this, I initialize these values in the constructor.

# Reference
Docs for React mount ordering: https://reactjs.org/docs/react-component.html#mounting

Changelog:
[General][Fixed] Fix sticky header not sticking on first render in ScrollView

Reviewed By: nadiia

Differential Revision: D26792003

fbshipit-source-id: c575e8cdd1d986ce3c38941d95d763e329e74874
2021-03-03 15:19:00 -08:00
Nadiia D 397bfa6ad7 Hide caret during test runs
Summary:
Changelog:
[General][Changed] Hide caret in the TextInput during test runs.

Reviewed By: lunaleaps

Differential Revision: D26728766

fbshipit-source-id: b75827f00b4d5c6243d93106093f97b40dc4b366
2021-03-02 18:04:28 -08:00
Sam Goldman 62fcb4e22c Fixed Flow typing of TextInput refs
Summary:
`React.ElementRef<HostComponent<mixed>>` is an inexact object type, which can not be spread into an exact object type, as is happening here. This error is masked in types-first mode, but causes the instance type of this component to be `any`. In a future version of Flow, this issue will be fixed, so this change unblocks upgrading Flow.

This change is likely to cause code using `TextInput` refs to find errors which were missed before.

Changelog:
[General][Fixed] - Fixed Flow typing of TextInput refs

Reviewed By: yungsters

Differential Revision: D26733314

fbshipit-source-id: 8aa26ce5b49357b279f76dd1767a17a9fb4dd4f1
2021-03-02 00:28:03 -08:00
Joshua Gross ee98e6a493 ReactCommon/nativemodule: Migrate uses of NDEBUG to REACT_NATIVE_DEBUG + react_native_assert
Summary:
For better cross-platform consistency, migrate usages of NDEBUG to REACT_NATIVE_DEBUG. See flags.h for explanation.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D26695016

fbshipit-source-id: 63e6f6fc919076d94f04416f6821f21e0b3707a3
2021-02-26 21:20:25 -08:00
Ramanpreet Nara 2ee5db0fb7 Back out "React Native sync for revisions c3e20f1...0cf9fc1"
Summary:
This diff broke scrolling on Profile React Native surfaces. Please see the task for repro steps. Backing this out.

Changelog:
[General][Changed] - Back out "React Native sync for revisions c3e20f1...4d28eca"

build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review

Oncall Short Name: fbandroid_sheriff

Reviewed By: JoshuaGross

Differential Revision: D26708096

fbshipit-source-id: 40f1e7473b8cc041073b2658d46f9500281da99e
2021-02-26 20:00:06 -08:00
Rick Hanlon ab53332115 React Native sync for revisions c3e20f1...0cf9fc1
Summary:
This sync includes the following changes:
- **[0cf9fc10b](https://github.com/facebook/react/commit/0cf9fc10b )**: Fix React Native flow types ([#20889](https://github.com/facebook/react/pull/20889)) //<Ricky>//
- **[c581cdd48](https://github.com/facebook/react/commit/c581cdd48 )**: Schedule sync updates in microtask ([#20872](https://github.com/facebook/react/pull/20872)) //<Ricky>//
- **[90bde6505](https://github.com/facebook/react/commit/90bde6505 )**: Add SuspenseList to react-is ([#20874](https://github.com/facebook/react/pull/20874)) //<Brian Vaughn>//
- **[8336f19aa](https://github.com/facebook/react/commit/8336f19aa )**: Update React Native types ([#20883](https://github.com/facebook/react/pull/20883)) //<Rubén Norte>//
- **[9209c30ff](https://github.com/facebook/react/commit/9209c30ff )**: Add StrictMode level prop and createRoot unstable_strictModeLevel option ([#20849](https://github.com/facebook/react/pull/20849)) //<Brian Vaughn>//
- **[e5f6b91d2](https://github.com/facebook/react/commit/e5f6b91d2 )**: Add Lane labels to scheduling profiler marks ([#20808](https://github.com/facebook/react/pull/20808)) //<Brian Vaughn>//
- **[c62986cfd](https://github.com/facebook/react/commit/c62986cfd )**: Add additional messaging for RulesOfHooks lint error ([#20692](https://github.com/facebook/react/pull/20692)) //<Anthony Garritano>//
- **[78d2f2d30](https://github.com/facebook/react/commit/78d2f2d30 )**: Fabric-compatible implementation of `JSReponder` feature ([#20768](https://github.com/facebook/react/pull/20768)) //<Valentin Shergin>//
- **[4d28eca97](https://github.com/facebook/react/commit/4d28eca97 )**: Land enableNonInterruptingNormalPri ([#20859](https://github.com/facebook/react/pull/20859)) //<Ricky>//
- **[8af27aeed](https://github.com/facebook/react/commit/8af27aeed )**: Remove scheduler sampling profiler shared array buffer ([#20840](https://github.com/facebook/react/pull/20840)) //<Brian Vaughn>//
- **[af3d52611](https://github.com/facebook/react/commit/af3d52611 )**: Disable (unstable) scheduler sampling profiler for OSS builds ([#20832](https://github.com/facebook/react/pull/20832)) //<Brian Vaughn>//
- **[8fa0ccca0](https://github.com/facebook/react/commit/8fa0ccca0 )**: fix: use SharedArrayBuffer only when cross-origin isolation is enabled ([#20831](https://github.com/facebook/react/pull/20831)) //<Toru Kobayashi>//
- **[099164792](https://github.com/facebook/react/commit/099164792 )**: Use setImmediate when available over MessageChannel ([#20834](https://github.com/facebook/react/pull/20834)) //<Dan Abramov>//
- **[e2fd460cc](https://github.com/facebook/react/commit/e2fd460cc )**: Bailout in sync task if work is not sync ([#20813](https://github.com/facebook/react/pull/20813)) //<Andrew Clark>//
- **[1a7472624](https://github.com/facebook/react/commit/1a7472624 )**: Add `supportsMicrotasks` to the host config ([#20809](https://github.com/facebook/react/pull/20809)) //<Andrew Clark>//
- **[696e736be](https://github.com/facebook/react/commit/696e736be )**: Warn if static flag is accidentally cleared ([#20807](https://github.com/facebook/react/pull/20807)) //<Andrew Clark>//
- **[483358c38](https://github.com/facebook/react/commit/483358c38 )**: Omit TransitionHydrationLane from TransitionLanes ([#20802](https://github.com/facebook/react/pull/20802)) //<Andrew Clark>//
- **[78ec97d34](https://github.com/facebook/react/commit/78ec97d34 )**: Fix typo ([#20466](https://github.com/facebook/react/pull/20466)) //<inokawa>//
- **[6cdc35972](https://github.com/facebook/react/commit/6cdc35972 )**: fix comments of markUpdateLaneFromFiberToRoot ([#20546](https://github.com/facebook/react/pull/20546)) //<neroneroffy>//
- **[47dd9f441](https://github.com/facebook/react/commit/47dd9f441 )**: Remove fakeCallbackNode ([#20799](https://github.com/facebook/react/pull/20799)) //<Andrew Clark>//
- **[114ab5295](https://github.com/facebook/react/commit/114ab5295 )**: Make remaining empty lanes Transition lanes ([#20793](https://github.com/facebook/react/pull/20793)) //<Andrew Clark>//
- **[d3d2451a0](https://github.com/facebook/react/commit/d3d2451a0 )**: Use a single lane per priority level ([#20791](https://github.com/facebook/react/pull/20791)) //<Andrew Clark>//
- **[eee874ce6](https://github.com/facebook/react/commit/eee874ce6 )**: Cross-fork lint: Support named export declaration ([#20784](https://github.com/facebook/react/pull/20784)) //<Andrew Clark>//
- **[3b870b1e0](https://github.com/facebook/react/commit/3b870b1e0 )**: Lane enableTransitionEntanglement flag ([#20775](https://github.com/facebook/react/pull/20775)) //<Andrew Clark>//
- **[d1845ad0f](https://github.com/facebook/react/commit/d1845ad0f )**: Default updates should not interrupt transitions ([#20771](https://github.com/facebook/react/pull/20771)) //<Andrew Clark>//
- **[3499c343a](https://github.com/facebook/react/commit/3499c343a )**: Apply #20778 to new fork, too ([#20782](https://github.com/facebook/react/pull/20782)) //<Andrew Clark>//
- **[3d10eca24](https://github.com/facebook/react/commit/3d10eca24 )**: Move scheduler priority check into ReactDOM ([#20778](https://github.com/facebook/react/pull/20778)) //<Dan Abramov>//
- **[97fce318a](https://github.com/facebook/react/commit/97fce318a )**: Experiment: Infer the current event priority from the native event ([#20748](https://github.com/facebook/react/pull/20748)) //<Dan Abramov>//
- **[6c526c515](https://github.com/facebook/react/commit/6c526c515 )**: Don't shift interleaved updates to separate lane ([#20681](https://github.com/facebook/react/pull/20681)) //<Andrew Clark>//
- **[35f7441d3](https://github.com/facebook/react/commit/35f7441d3 )**: Use Lanes instead of priority event constants ([#20762](https://github.com/facebook/react/pull/20762)) //<Dan Abramov>//
- **[a014c915c](https://github.com/facebook/react/commit/a014c915c )**: Parallel transitions: Assign different lanes to consecutive transitions ([#20672](https://github.com/facebook/react/pull/20672)) //<Andrew Clark>//
- **[77754ae61](https://github.com/facebook/react/commit/77754ae61 )**: Decouple event priority list from event name list ([#20760](https://github.com/facebook/react/pull/20760)) //<Dan Abramov>//
- **[b5bac1821](https://github.com/facebook/react/commit/b5bac1821 )**: Align event group constant naming with lane naming ([#20744](https://github.com/facebook/react/pull/20744)) //<Dan Abramov>//
- **[4ecf11977](https://github.com/facebook/react/commit/4ecf11977 )**: Remove the Fundamental internals ([#20745](https://github.com/facebook/react/pull/20745)) //<Dan Abramov>//
- **[eeb1325b0](https://github.com/facebook/react/commit/eeb1325b0 )**: Fix UMD bundles by removing usage of global ([#20743](https://github.com/facebook/react/pull/20743)) //<Dan Abramov>//
- **[0935a1db3](https://github.com/facebook/react/commit/0935a1db3 )**: Delete consolidateBundleSizes script ([#20724](https://github.com/facebook/react/pull/20724)) //<Andrew Clark>//
- **[7cb9fd7ef](https://github.com/facebook/react/commit/7cb9fd7ef )**: Land interleaved updates change in main fork ([#20710](https://github.com/facebook/react/pull/20710)) //<Andrew Clark>//
- **[dc27b5aaa](https://github.com/facebook/react/commit/dc27b5aaa )**: useMutableSource: Use StrictMode double render to detect render phase mutation ([#20698](https://github.com/facebook/react/pull/20698)) //<Andrew Clark>//
- **[bb1b7951d](https://github.com/facebook/react/commit/bb1b7951d )**: fix: don't run effects if a render phase update results in unchanged deps ([#20676](https://github.com/facebook/react/pull/20676)) //<Sebastian Silbermann>//
- **[766a7a28a](https://github.com/facebook/react/commit/766a7a28a )**: Improve React error message when mutable sources are mutated during render ([#20665](https://github.com/facebook/react/pull/20665)) //<Brian Vaughn>//
- **[a922f1c71](https://github.com/facebook/react/commit/a922f1c71 )**: Fix cache refresh bug that broke DevTools ([#20687](https://github.com/facebook/react/pull/20687)) //<Andrew Clark>//
- **[e51bd6c1f](https://github.com/facebook/react/commit/e51bd6c1f )**: Queue discrete events in microtask ([#20669](https://github.com/facebook/react/pull/20669)) //<Ricky>//
- **[aa736a0fa](https://github.com/facebook/react/commit/aa736a0fa )**: Add queue microtask to host configs ([#20668](https://github.com/facebook/react/pull/20668)) //<Ricky>//
- **[deeeaf1d2](https://github.com/facebook/react/commit/deeeaf1d2 )**: Entangle overlapping transitions per queue ([#20670](https://github.com/facebook/react/pull/20670)) //<Andrew Clark>//
- **[e316f7855](https://github.com/facebook/react/commit/e316f7855 )**: RN: Implement `sendAccessibilityEvent` in RN Renderer that proxies between Fabric/non-Fabric ([#20554](https://github.com/facebook/react/pull/20554)) //<Joshua Gross>//
- **[9c32622cf](https://github.com/facebook/react/commit/9c32622cf )**: Improve tests that use discrete events ([#20667](https://github.com/facebook/react/pull/20667)) //<Ricky>//
- **[d13f5b953](https://github.com/facebook/react/commit/d13f5b953 )**: Experiment: Unsuspend all lanes on update ([#20660](https://github.com/facebook/react/pull/20660)) //<Andrew Clark>//
- **[a511dc709](https://github.com/facebook/react/commit/a511dc709 )**: Error for deferred value and transition in Server Components ([#20657](https://github.com/facebook/react/pull/20657)) //<Sebastian Markbåge>//
- **[fb3f63f1a](https://github.com/facebook/react/commit/fb3f63f1a )**: Remove lazy invokation of segments ([#20656](https://github.com/facebook/react/pull/20656)) //<Sebastian Markbåge>//
- **[895ae67fd](https://github.com/facebook/react/commit/895ae67fd )**: Improve error boundary handling for unmounted subtrees ([#20645](https://github.com/facebook/react/pull/20645)) //<Brian Vaughn>//
- **[f15f8f64b](https://github.com/facebook/react/commit/f15f8f64b )**: Store interleaved updates on separate queue until end of render ([#20615](https://github.com/facebook/react/pull/20615)) //<Andrew Clark>//
- **[0fd6805c6](https://github.com/facebook/react/commit/0fd6805c6 )**: Land rest of effects refactor in main fork ([#20644](https://github.com/facebook/react/pull/20644)) //<Andrew Clark>//
- **[a6b5256a2](https://github.com/facebook/react/commit/a6b5256a2 )**: Refactored recursive strict effects method to be iterative ([#20642](https://github.com/facebook/react/pull/20642)) //<Brian Vaughn>//
- **[3957853ae](https://github.com/facebook/react/commit/3957853ae )**: Re-add "strict effects mode" for legacy roots only ([#20639](https://github.com/facebook/react/pull/20639)) //<Brian Vaughn>//
- **[fceb75e89](https://github.com/facebook/react/commit/fceb75e89 )**: Delete remaining references to effect list ([#20625](https://github.com/facebook/react/pull/20625)) //<Andrew Clark>//
- **[741dcbdbe](https://github.com/facebook/react/commit/741dcbdbe )**: Schedule passive phase whenever there's a deletion ([#20624](https://github.com/facebook/react/pull/20624)) //<Andrew Clark>//
- **[11a983fc7](https://github.com/facebook/react/commit/11a983fc7 )**: Remove references to Deletion flag ([#20623](https://github.com/facebook/react/pull/20623)) //<Andrew Clark>//
- **[2e948e0d9](https://github.com/facebook/react/commit/2e948e0d9 )**: Avoid .valueOf to close #20594 ([#20617](https://github.com/facebook/react/pull/20617)) //<Dima Tisnek>//
- **[2a646f73e](https://github.com/facebook/react/commit/2a646f73e )**: Convert snapshot phase to depth-first traversal ([#20622](https://github.com/facebook/react/pull/20622)) //<Andrew Clark>//
- **[fb3e158a6](https://github.com/facebook/react/commit/fb3e158a6 )**: Convert ReactSuspenseWithNoopRenderer tests to use built-in cache ([#20601](https://github.com/facebook/react/pull/20601)) //<Andrew Clark>//
- **[e0fd9e67f](https://github.com/facebook/react/commit/e0fd9e67f )**: Use update lane priority in work loop ([#20621](https://github.com/facebook/react/pull/20621)) //<Ricky>//
- **[58e830448](https://github.com/facebook/react/commit/58e830448 )**: Remove custom error message from hook access error ([#20604](https://github.com/facebook/react/pull/20604)) //<Andrew Clark>//
- **[9043626f0](https://github.com/facebook/react/commit/9043626f0 )**: Cache tests: Make it easier to test many caches ([#20600](https://github.com/facebook/react/pull/20600)) //<Andrew Clark>//
- **[af0bb68e8](https://github.com/facebook/react/commit/af0bb68e8 )**: Land #20595 and #20596 in main fork ([#20602](https://github.com/facebook/react/pull/20602)) //<Andrew Clark>//
- **[2b6985114](https://github.com/facebook/react/commit/2b6985114 )**: build-combined: Fix failures  when renaming across devices ([#20620](https://github.com/facebook/react/pull/20620)) //<Sebastian Silbermann>//
- **[af16f755d](https://github.com/facebook/react/commit/af16f755d )**: Update DevTools to use getCacheForType API ([#20548](https://github.com/facebook/react/pull/20548)) //<Brian Vaughn>//
- **[95feb0e70](https://github.com/facebook/react/commit/95feb0e70 )**: Convert mutation phase to depth-first traversal ([#20596](https://github.com/facebook/react/pull/20596)) //<Andrew Clark>//
- **[6132919bf](https://github.com/facebook/react/commit/6132919bf )**: Convert layout phase to depth-first traversal ([#20595](https://github.com/facebook/react/pull/20595)) //<Andrew Clark>//
- **[42e04b46d](https://github.com/facebook/react/commit/42e04b46d )**: Fix: Detach deleted fiber's alternate, too ([#20587](https://github.com/facebook/react/pull/20587)) //<Andrew Clark>//
- **[a656ace8d](https://github.com/facebook/react/commit/a656ace8d )**: Deletion effects should fire parent -> child ([#20584](https://github.com/facebook/react/pull/20584)) //<Andrew Clark>//
- **[e6ed2bcf4](https://github.com/facebook/react/commit/e6ed2bcf4 )**: Update package.json versions as part of build step ([#20579](https://github.com/facebook/react/pull/20579)) //<Andrew Clark>//
- **[eb0fb3823](https://github.com/facebook/react/commit/eb0fb3823 )**: Build stable and experimental with same command ([#20573](https://github.com/facebook/react/pull/20573)) //<Andrew Clark>//
- **[e8eff119e](https://github.com/facebook/react/commit/e8eff119e )**: Fix ESLint crash on empty react effect hook ([#20385](https://github.com/facebook/react/pull/20385)) //<Christian Ruigrok>//
- **[27659559e](https://github.com/facebook/react/commit/27659559e )**: Add useRefresh hook to react-debug-tools ([#20460](https://github.com/facebook/react/pull/20460)) //<Brian Vaughn>//
- **[99554dc36](https://github.com/facebook/react/commit/99554dc36 )**: Add Flight packages to experimental allowlist ([#20486](https://github.com/facebook/react/pull/20486)) //<Andrew Clark>//
- **[efc57e5cb](https://github.com/facebook/react/commit/efc57e5cb )**: Add built-in Suspense cache with support for invalidation (refreshing) ([#20456](https://github.com/facebook/react/pull/20456)) //<Andrew Clark>//
- **[00a5b08e2](https://github.com/facebook/react/commit/00a5b08e2 )**: Remove PassiveStatic optimization //<Andrew Clark>//
- **[a6329b105](https://github.com/facebook/react/commit/a6329b105 )**: Don't clear static flags in resetWorkInProgress //<Andrew Clark>//
- **[1cf59f34b](https://github.com/facebook/react/commit/1cf59f34b )**: Convert passive unmount phase to tree traversal //<Andrew Clark>//
- **[ab29695a0](https://github.com/facebook/react/commit/ab29695a0 )**: Defer more field detachments to passive phase //<Andrew Clark>//
- **[d37d7a4bb](https://github.com/facebook/react/commit/d37d7a4bb )**: Convert passive mount phase to tree traversal //<Andrew Clark>//
- **[19e15a398](https://github.com/facebook/react/commit/19e15a398 )**: Add PassiveStatic to trees with passive effects //<Andrew Clark>//
- **[ff17fc176](https://github.com/facebook/react/commit/ff17fc176 )**: Don't clear other flags when adding Deletion //<Andrew Clark>//
- **[5687864eb](https://github.com/facebook/react/commit/5687864eb )**: Add back disableSchedulerTimeoutInWorkLoop flag ([#20482](https://github.com/facebook/react/pull/20482)) //<Ricky>//
- **[9f338e5d7](https://github.com/facebook/react/commit/9f338e5d7 )**: clone json obj in react native flight client host config parser ([#20474](https://github.com/facebook/react/pull/20474)) //<Luna Ruan>//
- **[4e62fd271](https://github.com/facebook/react/commit/4e62fd271 )**: clone json obj in relay flight client host config parser ([#20465](https://github.com/facebook/react/pull/20465)) //<Luna Ruan>//
- **[070372cde](https://github.com/facebook/react/commit/070372cde )**: [Flight] Fix webpack watch mode issue ([#20457](https://github.com/facebook/react/pull/20457)) //<Dan Abramov>//
- **[0f80dd148](https://github.com/facebook/react/commit/0f80dd148 )**: [Flight] Support concatenated modules in Webpack plugin ([#20449](https://github.com/facebook/react/pull/20449)) //<Dan Abramov>//
- **[daf38ecdf](https://github.com/facebook/react/commit/daf38ecdf )**: [Flight] Use lazy reference for existing modules ([#20445](https://github.com/facebook/react/pull/20445)) //<Dan Abramov>//
- **[3f9205c33](https://github.com/facebook/react/commit/3f9205c33 )**: Regression test: SuspenseList causes lost unmount ([#20433](https://github.com/facebook/react/pull/20433)) //<Andrew Clark>//
- **[cdfde3ae1](https://github.com/facebook/react/commit/cdfde3ae1 )**: Always rethrow original error when we replay errors ([#20425](https://github.com/facebook/react/pull/20425)) //<Sebastian Markbåge>//
- **[b15d6e93e](https://github.com/facebook/react/commit/b15d6e93e )**: [Flight] Make PG and FS server-only ([#20424](https://github.com/facebook/react/pull/20424)) //<Dan Abramov>//
- **[40ff2395e](https://github.com/facebook/react/commit/40ff2395e )**: [Flight] Prevent non-Server imports of aliased Server entrypoints ([#20422](https://github.com/facebook/react/pull/20422)) //<Dan Abramov>//
- **[94aa365e3](https://github.com/facebook/react/commit/94aa365e3 )**: [Flight] Fix webpack plugin to use chunk groups ([#20421](https://github.com/facebook/react/pull/20421)) //<Dan Abramov>//
- **[842ee367e](https://github.com/facebook/react/commit/842ee367e )**: [Flight] Rename the shared entry point ([#20420](https://github.com/facebook/react/pull/20420)) //<Dan Abramov>//
- **[dbf40ef75](https://github.com/facebook/react/commit/dbf40ef75 )**: Put .server.js at the end of bundle filenames ([#20419](https://github.com/facebook/react/pull/20419)) //<Dan Abramov>//
- **[03126dd08](https://github.com/facebook/react/commit/03126dd08 )**: [Flight] Add read-only fs methods ([#20412](https://github.com/facebook/react/pull/20412)) //<Dan Abramov>//
- **[b51a686a9](https://github.com/facebook/react/commit/b51a686a9 )**: Turn on double effects for www test renderer ([#20416](https://github.com/facebook/react/pull/20416)) //<Brian Vaughn>//
- **[56a632adb](https://github.com/facebook/react/commit/56a632adb )**: Double Invoke Effects in __DEV__ (in old reconciler fork) ([#20415](https://github.com/facebook/react/pull/20415)) //<Brian Vaughn>//
- **[1a2422337](https://github.com/facebook/react/commit/1a2422337 )**: fixed typo ([#20351](https://github.com/facebook/react/pull/20351)) //<togami2864>//
- **[a233c9e2a](https://github.com/facebook/react/commit/a233c9e2a )**: Rename internal cache helpers ([#20410](https://github.com/facebook/react/pull/20410)) //<Dan Abramov>//
- **[6a4b12b81](https://github.com/facebook/react/commit/6a4b12b81 )**: [Flight] Add rudimentary FS binding ([#20409](https://github.com/facebook/react/pull/20409)) //<Dan Abramov>//
- **[7659949d6](https://github.com/facebook/react/commit/7659949d6 )**: Clear `deletions` in `detachFiber` ([#20401](https://github.com/facebook/react/pull/20401)) //<Andrew Clark>//
- **[b9680aef7](https://github.com/facebook/react/commit/b9680aef7 )**: Cache react-fetch results in the Node version ([#20407](https://github.com/facebook/react/pull/20407)) //<Dan Abramov>//
- **[cdae31ab8](https://github.com/facebook/react/commit/cdae31ab8 )**: Fix typo ([#20279](https://github.com/facebook/react/pull/20279)) //<inokawa>//
- **[51a7cfe21](https://github.com/facebook/react/commit/51a7cfe21 )**: Fix typo ([#20300](https://github.com/facebook/react/pull/20300)) //<Hollow Man>//
- **[373b297c5](https://github.com/facebook/react/commit/373b297c5 )**: fix: Fix typo in react-reconciler docs ([#20284](https://github.com/facebook/react/pull/20284)) //<Sam Zhou>//
- **[1b5ca9906](https://github.com/facebook/react/commit/1b5ca9906 )**: Fix module ID deduplication ([#20406](https://github.com/facebook/react/pull/20406)) //<Dan Abramov>//
- **[5fd9db732](https://github.com/facebook/react/commit/5fd9db732 )**: [Flight] Rename react-transport-... packages to react-server-... ([#20403](https://github.com/facebook/react/pull/20403)) //<Sebastian Markbåge>//
- **[ce40f1dc2](https://github.com/facebook/react/commit/ce40f1dc2 )**: Use assets API + writeToDisk instead of directly writing to disk ([#20402](https://github.com/facebook/react/pull/20402)) //<Sebastian Markbåge>//
- **[b66ae09b6](https://github.com/facebook/react/commit/b66ae09b6 )**: Track subtreeFlags et al with bubbleProperties //<Andrew Clark>//
- **[de75315d7](https://github.com/facebook/react/commit/de75315d7 )**: Track deletions using an array on the parent //<Andrew Clark>//
- **[1377e465d](https://github.com/facebook/react/commit/1377e465d )**: Add Placement bit without removing others ([#20398](https://github.com/facebook/react/pull/20398)) //<Andrew Clark>//
- **[18d7574ae](https://github.com/facebook/react/commit/18d7574ae )**: Remove `catch` from Scheduler build ([#20396](https://github.com/facebook/react/pull/20396)) //<Andrew Clark>//
- **[30dfb8602](https://github.com/facebook/react/commit/30dfb8602 )**: [Flight] Basic scan of the file system to find Client modules ([#20383](https://github.com/facebook/react/pull/20383)) //<Sebastian Markbåge>//
- **[9b8060041](https://github.com/facebook/react/commit/9b8060041 )**: Error when the number of parameters to a query changes ([#20379](https://github.com/facebook/react/pull/20379)) //<Dan Abramov>//
- **[60e4a76fa](https://github.com/facebook/react/commit/60e4a76fa )**: [Flight] Add rudimentary PG binding ([#20372](https://github.com/facebook/react/pull/20372)) //<Dan Abramov>//
- **[88ef95712](https://github.com/facebook/react/commit/88ef95712 )**: Fork ReactFiberLane ([#20371](https://github.com/facebook/react/pull/20371)) //<Andrew Clark>//
- **[41c5d00fc](https://github.com/facebook/react/commit/41c5d00fc )**: [Flight] Minimal webpack plugin ([#20228](https://github.com/facebook/react/pull/20228)) //<Dan Abramov>//
- **[e23673b51](https://github.com/facebook/react/commit/e23673b51 )**: [Flight] Add getCacheForType() to the dispatcher ([#20315](https://github.com/facebook/react/pull/20315)) //<Dan Abramov>//
- **[555eeae33](https://github.com/facebook/react/commit/555eeae33 )**: Add disableNativeComponentFrames flag ([#20364](https://github.com/facebook/react/pull/20364)) //<Philipp Spiess>//
- **[148ffe3cf](https://github.com/facebook/react/commit/148ffe3cf )**: Failing test for Client reconciliation ([#20318](https://github.com/facebook/react/pull/20318)) //<Dan Abramov>//
- **[a2a025537](https://github.com/facebook/react/commit/a2a025537 )**: Fixed invalid DevTools work tags ([#20362](https://github.com/facebook/react/pull/20362)) //<Brian Vaughn>//
- **[5711811da](https://github.com/facebook/react/commit/5711811da )**: Reconcile element types of lazy component yielding the same type ([#20357](https://github.com/facebook/react/pull/20357)) //<Sebastian Markbåge>//
- **[3f73dcee3](https://github.com/facebook/react/commit/3f73dcee3 )**: Support named exports from client references ([#20312](https://github.com/facebook/react/pull/20312)) //<Sebastian Markbåge>//
- **[565148d75](https://github.com/facebook/react/commit/565148d75 )**: Disallow *.server.js imports from any other files ([#20309](https://github.com/facebook/react/pull/20309)) //<Sebastian Markbåge>//
- **[e6a0f2763](https://github.com/facebook/react/commit/e6a0f2763 )**: Profiler: Improve nested-update checks ([#20299](https://github.com/facebook/react/pull/20299)) //<Brian Vaughn>//
- **[d93b58a5e](https://github.com/facebook/react/commit/d93b58a5e )**: Add flight specific entry point for react package ([#20304](https://github.com/facebook/react/pull/20304)) //<Sebastian Markbåge>//
- **[a81c02ac1](https://github.com/facebook/react/commit/a81c02ac1 )**: Profiler onNestedUpdateScheduled accepts id as first param ([#20293](https://github.com/facebook/react/pull/20293)) //<Brian Vaughn>//
- **[ac2cff4b1](https://github.com/facebook/react/commit/ac2cff4b1 )**: Warn if commit phase error thrown in detached tree ([#20286](https://github.com/facebook/react/pull/20286)) //<Andrew Clark>//
- **[0f83a64ed](https://github.com/facebook/react/commit/0f83a64ed )**: Regression test: Missing unmount after re-order ([#20285](https://github.com/facebook/react/pull/20285)) //<Andrew Clark>//
- **[ebf158965](https://github.com/facebook/react/commit/ebf158965 )**: Add best-effort documentation for third-party renderers ([#20278](https://github.com/facebook/react/pull/20278)) //<Dan Abramov>//
- **[82e99e1b0](https://github.com/facebook/react/commit/82e99e1b0 )**: Add Node ESM Loader and Register Entrypoints ([#20274](https://github.com/facebook/react/pull/20274)) //<Sebastian Markbåge>//
- **[bf7b7aeb1](https://github.com/facebook/react/commit/bf7b7aeb1 )**: findDOMNode: Remove return pointer mutation ([#20272](https://github.com/facebook/react/pull/20272)) //<Andrew Clark>//
- **[369c3db62](https://github.com/facebook/react/commit/369c3db62 )**: Add separate ChildDeletion flag ([#20264](https://github.com/facebook/react/pull/20264)) //<Andrew Clark>//
- **[765e89b90](https://github.com/facebook/react/commit/765e89b90 )**: Reset new fork to old fork  ([#20254](https://github.com/facebook/react/pull/20254)) //<Andrew Clark>//
- **[7548dd573](https://github.com/facebook/react/commit/7548dd573 )**: Properly reset Profiler nested-update flag ([#20253](https://github.com/facebook/react/pull/20253)) //<Brian Vaughn>//
- **[b44e4b13a](https://github.com/facebook/react/commit/b44e4b13a )**: Check for deletions in `hadNoMutationsEffects` ([#20252](https://github.com/facebook/react/pull/20252)) //<Andrew Clark>//
- **[3ebf05183](https://github.com/facebook/react/commit/3ebf05183 )**: Add new effect fields to old fork, and vice versa ([#20246](https://github.com/facebook/react/pull/20246)) //<Andrew Clark>//
- **[2fbcc9806](https://github.com/facebook/react/commit/2fbcc9806 )**: Remove cycle between ReactFiberHooks and ReactInternalTypes ([#20242](https://github.com/facebook/react/pull/20242)) //<Paul Doyle>//
- **[504222dcd](https://github.com/facebook/react/commit/504222dcd )**: Add Node ESM build option ([#20243](https://github.com/facebook/react/pull/20243)) //<Sebastian Markbåge>//
- **[1b96ee444](https://github.com/facebook/react/commit/1b96ee444 )**: Remove noinline directives from new commit phase ([#20241](https://github.com/facebook/react/pull/20241)) //<Andrew Clark>//
- **[760d9ab57](https://github.com/facebook/react/commit/760d9ab57 )**: Scheduling profiler tweaks ([#20215](https://github.com/facebook/react/pull/20215)) //<Brian Vaughn>//
- **[9403c3b53](https://github.com/facebook/react/commit/9403c3b53 )**: Add Profiler callback when nested updates are scheduled ([#20211](https://github.com/facebook/react/pull/20211)) //<Brian Vaughn>//
- **[62efd9618](https://github.com/facebook/react/commit/62efd9618 )**: use-subscription@1.5.1 //<Dan Abramov>//
- **[e7006d67d](https://github.com/facebook/react/commit/e7006d67d )**: Widen peer dependency range of use-subscription ([#20225](https://github.com/facebook/react/pull/20225)) //<Billy Janitsch>//
- **[15df051c9](https://github.com/facebook/react/commit/15df051c9 )**: Add warning if return pointer is inconsistent ([#20219](https://github.com/facebook/react/pull/20219)) //<Andrew Clark>//
- **[9aca239f1](https://github.com/facebook/react/commit/9aca239f1 )**: Improved dev experience when DevTools hook is disabled ([#20208](https://github.com/facebook/react/pull/20208)) //<Alphabet Codes>//
- **[12627f93b](https://github.com/facebook/react/commit/12627f93b )**: Perform hasOwnProperty check in Relay Flight ([#20220](https://github.com/facebook/react/pull/20220)) //<Sebastian Markbåge>//
- **[163199d8c](https://github.com/facebook/react/commit/163199d8c )**: Dedupe module id generation ([#20172](https://github.com/facebook/react/pull/20172)) //<Sebastian Markbåge>//
- **[76a6dbcb9](https://github.com/facebook/react/commit/76a6dbcb9 )**: [Flight] Encode Symbols as special rows that can be referenced by models … ([#20171](https://github.com/facebook/react/pull/20171)) //<Sebastian Markbåge>//
- **[35e53b465](https://github.com/facebook/react/commit/35e53b465 )**: [Flight] Simplify Relay row protocol ([#20168](https://github.com/facebook/react/pull/20168)) //<Sebastian Markbåge>//
- **[16e6dadba](https://github.com/facebook/react/commit/16e6dadba )**: Encode throwing server components as lazy throwing references ([#20217](https://github.com/facebook/react/pull/20217)) //<Sebastian Markbåge>//
- **[c896cf961](https://github.com/facebook/react/commit/c896cf961 )**: Set return pointer when reusing current tree ([#20212](https://github.com/facebook/react/pull/20212)) //<Andrew Clark>//
- **[089866015](https://github.com/facebook/react/commit/089866015 )**: Add version of scheduler that only swaps MessageChannel for postTask ([#20206](https://github.com/facebook/react/pull/20206)) //<Ricky>//
- **[393c452e3](https://github.com/facebook/react/commit/393c452e3 )**: Add "nested-update" phase to Profiler API ([#20163](https://github.com/facebook/react/pull/20163)) //<Brian Vaughn>//
- **[13a62feab](https://github.com/facebook/react/commit/13a62feab )**: Fix path for SchedulerFeatureFlags ([#20200](https://github.com/facebook/react/pull/20200)) //<Ricky>//
- **[7a73d6a0f](https://github.com/facebook/react/commit/7a73d6a0f )**: (Temporarily) revert unmounting error boundaries changes ([#20147](https://github.com/facebook/react/pull/20147)) //<Brian Vaughn>//
- **[c29710a57](https://github.com/facebook/react/commit/c29710a57 )**: fix: useImperativeMethods to useImperativeHandle ([#20194](https://github.com/facebook/react/pull/20194)) //<Jack Works>//

jest_e2e[run_all_tests]

Changelog:
[General][Changed] - React Native sync for revisions c3e20f1...4d28eca

Reviewed By: mdvacca

Differential Revision: D26583597

fbshipit-source-id: a042df12c587fa9248d8de6f0b21b3ab231b3a7d
2021-02-25 22:32:33 -08:00
Joshua Gross 4e243ca7a3 Fix RTL scrolling
Summary:
We recently fixed RTL scrolling in Fabric on iOS: D26608231 (e5921f7f38)

Turns out, the mechanism for RTL scrolling on Android is completely different. It requires that content be wrapped in a "directional content view", which is `View` in LTR and `AndroidHorizontalScrollContentView` in RTL, backed by `ReactHorizontalScrollContainerView.java`.

iOS doesn't require that and just uses View and some custom logic in ScrollView itself.

In the future it would be great to align the platforms, but for now, for backwards-compat with non-Fabric and so we don't have to tear apart ScrollView.js, we codegen the AndroidHorizontalScrollContentView so it exists in C++, register the component, and stop mapping it to View explicitly in C++.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D26659686

fbshipit-source-id: 3b9c646dbdb7fe9527d24d42bdc6acb1aca00945
2021-02-25 10:09:32 -08:00
Rubén Norte eeb36f4709 Improve display names of root components in React Profiler
Summary:
Changelog:
[General][Added] - Added `debugName` parameter to `renderApplication` to use as the display name for the React root tree

Reviewed By: rickhanlonii

Differential Revision: D26637787

fbshipit-source-id: 3ddc037573f4434101a9d3dcb5592a127193481c
2021-02-25 03:01:14 -08:00
Joshua Gross 468bc62da3 Animated JS: clear out component refs on unmount
Summary:
"The instance should not stick around after unmount..." - Tim Yung, 2021

I have a hypothesis that, if a component instance of an animated component sticks around after unmount, it could cause memory leaks due to references to Fabric ShadowNodes across the JSI (this would not impact non-Fabric... in theory).

Wild guess. If OOMs disappear then maybe this hypothesis is correct, but it's a long shot. I figure there's ~no harm in doing this cleanup here anyway.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D26650348

fbshipit-source-id: 90633db650b65755cacfb52344e7b53e46c9b125
2021-02-24 17:15:30 -08:00
Joshua Gross 3e06af9394 Animated: Default to disabling view flattening for animated Views
Summary:
There's logic in Animated JS that prevents flattening of animated views in Fabric. However, we cannot actually detect Fabric vs non-Fabric in the first render pass; in the past we defaulted to assuming non-Fabric. Now we assume Fabric for View flattening purposes.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D26647393

fbshipit-source-id: c91b51aeeb4f352cc502bc018f086e36fd1ffd85
2021-02-24 16:37:12 -08:00
Nadiia D 7b09eb54e7 Use flow strict-local
Summary:
Changelog:
[General][Changed] TextInput: use flow strict-local

Reviewed By: kacieb

Differential Revision: D26573763

fbshipit-source-id: 9d7d48310dd41949d07ad7616c4713b521c2545d
2021-02-22 18:30:01 -08:00
Luna Wei 33ff4445dc Fix disabled behavior
Summary:
Changelog:
[General][Fixed] - Pass disabled prop to pressability config

Reviewed By: kacieb

Differential Revision: D26590399

fbshipit-source-id: dd4f8f25d1b243b2983cd4ffaadb5d3dc6f3ed3e
2021-02-22 16:56:48 -08:00
Nadiia D c4aa411ee3 Replace Touchable with usePressability hook
Summary:
Changelog:
[General][Changed] textInput component changes:
- use Pressability hook directly
- no more cloning the component

Reviewed By: yungsters, kacieb

Differential Revision: D26573762

fbshipit-source-id: 17b47c8b0b9af22796d6e1528e8e3c16b5ed5d51
2021-02-22 15:39:57 -08:00
Nadiia D 7f005e6077 Add cancelable prop, use mixed return type for event handlers
Summary:
Changelog:
[General][Added] Added `cancelable` prop to Pressable.
[General][Changed] Event handlers return mixed type instead of void.

Reviewed By: yungsters

Differential Revision: D26432837

fbshipit-source-id: c7bafdec085d08a06e859b45bff91a3b07d747ed
2021-02-19 17:54:19 -08:00
simek 927573c581 Flow: fix VirtualizedList issues, remove few no longer valid suppressions (#30128)
Summary:
This PR fixes few suppressed Flow issues in `VirtualizedList` component.

I have also removed few no longer valid Flow suppressions in `ActivityIndicator` and `ReactNativeTestTools`.

## Changelog
[General] [Fixed] - Flow: fix few issues in `VirtualizedList`,
[General] [Removed] - Flow: remove few no longer valid suppressions in `ReactNativeTestTools`

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

Test Plan: Successful run of `yarn flow` check.

Reviewed By: kacieb

Differential Revision: D26489398

Pulled By: lunaleaps

fbshipit-source-id: db71d8bfeb3b6dc5a2738a73ac6644aef4a0311b
2021-02-19 14:31:33 -08:00
Peter Argany 441d630ed0 Enable dev tools setup in bridgeless mode
Summary:
Changelog: [Internal]

I'm trying to get Fast refresh working in bridgeless mode. I need the `    require('./setUpReactRefresh');` line to be executed to do so.

I'm not sure why this was commented out in the first place, it seems to be working fine in FBiOS/FB4A.

Reviewed By: p-sun

Differential Revision: D26289573

fbshipit-source-id: 6151f781c31e3aadaebfeb759d3eb776e8b525cc
2021-02-19 13:47:25 -08:00
Peter Argany f0faa7843c Remove iOS10/tvOS10 support from remaining podfiles
Summary: Changelog: [iOS] Remove iOS10/tvOS10 support from remaining podfiles

Reviewed By: shergin

Differential Revision: D26410811

fbshipit-source-id: 9050346def5070338e709ff102a284a828821586
2021-02-19 13:47:25 -08:00
Luna Wei 224757e830 Remove FlowFixMe in VirtualizedSectionList
Summary:
Changelog:
[Internal][Fixed] - Remove FlowFixMe in VirtualizedSectionList

Reviewed By: kacieb

Differential Revision: D26497027

fbshipit-source-id: 57ea417041df643139068b084d69aaa4efb995fd
2021-02-18 13:46:52 -08:00
Paige Sun 10f8c1a1c0 Add ViewConfig for MultilineTextInput
Differential Revision: D26463558

fbshipit-source-id: fe73e60f9a03d865bc9deab59260321072151e22
2021-02-18 09:20:22 -08:00
Kacie Bawiec aaede1029d Remove UNSAFE_componentWillReceiveProps
Summary:
This diff removes `UNSAFE_componentWillReceiveProps` and adds the changes to `componentDidUpdate` instead.

Why use `componentDidUpdate`? When reading through the [React docs on removing UNSAFE_componentWillReceiveProps](https://reactjs.org/docs/react-component.html#unsafe_componentwillreceiveprops), it says:
> If you need to perform a side effect (for example, data fetching or an animation) in response to a change in props, use componentDidUpdate lifecycle instead.

The original usage of `UNSAFE_componentWillReceiveProps` updates the content inset when `props.contentInset` changes. However, we don't always want it to update if the content inset hasn't changed, as calling `setValue` will reset the animated value unnecessarily, and kill any current animations (which we don't want to do). [React Native doc on setValue for reference](https://reactnative.dev/docs/animatedvalue#setvalue).

Changelog:
[General] Use componentDidUpdate instead of UNSAFE_componentwillReceiveProps in ScrollView

Reviewed By: lunaleaps

Differential Revision: D26487276

fbshipit-source-id: 77419deacf5db676cd721b58f34932bd6ca2399f
2021-02-17 15:00:07 -08:00
Tim Yung 3af0c84aa5 RN: Simplify `RCTDeviceEventEmitter`
Summary:
Simplifies `RCTDeviceEventEmitter` to simply be an `EventEmitter`.

The only thing special about it is that all native events are emitted on it and that `NativeEventEmitter` composes it.

Changelog:
[General][Removed] - Removed `RCTDeviceEventEmitter.sharedSubscribers`.

Reviewed By: RSNara

Differential Revision: D26163660

fbshipit-source-id: aedff8323d86947220fc293a74a19a3981fd875a
2021-02-17 12:20:26 -08:00
David Vacca 34d3efe2ef TextInlineImage view configs
Summary:
Migrate RCTTextInlineImage to use NativeComponentRegistry

changelog: [internal] internal

Reviewed By: PeteTheHeat

Differential Revision: D26427141

fbshipit-source-id: 56c120f19493e17c9be4e467032e0a4f2244c0a9
2021-02-17 10:46:20 -08:00
David Vacca 769136ca3c Fix rendering of Text and TextInlineViews in Fabric + StaticViewConfigs enabled
Summary:
This diff fixes the render of Text and TextInlineViews when using Fabric + StaticViewConfigs enabled

Similar to Bridgeless mode, we want TextNativeComponent to render "createReactNativeComponentClass('RCTVirtualText..." instead of NativeText.

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Text/TextNativeComponent.js?commit=f044696a1a273dec1fac227898f5603682d4b19d&lines=59

UIManager.hasViewManagerConfig returns false for all components when using StaticViewConfigs enabled.
I'm changing this method to return true when the component is supported by static view configs:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/RKJSModules/EntryPoints/Fb4aBundle.js?commit=4661488cc6aab5078dc6b2afcbb0624e887346d5&lines=81-94

This is correct because hasViewManagerConfig is a new method that's used ONLY in two callsites:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Text/TextNativeComponent.js?lines=59

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Utilities/deprecatedPropType.js?lines=24

Although, this can fail if "hasViewManagerConfig" is started to be used as "feature detection" (see next diffs of the stack)

I'm open to other suggestions (please comment in the diff

My current plan is:

- Land this diff (or similar) to unblock static view configs experiment next week
- Include all codeGenNativeComponents into the list of static view configs
- Migrate callsites of getViewManagerConfig() -> hasNativeConfig() (only for components that have static view configs)
- Think/Discuss/Plan long term plan about feature detection

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D26427140

fbshipit-source-id: ce8bf00d6c9793ad17bdc65eb8476aaab63db066
2021-02-17 10:46:19 -08:00
Joshua Gross 84778d7cfd LayoutAnimation: ensure onCompleteCallback is called in Fabric and non-Fabric
Summary:
Previously this branch of code only ran on Fabric+iOS. It is also needed for non-Fabric+Android in case `setLayoutAnimationEnabledExperimental` is not called on Android and an animation is queued up.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D26466482

fbshipit-source-id: 11c50bf94daa287a619f2b623785b60675eb6cf0
2021-02-17 10:33:58 -08:00
Kacie Bawiec 1641d46529 Replace UNSAFE_componentWillMount with componentDidMount
Summary:
Changelog:
[General] Replace UNSAFE_componentWillMount with componentDidMount in ScrollView

Reviewed By: nadiia

Differential Revision: D26375818

fbshipit-source-id: 1a33a7fddcf78c05cc1e4f04bd85b48a59290560
2021-02-17 09:58:10 -08:00
Kacie Bawiec 099f67cf8a Move ScrollResponder.Mixin methods into ScrollView and Remove ScrollResponder.js
Summary:
The purpose of this diff is to move all of the ScrollResponder methods into ScrollView to delete ScrollResponder.Mixin.

NOTE: ScrollResponder.Mixin uses a variable named "state" but it does not use React state correctly. Instead of calling `setState()`, state is set using `this.state.item = 123` ([example](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Components/ScrollResponder.js?lines=315)).  This means these are not actually React state - these are functionally just variables. In this stack, these "state" items from ScrollResponder are turned into regular internal variables.

Changelog:
[General][Removed] Moved ScrollResponder.Mixin methods into ScrollView to Remove ScrollResponder.js

Reviewed By: lunaleaps, nadiia

Differential Revision: D20715880

fbshipit-source-id: 99441434a6dc1c8ff3f435e7d6ec2840821e4e05
2021-02-16 08:03:11 -08:00
David Vacca 5d500f4dbc Remove log in PaperUIManager
Summary:
Removing log in PaperUIManager since this is logging warn messages for "Text" components

changelog: [internal] internal

Differential Revision: D26315745

fbshipit-source-id: 8871148b0fc1791e1723962f1f2477cd5e0c562d
2021-02-15 21:07:25 -08:00
Luna Wei 0939b938b2 Remove FlowFixMe on ref
Summary:
Changelog:
[Internal][Fixed]:Remove FlowFixMe VirtualizedSectionList ref

Reviewed By: nadiia

Differential Revision: D26381836

fbshipit-source-id: ed9a687c50a05f1176d99e6e6bd362ac830fbfae
2021-02-12 14:49:19 -08:00
Luna Wei 4e6d33a112 Remove UNSAFE_componentWillReceiveProps
Summary:
Changelog:
[General][Fixed] Remove UNSAFE_componentWillReceiveProps from VirtualizedSectionList

Reviewed By: nadiia

Differential Revision: D26381837

fbshipit-source-id: b029c82e4090369c76f303e71a3c9158e34ad82e
2021-02-12 14:49:19 -08:00
Pieter De Baets a8b5b63d4e Remove unused promiseRejectionIsError
Summary: Changelog: [Internal]

Reviewed By: MichaReiser

Differential Revision: D26338073

fbshipit-source-id: 7b4d8881ffc58ee93b1ccf58e6717a4a8597dece
2021-02-10 07:57:17 -08:00
Micha Reiser cb0764eeb0 Upgrade react-hooks rules
Summary:
Upgrades the `react-hooks` eslint-rules to `4.2.0`

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D26366235

fbshipit-source-id: 04628e8f2a6c56eacba516d877df143c6c81adb8
2021-02-10 07:43:52 -08:00
Tim Yung d39643b9de RN: Rewrite `NativeEventEmitter`
Summary:
Rewrites `NativeEventEmitter` to not extend `EventEmitter` and to compose `RCTDeviceEventEmitter` instead of (mis)using its exported `sharedSubscriber` property.

This makes it easier to reason about `NativeEventEmitter`. Also, the extraneous methods on `EventEmitter` are no longer inherited.

Changelog:
[General][Removed] - `NativeEventEmitter` no longer inherits from `EventEmitter`, so it no longer implements `removeListener` and `removeSubscription`. Instead, use the `remove()` method on the subscription object returned by `addListener`.

Reviewed By: rubennorte

Differential Revision: D26163562

fbshipit-source-id: c1aadb99bdefbaa36fece57ce74604e414f94d4d
2021-02-09 21:27:45 -08:00
Tim Yung 1049835b50 RN: Simplify `Keyboard`
Summary:
Simplifies `Keyboard` by removing redundant methods and changing `addEventListener` to return an `EventSubscription`.

Changelog:
[General][Changed] - `Keyboard.addListener` now returns an `EventSubscription` object.
[General][Removed] - Removed `Keyboard.removeListener`. Instead, use the `remove()` method on the object returned by `Keyboard.addListener`.
[General][Removed] - `Keyboard` no longer inherits from `NativeEventEmitter`, so it no longer implements `removeAllListeners`, and `removeSubscription`.

Reviewed By: milroc

Differential Revision: D26163536

fbshipit-source-id: b4bd91627cd027a13fcba269a253823913eb7589
2021-02-08 17:49:31 -08:00
Tim Yung 88a41f180c LogBox: Intelligently Un-Collapse Stack Frames
Summary:
Tweaks LogBox so that if all stack frames are collapsed, start off without collapsing any of them.

It saves developers from one extra interaction to make the LogBox actually useful for errors where every frame is ignored.

Changelog:
[General][Changed] - LogBox will not initially collapse stack frames if every frame would be collapsed.

Differential Revision: D26266195

fbshipit-source-id: dcdbe0834da5fc3a0bf49fb7857de30dd7e4b8cb
2021-02-08 17:17:57 -08:00
Kacie Bawiec 1c7d9c8046 Fix disabled prop not disabling onPress for voice assistant
Summary:
It is currently possible to activate a disabled Pressable with VoiceOver/TalkBack. This fixes this.

Changelog:
[General][Fixed] Fix disabled prop not disabling onPress for voice assistant

Reviewed By: blavalla

Differential Revision: D26225448

fbshipit-source-id: 67fa10f9e5c50143d986dc709a2fb639fdc3e718
2021-02-08 15:18:50 -08:00
Tim Yung 6c0f5d1178 Fabric: Fix DevTools Inspector
Summary:
Fixes a bug when using Fabric with React DevTools to inspect a component.

The bug is due to the shape of instances being a bit different. These are where Paper and Fabric create instances differently:

- Paper: [ReactNativeHostConfig.js](aa736a0fa6/packages/react-native-renderer/src/ReactNativeHostConfig.js (L138))
- Fabric: [ReactFabricHostConfig.js](aa736a0fa6/packages/react-native-renderer/src/ReactFabricHostConfig.js (L218-L236))

Changelog:
[Internal]

Reviewed By: TheSavior

Differential Revision: D26265476

fbshipit-source-id: dfc510dc3854e1478d20a4c612237b1c2da608eb
2021-02-04 17:17:17 -08:00
David Vacca 3d0e974ed8 Add logs in the getViewManagerConfig
Summary:
This diff adds error logs when the method getViewManagerConfig() can't find a ViewConfig associated to a view manager

changelog: [inernal] internal

Reviewed By: JoshuaGross, ShikaSD

Differential Revision: D26231245

fbshipit-source-id: d9252dcdcb84464d57342058a928881ebbb1b68c
2021-02-04 15:56:15 -08:00
Valentin Shergin 338ce93648 Fabric: `setNativeProps` methods was removed from `FabricUIManager` Flow type declaration
Summary:
FabricUIManager does not support it, the declaration is not correct.

Changelog: [Internal] Fabric-specific internal change.

Created from Diffusion's 'Open in Editor' feature.

Differential Revision: D26241483

fbshipit-source-id: 8a894dc847bce9c196d8ac2e1601853e4fe03e1d
2021-02-04 13:55:43 -08:00
Tim Yung 6f22989e92 RN: Simplify `AppState`
Summary:
Simplifies `AppState` by removing redundant methods and changing `addEventListener` to return an `EventSubscription`.

Changelog:
[General][Changed] - `AppState.addEventListener` now returns an `EventSubscription` object.
[General][Removed] - Removed `AppState.removeEventListener`. Instead, use the `remove()` method on the object returned by `AppState.addEventListener`.
[General][Removed] - `AppState` no longer inherits from `NativeEventEmitter`, so it no longer implements `addListener`, `removeAllListeners`, and `removeSubscription`.

Reviewed By: wtfil

Differential Revision: D26161343

fbshipit-source-id: b3cff76bf0f8f7d79cd954fdef551d0654c682ca
2021-02-04 12:48:13 -08:00
Tim Yung c8c975f0d7 RN: Remove `RCTDeviceEventEmitter` Checks
Summary:
Removes the checks in `RCTDeviceEventEmitter` that were initially added to migrate call sites to other modules when `NativeEventEmitter` was introduced.

This set of checks is problematic for a few reasons:

1. Does not cover many other events that have since been introduced, so the small list covered is arbitrary.
2. Prevents composition of `RCTDeviceEventEmitter` in the implementation of those modules.
3. Code bloat.

Changelog:
[General][Removed] - `RCTDeviceEventEmitter` no longer throws for `SttatusBar`, `Keyboard`, and `AppState` events. However, you are still recommended to use the more appropriate modules for listening to these events.

Reviewed By: lunaleaps

Differential Revision: D26163602

fbshipit-source-id: 316287bfdf2947fe85d022a3f83a205e89c432ba
2021-02-03 22:04:40 -08:00
Ramanpreet Nara 690a29355e Make PaperUIManager.getViewManagerConfig log thrown exceptions
Summary:
When NativeUIManager.getConstantsForViewManager throws an exception from native, we just swallow that exception and set null as the view config. Instead, we should log that an error occurred. This way, we can tell if the NativeModule sync method call returned undefined, or if the NativeModule sync method call thew an exception.

I'll take a look and see if we can add this logging higher up in the native stack, so that we can actually capture the stack information from this NativeModule sync method call failure.

Created from Diffusion's 'Open in Editor' feature.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26227379

fbshipit-source-id: 02b516d247f82f873f059005e6a2cc6f2a64fdb5
2021-02-03 11:47:58 -08:00
Tim Yung 6d1aca806c RN: Delete `Linking.removeEventListener`
Summary:
Deletes `Linking.removeEventListener` in favor of returning the `EventSubscription` returned by `NativeEventEmitter.addListener`.

Changelog:
[General][Added] - `Linking.addEventListener` now returns a subscription with a `remove()` method.
[General][Removed] - Removed `Linking.removeEventListener`. Instead, call `remove()` on the subscription returned by `Linking.addEventListener`.

Reviewed By: rubennorte, wtfil

Differential Revision: D26155896

fbshipit-source-id: 1176ec6eae1c0fff2d68acf5411a18da530b212a
2021-02-02 19:36:21 -08:00
Micha Reiser 93377ff508 Remove "use strict" directive from ES Modules
Summary:
ES Modules implicitly enable strict mode. Adding the "use strict" directive is, therefore, not required.

This diff removes all "use strict" directives from ES modules.

Changelog:

[Internal]

Reviewed By: motiz88

Differential Revision: D26172715

fbshipit-source-id: 57957bcbb672c4c3e62b1db633cf425c1c9d6430
2021-02-02 11:12:56 -08:00
Tim Yung 41b6884a1b RN: Implements `EventSubscription`
Summary:
Changes the to-be-legacy `_EventSubscription` and `_EmitterSubscription` classes to implement the event-agnostic `EventSubscription` interface.

This interface is valuable because it abstracts away the event definitions.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D26155911

fbshipit-source-id: f94280976d4f9219f4780ac8fae0d5fbc1865386
2021-02-01 17:50:22 -08:00
Tim Yung 70cd569e7e RN: Simplify `DevSettings` Implementation
Summary:
Simplifies the implementation of `DevSettings`. The fact that it uses `NativeEventEmitter` is an implementation detail and does not need to be exposed via inheritance.

This also enables more code to be removed from production builds (because the development implementation is now statically enclosed by `__DEV__`).

Changelog:
[General][Changed] - `DevSettings` no longer inherits from `NativeEventEmitter`

Reviewed By: RSNara

Differential Revision: D26140148

fbshipit-source-id: 99fa9d0c6ce8e365f89936aa12a4720f7a04b984
2021-02-01 17:50:22 -08:00
Tim Yung f5f47879b8 RN: Delete `NativeEventEmitter` Options
Summary:
Removes the `options` argument in the `NativeEventEmitter` constructor. It was only being used for an experimental flag that is no longer necessary.

Changelog:
[General][Removed] - Removed second optional argument of `NativeEventEmitter` constructor

Reviewed By: RSNara

Differential Revision: D26138239

fbshipit-source-id: 0481ce44f0464668e3a6e7ffaf079d17c87afd42
2021-02-01 17:50:21 -08:00
Janic Duplessis 12fccdeea3 Make codegen more reliable on iOS (#30792)
Summary:
This addesses a few issues I noticed while migrating my app to the new build-time codegen on iOS.

1. I noticed random failures because of codegen on iOS. This is mostly due to the fact the codegen output files are not specified in the xcode script. The only reason it works relatively fine currently is because the codegen output is inside the input files directory. This has the side effect of causing files to be regenerated every build, then causes all core modules to be recompiled which adds up a significant amount of time to rebuilds. To fix this I added the generated files to the script phase output and moved the FBReactNativeSpec dir outside of the codegen source (Libraries). I moved it to the React directory as this seemed to make sense and is where a lot of iOS files are as well as the core modules. Note this might require internal changes. This removes the circular dependency between our build phase input and output so consecutive builds can be cached properly.

2. Add `set -o pipefail` to the xcode script, this helped propagate errors properly to xcode because of the `| tee` pipe so it fails at the script phase and not later with a header not found error. Also add `2>&1` to pipe stderr to stdout so errors are also captured in the log file.

3. Add the `-l` flag to the bash invocation to help finding the yarn binary. With my setup yarn is added to the system PATH in my user .profile. Adding this file will cause bash to source the user environment which xcode scripts does not by default. I think this will help with most setups.

4. If yarn is not found the `command -v yarn` would make the script exit without any output because of the -e flag. I made a change to ignore the return code and check later if YARN_BINARY is set and have an explicit error message if not.

## Changelog

[iOS] [Fixed] - Make codegen more reliable on iOS

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

Test Plan:
Tested various project states to make sure the build always succeeds in RN tester:

- Simulate fresh clone, remove all ignored files, install pods, build
- Build, delete FBReactNativeSpec generated files, build again
- Build, build again, make sure FBReactNativeSpec is cached and not rebuilt
- Make the script fail and check that xcode shows the script error logs properly

![image](https://user-images.githubusercontent.com/2677334/105891571-c8badd00-5fde-11eb-839c-259d8e448523.png)

Note: Did not test fabric

Reviewed By: fkgozali

Differential Revision: D26104213

Pulled By: hramos

fbshipit-source-id: e18d9a0b9ada7c0c2e608d29ffe88087f04605b4
2021-02-01 14:39:25 -08:00
Joshua Gross 6eea5974cf LayoutAnimations.js: ensure that onComplete callback is always called, even if LayoutAnimations is disabled on iOS
Summary:
See comments. On iOS in Fabric, LayoutAnimations is only conditionally enabled; whereas on Android it's always enabled. That means for code on iOS that relies on the onComplete callback, there might be bugs.

Ensure the callback is always called on iOS by racing a timer with the animation completion.

This will be deleted before Fabric "ships" fully.

Impact is minimal since this change is scoped to only run on iOS and under Fabric.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D26166237

fbshipit-source-id: 9a07a402845c379e1511f199eef3d3e249e1eb06
2021-02-01 11:57:33 -08:00
Tim Yung a81b7d18fa RN: Cleanup RCTNetworking (iOS)
Summary:
Refactors `RCTNeworking.ios.js` so that event registration does not get passed along to `NativeNetworkingIOS`. Instead, we go straight to `RCTDeviceEventEmitter` (which is what `NativeEventEmitter` ultimately does when `nativeModule` is not supplied).

This optimization reduces overhead of making network requests, and it is made possible because `NativeNetworkingIOS` does not actually do any meaningful work when `startObserving` is invoked.

Changelog:
[iOS][Removed] - Removed event methods except `addListener` from `Networking`

Reviewed By: lunaleaps

Differential Revision: D26137965

fbshipit-source-id: b6e0288689459ddb8ecf8d34dce6250d3b0ecb59
2021-02-01 11:04:37 -08:00
Samuel Susla 88c43490a1 Fix initial placeholder in multiline TextInput
Summary:
Changelog: [internal]

`[self _invalidatePlaceholderVisibility]` wasn't triggered in multiline text input in Fabric. Even in Paper it was triggered what to me seems like coincidence rather than intention (I might be wrong). This is more explicit, visibility of placeholder text needs to be re-evaluated every time placeholder text is changed.

Reviewed By: shergin

Differential Revision: D26172754

fbshipit-source-id: 3a767d333b79c266a3d70a96883b1289fff16750
2021-02-01 10:59:38 -08:00
Tim Yung ef765d423c RN: Move `TOUCH_TARGET_DEBUG` to PressabilityDebug
Summary:
This is just cleanup. When I migrated components to `Pressability` instead of `Touchable`, I left `TOUCH_TARGET_DEBUG` alone to minimize moving pieces. But I had created `PressabilityDebug` as the eventual destination for this logic.

Now that `Text` is migrated away from `Touchable` (see D26106824 (f275514f27)), this cleans up the final internal reference to `Touchable`.

Changelog:
[General][Changed] - `Touchable.renderDebugView` now accepts `ColorValue` instead of `string | number`.
[General][Removed] - Removed `Touchable.TOUCH_TARGET_DEBUG` property.

Reviewed By: kacieb

Differential Revision: D26108570

fbshipit-source-id: 2694c9a9c29182ae04a77ba6c2e4406fcd5a277e
2021-01-28 14:13:43 -08:00
Joshua Gross 99b7052248 Implement sendAccessibilityEvent in the React(Fabric/non-Fabric) renderer
Summary:
`sendAccessibilityEvent_unstable` is a cross-platform, Fabric/non-Fabric replacement for previous APIs (which went through UIManager directly on Android, and a native module on iOS).

Changelog: [Added] sendAccessibilityEvent_unstable API in AccessibilityInfo and sendAccessibilityEvent in React renderer

Reviewed By: kacieb

Differential Revision: D25821052

fbshipit-source-id: 03f7a9878c95e8395f9102b3e596bfc9f03730e0
2021-01-27 17:37:38 -08:00
Tim Yung f275514f27 RN: Modernize `Text` Component
Summary:
Rewrites the `Text` component using modern best practices.

Notably, `Text` no longer depends on `Touchable` and now instead depends on `Pressability`.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D26106824

fbshipit-source-id: 0797e66075ae03c51dd5b4b3395b21ae92c39ba6
2021-01-27 16:20:20 -08:00
David Vacca 3dd3123113 Avoid retrieving view configs on Text component
Summary:
This diff avoids retrieving view configs on Text component when static view configs are enabled

changelog: [interrnal]

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D25577278

fbshipit-source-id: 674b8067cea13d284848e35dabaf26cd1bea4e27
2021-01-26 14:05:34 -08:00
David Vacca 4cdafd997a Add supoprt for Text Input view configs
Summary:
This diff adds TextInput in the list of components that support static view configs

changelog: [internal]

Reviewed By: yungsters

Differential Revision: D26040854

fbshipit-source-id: d6b5d3a78ef4657acf3f2c4ebe527ad4ca40bcb5
2021-01-26 14:05:33 -08:00
David Vacca e68cf7cee9 Avoid the call to getViewManagerConfig on deprecatedPropType method
Summary:
This diff removes the call to UIManager.getViewManagerConfig into the deprecatedPropType method when static view configs are enabled

This was necessary to avoid innecessary calls to UIManager.getViewManagerConfig and to avoid loading UIManagerModule classes when static view configs are enabled

changelog: [internal] internal

Reviewed By: fkgozali, yungsters

Differential Revision: D26040855

fbshipit-source-id: 82cad9f4abe9898e781fd989ebaa03497dad926b
2021-01-26 14:05:33 -08:00
David Vacca ec7b2085d8 Refactor StaticViewConfigsPaperUIManager to avoid loading NativeUIManager.js
Summary:
This diff refactors the StaticViewConfigsPaperUIManager to avoid loading NativeUIManager.

This is part of a experiment to prevent loading UIManagerModule class in native.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D25630215

fbshipit-source-id: 40d6f3b36ad4c3377820b1dcf0bd949db063d899
2021-01-26 14:05:33 -08:00
David Vacca dd60414578 Change flow types of RefreshControl.size prop
Summary:
This diff changes the flow types of RefreshControl.size prop from 'int' to string'. For more context see previous diff of the stack.
This diff will be landed as soon as the native release containing D25933458 (65975dd28d) goes to production.

It's important to clarify that there are currently no usages of this prop in production

Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'

Reviewed By: JoshuaGross

Differential Revision: D25933457

fbshipit-source-id: 2f34566f2f8a097e6d40f63c09ecb3ada2fd8409
2021-01-25 21:05:56 -08:00
Nadiia D 881860886c TextInput: sort props
Summary:
Changelog:
[General][Changed] - Refactor TextInput component

Reviewed By: lunaleaps

Differential Revision: D26009114

fbshipit-source-id: 25676a93d59d43ec6c5073fc481d4b9cd20e2f9a
2021-01-22 13:13:57 -08:00
Ramanpreet Nara 5a2099fe7d Rename rn_codegen_modules(native_module_spec_name => name)
Summary: Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25963929

fbshipit-source-id: 4c82562404a21b5a1789d11ae2d228411329fee5
2021-01-21 19:04:54 -08:00
Ramanpreet Nara 93e4170d03 Rename NativeModule schema targets
Summary:
NativeModule schema targets will now take the form '{library_name}-codegen-modules-schema'.

NOTE: Will launch the necessary diffs to make the same refactor in our component codegen.

Changelog: [Internal]

Differential Revision: D25968071

fbshipit-source-id: 1d7c9f4679e4ae6c26c9a29a74fa7b7ea76460eb
2021-01-21 19:04:53 -08:00
Brandon Baumgarten 17aa1e320e Fix image loop counter on iOS 14 (#30744)
Summary:
Animated gifs, which do not loop, currently animate twice on iOS 14.
See: https://github.com/facebook/react-native/issues/30147

## Changelog

[iOS] [Fixed] - Animated images without loop no longer animate twice

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

Test Plan:
Run the example app with any animated gif. I attached a gif, which is affected.

![checkmark](https://user-images.githubusercontent.com/54310840/104746529-b2e02900-574f-11eb-9870-0c03c769c990.gif)

Reviewed By: sammy-SC

Differential Revision: D25977626

Pulled By: PeteTheHeat

fbshipit-source-id: 889d4a7bed8f7a7be6a9a427501d0071b7c02b8c
2021-01-21 10:56:14 -08:00
Peter Argany b32e996898 Fix RCTNetworking yellow box
Summary:
Since `RCTNetworking` overrides init, it requires main queue setup. Native module infra currently throw a yellowbox if a module forgets it.

This diff fixes that.

{F361182429}

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25962402

fbshipit-source-id: d847117cbfe0a191dc1882898711693c6fda68cd
2021-01-20 12:57:40 -08:00
sirpy 8facc865ab fix: save connection url as class variable
Summary:
Conform with Websocket javascript api.
related to web3js issues: https://github.com/ethereum/web3.js/issues/2864 https://github.com/ethereum/web3.js/issues/2602

Reviewed By: javache

Differential Revision: D25927475

Pulled By: TheSavior

fbshipit-source-id: 26b2df0565dac581d546b6824dd4f0fc2c8cdc32
2021-01-18 21:58:53 -08:00
David Vacca 65975dd28d Change type of SwipeRefreshLayoutManager.size prop from Int to String
Summary:
This diff changes the type of the SwipeRefreshLayoutManager.size prop from Int to String in Fabric.

The current implementation of this prop allows JS developers to use "int" type when fabric is enables and "int or string" types when using Fabric is disabled.
Since long term we want to only support "string" type for this prop, I'm changing the type of the prop to be String.

After my diff Fabric will start supporting only "string" types, non fabric screens will keep supporting "int or string" values.

**Will this break production?**
No, because there are no usages of RefreshControl.Size prop in fbsource

**What about if someone start using this prop next week?**
IMO It's very unlikely because of the nature of this prop, I will be monitoring next week and if there's an usage it will be detected by flow when trying to land D25933457.

Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'

Reviewed By: JoshuaGross

Differential Revision: D25933458

fbshipit-source-id: 55067d7405b063f1e8d9bb7a5fd7731f5f168960
2021-01-17 02:57:02 -08:00
Ramanpreet Nara 1f017617ac Stop passing in the schema from JavaScript
Summary:
This concludes the JavaScript clean for TurboModule JavaScript codegen teardown.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25915168

fbshipit-source-id: 1decc394ff63b1d39d270fc048e817501ea388ea
2021-01-14 19:14:23 -08:00
Vladislav Shabanov 6e36d046a3 Fix ScrollView getInnerViewNode and getInnerViewRef ref methods (#30588)
Summary:
Currently ScrollView ref's `getInnerViewNode` and `getInnerViewRef` are unbound and don't work as expected returning empty values. The origin of this problem probably is issued by d2f314af75

Working example of the problem is available here: https://github.com/vshab/RNGetInnerViewBug

This PR binds getInnerViewNode and getInnerViewRef to ScrollView and adds test checking the value of getInnerViewRef.

Before:
![Simulator Screen Shot - iPhone 11 - 2020-12-15 at 02 07 03](https://user-images.githubusercontent.com/6755908/102149544-c7df4900-3e7f-11eb-89de-de39a28fbdb3.png)
After:
![Simulator Screen Shot - iPhone 11 - 2020-12-15 at 01 49 31](https://user-images.githubusercontent.com/6755908/102149559-d168b100-3e7f-11eb-8b27-031c9e43112c.png)

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

[JavaScript] [Fixed] - ScrollView: Fix `getInnerViewNode` and `getInnerViewRef` ref methods

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

Test Plan:
1. The test checking the value of getInnerViewRef is added.
2. Example app demonstrating the problem is provided with before/after screenshots.

Reviewed By: TheSavior, nadiia

Differential Revision: D25916413

Pulled By: kacieb

fbshipit-source-id: bf18079682be7c647b8715bd0f36cf84953abcfa
2021-01-14 14:45:55 -08:00
Luna Wei cfd39bc656 Provide default for cachebreaker value
Summary:
Changelog:
[Internal][Fixed] - Add a default value for the cache breaker value

Reviewed By: fkgozali

Differential Revision: D25907137

fbshipit-source-id: 243346cbc67d1a85519bb469f4d68d61676ba547
2021-01-14 14:11:10 -08:00
Tim Yung 1433ed6333 Text: Restore `android_hyphenationFrequency`
Summary:
Restore the `android_hyphenationFrequency` attribute in the view config for `Text`. This was accidentally dropped by D23708205 (06ce643565) (06ce643565).

Changelog:
[Android][Fixed] - Restore `android_hyphenationFrequency` on `Text`.

Reviewed By: mdvacca

Differential Revision: D25889971

fbshipit-source-id: 622eef618370efdd9a8b060ccd3272e25de218fa
2021-01-13 10:11:12 -08:00
Moti Zilberman 05e380f26c Type AsyncStorage
Summary:
Types the AsyncStorage module with Flow.

Changelog: [Internal]

Reviewed By: MichaReiser

Differential Revision: D25884607

fbshipit-source-id: 7762ebfc68b87e6c5a0d8100fcc564f002061f5c
2021-01-12 11:14:27 -08:00
Samuel Susla c42a59af7e Fix detection of Fabric in ScrollViewStickyHeader
Summary:
Changelog: [internal]

Revert a change introduced in https://github.com/facebook/react-native/pull/30333 where rickhanlonii asked it to be reverted as well.

The change breaks sticky header in Fabric.

Reviewed By: rubennorte

Differential Revision: D25883861

fbshipit-source-id: b01305c6def390d0664c7be939ab3fc72186a07a
2021-01-12 09:59:03 -08:00
Peter Argany a1d626739d Delete iOS10/tvOS10 support from React Native Libraries
Summary:
allow-large-files

Changelog: [iOS] Remove iOS10/tvOS10 suppport

Similar to D19265731 (674b591809) for iOS9.

I just ran this command:
`find . -type f -exec sed -i '' 's/{ :ios => "10.0" }/{ :ios => "11.0" }/' {} +`
and then updated pods

Reviewed By: fkgozali

Differential Revision: D25693227

fbshipit-source-id: 0073d57ecbb268c52d21962cef202316857bcbd2
2021-01-11 16:46:16 -08:00
Valentin Shergin e37e56b042 Back out "Add onFocus and onBlur to Pressable."
Summary:
I suspect it's causing T82781515.

Changelog:
[Category][Type] - Backout of "[react-native][PR] Add onFocus and onBlur to Pressable."

Reviewed By: p-sun

Differential Revision: D25864414

fbshipit-source-id: efba9136edba97d5bd2a0de15f9ddae7dfd24e51
2021-01-10 13:56:27 -08:00
Ramanpreet Nara 4bf03e1f23 Stop force including OSS specs in TMMDelegate codegen
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D25844710

fbshipit-source-id: b80c29335fbac6941918c07f24027971359d0df2
2021-01-08 14:44:00 -08:00
Igor Klemenski cab4da7288 Add onFocus and onBlur to Pressable. (#30405)
Summary:
Starting to upstream keyboard-related features from React Native Windows - this is the Android implementation.
Exposing onFocus and onBlur callbacks on Pressable; they're already declared for View in ViewPropTypes.js, which Pressable wraps.

Registering event listeners in ReactViewManager to listen for native focus events.
## 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 onFocus/onBlur for Pressable on Android.

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

Test Plan:
Tested on v63-stable, since building master on Windows is now broken. Screenshots from RNTester running on the emulator:
![image](https://user-images.githubusercontent.com/12816515/99320373-59777e80-2820-11eb-91a8-704fff4aa13d.png)
![image](https://user-images.githubusercontent.com/12816515/99320412-6f853f00-2820-11eb-98f2-f9cd29e8aa0d.png)

Reviewed By: mdvacca

Differential Revision: D25444566

Pulled By: appden

fbshipit-source-id: ce0efd3e3b199a508df0ba1ce484b4de17471432
2021-01-08 13:59:48 -08:00
Kshitij Kotasthane 835117aba3 Added sharedAction example to Share API (#30333)
Summary:
* Added an example for `sharedAction` and `dismissedAction` in Share API examples

**Motivation** - Missing example for `sharedAction` in examples

## 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] - Added an example in ShareExample.js

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

Test Plan:
* Tested on Android

![sharedAction](https://user-images.githubusercontent.com/26821140/98447958-ed758600-214e-11eb-8a50-67ad5dcebea5.png)

Reviewed By: cpojer

Differential Revision: D25246375

Pulled By: rickhanlonii

fbshipit-source-id: f0d25a04c77ba02c9bea07aceccbfb65b2aa67e9
2021-01-08 12:41:32 -08:00
Pieter Vanderwerff f2052fedc2 Land suppressions for 0.142.0 release to xplat
Summary:
This change contains the suppressions for the up coming v0.142.0 Flow release.

The new suppressions are a result the following changes:
* Disallow flowing functions or inexact objects to indexed objects to improve object soundness. This can cause errors if you are passing a function or inexact objects when an indexed object is expected.
* Flow now processes imports before checking the body of a file. In some rare cases this can expose previously skipped errors due to the processing order.

Reviewed By: mroch

Differential Revision: D25820434

fbshipit-source-id: 59cc1d852ffc8cc39f0d5112ce485fb33f05c092
2021-01-07 11:33:45 -08:00
Rubén Norte fa406ac2aa Implement typed event emitters
Summary:
Adds types to Event Emitters and migrates the most relevant modules using them in `react-native`.

The most relevant file of this diff is `react-native/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js` with the Flow tests showing and testing the behavior of the new types

Changelog: [Internal] Add types for Event Emitters and subclasses

Reviewed By: motiz88

Differential Revision: D25587936

fbshipit-source-id: feeb09f9ad15d383cdd82deaaaba0d12b94e868b
2021-01-07 03:19:04 -08:00
Micha Reiser 306edff62c Pass Systrace and Refresh as globals
Summary:
The `Systrace` and `Refresh` dependencies are injected into the `metroRequire` implementation by assigning the values to e.g. `require.Systrace = ...`.

The issue with this approach is that some `require` implementations might not support extending the `require` object or doing so results in a degraded performance. An example where this is the case is Hermes where changing the `require` object forces Hermes to opt out of the static require optimization.

This diff extends Metro so that the `Systrace` and `Refresh` implementation can either be injected by assigning to `require.Systrace` or by exposing the implementation in the global scope. It further changes the `Systrace` and `Refresh` modules to inject the instances using the global scope instead of extending `require`.

Changelog:
[Internal][Changed] - Expose Systrace and ReactRefresh as globals instead of extending require.

Reviewed By: motiz88

Differential Revision: D25693381

fbshipit-source-id: 254d66d43e7a56d3310cf1a17d5146b8d1307562
2021-01-04 07:40:19 -08:00
Rubén Norte e2033c5b7b Add FlowFixMes for future violations of typed EventEmitter
Summary:
This prevents having to modify too many files when we add the proper typing for that module

Changelog: [Internal]

Reviewed By: nadiia

Differential Revision: D25586848

fbshipit-source-id: 16001ada4a37a58f83b6e5a4400daebf9257be72
2021-01-04 03:56:57 -08:00
Rubén Norte c7463f0059 Add FlowFixMes for future violations of typed NativeEventEmitter
Summary:
Migrates all usages of `NativeEventEmitter` to `NativeEventEmitter<$FlowFixMe>`.

This prevents having to modify a very large number of files in the same change that adds support for typed events. It adds an unused typed parameter to `NativeEventEmitter` so we can change all usages to add `$FlowFixMe`.

Changelog: [Internal]

Reviewed By: nadiia

Differential Revision: D25575774

fbshipit-source-id: c7979e1502e980401d9c03456282eba333c1606d
2021-01-04 03:56:57 -08:00
Rubén Norte 1e7536a070 Migrate CodegenTypes and dependencies to Flow strict
Summary:
Migrates `CodegenTypes` and its transitive dependencies to Flow strict to unblock this mode in Native Modules and Native Components.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D25540629

fbshipit-source-id: 7bed2ee58af7a789b50932734c7a86cf1719e2c5
2021-01-04 03:56:57 -08:00
Rubén Norte e088a4fe9c Add support for UnsafeObject to allow using Flow strict in native modules
Summary:
This new type will be valid in Flow strict mode and can be used by native modules and components to replace `Object`, with the same semantics.

This unblocks the migration of the most modules in the React Native package to Flow strict.

Changelog: [Internal] Add UnsafeObject type compatible with Flow strict mode to use in native modules and components

Reviewed By: RSNara

Differential Revision: D25540631

fbshipit-source-id: 60b80bbc84a53aecc747e3a1799cdf551e1859cd
2021-01-04 03:56:57 -08:00
Joshua Gross 053b8f6c93 Fix typo in ReactNativeTypes
Summary:
Faric -> Fabric

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25734126

fbshipit-source-id: 5d0bb02482fd713601de0a22477c5b5c39daf522
2020-12-30 12:23:20 -08:00
Héctor Ramos 811ccec74e Add use_react_native_codegen!
Summary:
Consolidate CocoaPods codegen scripts under a single `use_react_native_codegen!` method in `react_native_pods.rb`.

This is the first step towards making the codegen scripts library-agnostic. There are still a handful of hardcoded assumptions in place (e.g. the output directory structure, the use of a separate directory for components), but with some work one would be able to add codegen support to arbitrary CocoaPods podspecs.

The codegen script no longer takes a CODEGEN_PATH argument, and will instead attempt to use the local react-native-codegen package if available, and fallback to using the node_modules/react-native-codegen package if not.

## Usage

The `use_react_native_codegen!` method has two arguments:

- `spec`, a pod [Specification](https://www.rubydoc.info/github/CocoaPods/Core/Pod/Specification) object.
- `options`, an optional object. Supported keys:
  - `:srcs_dir`, the path to your JavaScript sources. Your native module or component specs should be located somewhere in this directory.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25728053

fbshipit-source-id: feec587b656d5b220598ce6196ea6bb34a9580a9
2020-12-29 16:10:34 -08:00
Valentin Shergin 00e038689d TextInput measuring error in ScrollResponder downgraded to a warning
Summary:
Even though replacing an error with a warning does not look like a future-proof solution here are the reasons for this:
* The measuring operation might just fail because of the async nature of React Native. And here, from my understanding, we don't even have a good reason for measuring. Auto-scrolling to selected textinput (which is the reason for this code, AFAIK) is a standard feature that OS does for all text input. I suspect that this (very old) feature was built in a timeframe where this system feature was originally broken (sometime before 2016).
* This product-facing API does not have an error-callback, so just loggin an error here is as (not) actionable as logging a warning.
* The error callback was never implemented in the pre-Fabric world, so it *never* got called for years, and now when Fabric is starting calling in some cases, it is being "punished" for this. In the next diff, I will try to retrofit this feature back to Paper to reach parity with Paper.

Changelog: [Internal]

Differential Revision: D25700156

fbshipit-source-id: 319a146b17cc2130848148ad11adbde16e86c5d5
2020-12-29 15:58:56 -08:00
Ramanpreet Nara 4c734d1e8d Support custom android_package_name in module codegen
Summary:
## Changes
All `rn_library(codegen_modules = True)` must now also specify native_module_android_package_name, like so:

```
rn_library(
  name = "FBAuth"
  codegen_modules = True,
  native_module_spec_name = "Foo",
  native_module_android_package_name = "com.facebook.fbreact.specs",
)
```

This will generate the FBAuth Java spec files under the appropriate directory: "com/facebook/fbreact/specs". It will also make the code-generated specs have the appropriate package name: "com.facebook.fbreact.specs".

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25723176

fbshipit-source-id: 6efec1cbee43d70110c0ef23e2422e08609b61d4
2020-12-29 13:04:36 -08:00
Joshua Gross b8ca59cd74 Reduce re-rendering of Animated components in Fabric
Summary:
The `isFabric` method used in createAnimatedComponent is unreliable (another reason in a long list of reasons why you should not duplicate this code elsewhere, and why we want to delete it ASAP).
In particular, during the first render, the ref component has not been set yet, so we /cannot/ detect if the component is Fabric or non-Fabric and assume it's non-Fabric.

In Fabric, this causes `collapsable` and `nativeID` values to change after the first render.

To reduce this re-rendering, but not eliminate it for all components, I've introduced a flag that indicates if a component will /never/ be flattened. In particular, Image components, ScrollViews, Text cannot ever be flattened,
so we should always pass `collapsable:false` and the same nativeID prop for those components. For Animated <View>s and other components, the re-rendering issue is still a problem in Fabric for now.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25720322

fbshipit-source-id: fe3234d8ae974911a2b5f82e4f6a093216f43d4b
2020-12-28 22:35:15 -08:00
Luna Wei 3ade096f02 Add cachebreaker to remote assets
Summary:
Changelog:
[Internal][Added] - Create a general utils for assets and add a cache breaker utility to set/get a urlparam for remote assets.

Reviewed By: motiz88

Differential Revision: D25521331

fbshipit-source-id: 042e52a27e826bc9993e80bc68cc6fc68abaf224
2020-12-23 19:49:27 -08:00
Luna Wei 1c895678cf Separate out pickScale
Summary:
Changelog:
[Internal][Changed] - Separate `pickScale` implementation from AssetSourceResolver

Reviewed By: motiz88

Differential Revision: D25520686

fbshipit-source-id: 7c5845d5e6f130e719cf8725224589031037a61d
2020-12-23 01:12:58 -08:00
Samuel Susla e5ecca39a8 Prevent crash when blurring an image
Summary:
Changelog: [internal]

Return original image instead of calling `abort()` when malloc fails.
Should we show a redbox? I don't think so, the redbox wouldn't be actionable for product engineer.

Reviewed By: PeteTheHeat

Differential Revision: D25678532

fbshipit-source-id: dd44d5e87198a0f76767ea40fe111ed347a7669a
2020-12-22 12:18:46 -08:00
empyrical f312e5ba84 Update iOS Fabric-related files to compile on OSS (#29810)
Summary:
Original PR contents:

This pull request updates the Podspecs and associated build scripts, and some source files so they build on OSS. RNTester now compiles with `fabric_enabled` again.

The following changes have been made:

 * Various spots that were pointing to the old `ReactCommon/fabric` location have now been updated to `ReactCommon/react/renderer`
 * Files that were attempting to use internal FB header `FBRCTFabricComponentsPlugins.h` were changed to use `RCTFabricComponentsPlugins.h`
 * `RCTFabricComponentsPlugins` in OSS was updated to include the `Image` fabric component (thanks tsapeta)
 * Replaced old `generate-rncore.sh` build script with new `generate-rncore.js` script which does not require `flow-node` and uses the `react-native-codegen` API directly, so there is no longer any need for an interim `schema-rncore.json` file.
 * Updated Yoga podspec which wasn't fully synced with changes from the main Yoga repo
 * Updated Fabric podspec with additional needed subspecs

Additions to PR by hramos:
* Replaced use of generate-rncore scripts with the original generate-native-modules-specs.sh script, which is now generate-specs.sh and supports both codegen for Native Modules and Components now (TurboModules/Fabric).
* Codegen now runs at build time as part of the Xcode build pipeline instead of as part of `pod install`. The build script is injected by the FBReactNativeSpec pod, as the pod is part of both Fabric and non-Fabric builds.

## Changelog

[General] [Fixed] - RNTester compiles with `fabric_enabled` again

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

Test Plan:
RNTester now compiles and runs in the simulator again when `fabric_enabled` is set to `true`.

```
cd xplat/js/react-native-github/packages/rn-tester
USE_FABRIC=1 pod install
open RNTesterPods.xcworkspace
# Build and run
```

Reviewed By: fkgozali

Differential Revision: D24058507

Pulled By: hramos

fbshipit-source-id: 8b2ea3694e6cb9aa23f83f087e2995fd4320e2bb
2020-12-22 08:36:22 -08:00
Ramanpreet Nara 331dc2a998 Default initialize RCTNetworking with observation disabled
Summary:
## Context
When you add/remove listeners from event emitters in JavaScript on iOS, we [call the NativeModule's addListener/removeListener methods](https://fburl.com/diffusion/4878jv6p). These addListener() and removeListener() methods [are implemented on the RCTEventEmitter class](https://fburl.com/diffusion/y913pqhy). All event emitters on iOS are subclasses of RCTEventEmitter.

The only purpose of calling RCTEventEmitter's addListener() and removeListener() methods is to call the [subclasses' startObservation, and stopObservation methods](https://fburl.com/diffusion/rpzyfppk), and [increment/decrement a listenerCount member variable](https://fburl.com/diffusion/ktl8if26) in RCTEventEmitter, which helps catch memory leaks.

RCTNetworking is a subclass of RCTEventEmitter, but it doesn't implement these startObserving/stopObserving methods. Since the [listenerCount is only used to show warnings](https://fburl.com/diffusion/i45lobil), in D24272560 (82187bfb6b), I disabled observation in RCTNetworking on the native side. Then in D24272663 (dabca52f77), I disabled RCTNetworking.addListener/removeListener NativeModule calls in JavaScript. This was gated via a QE/MC.

## Problem
The default initializer of RCTNetworking doesn't initialize with observation disabled. This broke antwerp when we shipped the experiment in D24272663 (dabca52f77). This diff fixes that problem.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D25671343

fbshipit-source-id: d9a8ba5324a23ade8f4b0bf2ec093f3e4fb494dc
2020-12-21 16:18:23 -08:00
Javier Fraire 932c04cc99 Back out "Roll out RCTNetworking extraneous NativeModule call removal"
Summary:
It broke Forecast.

Original commit changeset: 0da20475a088

Changelog: [Internal]

Differential Revision: D25641098

fbshipit-source-id: 94daf0479963745bbca50b409b5a1dec1c8e8e71
2020-12-18 11:09:59 -08:00
Ramanpreet Nara 0e0d2e84f5 Roll out RCTNetworking extraneous NativeModule call removal
Summary:
## Context
Every time we call RCTNetworking.sendRequest(), we [set up six event listeners inside XMLHttpRequest](https://fburl.com/diffusion/85k6ou5w) by calling RCTNetworking.addListener(). Seeing how RCTNetworking.addListener() is implemented, each call results in two async NativeModule call: [one to addListener()](https://fburl.com/diffusion/ng21jek6), and [another to removeEventListener()](https://fburl.com/diffusion/nua3y973).

For RCTNetworking, both of these NativeModule calls are unnecessary, as explained in D24272663 (dabca52f77)
> RCTNetworking.startObserving and RCTNetworking.stopObserving don't exist. The main purpose of RCTEventEmitter.addListener is to call these methods, and increment the _listeners counter, so that we can start dispatching events when _listeners > 0. In D24272560 (82187bfb6b), I made RCTEventEmitter dispatch events even when _listeners <= 0. This is sufficient for us to stop calling these two RCTNetworking methods entirely.

Therefore, this experiment gets rid of on average 6-8 NativeModule method calls for every network call we make in React Native on iOS.

Reviewed By: PeteTheHeat

Differential Revision: D25618704

fbshipit-source-id: 0da20475a0882ed737cf32de27f266fd2cd016af
2020-12-17 17:27:09 -08:00
Ramanpreet Nara df0bfec201 Round 2: Remove synthesize bridge = _bridge
Summary:
All NativeModules that used to use the bridge to require other NativeModules now require other NativeModules via the Venice-compatible RCTModuleRegistry abstraction. Therefore, we can safely get rid of synthesize bridge = _bridge from them.

## How did I generate this diff?
1. Search for all NativeModules that have `synthesize bridge =`
2. Remove the `synthesize bridge = _bridge` from each NativeModule, and if it doesn't contain `_bridge`, `setBridge:`, or `elf.bridge`, add it to this codemod.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25551295

fbshipit-source-id: 585d50ad55cb9ab083e430b07e1cf30e31f0d3c5
2020-12-17 10:13:32 -08:00
Mike c4950610e4 fix: First press not working after pull to refresh (#30291)
Summary:
According to https://github.com/facebook/react-native/issues/20011, the first onPress will not work after pull to refresh.

Dive into the code, found out that is because the state `isTouching` in `Libraries/Components/ScrollResponder.js` is not updated after the pull to refresh.

Update the `isTouching` state in `scrollResponderHandleResponderRelease` to fix this.

## 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] - First press not working after pull to refresh

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

Test Plan:
### Before
- The first onPress fail
![ezgif-4-c6aa5383e898](https://user-images.githubusercontent.com/48589760/97789482-cd4c4100-1bfb-11eb-8a6b-649e8a966b99.gif)
### After
- The first onPress success
![ezgif-4-195f9f6c302e](https://user-images.githubusercontent.com/48589760/97789488-da693000-1bfb-11eb-9a87-f005e61b8ad0.gif)

Eli:
I tested this myself internally using this code sample:

```
'use strict';

import PlaygroundRoute from 'PlaygroundRoute';
import type {SurfaceProps} from 'Surface';
import TetraText from 'TetraText';
import TetraView from 'TetraView';
import {TouchableOpacity, Text, View, ScrollView, RefreshControl, StyleSheet} from 'react-native';
import * as React from 'react';

type Props = SurfaceProps<PlaygroundRoute>;

class App extends React.Component<{}> {
  constructor() {
    super();
    this.state = {refreshing: true, items: []};
  }

  componentDidMount() {
    this.refresh();
  }

  refresh = () => {
    this.setState({
      refreshing: true,
      items: [],
    });

    setTimeout(
      () =>
        this.setState({
          refreshing: false,
          items: [0, 1, 2, 3, 4, 5],
        }),
      1500,
    );
  };

  renderItem = ({item}) => {
    return (
      <TouchableOpacity onPress={() => alert('pressed!')} key={`${item}`}>
        <Text style={{width: '100%', height: 48, backgroundColor: 'white'}}>
          {item}
        </Text>
        <View style={{width: '100%', height: 1, backgroundColor: 'gray'}} />
      </TouchableOpacity>
    );
  };

  render() {
    return (
      <View style={{flex: 1, padding: 48}}>
        <ScrollView
          style={{
            flex: 1,
            backgroundColor: '#aaa',
            borderColor: 'gray',
            borderWidth: 1,
          }}
          keyExtractor={item => `${item}`}
          refreshControl={
            <RefreshControl
              refreshing={this.state.refreshing}
              onRefresh={this.refresh}
            />
          }>
          {this.state.items.map(item => this.renderItem({item}))}
        </ScrollView>
      </View>
    );
  }
}

export default function Playground(props: Props): React.Node {
  return (
    <App />
  );
}

const styles = StyleSheet.create({
  container: {
    padding: 10,
    paddingTop: 30,
  },
});
```

{F351458967}

Reviewed By: appden

Differential Revision: D25574927

Pulled By: TheSavior

fbshipit-source-id: 7abf8a2f947d94150419e51d46a19e792441c981
2020-12-16 10:14:02 -08:00
Ramanpreet Nara ad75a3fbb0 Fix RCTBlobManager require inside RCTFileReaderModule
Summary:
RCTBlobManager actually has the name "BlobModule", not "BlobManager".

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25569865

fbshipit-source-id: f6b41300bda6485cef3f18d3d0308dad9c002b77
2020-12-15 15:15:11 -08:00
Samuel Susla 67309277fe Fix infinite loop in KeyboardAvoidingView
Summary:
Changelog: [General][Fixed] Fix stalling UI due to a bug in KeyboardAvoidingView

I introduced this bug in D22764192 (b08fff6f86).

The stalling was caused by onLayout in JavaScript triggering native layout which called onLayout in JavaScript without terminating condition.

The fix is to only cause native layout once from JavaScript's onLayout function. This makes sure both Fabric and Paper works correctly and UI stall isn't caused.

Resolves:
https://github.com/facebook/react-native/issues/30495
https://github.com/facebook/react-native/issues/30532

Reviewed By: TheSavior

Differential Revision: D25522362

fbshipit-source-id: 602e540bb1c40ae4f421b3e6ebc5a047cd920c17
2020-12-15 12:04:36 -08:00
simek 7485208498 Pressability: fix typo in variable, follow event check pattern, small tweak (#30151)
Summary:
This small PR introduces the following changes to the `Pressability`:
* fixes typo in internal `isActivationTransiton` variable name
* assigns `onPressMove` to variable before check and potential usage (this is the common pattern in this file)
* utilizes destructuring assignment to simplify passing coordinates to `_touchActivatePosition`

## Changelog

[Internal] [Fixed] - Pressability: fix typo in variable, follow event check pattern, small tweak

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

Test Plan: Successful `yarn test` run.

Reviewed By: kacieb

Differential Revision: D25545662

Pulled By: nadiia

fbshipit-source-id: 8d311fe21b485ee707e05dad120322b3027e686b
2020-12-15 11:50:02 -08:00
Ramanpreet Nara 6c3dd87ef1 Manual: Migrate from bridge.moduleForName to RCTModuleRegistry
Summary:
All NativeModules that use `[RCTBridge moduleForName:]` to access other NativeModules are now instead using the Venice-compatible RCTModuleRegistry to access other NativeModules.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25508910

fbshipit-source-id: 85fc390063af264f2f2843e5640fa7336a784ab4
2020-12-12 19:02:04 -08:00
Ramanpreet Nara 282b1a880f Manual: Migrate from bridge.moduleForClass to RCTModuleRegistry
Summary:
All NativeModules that use `[RCTBridge moduleForClass:]` to access other NativeModules are now instead using the Venice-compatible RCTModuleRegistry to access other NativeModules.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25508277

fbshipit-source-id: 1b415a5ad4055290940879e100ceaa84ae83feeb
2020-12-12 19:02:04 -08:00
Ramanpreet Nara c7e1355dec Manual: Migrate from bridge.webSocketModule to RCTModuleRegistry
Summary:
All NativeModules that access the _bridge from self to require the WebSocketModule NativeModule now instead get the WebSocketModule NativeModule from the _moduleRegistry.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25500433

fbshipit-source-id: 21aebc5684dd6a058de4e35b042c9fb255ffcb33
2020-12-12 19:02:03 -08:00
Ramanpreet Nara f50d9c41b2 Manual: Clean up bridge.networking -> RCTModuleRegistry codemod
Summary:
Spotted a few errors in Codemod that migrated bridge.networking calls to [_moduleRegistry moduleForName:"Networking"] calls. This diff fixes those mistakes.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25499699

fbshipit-source-id: 29f296fc1011cf65d30e083e0ef001e3185edbfb
2020-12-12 19:02:03 -08:00
Ramanpreet Nara ad6705f142 Codemod: Migrate from bridge.networking to RCTModuleRegistry
Summary:
All NativeModules that access the _bridge from self to require the Networking NativeModule now instead get the Networking NativeModule from the _moduleRegistry.

NOTE: xbgs .networking reveal any other usages. So, there won't be a manual migration diff associated with this codemod.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25499412

fbshipit-source-id: 7b0e33135c6c91ffc1e041ad3ab95f1346a8bc22
2020-12-12 19:02:03 -08:00
Ramanpreet Nara e041c616d1 Codemod: Migrate from bridge.imageStoreManager to RCTModuleRegistry
Summary:
All NativeModules that access the _bridge from self to require the ImageStoreManager now instead get the ImageStoreManager from the `_moduleRegistry`.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25498774

fbshipit-source-id: 1d97888ed2ef8d295aa35cf08cb9e9f3bc33ed05
2020-12-12 19:02:02 -08:00
Peter Argany e0ece12203 Fix duplicate Networking module bug
Summary:
While investigating a bridgeless networking issue, I noticed something very peculiar. **Two** networking turbo modules are built and used in bridgeless mode. Upon debugging, I realized that each of them have a different `TurboModuleHolder`. The reason is the following:
1. In JS, the module's name is [Networking](https://fburl.com/diffusion/f2xu4wie)
2. In ObjC, we call the module "RCTNetworking" (examples in this diff)
3. Both scenarios end up creating the correct Turbo Module: [RCTNetworking](https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/Libraries/Network/RCTNetworking.mm?link_ref=search), but the `TurboModuleHolder` doesn't know that "RCTNetworking" and "Networking" are the same. Any other modules accessed this way will have the same issue.

An alternative solution would be to tell `TurboModuleHolder` to strip the `RCT` suffix, which would solve the problem globally. RSNara thoughts?

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D25477044

fbshipit-source-id: 02219de578ef4d19e579110e4242883a30cefcd6
2020-12-11 11:24:27 -08:00
Ramanpreet Nara 1f883192ec Manual: Migrate from bridge.eventDispatcher to RCTModuleRegistry
Summary:
This is an extension of D25449795. I searched for all usages of .eventDispatcher within NativeModules, and migrated them all to the Venice-compatible RCTModuleRegistry API.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25473844

fbshipit-source-id: 2b8deec236e019f3adfb59fadd745c249ff822f4
2020-12-11 10:42:28 -08:00
Ramanpreet Nara 74fd6fb1da Codemod: Migrate from bridge.eventDispatcher to RCTModuleRegistry
Summary:
All NativeModules that use the bridge to require the eventDispatcher are now instead using the RCTModuleRegistry I introduced in D25412847 (0ed81b28d3).

## What does this codemod do?
For all ObjC files that contain `synthesize bridge = _bridge`, migrate calls that access the React Native bridge from `self`, and use it to load the event dispatcher.

**Thoughts on Codemod Safety:** If we can access the bridge from self, then that means that if we synthesize the module registry, we can access the module registry from self. Therefore, this codemod is safe.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25449795

fbshipit-source-id: 2f7235d14659e73d673ae08763dc2cccdde55a19
2020-12-11 10:42:28 -08:00
Ramanpreet Nara de7cc12707 Migrate NativeModules from [self bridge] -> _bridge
Summary:
This should be a noop. It just makes writing codemods easier.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25442218

fbshipit-source-id: dba0c35a6f566e83ed5b7142075fff6929efeada
2020-12-10 20:23:17 -08:00
Kevin Gozali 3af21381df Codegen Android: allow generating Fabric Java component files during build time
Summary:
This commit:
* Generate Fabric component Java files along side Java NativeModule specs, when `USE_FABRIC=1` is set
* Adjust the component codegen to place output files in a subdir based on package name
* Adjust existing Buck targets to filter the right nativemodule vs component java files (this avoids duplicated symbols)
* Compiles the Java output during build time on RNTester/ReactAndroid (Gradle)

Not in this commit:
* Fabric C++ files
* Removing checked-in generated component files.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25416614

fbshipit-source-id: fd670ead2198c9b5a65812c692b7aed9f3d7cd58
2020-12-09 09:19:33 -08:00
Samuel Susla 2092dca003 Add missing @synthesize bridge to VerseThreadView and RCTFileReaderModule
Summary:
Changelog: [internal]

In D25386708 (408bcdeedb) `synthesize bridge` was removed. But two modules actually depend on this.

`RCTFileReaderModule` and `VerseThreadView` which both use it.

Reviewed By: RSNara

Differential Revision: D25423574

fbshipit-source-id: daf95d9b27841cf8d205d8ea2666d5aa69a6d720
2020-12-09 07:27:38 -08:00
Ramanpreet Nara 408bcdeedb Remove unneeded @synthesize bridge from NativeModules
Summary:
This is a codemod. All these NativeModules demand access to the bridge. However, they don't use it.

Changelog: [Internal]

Reviewed By: PeteTheHeat, RoelCastano

Differential Revision: D25386708

fbshipit-source-id: f05f4777d2527e96e53581e7ac58f6be47411dce
2020-12-08 20:27:44 -08:00
David Vacca f96478778c Ensure iOS Native components are initialized when using JS View configs
Summary:
As part of the initialization of Native View configs, the PaperUIManager.getViewManagerConfig() method calls the native side to lazy initialize iOS Native components. This is necessaary to make ensure that native classes are loaded and initialized before a view is created.
Note that this requirement is only necessary when Fabric is disabled.

As part of JS ViewConfigs, we removed the native call to lazy initialize iOS native components. This causes a crash during the creation of NativeViews when JS ViewConfigs are enabled and Fabric is disabled. The rootcase of the exception is that native classes are not properly initialized when the createView method is executed in iOS.

This diff forces the lazy initialization of iOS Native components when JS View configs are enabled and Fabric is disabled. This new mechanism is executed as part of the creation of views and it's ONLY going to be executed when the user navigates to a NON-FABRIC screen, JS ViewConfigs are enabled and the component is not initialized yet.

The extra cost should be minimal or zero.

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D25387014

fbshipit-source-id: fe3bc42f803a805192b419bfb4b7a6b5b1b71b60
2020-12-07 23:14:02 -08:00
Dmytro Voronkevych 0d4985900b Adding support for cancelOnBackground for UserFlow
Summary:
UserFlow API now takes configuration parameter, which is required. It contains of 2 arguments:
* triggerSource
* cancelOnBackround

Reviewed By: swillard13

Differential Revision: D25094721

fbshipit-source-id: 64a468c2168265ade9f8d4cea4beb911637544fa
2020-12-07 10:49:29 -08:00
David Vacca 959bc47c18 Add internal_analyticTag into RCTImageView JS view configs
Summary:
this diff fixes the next error:

```
'RCTImageView' has a view config that does not match native. 'validAttributes' is missing: internal_analyticTag
    in RCTImageView (at Image.ios.js:149)
    in ImageAnalyticsTagContext.Consumer (at Image.ios.js:146)
    in Image (at TintedIcon.js:55)
    in TintedIcon (at TetraIcon.js:98)
    in TetraIcon (at FDSCheckbox.js:67)
    in FDSCheckbox (at TetraListCell.js:820)
    in TetraAddOnSecondary (at TetraListCell.js:576)
    in TetraPressable (at TetraListCell.js:603)
    in TetraListCell (created by TetraListCell)
    in TetraListCell (at RNInternalSettingsUnit.js:35)
    in TetraList (at RNInternalSettingsUnit.js:32)
    in RNInternalSettingsUnit (at RNInternalSettingsDeveloperModeUnit.new.js:73)
    in RNInternalSettingsDeveloperModeUnit (at RNInternalSettingsSurface.js:79)
    in RNInternalSettingsSurface (at withDefaultErrorBoundary.js:30)
    in DefaultError(React.lazy(RNInternalSettingsSurfaceForFacebook)) (at renderApplication.js:47)
```

changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D25313414

fbshipit-source-id: ab951d25ac6a80809a2977c80ff059f667cc5595
2020-12-04 10:54:33 -08:00
Kim Svatos 5d8fcde632 Back out "Avoid accessing `self.component` on background thread"
Summary: Changelog: [Internal] backout change dispatching main queue before using it

Reviewed By: shergin

Differential Revision: D25319046

fbshipit-source-id: 4f8952e577cfd9033fb2c2248b9b056a0d468b5d
2020-12-03 19:09:50 -08:00
Héctor Ramos 5eee2f2bc0 Fix Circle CI iOS Tests: Make FBReactNativeSpec dir as needed
Summary:
Quick fix for Circle CI: Ensure FBReactNativeSpec dir exists before touching files.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D25285573

fbshipit-source-id: 8dec496856c90accc687648d7068aadfea24d72b
2020-12-02 16:13:03 -08:00
Héctor Ramos c901c1fbce Integrate Native Module codegen into Xcode build pipeline (#30449)
Summary:
Move the codegen invocation out of Podfiles and into the FBReactNativeSpec Pod itself. With this change, developers do not need to modify their existing project's Podfiles, and yet the codegen will be integrated into their projects automatically by way of the FBReactNativeSpec Pod.

This is accomplished in part by injecting a script build phase into the Pods Xcode project that is generated by CocoaPods. The build phase will save the output of the codegen script to a log in the derived files directory. The codegen will be executed if the codegen log file is not present, or if the contents of the Libraries directory has changed.

The codegen will thus be invoked in these situations:

**RNTester:**
* When `packages/rn-tester/RNTesterPods.xcworkspace` is built, if the codegen output logfile is not present or if the input files have changed.

**OSS React Native apps:**
* When `ios/AwesomeProject.xcworkspace` is built, if the codegen output file is not present or if the input files have changed. Normally, this should not happen, as we do not expect folks to update the contents of `node_modules/react-native/Libraries`.

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

Changelog: [Internal] - Moved codegen invocation out of Podfile and into FBReactNativeSpec Pod

Reviewed By: fkgozali

Differential Revision: D25138896

fbshipit-source-id: 4779f822459cea2c30fd544eee19a49e8d80153d
2020-12-02 14:27:50 -08:00
Emily Janzer d435d26d87 Check if result from native UIManager is null before accessing view config
Summary:
As titled - attempt to mitigate a JS error on iOS while we work on getting JS view configs. It seems like this happens when the bridge is invalid.

Changelog: [Fixed][iOS] Don't throw an error if the UIManager returns null when fetching a view config

Reviewed By: kacieb

Differential Revision: D25247203

fbshipit-source-id: e2003f99b818f9657c60ff95b266be74fe18a94b
2020-12-01 15:02:20 -08:00
Tim Yung aa03c836b4 RN: Migrate `View` to NativeComponentRegistry
Summary:
Migrates `View` to use `NativeComponentRegistry`, which enables configuring it to avoid reflection by using a static `ViewConfig`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25136054

fbshipit-source-id: f2abda1105bd2a8b396db6f1a640430b62bbcdaf
2020-11-28 21:49:58 -08:00
Shelly Willard bb1dcc182e Migrate jsi wrapper + pass markerId to get next instance key
Summary:
Migrating jsi wrapper userflow v2. Also pass markerId to the method that gets instance key

Changelog: [internal]

Differential Revision: D25184462

fbshipit-source-id: c316720b0b3d47b345156bb71d51d6f4c473ceef
2020-11-27 11:15:00 -08:00
Kevin Lin 9528ef27b9 Avoid accessing `self.component` on background thread
Summary: Changelog: [Internal] `self.component` is main thread affined so we need to dispatch to main queue before using it.

Reviewed By: shergin

Differential Revision: D25163182

fbshipit-source-id: a7da0324982354215e0ccb47615f7f121200f12a
2020-11-26 04:06:59 -08:00
Tim Yung f638aff434 RN: Add `NativeComponentRegistry.getWithFallback_DEPRECATED`
Summary:
Creates `NativeComponentRegistry.getWithFallback_DEPRECATED`. This is deprecated from inception because it exists only to support a pattern that should not be necessary.

For any given `NativeX` component, the JavaScript module that calls `NativeComponentRegistry.get('NativeX', …)` should only exist in the JavaScript bundle if the native binary actually supports that native component.

But in today's transitional state of the world, there are JavaScript modules that use `UIManager.getViewManagerConfig('NativeX')` as a means of feature detection.

The purpose of `NativeComponentRegistry.getWithFallback_DEPRECATED` is to bridge this transitional gap. Component should migrate toward initializing the `NativeComponentRegistry` with a runtime configuration provider that enumerates all supported native components. If the native component is not supported, it should return null.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D25109988

fbshipit-source-id: 76f7077904594ca63495d8338905c43712ea02e0
2020-11-20 18:53:14 -08:00
Tim Yung a865bd89d7 RN: Migrate `ImageView` to NativeComponentRegistry
Summary:
Migrates `ImageView` to use `NativeComponentRegistry`, which enables configuring it to avoid reflection by using a static `ViewConfig`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25104446

fbshipit-source-id: dd01bf01ead94ca6632b2653b45becf408953bcf
2020-11-20 18:53:14 -08:00
Tim Yung 9dfefa8da0 RN: Rename to `ScrollViewNativeComponent`
Summary:
There may be assumptions that `Native*.js` contains TurboModule. In order to avoid introducing unplanned breaking changes (especially right before the holidays), roll this back for now.

In doing so, I also realized that I forgot to migrate over `ScrollContentViewNativeComponent`. This does that, too.

Changelog:
[Internal]

Reviewed By: RSNara

Differential Revision: D25129324

fbshipit-source-id: 343c4b800969dab91f7cd9f2bf253788c94d38e6
2020-11-20 18:53:14 -08:00
Mike Vitousek 7f53bb95f7 Suppress errors and switch to new-generics in xplat
Summary:
The Flow team has been building a new implementation of the system that typechecks the body of generic functions and classes. This system is more sound than the previous approach and detects errors that were uncaught previously. This diff turns on the new generic system by setting generate_tests=false in the .flowconfig, and suppresses newly discovered errors.

This diff modifies and re-signs some generated modules, because syncing from www pulled in a ton of other changes that have runtime differences, and I'm not equipped to verify that the changes are safe to land.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D24801184

fbshipit-source-id: bb31fe4c5a4107d183649b436a548df5ff42e217
2020-11-20 00:50:30 -08:00
Tim Yung 00e623ddbb RN: Migrate `ScrollView` to NativeComponentRegistry
Summary:
Migrates `ScrollView` (and its related native components) to use `NativeComponentRegistry`. This will enable it to be configured using experiments to conditionally use the native `ViewConfig` or verify the static `ViewConfig`.

This also cleans up a bunch of the modules and types related to defining the native `ScrollView` component.

This also proposes adopting the same module naming protocol was has been adopted for TurboModules (i.e. `NativeScrollView` instead of `ScrollViewNativeComponent`).

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25098530

fbshipit-source-id: ff1394bfac023daf58e85d5f9068e4f8da3538be
2020-11-19 15:55:23 -08:00
Tim Yung d4e29ecdaa RN: Fix `ScrollView` Type Errors
Summary:
Fixes some of the type errors in `ScrollView` that were previously being suppressed by comments. This also slightly simplifies the implementation of `ScrollView`.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D25097225

fbshipit-source-id: a444db8179c91e264671d8f32431b93c4da8dfc4
2020-11-19 15:55:23 -08:00
Tim Yung 54a067e61e RN: Refactor `ScrollView` Style Splitting
Summary:
Rewrites `splitLayoutProps`, which is only used by `ScrollView`.

- Improve type safety by avoiding `DangerouslyImpreciseStyle`.
- Avoid allocating objects when it is not necessary.
- Avoid allocating a object enumeratig layout props by using a switch statement.

Changelog:
[Internal]

Reviewed By: JoshuaGross, kacieb

Differential Revision: D25097226

fbshipit-source-id: 2050c03b681024212c06a48b7eb05f28c14415f9
2020-11-19 15:55:23 -08:00
Tim Yung 7e7527e7db RN: Preserve Style Type in `flattenStyle`
Summary:
Refactors `flattenStyle` so that it preserves the style type of the argument. This lets us avoid using `DangerouslyImpreciseStyleProp` where we can.

Changelog:
[Internal]

Reviewed By: JoshuaGross, nadiia, kacieb

Differential Revision: D25097227

fbshipit-source-id: df6af6fefab25dbb62e3c81897c3cef98619a9c7
2020-11-19 15:55:23 -08:00
Nick Gerleman 6d2a527984 Avoid eating clicks/taps into ScrollView when using physical keyboard (#30374)
Summary:
This is an extension of https://github.com/facebook/react-native/issues/29798 which was reverted due to cases where the soft keyboard could not be dismissed.

## 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] - Avoid eating clicks/taps into ScrollView when using physical keyboard

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

Test Plan: Validated with iOS simulator that taps on default ScrollView will dismiss soft keyboard and be eaten if open, but taps are not eaten when emulating a connected physical keyboard.

Reviewed By: kacieb

Differential Revision: D24935077

Pulled By: lyahdav

fbshipit-source-id: 19d9cf64547e40a35f9363896e3abbdccb95b546
2020-11-19 13:12:41 -08:00
Tim Yung 6a547c6c57 RN: Create `NativeComponentRegistry`
Summary:
Creates `NativeComponentRegistry` which makes native component initialization more declarative and configurable through an optionally configurable provider.

The next diff converts `ScrollView` to use this new abstraction as a demonstration. The plan would be to use this to replace all current manual call sites of `registerGeneratedViewConfig`, and then the ones generated via the Babel plugin.

Migrating to this will not change any production behavior, but it will enable verification of `ViewConfig` in development.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084468

fbshipit-source-id: 9c758ddc279bf937a401a868a066907a94098f37
2020-11-19 10:55:50 -08:00
Tim Yung f6b8736b09 RN: Update ViewConfig for ScrollView
Summary:
Updates `ReactScrollViewManager` and the `ViewConfig` for `ScrollView` so that they are equivalent.

- `inverted` was missing.
- `contentOffset` was missing differ on Android. (However, there does not seem to be any perceivable behavior difference besides the native `ViewConfig` being different.)

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084470

fbshipit-source-id: 8bea3b7a692c1038819a4147b174583a4faa71e9
2020-11-19 02:52:00 -08:00
Tim Yung de92e7405d RN: Refactor `ViewConfig` Inflation
Summary:
Refactors the conversion of a `PartialViewConfig` into a `ViewConfig` to a separate function so that it can be reused.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25084469

fbshipit-source-id: 8a7f53ff2c68860697c791c37a6abbfd3213a0f9
2020-11-19 02:52:00 -08:00
Luna Wei 003d72d80b Provide default device scale
Summary:
Changelog:
[Internal][Fixed] - Provide a default device scale

Reviewed By: kacieb

Differential Revision: D24975788

fbshipit-source-id: 5f2158d7b704713b6a759734943e52228c9cafbc
2020-11-18 21:27:17 -08:00
Tim Yung 5b527fefcb RN: Fix `registerGeneratedViewConfig` Types
Summary:
Fixes types in `registerGeneratedViewConfig` and also removes some unnecessary hacks for the `ReactNativeViewViewConfig` type.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25076608

fbshipit-source-id: 5cb2060e11db598b42fbb7f2f8aecfd7f4b262ef
2020-11-18 21:19:13 -08:00
Tim Yung e136aa3fc4 RN: Cleanup ViewConfig Types
Summary:
Cleans up the Flow types for React Native ViewConfig. After this diff, we will have two new canonical types:

- `ViewConfig` which is what we get from native and what is registered in the `ReactNativeViewConfigRegistry`.
- `PartialViewConfig` which is what we generate statically and augment at runtime before registering with the `ReactNativeViewConfigRegistry`.

Changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D25075299

fbshipit-source-id: 4b53927b2db437b615447b711e83db355d0cfa55
2020-11-18 21:19:12 -08:00
Tim Yung 69b4611049 RN: Hoist Reflection from Verification
Summary:
Hoists the call to `getNativeComponentAttributes` out of the verification function so that it's easier to keep track of when this function is and is not called.

The purpose of this will become clearer in a future refactor.

Changelog:
[Internal]

Reviewed By: ejanzer

Differential Revision: D25072600

fbshipit-source-id: bc42461baae3476fa7ecb6186c4256dd23921ed5
2020-11-18 21:19:12 -08:00