Commit Graph

944 Commits

Author SHA1 Message Date
Dan Abramov
adf5a323bc Revert "Fix email cursor jump (#18379)"
This reverts commit 9b88b78b3d.
2020-04-01 21:52:43 +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
Utkarsh Kukreti
5200547100
Do not warn when a controlled input has onInput handler. (#18189)
`onInput` behaves the same as `onChange` for controlled inputs as far as I
know, so React should not print the following warning when `onInput` is
present.

> Failed prop type: You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.
2020-04-01 19:58:07 +01:00
Nick Reiley
9b88b78b3d
Fix email cursor jump (#18379)
* add email input fixture to show cursor jump

* fix cursor jump in email input

Co-authored-by: Peter Potapov <dr.potapoff-peter@yandex.ru>

* add regression tests to ensure attributes are working

Co-authored-by: Peter Potapov <dr.potapoff-peter@yandex.ru>
2020-04-01 19:30:26 +01:00
Dan Abramov
d8d2b6e89c
Disable module components dynamically for WWW (#18446)
* Make disableModulePatternComponents dynamic for WWW

* Run both flags and tests and respect the flag in SSR
2020-04-01 18:31:59 +01:00
Sebastian Markbåge
e2c6702fca
Remove ConcurrentMode and AsyncMode symbols (#18450)
This API was never released.
2020-04-01 10:18:52 -07:00
Dominic Gannaway
d6d5f5aabe
Move accumulateEventTargetListeners to its own module/function (#18407) 2020-04-01 14:19:21 +01:00
Dominic Gannaway
dc3c6c9565
ReactDOM.useEvent: revert and add guard for null stateNode (#18441) 2020-04-01 12:45:26 +01:00
Brian Vaughn
4de3a60325
Remove disableMapsAsChildren flag (#18445)
Change warning to say the case is unsupported (not "will be deprecated")
2020-03-31 11:00:51 -07:00
Andrew Clark
90e90ac8e0
Revert useEvent PRs (#18438)
* Revert "ReactDOM.useEvent: enable on internal www and add inspection test (#18395)"

This reverts commit e0ab1a429d.

* Revert "ReactDOM.useEvent: Add support for experimental scopes API (#18375)"

This reverts commit a16b349745.

* ReactDOM.useEvent: Add support for experimental scopes API
2020-03-30 19:16:28 -07:00
Dan Abramov
bf30e370a5
Remove User Timings (#18417) 2020-03-31 00:29:53 +01:00
Ricky
dd7e5e4f5a
Add getInspectorDataForViewAtPoint (take two) (#18388)
* Add getInspectorDataForViewAtPoint (take two)

* Updates from review

* Add DEV to dev-only variable

* Missed this rename
2020-03-30 15:42:41 -04:00
Sebastian Silbermann
ba31ad40a9
feat(StrictMode): Double-invoke render for every component (#18430)
* feat(StrictMode): Double-invoke render for every component

* fix: Mark ReactTestRendererAsync as internal
2020-03-29 23:13:46 +01:00
Dominic Gannaway
e0ab1a429d
ReactDOM.useEvent: enable on internal www and add inspection test (#18395) 2020-03-26 17:13:05 +00:00
Dominic Gannaway
a16b349745
ReactDOM.useEvent: Add support for experimental scopes API (#18375)
* ReactDOM.useEvent: Add support for experimental scopes API
2020-03-26 13:29:54 +00:00
Sebastian Markbåge
64ed221c3d
Formalize the Wakeable and Thenable types (#18391)
* Formalize the Wakeable and Thenable types

We use two subsets of Promises throughout React APIs. This introduces
the smallest subset - Wakeable. It's the thing that you can throw to
suspend. It's something that can ping.

I also use a shared type for Thenable in the cases where we expect a value
so we can be a bit more rigid with our us of them.

* Make Chunks into Wakeables instead of using native Promises

This value is just going from here to React so we can keep it a lighter
abstraction throughout.

* Renamed thenable to wakeable in variable names
2020-03-25 16:49:37 -07:00
Dan Abramov
6498f62edc
Fix a mistake in ReactChildren refactor (#18380)
* Regression test for map() returning an array

* Add forgotten argument

This fixes the bug.

* Remove unused arg and retval

These aren't directly observable. The arg wasn't used, it's accidental and I forgot to remove. The retval was triggering a codepath that was unnecessary (pushing to array) so I removed that too.

* Flowify ReactChildren

* Tighten up types

* Rename getComponentKey to getElementKey
2020-03-25 09:20:46 +00:00
Dan Abramov
2ba43edc26
Rename internal fields (#18377) 2020-03-24 18:19:20 +00:00
Andrew Clark
fc7835c657
Revert "Upgrade to jest 25 (#17896)" (#18376)
This reverts commit cf0081263c.

The changes to the test code relate to changes in JSDOM that come with Jest 25:

* Several JSDOM workarounds are no longer needed.
* Several tests made assertions to match incorrect JSDOM behavior (e.g. setAttribute calls) that JSDOM has now patched to match browsers.
  * https://codesandbox.io/s/resets-value-of-datetime-input-to-fix-bugs-in-ios-safari-1ppwh
* JSDOM no longer triggers default actions when dispatching click events.
  * https://codesandbox.io/s/beautiful-cdn-ugn8f
* JSDOM fixed (jsdom/jsdom#2700) a bug so that calling focus() on an already focused element does not dispatch a FocusEvent.
* JSDOM now supports passive events.
* JSDOM has improved support for custom CSS properties.
  * But requires jsdom/cssstyle#112 to land to support webkit prefixed properties.
2020-03-24 10:51:48 -07:00
Dominic Gannaway
0140118e8e
ReactDOM.useEvent: add support for beforeblur/afterblur (#18370)
* ReactDOM.useEvent: add support for beforeblur/afterblur
2020-03-24 16:14:55 +00:00
Sebastian Markbåge
fd61f7ea53
Refactor Lazy Components to use teh Suspense (and wrap Blocks in Lazy) (#18362)
* Refactor Lazy Components

* Switch Blocks to using a Lazy component wrapper

Then resolve to a true Block inside.

* Test component names of lazy Blocks
2020-03-22 21:53:05 -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
Luna Ruan
7c1478680f
fix string ref cannot be auto converted warning for React.jsxDEV (#18354)
The string ref cannot be auto converted warning was using the wrong _self. This diff fixes this so it is now using the correct __self
2020-03-19 23:47:53 -07:00
Dominic Gannaway
9e7f334c71
ModernEventSystem: fix event replaying (#18346)
* ModernEventSystem: fix event replaying
2020-03-19 20:44:38 +00:00
Dominic Gannaway
ffefb4e77f
ModernEventSystem: refine Flow types (#18349) 2020-03-19 20:25:52 +00:00
Andrew Clark
6818a2aa01
Revert accidental changes to package.json (#18348)
The publish script was written before we switched to running patch
releases out-of-band, so when updating the local package.json version
numbers, it accidentally reverted other changes that have landed to
master since 16.13 was released.
2020-03-19 13:16:37 -07:00
Andrew Clark
ad445b127e Update package.jsons for 16.13.1 patch relase 2020-03-19 12:58:31 -07:00
Dominic Gannaway
8311cb5d24
Modern Event System: refactor legacy FB support logic (#18336) 2020-03-19 13:22:36 +00:00
Dan Abramov
1cf4a170ac
Stop exposing ReactDOMComponentTree from FB builds (#18338) 2020-03-18 20:35:58 +00:00
Sebastian Markbåge
94505b9613
Don't use EventListener Fork in Modern WWW Builds (#18333)
* Move unsubscribe fork to EventListener

That way we can statically compile out more of these indirections.

* Don't use the EventListener fork for Modern WWW builds
2020-03-18 13:13:50 +00:00
Dominic Gannaway
7d466bcc25
React Event System: Refactor ElementListenerMap for upgrading (#18308) 2020-03-18 00:15:50 +00:00
Dan Abramov
fe1f79b95b
Don't fire the render phase update warning for class lifecycles (#18330)
* Change the warning to not say "function body"

This warning is more generic and may happen with class components too.

* Dedupe by the rendering component

* Don't warn outside of render
2020-03-18 00:07:14 +00:00
Sebastian Silbermann
22cab1cbd6
test(getComponentName): Increase test coverage (#18149)
Co-authored-by: Brian Vaughn <brian.david.vaughn@gmail.com>
2020-03-17 14:47:24 -07:00
Dan Abramov
26666427d6
Don't support older isomorphic React with newer renderers (#18329)
* Don't support older isomorphic React with newer renderers

* Remove the lazy hack
2020-03-17 19:30:10 +00:00
Dominic Gannaway
3a0076e0e8
useEvent: Small tweaks and changes (#18328) 2020-03-17 15:32:26 +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
0705b7282f
Refine event system types + pass through priority (#18305) 2020-03-13 17:57:17 +00:00
Dominic Gannaway
45d26f6edb
Remove un-used function arg (#18303) 2020-03-13 14:16:12 +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
8b155d2613
Flow type ReactDOMComponentTree (#18280) 2020-03-11 19:38:23 +00:00
Brian Vaughn
322cdcd3ab
useMutableSource hook (#18000)
useMutableSource hook

useMutableSource() enables React components to safely and efficiently read from a mutable external source in Concurrent Mode. The API will detect mutations that occur during a render to avoid tearing and it will automatically schedule updates when the source is mutated.

RFC: reactjs/rfcs#147
2020-03-11 12:34:39 -07:00
Dominic Gannaway
30a998debf
ModernEventSystem: refactor accumulateTwoPhaseListeners (#18274) 2020-03-11 18:55:01 +00:00
Dominic Gannaway
160505b0ca
ReactDOM.useEvent: Add more scaffolding for useEvent hook (#18271) 2020-03-10 20:31:12 +00:00
Dominic Gannaway
a3bf668812
Flare: Fix listener upgrade bug (#18270) 2020-03-10 17:59:03 +00:00
Dominic Gannaway
29534252ad
ReactDOM.useEvent add flag and entry point (#18267) 2020-03-10 12:18:49 +00:00
Sebastian Markbåge
bdc5cc4635
Add Relay Flight Build (#18242)
* Rename to clarify that it's client-only

* Rename FizzStreamer to FizzServer for consistency

* Rename react-flight to react-client/flight

For consistency with react-server. Currently this just includes flight
but it could be expanded to include the whole reconciler.

* Add Relay Flight Build

* Rename ReactServerHostConfig to ReactServerStreamConfig

This will be the config specifically for streaming purposes.
There will be other configs for other purposes.
2020-03-07 11:23:30 -08:00