1785 Commits

Author SHA1 Message Date
Spencer Ahrens
a5212c8180 Merge pull request #1576 from sahrens/Update_Tue_9_Jun
Update Tue June 9th
2015-06-09 17:51:20 -07:00
Spencer Ahrens
205e2659a1 Updates from Tue 9 Jun 2015-06-09 17:20:30 -07:00
Spencer Ahrens
3102fc5df9 [ReactNative] Fix secure text entry
Summary:
@public

`validAttributes` strikes again.

Test Plan: secure box in example is actually secure
2015-06-09 16:02:38 -08:00
Spencer Ahrens
6c6b8bec7e [ReactNative] Fix require-time redboxes 2015-06-09 15:42:47 -08:00
Tadeu Zagallo
847dff8d75 [ReactNative] Make JavaScript executors bridge modules
Summary:
@public

This is the first of a few diffs that change the way the executors are handled
by the bridge.

For they are just promoted to modules, so they are automatically loaded by the bridge.

Test Plan:
Tested on UIExplorer, Catalyst and MAdMan.
Tested all the 3 executors, everything looks fine.
2015-06-09 15:40:55 -08:00
Spencer Ahrens
68bb3a7e71 [ReactNative] orange box
Summary:
@public

There have been multiple instances of confusion about whether a redbox means the
developer did something they shouldn't but things will keep working, or if
something went horribly wrong and the app will crash in prod.  This diff
introduces an orange background color to the redbox for `console.error` and
`RCTLogError` to indicate that something bad happened, but that the app will
continue working.

Test Plan:
see orange error for geo permissions:

{F22541375}
2015-06-09 14:53:29 -08:00
Tadeu Zagallo
6358e163a5 [ReactNative] Revert async exports changes to MessageQueue + test
Summary:
@public

`[Bridge] Add support for JS async functions to RCT_EXPORT_METHOD` was imported but broke some internal code, reverting the `MessageQueue` that caused the issues and add a test, since the method is not used yet.

Test Plan: Run the test o/
2015-06-09 14:25:32 -08:00
James Ide
90439cec26 [Bridge] Add support for JS async functions to RCT_EXPORT_METHOD
Summary:
Adds support for JS async methods and helps guide people writing native modules w.r.t. the callbacks. With this diff, on the native side you write:

```objc
RCT_EXPORT_METHOD(getValueAsync:(NSString *)key
                       resolver:(RCTPromiseResolver)resolve
                       rejecter:(RCTPromiseRejecter)reject)
{
  NSError *error = nil;
  id value = [_nativeDataStore valueForKey:key error:&error];

  // "resolve" and "reject" are automatically defined blocks that take
  // any object (nil is OK) and an NSError, respectively
  if (!error) {
    resolve(value);
  } else {
    reject(error);
  }
}
```

On the JS side, you can write:

```js
var {DemoDataStore} = require('react-native').NativeModules;
DemoDataStore.getValueAsync('sample-key').then((value) => {
  console.log('Got:', value);
}, (error) => {
  console.error(error);
  // "error" is an Error object whose message is the NSError's description.
  // The NSError's code and domain are also set, and the native trace i
Closes https://github.com/facebook/react-native/pull/1232
Github Author: James Ide <ide@jameside.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-09 14:25:31 -08:00
James Ide
2f78b8ace6 Merge pull request #1573 from fisherwebdev/master
[Docs] Note about transformMatrix
2015-06-09 14:28:06 -07:00
fisherwebdev
1fc5e3d1e3 [Docs] Note about transformMatrix 2015-06-09 14:05:17 -07:00
David Callahan
cf8c2693af Use getsectiondata 2015-06-09 12:40:52 -08:00
Nick Lockwood
f88bc3eb73 [ReactNative] Refactor RCTDataManager to support pluggable data source modules (RCTURLRequestHandlers)
Summary:
@public

This is a refactor of @philikon's original diff that decouples the dependencies between the Network and Image modules, and replaces RCTDataQueryExecutor with a more useful abstraction.

I've introduced the RCTURLRequestHandler protocol, which is a new type of bridge module used for loading data using an NSURLRequest. RCTURLRequestHandlers can be registered using RCT_EXPORT_MODULE() and are then available at runtime for use by the RCTDataManager, which will automatically select the appropriate handler for a given request based on the handler's self-reported capabilities.

The currently implemented handlers are:

- RCTHTTPRequestHandler - the standard open source HTTP request handler that uses NSURLSession
- RKHTTPRequestHandler - the internal FB HTTP request handler that uses FBNetworking
- RCTImageRequestHandler - a handler for loading local images from the iOS asset-library

Depends on D2108193

Test Plan:
- Internal apps still work
- OSS port still compiles, Movies app and a sample Parse app still work
- uploading image to Parse using the above code snippet works
- tested `FormData` with string and image parameters using http://www.posttestserver.com/
2015-06-09 12:27:06 -08:00
Nick Lockwood
f4bf80f3ea [ReactNative] Allow uploading native files (e.g. photos) and FormData via XMLHttpRequest 2015-06-09 12:27:05 -08:00
Spencer Ahrens
f590a8b15b [ReactNative] fix navIOS example
Summary: constants were refactored to be enums.

Test Plan:
@public

navIOS example doesn't fatal.
2015-06-09 12:06:14 -08:00
Tadeu Zagallo
2a08897c6e [ReactNative] Batch JS -> Native calls per queue
Summary:
@public

For every call that comes from JS to Native we'd call dispatch_async so the
method would be cllead on the queue/thread it's expecting. This diff
buckets the calls by target queue, dispatches only once to that queue, and then
call all the methods for it inside the same dispatch.

Test Plan: {F22510090}
2015-06-09 06:52:54 -08:00
Tadeu Zagallo
459882ea7e [ReactNative] Fix BUCK file and reenable tests 2015-06-09 05:16:21 -08:00
Andy Street
0a3fca9520 [react_native] JS files from D2130816: [react_native] Don't render crumb container to texture 2015-06-09 03:09:17 -08:00
Tadeu Zagallo
de1320acc7 [ReactNative] Check if bridge is valid on -modules 2015-06-09 02:54:59 -08:00
Philipp von Weitershausen
8e2727ad52 Back out D2128859: interop with react devtools 2015-06-08 20:54:21 -08:00
Philipp von Weitershausen
0a95edf6ea [ReactNative] use Map, not Object when functions are keys 2015-06-08 17:43:17 -08:00
Christopher Chedeau
1a12b95f7a [ReactNative] Revert D2134877 2015-06-08 13:49:28 -08:00
Christopher Chedeau
0fcc7bacb8 Bump react-native-cli version 2015-06-08 14:25:48 -07:00
Christopher Chedeau
c9e555f4b3 [ReactNative] Better error message when forgetting to wrap Animated 2015-06-08 12:44:32 -08:00
Andrei Coman
8a0390f5f8 [react_native] Fix UIExplorer 2015-06-08 11:26:01 -08:00
Eric Vicenti
f6528171d0 [ReactNative] Fix navigator touch-blocking logic
Summary:
The logic for this is incorrect when the `state.transitionToIndex === 0`, and will return false and not capture the touch.

@public

Test Plan: Try to repro bugs on device and simulator
2015-06-08 11:20:12 -08:00
Jared Forsyth
d68776d5de interop with react devtools 2015-06-08 09:04:09 -08:00
Adam Ernst
16b8747f61 @build-break Disable flaky react tests 2015-06-08 06:38:44 -08:00
Andrei Coman
fc48f175c3 [react_native] JS files from D2126599: Android MentionInput Rendering (part 1/2) 2015-06-08 03:47:32 -08:00
Andrei Coman
8e3c02e4f0 [react_native] JS files from D2127018: [react_native] Add uiexplorer app 2015-06-08 03:28:35 -08:00
Brent Vatne
e712306318 Merge pull request #1548 from kevindeleon/patch-1
Adds additional info for creating Swift modules
2015-06-07 16:52:23 -07:00
Kevin deLeon
40b1976233 Fixes spelling error in requested change. 2015-06-07 16:42:06 -05:00
Kevin deLeon
b39aed4d0a Adds additional info for creating Swift modules
This may be common knowledge for most Swift/ObjC guys, but it took me quite a while to figure out why I was getting an error when creating/exporting my module. As a web guy coming to the "native" world, it was a bit confusing. I would imagine a lot of RCTN users will be in the same boat.
2015-06-07 16:31:40 -05:00
Tadeu Zagallo
c2fb21b322 [ReactNative] Properly pause frame update observers when idle
Summary:
@public

`RCTDispatchEvent` and `RCTTiming` weren't being paused when there wasn't any
work left to be done.

Test Plan:
Run the timers example - check everything still works as expected
Test the ListView paging example - check scroll events are still fired as expected
Launch UIExplorer, let it idle, and put a break point on `-[RCTBridge dispatchBlock:moduleID:]`,
it should never fire.
2015-06-07 08:45:18 -08:00
Christopher Chedeau
8ee9bfe944 [ReactNative] Fix XHR 2015-06-06 16:44:55 -08:00
Tadeu Zagallo
1c9e957d22 [ReactNative] Invalidate modules on their own queues
Summary:
@public

Bridge modules were being invalidate on the main thread, what could lead to
racing conditions, move the calls to invalidate on happen to the module's
methodQueue

Test Plan: Run the tests
2015-06-06 14:13:32 -08:00
Tadeu Zagallo
35b770201d [ReactNative] Merge IntegrationTest into UIExplorer tests 2015-06-06 13:38:35 -08:00
Tadeu Zagallo
c2b0e72771 [ReactNative] Move unit tests to UIExplorer 2015-06-06 13:38:34 -08:00
Tadeu Zagallo
40579181d3 [ReactNative] Split oss tests into two targets: unit and integration 2015-06-06 13:38:33 -08:00
Nick Lockwood
96c070de11 Fixed typo in XMLHttpRequest.ios.js 2015-06-05 18:47:18 -08:00
Nick Lockwood
e00b9ac8f3 Added incremental XMLHttpRequest updates
Summary:
@public

Previously, our XMLHttpRequest implementation would only update the readyState when the download was fully completed. This diff adds support for receiving incremental data updates as the download happens, which can be monitored by adding the onreadystatechange event handler.

As a performance optimization, incremental data updates are only sent if the onreadystatechanged handler has been set in the JS, otherwise it just sends the whole data block once download is complete, as before.

Test Plan:
* Run the UIExplorer XMLHttpRequest example (in both OSS and Catalyst) to see incremental downloads working.
* Run the Movies app to see regular (non-incremental) downloads in action
* Run any network-based app in Catalyst shell to verify RKDataManager still works
2015-06-05 15:21:25 -08:00
Eric Vicenti
98263c4f8f Merge pull request #1529 from ericvicenti/Update_Fri_5_Jun
Update fri 5 jun
2015-06-05 15:32:44 -07:00
Eric Vicenti
0293def7a9 Updates from Fri 5 Jun 2015-06-05 15:11:57 -07:00
Eric Vicenti
bb95400f24 [ReactNative] Fix POPAnimation export issue from bad transform
Summary:
Some transform is going wrong here and produces broken code

@public

Test Plan: Test on OSS repo, e2e tests pass
2015-06-05 10:03:57 -08:00
Nick Lockwood
45d8fb0ef6 Removed deprecated RCT_EXPORT + code paths 2015-06-05 09:58:25 -08:00
Eric Vicenti
f90fa53df9 Revert [react-packager] Add support for nested node_modules 2015-06-05 08:44:06 -08:00
Tadeu Zagallo
1a564eed77 [ReactNative] Run UIExplorer tests on sandcastle 2015-06-05 05:36:06 -08:00
Tadeu Zagallo
7009f0a47b [ReactNative] Add profiling hooks to bridge modules at runtime
Summary:
@public

Add `RCT_DEV`-only profiling hooks to every method in every bridge modules to
add a little bit more detail to the timeline profile.

Test Plan: {F22522834}
2015-06-05 04:22:57 -08:00
Eric Vicenti
f744c7c444 [ReactNative] Native touch unique identifier
Summary:
This bug was causing a redbox when touching rapidly because multiple touches had the same identifier. This code was meant to ensure that a unique ID is found, but it was checking against the wrong property in the react touch array.

I don't think this was really affecting prod, because the invariant is guarded by a __DEV__ check

@public

Test Plan:
- Start several touches at once (or just rapidly jam fingers on your device), and you won't see a redbox
- Also verify that single touches, touch moves, and multi touches work as before
2015-06-04 20:21:19 -08:00
Amjad Masad
30fc7389d1 [react-packager] Fix more node_modules resolution rules
Summary:
@public
Fixes #773
This fixes `.json` name resolution. And also reads `package.json` when doing a directory module resolution.
The algorithm can be found here: https://nodejs.org/api/modules.html
I'll probably start including the node (or browserify) modules test in later diffs to make sure we're fully compliant.

Test Plan:
* ./runJestTests.sh
* ./runJestTests.sh PackagerIntegration
* open playground and require a json file
* test redbox
2015-06-04 15:07:03 -08:00
Jared Forsyth
53b2c39cc0 select up and down the inspector hierarchy
Summary:
This allows you to select the displayed owner hierarchy, and see the styles,
props, and position.

@public

Test Plan:
Open the inspector, select something in the middle of the page. Click the
breadcrumb train in the inspector, and verify that:
- styles are reflected
- margin/padding/box is correct
- the highlight updates to show the selected item

See video as well.

[Video](https://www.latest.facebook.com/pxlcld/mqnl)

Screenshot
{F22518618}
2015-06-04 10:18:56 -08:00