Commit Graph

18 Commits

Author SHA1 Message Date
leeight 5d35df8afa Add missing return, FIX #9886
Summary:
cc sahrens

FIX #9886
Closes https://github.com/facebook/react-native/pull/9938

Differential Revision: D3875766

Pulled By: sahrens

fbshipit-source-id: c3eb7f8203db80403de3b789eea907651bc333da
2016-09-15 22:43:36 -07:00
Spencer Ahrens 3b5e4cc593 Fix InteractionManager promise issue with some OSS setups
Reviewed By: yungsters

Differential Revision: D3860551

fbshipit-source-id: 731ba758e28ce24f12ca80f7be0f962e6929ee2c
2016-09-15 15:13:35 -07:00
Pieter De Baets ad677426cf Cleanup clear/set/throwImmediate
Reviewed By: vjeux

Differential Revision: D3703300

fbshipit-source-id: ad03d558d6af61aba17899ec256d71fdda4c4c84
2016-08-12 07:28:38 -07:00
Spencer Ahrens be09cccb1f Make InteractionManager tasks cancellable
Summary:
Returns a promise-like object with a new cancel function that will dig through the queue
and remove relevant tasks before they are executed. Handy when tasks are scheduled in react
components but should be cleaned up in unmount.

Reviewed By: devknoll

Differential Revision: D3406953

fbshipit-source-id: edf1157d831d5d6b63f13ee64cfd1c46843e79fa
2016-06-08 22:58:19 -07:00
Basil Hosmer ac5636dd59 explicit type args in react-native-github
Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
2016-05-24 18:28:26 -07:00
Spencer Ahrens b5d9bf0fb2 merge InteractionManager stuff back into PanResponder
Reviewed By: bestander

Differential Revision: D3224519

fb-gh-sync-id: d041214b68fedfdd6b01aa2b710b02381c29dcfa
fbshipit-source-id: d041214b68fedfdd6b01aa2b710b02381c29dcfa
2016-04-26 13:19:22 -07:00
Spencer Ahrens 667d278119 Only grab InteractionManager handle in PanResponder, not all touches
Summary:
Previously, `InteractionManager` was baked in at the lowest level to all touches via `ResponderEventPlugin`,
which meant that any time a finger was touching the screen, `InteractionManager` would be locked. This included while
doing 100% native scrolls, and thus would block progress from Relay, Incremental, or anything else scheduling events
through `InteractionManager`.

This diff switches to only bake it into `PanResponder` (and it remains hooked into `Animated` as before) which are the
main two cases where we need 60fps JS execution and want to queue up slower tasks.

This is done with a reusable higher-order-responder `InteractionManager.createResponderClass`.

Depends on FYI https://github.com/facebook/react/pull/6587, https://github.com/facebook/react/pull/6584

Reviewed By: sebmarkbage

Differential Revision: D3210951

fb-gh-sync-id: 682d21ac5cff704673b63d5942a903a3d8912835
fbshipit-source-id: 682d21ac5cff704673b63d5942a903a3d8912835
2016-04-26 00:23:30 -07:00
Spencer Ahrens ca353d0829 A little more debugging code for Incremental
Reviewed By: astreet

Differential Revision: D3091688

fb-gh-sync-id: 4f91d5126a16b56904fa4af7acdc32b9bb873c6d
shipit-source-id: 4f91d5126a16b56904fa4af7acdc32b9bb873c6d
2016-03-24 19:44:29 -07:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Spencer Ahrens 893a54d0cd Add yieldy, chained async task support to InteractionManager
Summary:
Default behavior should be unchanged.

If we queue up a bunch of expensive tasks during an interaction, the default
`InteractionManager` behavior would execute them all in one synchronous loop at
the end the JS event loop via one `setImmediate` call, blocking the JS thread
the entire time.

The `setDeadline` addition in this diff enables an option to only execute tasks
until the `eventLoopRunningTime` is hit (added to MessageQueue/BatchedBridge),
allowing the queue execution to be paused if an interaction starts in between
tasks, making the app more responsive.

Additionally, if a task ends up generating a bunch of additional tasks
asynchronously, the previous implementation would execute these new tasks after
already scheduled tasks. This is often fine, but I want it to fully resolve
async tasks and all their dependencies before making progress in the rest of the
queue, so I added support for `type PromiseTask = {gen: () => Promise}` to do
just this. It works by building a stack of queues each time a `PromiseTask` is
started, and pops them off the stack once they are resolved and the queues are
processed.

I also pulled all of the actual queue logic out of `InteractionManager` and into
a new `TaskQueue` class to isolate concerns a bit.

public

Reviewed By: josephsavona

Differential Revision: D2754311

fb-gh-sync-id: bfd6d0c54e6410cb261aa1d2c5024dd91a3959e6
2015-12-23 16:12:30 -08:00
Philipp von Weitershausen d7c8b4478b Make InteractionManager.runAfterInteractions() return a Promise
Summary: In accordance with the unwritten rule that any API that takes a callback should also return a promise, I've changed `InteractionManager.runAfterInteractions()` to do just that.

```js
  InteractionManager.runAfterInteractions(() => {
    ...
  });
```
can become
```js
  InteractionManager.runAfterInteractions().then(() => {
    ...
  });
```
(but doesn't have to). Most importantly, though, this change enables code like
```js
  doSomeUIStuff();
  await InteractionManager.runAfterInteractions();
  doSomeNonUIStuff();
```
which is nice.

Note: Because returning a `Promise` means the callback argument is now optional, the behaviour of the API is slightly changed, though not in a backwards-incompatible way (unless a consumer is in some way relying on the exception, but that would be insane).
Closes https://github.com/facebook/react-native/pull/3788

Reviewed By: vjeux

Differential Revision: D2634693

Pulled By: josephsavona

fb-gh-sync-id: 7315120963be23cf69d777e940b2750d32ae47a8
2015-11-09 20:14:26 -08:00
Joe Savona 776dc97437 InteractionManager: remove dev timeout warnings 2015-07-01 04:51:28 -08:00
Joe Savona 1d5d01c3c9 InteractionManager: DEV warning for possibly unclosed handles 2015-05-20 16:54:03 -08:00
Tim Yung 29696a26eb React Native: Fix InteractionManager Race Condition 2015-04-13 11:14:11 -08:00
Basil Hosmer 030b264eb4 flowify a few more Libraries 2015-03-26 10:13:38 -08:00
Christopher Chedeau e1ef0328d9 [ReactNative] Expanded license on js files 2015-03-23 13:17:54 -08:00
Christopher Chedeau 2ad43094ea [ReactNative] OSS Interaction Manager 2015-03-14 11:17:15 -08:00
Spencer Ahrens efae175a8e [react-packager][streamline oss] Move open sourced JS source to react-native-github 2015-02-19 21:25:11 -08:00