Commit Graph
10909 Commits
Author SHA1 Message Date
Andrew ClarkandGitHub f9e60c8a19 Warn when suspending at wrong priority (#15492)
* Warn when suspending at wrong priority

Adds a warning when a user-blocking update is suspended.

Ideally, all we would need to do is check the current priority level.
But we currently have no rigorous way to distinguish work that was
scheduled at user- blocking priority from work that expired a bit and
was "upgraded" to a higher priority. That's because we don't schedule
separate callbacks for every level, only the highest priority level per
root. The priority of subsequent levels is inferred from the expiration
time, but this is an imprecise heuristic.

However, we do store the last discrete pending update per root. So we
can reliably compare to that one. (If we broaden this warning to include
high pri updates that aren't discrete, then this won't be sufficient.)

My rationale is that it's better for this warning to have false
negatives than false positives.

Potential follow-ups:
- Bikeshed more on the message. I don't like what I landed on that much
but I think it's good enough to start.
- Include the names of the components that updated. (The ideal place to
fire the warning is during the setState call but we don't know if
something will suspend until the next update. Maybe we could be clever
and warn during a subsequent update to the same component?)

* Move Suspense priority check to throwException
2019-05-07 16:50:04 -07:00
Nicolas GallagherandGitHub 89d8d1435f Add React.unstable_createEventComponent (#15580)
API for creating event components from event responders.
2019-05-07 12:36:42 -07:00
Brian VaughnandGitHub 6da04b5d88 Fix interaction tracing for batched update mounts (#15567)
* Added failing test for act+interaction tracing
* Mark pending interactions on root for legacy unbatched phase
2019-05-06 12:59:48 -07:00
Dominic GannawayandGitHub d38cfd452f Ensure TouchHitTarget element is server side rendered with hit slop (#15385)
* Follow up to 15381

* Add back in hit slop properties

* Prettier

* Fix lint

* move hydration update out of DEV block

* Remove pointer-events:auto
2019-05-06 20:13:23 +01:00
Nicolas GallagherandGitHub 2e5d1a8b9e React Events: fix cancel events for Press (#15563)
* Fixes a bug in the cancellation logic. The cancel events are now correctly listened to on the root.
* Fixes cancellation in Safari by using the dragstart event as a proxy for cancellation (i.e., the event dispatched when move-during-press occurs on an anchor tag)
2019-05-03 15:33:21 -07:00
Nicolas GallagherandGitHub 307e0a7d7d React Events: cancel onLongPress for large enough moves (#15562)
Implements the behaviour from React Native's Pressability.
2019-05-03 12:59:55 -07:00
Dominic GannawayandGitHub 339366c461 Event API: Support press reentry for pointer events (#15560) 2019-05-03 18:32:50 +01:00
Dominic GannawayandGitHub ec6691a687 Event API: remove isTargetDirectlyWithinEventComponent (#15546) 2019-04-30 17:38:48 +01:00
Dominic GannawayandGitHub a6e30001fb Delete duplicate Focus.js (#15540)
This file was renamed to the lower case version, but as Mac filesystems are typically case insensitive, it was never removed.
2019-04-30 12:20:44 +01:00
Dominic GannawayandGitHub f7993d5477 Delete duplicate Hover.js (#15539)
This file was renamed to the lower case version, but as Mac filesystems are typically case insensitive, it was never removed.
2019-04-30 12:13:07 +01:00
Dominic GannawayandGitHub c8ee10037a Delete duplicate Swipe.js (#15541)
This file was renamed to the lower case version, but as Mac filesystems are typically case insensitive, it was never removed.
2019-04-30 12:11:26 +01:00
Dominic GannawayandGitHub 494716c9b4 Delete duplicate Drag.js (#15537)
This file was renamed to the lower case version, but as Mac filesystems are typically case insensitive, it was never removed.
2019-04-30 12:07:24 +01:00
Dominic GannawayandGitHub 377846fef8 Delete duplicate Press.js (#15538)
This file was renamed to the lower case version, but as Mac filesystems are typically case insensitive, it was never removed.
2019-04-30 12:06:44 +01:00
Dominic GannawayandGitHub 379515e83e Follow up to 15535 (#15536) 2019-04-30 12:04:19 +01:00
Dominic GannawayandGitHub bd88982fbf Event API: use capture for all event listeners using experimental responder system (#15526) 2019-04-30 11:40:45 +01:00
Andrew ClarkandGitHub 72ca3c60e7 Bump scheduler version to 0.14.0 (#15395) 2019-04-29 18:10:11 -07:00
Andrew ClarkandGitHub 7882c41f60 Use lowercase entry points for event modules (#15535)
Matches npm convention
2019-04-29 16:25:56 -07:00
Nathan SchlossandAndrew Clark 43c4e5f348 Add method for forcing a lower framerate 2019-04-29 15:51:58 -07:00
Brian VaughnandGitHub 1b752f1914 Fixed potential interaction tracing leak in Suspense thennable memoization (#15531)
Audited the other places we call unstable_wrap() in React DOM and verified that they didn't have this similar problem.
2019-04-29 15:04:52 -07:00
Eli WhiteandGitHub 12e5a13cf2 [React Native] Inline calls to FabricUIManager in shared code (#15490)
* [React Native] Inline calls to FabricUIManager in shared code

* Call global.nativeFabricUIManager directly as short term fix

* Add flow types

* Add nativeFabricUIManager global to eslint config

* Adding eslint global to bundle validation script
2019-04-29 14:31:16 -07:00
Nicolas GallagherandGitHub 2cca18728e React Events: add onFocusVisibleChange to Focus (#15516)
Called when focus visibility changes. Focus is only considered visible if a
focus event occurs after keyboard navigation. This provides a way for people to
provide visual focus styles for keyboard accessible UIs without those styles
appearing if focus is triggered by mouse, touch, pen.
2019-04-29 13:52:15 -07:00
Nicolas GallagherandGitHub cc5a49379b React Events: FocusScope tweaks and docs (#15515)
* FocusScope: rename trap to contain.
* FocusScope: avoid potential for el.focus() errors.
* FocusScope: add docs.
* Update docs formatting.
2019-04-26 13:38:01 -07:00
Dominic GannawayandGitHub 796c67a25f Event API: responder event types should not re-register on EventComponent update (#15514) 2019-04-26 21:33:54 +01:00
Dominic GannawayandGitHub c4d1dcb533 React Events: core API documentation followup (#15506) 2019-04-26 15:47:28 +01:00
Dan NateandPhilipp Spiess 41ef1961c1 Update TopLevelEventTypes.js (#15511)
Fix grammar of code comment.
2019-04-26 14:58:32 +02:00
Dominic GannawayandGitHub 7a482af5d8 Event API: Fix bug where Press root events were not being cleared (#15507) 2019-04-26 10:30:38 +01:00
Nicolas GallagherandDominic Gannaway a14e24efab React Events: core API documentation (#15505) 2019-04-26 08:11:40 +01:00
Dominic GannawayandGitHub 8658611b6c Event API: ensure event keys are unique + add validation (#15501) 2019-04-26 08:00:57 +01:00
Nicolas GallagherandGitHub d9839740ef React events: remove unused types (#15503) 2019-04-25 15:11:53 -07:00
Nicolas GallagherandGitHub 0b34311705 React events: fix press end event dispatching (#15500)
This patch fixes an issue related to determining whether the end event occurs
within the responder region. Previously we only checked if the event target was
within the responder region for moves, otherwise we checked if the target was
within the event component. Since the dimensions of the child element can
change after activation, we need to recalculate the responder region before
deactivation as well if the target is not within the event component.
2019-04-25 13:00:22 -07:00
Dominic GannawayandGitHub d1f667acc0 Event API: follow up fixes for FocusScope + context changes (#15496) 2019-04-25 20:10:33 +01:00
Kunuk NykjærandChristoph Nakazawa c530639dd2 Minor code structure adjustments to the bundles.js file (#15079)
* simplify

* fix error

* use deepFreeze

* move comments
2019-04-25 16:24:01 +01:00
Alec LarsonandChristoph Nakazawa ed36df46c6 add --watch mode to "yarn build" (#15116)
* wip: add --watch mode to "yarn build"

* fix: handle error events
2019-04-25 12:55:44 +01:00
Redmond TranandChristoph Nakazawa 793ef9b855 test(eslint-plugin-react-hooks): add coverage for unused custom hook (#15130) 2019-04-25 12:15:29 +01:00
Jeffrey BerryandChristoph Nakazawa d61da93878 test(accumulate): add test suite for accumulate function (#15159)
* refactor(typo): remove typo 'be'

* test(accumulate): add test suite for accumulate function
2019-04-25 12:12:25 +01:00
Adam ComellaandChristoph Nakazawa a187e9b5e4 React Native: Allow Views to be nested inside of Text (#15464)
This feature is now supported on both iOS and Android. The Android feature was merged a couple of weeks ago: https://github.com/facebook/react-native/pull/23195.
2019-04-25 12:06:39 +01:00
Radu-Sebastian AmarieandChristoph Nakazawa f85aadefc0 ADD: disablePictureInPicture attribute for HTML5 videos (#15334)
* ADD: disablePictureInPicture attribute for HTML5 videos

* ADD: disablePictureInPicture as DOMProperty and attribute

* Update: Replace camelCase with lowercase and vice-versa

* FIX: Missing comma on attribute (prettier)
2019-04-25 12:02:27 +01:00
FUJI GoroandChristoph Nakazawa 1eb2b892df give canUseDOM with a possibility to be a constant (#14194)
https://webpack.js.org/plugins/define-plugin/

Webpack's DefinePlugin has the ability to replace `typeof expr` to a constant in compile-time, which should lead to better dead-code-elimination.
2019-04-25 11:28:53 +01:00
shubhamandChristoph Nakazawa de26d6dd36 typo fix (#15493)
changed ReactResponderContext.dispatchEvent otpions keys to options.
2019-04-25 09:37:35 +01:00
Dominic GannawayandGitHub 64e3da286f Event API: Add FocusScope surface (#15487) 2019-04-25 02:01:09 +01:00
Dominic GannawayandGitHub 3f058debc2 Event API: various bug fixes (#15485) 2019-04-24 17:56:21 +01:00
Brendan McLoughlinandDominic Gannaway fb28e90482 Add missing word to code comment for clarity (#15443) 2019-04-24 11:03:51 +01:00
Dominic GannawayandGitHub fa2fa3564d Experimental event API: adds context.isTargetDirectlyWithinEventComponent (#15481) 2019-04-24 11:02:47 +01:00
Dominic GannawayandGitHub d3af2f2a5d Experimental Event API: add event component mount phase callback (#15480) 2019-04-24 10:41:24 +01:00
Andrew ClarkandGitHub ce126fbb23 Fix priority inference of next level of work (#15478)
Bugfix for `inferPriorityFromExpirationTime` function. It happened to
work in our existing tests because we use virtual time.

Flow would have caught this if expiration times were an opaque type. We
should consider that in the future. (The downside of opaque types is
that all operations would have to go through helper functions, which may
or may not get inlined by Closure.)
2019-04-23 16:41:05 -07:00
Andrew ClarkandGitHub 71c8759ceb Measure callback timeout relative to current time (#15479)
Fixes a bug where the timeout passed to `scheduleCallback` represented
an absolute timestamp, instead of the amount of time until that
timestamp is reached. The solution is to subtract the current time
from the expiration.

The bug wasn't caught by other tests because we use virtual times that
default to 0, and most tests don't advance time.

I also moved the `initialTimeMs` offset to the
`SchedulerWithReactIntegration` module so that we don't have to remember
to subtract the offset every time. (We should consider upstreaming this
to the Scheduler package.)
2019-04-23 16:40:55 -07:00
Andrew ClarkandGitHub 9c6ff136c7 Remove timeout from performance flamegraph (#15477)
The implementation is wrong, but also it's not that useful for
debugging. Implementing it properly would involve tracking more
information than we do currently. Perhaps including the priority
of the callback in the message would be helpful, but not sure. For now
I'll just remove it.
2019-04-23 15:42:25 -07:00
Dan AbramovandGitHub 299a2714c3 Use stricter equality check (#15474) 2019-04-23 23:28:02 +01:00
Dominic GannawayandGitHub 017d6f14b7 Experimental Event API: add rootEventTypes support to event responders (#15475)
* Adds rootEventTypes
2019-04-23 19:55:50 +01:00
Dominic GannawayandGitHub 784ebd8fa9 Experimental event API: rework the propagation system for event components (#15462) 2019-04-23 11:50:48 +01:00