Commit Graph

69 Commits

Author SHA1 Message Date
Spencer Ahrens ab44d32ec5 Better Incremental/TaskQueue error reporting
Reviewed By: yungsters

Differential Revision: D3135010

fb-gh-sync-id: 2d6d8800c7f7557221bd57869b6a6fa30d65f122
fbshipit-source-id: 2d6d8800c7f7557221bd57869b6a6fa30d65f122
2016-04-05 02:35:22 -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
Spencer Ahrens f21da3aa31 <Incremental> for incremental rendering
Summary:Everything wrapped in `<Incremental>` is rendered sequentially via `InteractionManager`.
The `onDone` callback is called when all descendent incremental components have
finished rendering, used by `<IncrementalPresenter>` to make the story visible all at once
instead of the parts popping in randomly.

This includes an example that demonstrates streaming rendering and the use of
`<IncrementalPresenter>`.  Pressing down pauses rendering and you can see the
`TouchableOpacity` animation runs smoothly.  Video:

https://youtu.be/4UNf4-8orQ4

Ideally this will be baked into React Core at some point, but according to jordwalke that's
going to require a major refactoring and take a long time, so going with this for now.

Reviewed By: ericvicenti

Differential Revision: D2506522

fb-gh-sync-id: 5969bf248de10d38b0ac22f34d7d49bf1b3ac4b6
shipit-source-id: 5969bf248de10d38b0ac22f34d7d49bf1b3ac4b6
2016-03-10 08:14:23 -08: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
Adam Miskiewicz 28116ec3db Reverted commit D2803288
Summary:
As spicyj mentioned in commit 6a838a4, the ideal state of affairs when it comes to consuming `react` and `fbjs` from NPM is for the packager not to have knowledge of either package. This PR addresses the `fbjs` part of that, and relies on https://github.com/facebook/fbjs/pull/95. **DO NOT MERGE** until #95 (or a variation) is in `fbjs` and is released to npm.

This PR does several things:

1. Adds stub modules within RN that expose `fbjs` modules to be required using Haste. After discussing a few ideas with spicyj, this seemed like a good option to keep internal FB devs happy (and not make them change the way they write JS), but allow for removing packager complexity and fit in better with the NPM ecosystem. Note -- it skips stubbing `fetch`, `ExecutionEnvironment`, and `ErrorUtils`, due to the fact that these need to have Native specific implementations, and there's no reason for those implementations to exist in `fbjs`.
2. Removes the modules that were previously being used in lieu of their `fbjs` eq
Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2803288

Pulled By: javache

fb-gh-sync-id: 121ae811ce4cc30e6ea79246f85a1e4f65648ce1
shipit-source-id: 121ae811ce4cc30e6ea79246f85a1e4f65648ce1
2016-02-11 02:45:34 -08:00
Adam Miskiewicz 98e5e2b427 Remove knowledge of fbjs from the packager
Summary:
As spicyj mentioned in commit 6a838a4, the ideal state of affairs when it comes to consuming `react` and `fbjs` from NPM is for the packager not to have knowledge of either package. This PR addresses the `fbjs` part of that, and relies on https://github.com/facebook/fbjs/pull/95. **DO NOT MERGE** until #95 (or a variation) is in `fbjs` and is released to npm.

This PR does several things:

1. Adds stub modules within RN that expose `fbjs` modules to be required using Haste. After discussing a few ideas with spicyj, this seemed like a good option to keep internal FB devs happy (and not make them change the way they write JS), but allow for removing packager complexity and fit in better with the NPM ecosystem. Note -- it skips stubbing `fetch`, `ExecutionEnvironment`, and `ErrorUtils`, due to the fact that these need to have Native specific implementations, and there's no reason for those implementations to exist in `fbjs`.
2. Removes the modules that were previously being used in lieu of their `fbjs` eq
Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2803288

Pulled By: davidaurelio

fb-gh-sync-id: fd257958ee2f8696eebe9048c1e7628c168bf4a2
shipit-source-id: fd257958ee2f8696eebe9048c1e7628c168bf4a2
2016-02-11 02:21:37 -08:00
Christoph Pojer b84ad2ab0d Updates for haste2 inside of jest
Summary:
I'm working on deploying haste2 with jest. This updates all the files that require changes for this to work and they are backwards compatible with the current version of jest.

* package.json was just outdated. I think haste1's liberal handling with collisions made this a "non-issue"
* env.js didn't properly set up ErrorUtils, also unsure why that isn't a problem in jest right now already?
* some things were mocking things they shouldn't
* Because of the regex that matches against providesModule and System.import, it isn't possible to list module names more than once. We have multiple tests reusing the same providesModule ids and using System.import with modules that only exist virtually within that test. Splitting up the strings makes the regexes work (we do the same kind of splitting on www sometimes if we need to) and using different providesModule names in different test files fixes the problem. I think the BundlesLayoutIntegration-test is going to be deleted, so this doesn't even matter.

public

Reviewed By: voideanvalue

Differential Revision: D2809681

fb-gh-sync-id: 8fe6ed8b5a1be28ba141e9001de143e502693281
2016-01-08 06:52:29 -08:00
sunnylqm a47fcd44f9 Confusing description about task queue
Summary:
Just can't get the point. What does `the next task that might have been queued up earlier` mean? Earlier than what? `The first task`? Please correct me if I missed something.
Closes https://github.com/facebook/react-native/pull/4970

Reviewed By: svcscm

Differential Revision: D2789390

Pulled By: sahrens

fb-gh-sync-id: 3078fb6cbc7940d26d2dc393ba9448f132721ea2
2015-12-24 19:35:29 -08:00
Adam Miskiewicz c972cce405 Fix InteractionManager-test.js
Summary:
Rather than specifying what not to mock, turn off autoMock for this test suite, and only mock BatchedBridge.

Fixes #4965
Closes https://github.com/facebook/react-native/pull/4967

Reviewed By: svcscm

Differential Revision: D2789079

Pulled By: androidtrunkagent

fb-gh-sync-id: 0d7024f92b630a3c0643ea2e1fde8d673fcdf6e1
2015-12-24 09:25:19 -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
Eric Vicenti c9a40a989b [ReactNative] OSS JSNavigationStack w/ Examples 2015-03-24 09:39:40 -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