Commit Graph

45 Commits

Author SHA1 Message Date
Dan Abramov
8e99618afa Rm bad tests 2020-07-01 15:59:26 +01:00
Dominic Gannaway
4a3f779d67
Remove event pooling in the modern system (#18969) 2020-05-21 13:54:05 +01:00
Dominic Gannaway
9751935abf
Modern Event System: improve dispatching queue (#18799) 2020-05-04 16:55:45 +01:00
Nicolas Gallagher
96203240d3
ReactDOM: remove unstable-native-dependencies bundle (#18483)
This is only used by react-native-web and will be replaced by a user-space
implementation. See: https://github.com/necolas/react-native-web/issues/1568
2020-04-18 15:40:13 -07:00
Andrew Clark
376d5c1b5a Split cross-package types from implementation
Some of our internal reconciler types have leaked into other packages.
Usually, these types are treated as opaque; we don't read and write
to its fields. This is good.

However, the type is often passed back to a reconciler method. For
example, React DOM creates a FiberRoot with `createContainer`, then
passes that root to `updateContainer`. It doesn't do anything with the
root except pass it through, but because `updateContainer` expects a
full FiberRoot, React DOM is still coupled to all its fields.

I don't know if there's an idiomatic way to handle this in Flow. Opaque
types are simlar, but those only work within a single file. AFAIK,
there's no way to use a package as the boundary for opaqueness.

The immediate problem this presents is that the reconciler refactor will
involve changes to our internal data structures. I don't want to have to
fork every single package that happens to pass through a Fiber or
FiberRoot, or access any one of its fields. So my current plan is to
share the same Flow type across both forks. The shared type will be a
superset of each implementation's type, e.g. Fiber will have both an
`expirationTime` field and a `lanes` field. The implementations will
diverge, but not the types.

To do this, I lifted the type definitions into a separate module.
2020-04-08 23:49:23 -07:00
Andrew Clark
d686f3f16a Add .old prefix to reconciler modules 2020-04-08 23:49:19 -07:00
Dominic Gannaway
a3875663f6
React Event System: cleanup plugins + break out update batching logic (#18503) 2020-04-06 22:01:20 +01:00
Dominic Gannaway
8815e4cc72
Cleanup getListener and EventSystemFlags (#18469) 2020-04-02 23:17:10 +01:00
Dominic Gannaway
5e464546af
ReactDOM.useEvent: fix scope propagation issue (#18464) 2020-04-02 18:26:56 +01:00
Dominic Gannaway
d5e4b3ae1d
Modern Event System: refine flags and handling of enableLegacyFBSupport (#18466) 2020-04-02 18:26:34 +01:00
Dominic Gannaway
663c13d71d
Refactor Enter/Leave listener accumulation (#18405)
* Refactor Enter/Leave listener accumulation
2020-04-02 11:07:20 +01:00
Sebastian Markbåge
3e94bce765
Enable prefer-const lint rules (#18451)
* Enable prefer-const rule

Stylistically I don't like this but Closure Compiler takes advantage of
this information.

* Auto-fix lints

* Manually fix the remaining callsites
2020-04-01 12:35:52 -07:00
Sebastian Markbåge
c5d2fc7127
Move some files out of /shared and rename to upper case (#18363)
* Rename lower case isomorphic default exports modules to upper case named exports

We're somewhat inconsistent here between e.g. ReactLazy and memo.

Let's pick one.

This also moves the responder, fundamental, scope creators from shared
since they're isomorphic and same as the other creators.

* Move some files that are specific to the react-reconciler from shared

Individual renderers are allowed to deep require into the reconciler.

* Move files specific to react-dom from shared

react-interactions is right now dom specific (it wasn't before) so we can
type check it together with other dom stuff. Avoids the need for
a shared ReactDOMTypes to be checked by RN for example.

* Move ReactWorkTags to the reconciler

* Move createPortal to export from reconciler

Otherwise Noop can't access it since it's not allowed deep requires.
2020-03-21 15:22:01 -07:00
Dominic Gannaway
a600408b28
ReactDOM.useEvent: add EventTarget support (#18355)
* ReactDOM.useEvent: add support for all EventTarget types
2020-03-20 18:31:47 +00:00
Dominic Gannaway
dbd85a08d9
ReactDOM.useEvent: support custom types (#18351)
* ReactDOM.useEvent: support custom types
2020-03-20 14:45:33 +00:00
Dominic Gannaway
8311cb5d24
Modern Event System: refactor legacy FB support logic (#18336) 2020-03-19 13:22:36 +00:00
Dominic Gannaway
c804f9aebb
ReactDOM.useEvent: wire to event system to the hook (#18304) 2020-03-16 21:46:17 +00:00
Dominic Gannaway
2a7cd58956
ReactDOM.useEvent: Add DOM host event listener logic (#18292) 2020-03-12 22:41:33 +00:00
Dominic Gannaway
d3ec42020d
Address feedback for accumulateTwoPhaseListeners (#18289) 2020-03-12 21:48:29 +00:00
Dominic Gannaway
99d271228d
ReactDOM.useEvent: more scaffolding changes (#18282) 2020-03-12 09:12:06 +00:00
Dominic Gannaway
30a998debf
ModernEventSystem: refactor accumulateTwoPhaseListeners (#18274) 2020-03-11 18:55:01 +00:00
Dominic Gannaway
704c8b0118
Fix Flow type for AnyNativeEvent (#18266) 2020-03-10 10:46:12 +00:00
Dominic Gannaway
2fe0fbb05e
Use accumulateTwoPhaseDispatchesSingle directly (#18203) 2020-03-05 00:04:27 +00:00
Dominic Gannaway
62861bbcc7
More event system cleanup and scaffolding (#18179) 2020-03-02 10:59:07 +00:00
Dominic Gannaway
3f85d53ca6
Further pre-requisite changes to plugin event system (#18083) 2020-02-20 00:46:03 +00:00
Dominic Gannaway
1000f6135e
Add container to event listener signature (#18075) 2020-02-19 18:00:57 +00:00
Dominic Gannaway
9def56ec0e
Refactor DOM plugin system to single module (#18025) 2020-02-14 08:10:42 +00:00
Alfredo Granja
812277dab6
Fix onMouseEnter is fired on disabled buttons (#17675) 2020-02-04 14:56:55 +00:00
Dan Abramov
e706721490
Update Flow to 0.84 (#17805)
* Update Flow to 0.84

* Fix violations

* Use inexact object syntax in files from fbsource

* Fix warning extraction to use a modern parser

* Codemod inexact objects to new syntax

* Tighten types that can be exact

* Revert unintentional formatting changes from codemod
2020-01-09 14:50:44 +00:00
Dan Abramov
b979db4e72
Bump Prettier (#17811)
* Bump Prettier

* Reformat

* Use non-deprecated option
2020-01-09 13:54:11 +00:00
Brian Vaughn
1b9328cd9b
Null stateNode after unmount (#17666) 2019-12-19 13:32:14 -08:00
Dominic Gannaway
9fe1031244
[react-interactions] Rename Flare APIs to deprecated and remove from RN (#17644) 2019-12-18 10:24:46 +00:00
Dan Abramov
0cf22a56a1
Use console directly instead of warning() modules (#17599)
* Replace all warning/lowPriWarning with console calls

* Replace console.warn/error with a custom wrapper at build time

* Fail the build for console.error/warn() where we can't read the stack
2019-12-14 18:09:25 +00:00
Dominic Gannaway
be603f5a51
[react-events] Remove lastNativeEvent in favor of SystemFlags (#17585) 2019-12-13 17:03:35 +00:00
Dan Abramov
b15bf36750
Add component stacks to (almost) all warnings (#17586) 2019-12-12 23:47:55 +00:00
Laura buns
9ac42dd074 Remove the condition argument from warning() (#17568)
* prep for codemod

* prep warnings

* rename lint rules

* codemod for ifs

* shim www functions

* Handle more cases in the transform

* Thanks De Morgan

* Run the codemod

* Delete the transform

* Fix up confusing conditions manually

* Fix up www shims to match expected API

* Also check for low-pri warning in the lint rule
2019-12-11 03:28:14 +00:00
Laura buns
b43eec7eaa Replace wrap-warning-with-env-check with an eslint plugin (#17540)
* Replace Babel plugin with an ESLint plugin

* Fix ESLint rule violations

* Move shared conditions higher

* Test formatting nits

* Tweak ESLint rule

* Bugfix: inside else branch, 'if' tests are not satisfactory

* Use a stricter check for exactly if (__DEV__)

This makes it easier to see what's going on and matches dominant style in the codebase.

* Fix remaining files after stricter check
2019-12-06 18:25:54 +00:00
Eli White
01bce8c248
Change legacy-events plugin nativeEventTarget to allow null (#17344) 2019-11-11 11:22:41 -08:00
Nicolas Gallagher
ab1a4f249e
Move eventSystemFlags to last argument in event plugin extractors (#16978)
Fix for necolas/react-native-web#1443
2019-10-02 10:31:15 -07:00
Sebastian Markbåge
0a527707cd
Event Replaying (#16725)
* Add Event Replaying Infra

* Wire up Roots and Suspense boundaries, to retry events, after they commit

* Replay discrete events in order in a separate scheduler callback

* Add continuous events

These events only replay their last target if the target is not yet
hydrated. That way we don't have to wait for a previously hovered
boundary before invoking the current target.

* Enable tests from before

These tests were written with replaying in mind and now we can properly
enable them.

* Unify replaying and dispatching

* Mark system flags as a replay and pass to legacy events

That way we can check if this is a replay and therefore needs a special
case. One such special case is "mouseover" where we check the
relatedTarget.

* Eagerly listen to all replayable events

To minimize breakages in a minor, I only do this for the new root APIs
since replaying only matters there anyway. Only if hydrating.

For Flare, I have to attach all active listeners since the current
system has one DOM listener for each. In a follow up I plan on optimizing
that by only attaching one if there's at least one active listener
which would allow us to start with only passive and then upgrade.

* Desperate attempt to save bytese

* Add test for mouseover replaying

We need to check if the "relatedTarget" is mounted due to how the old
event system dispatches from the "out" event.

* Fix for nested boundaries and suspense in root container

This is a follow up to #16673 which didn't have a test because it wasn't
observable yet. This shows that it had a bug.

* Rename RESPONDER_EVENT_SYSTEM to PLUGIN_EVENT_SYSTEM
2019-09-23 11:21:10 -07:00
Matt Kane
56114a4b22 Change trackedTouchCount console.error to warn (#16750) 2019-09-11 14:10:26 +02:00
Dominic Gannaway
e86146e714
[react-events] Refine executeUserEventHandler (#16662) 2019-09-05 00:36:29 +01:00
Dominic Gannaway
7126a37bf4
[react-events] Keyboard responder propagation handling (#16657) 2019-09-04 18:25:05 +01:00
Dominic Gannaway
dce430ad92
[Flare] Rework the responder dispatching/batching mechanism (#16334) 2019-08-19 19:22:46 +01:00
Brian Vaughn
b1a03dfdc8
Rename legacy "events" package to "legacy-events" (#16388)
* Renamed 'events' package to 'legacy-events'
* Updated 'events' references to point to 'legacy-events'
2019-08-14 07:32:42 -07:00