1700 Commits

Author SHA1 Message Date
Andrei Coman
9b455c8677 [react_native] JS files from D2115306: implement ExceptionsManager.report(Fatal|Soft)Exception 2015-06-02 07:41:40 -08:00
Andy Street
c094a156d6 [react_native] JS files from D2036695: [ReactNative] Implement new transform API on Android 2015-06-02 07:30:28 -08:00
Tadeu Zagallo
0f16d15d64 [ReactNative] Optimize console.profile and add markers on JS entry points
Summary:
@public

Right now the profiler shows how long the executor took on JS but doesn't show
how long each of the batched calls took, this adds a *very* high level view of JS
execution (still doesn't show properly calls dispatched with setImmediate)

Also added a global property on JS to avoid trips to Native when profiling is
disabled.

Test Plan:
Run the Profiler on any app

{F22491690}
2015-06-02 06:22:49 -08:00
Tadeu Zagallo
2dfa3b34a1 [ReactNative] Track bridge events' flow
Summary:
@public

Use trace-viewer's flow events to link the bridge calls

Test Plan: {F22498582}
2015-06-02 06:19:16 -08:00
Andrei Coman
0aa7f3f8d5 [react_native] Implement connectivity module 2015-06-02 05:41:16 -08:00
Tadeu Zagallo
777363fdd7 [ReactNative] Use NSDictionary + NSNumber for event coalescing
Summary:
@public

On D2099270 event coalescing was implemented and the event key on the RCTSparseArray
is an uint64_t, but it was declared as NSUInteger.  On a 32 bits architecture
it'll be clipped to 4 bits, meaning that just `reactTag` will be taken into
account, e.g. different types of events can coalesce with each other if they target the same view

Switching to use an NSMutableDictionary instead of RCTSparseArray and NSNumber
as keys instead of uint64_t

Test Plan: Fixed the previous tests and added a new test to RCTEventDispatcherTests
2015-06-02 03:06:06 -08:00
John Harper
dc6fd82231 [react-native] -mountOrUnmountSubview: should handle zero-sized clip-rects correctly 2015-06-02 01:48:21 -08:00
John Harper
570597c4ac [react-native] dispatch perf updates to main thread 2015-06-02 01:44:55 -08:00
Chace Liang
1ed2542b46 Revert "[Bridge] Add support for JS async functions to RCT_EXPORT_METHOD" 2015-06-01 20:26:37 -08:00
Jared Forsyth
e6c04df5a1 fix bug with inspector clicking
Summary:
Previously, if you were already inspecting an element, touching again would
select a completely different element because the touch position was
calculated relative to the current overlay.

This fixes it.

@public

Test Plan:
Open the inspector, click around, verify that every click selects the thing
you clicked on.
2015-06-01 18:02:26 -08:00
Eric Vicenti
219a7c1bfd [ReactNative] Navigator block touches on scene when navigating 2015-06-01 16:35:43 -08:00
James Ide
2a6fe079c0 [Timers] Batch setImmediate handlers
Summary:
Wraps the setImmediate handlers in a `batchUpdates` call before they are synchronously executed at the end of the JS execution loop.

Closes https://github.com/facebook/react-native/pull/1242
Github Author: James Ide <ide@jameside.com>

Test Plan:
 Added two `setImmediate` calls to `componentDidMount` in UIExplorerApp. Each handler calls `setState`, and `componentWillUpdate` logs its state. With this diff, we can see the state updates are successfully batched.

```javascript
componentDidMount() {
  setImmediate(() => {
    console.log('immediate 1');
    this.setState({a: 1});
  });
  setImmediate(() => {
    console.log('immediate 2');
    this.setState({a: 2});
  });
},

componentWillUpdate(nextProps, nextState) {
  console.log('componentWillUpdate with next state.a =', nextState.a);
},
```

**Before:**

"immediate 1"
"componentWillUpdate with next state.a =", 1
"immediate 2"
"componentWillUpdate with next state.a =", 2

**After:**

"immediate 1"
"immediate 2"
"componentWillUpdate with next state.a =", 2

Addresses the batching issue in #1232. cc @vjeux @spicyj
2015-06-01 16:23:12 -08:00
Spencer Ahrens
38f57ee18c [ReactNative] improve UIExplorer keyboard interactions 2015-06-01 16:14:21 -08:00
Joshua Sierles
43adb7b02c [CameraRoll] support fetching videos from the camera roll
Summary:
This adds a parameter for fetching videos from the camera roll. It also changes the default to fetch both videos and photos.
Closes https://github.com/facebook/react-native/pull/774
Github Author: Joshua Sierles <joshua@diluvia.net>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-01 15:57:32 -08:00
Spencer Ahrens
34cef28a10 [ReactNative] kill setInterval in ListView 2015-06-01 13:34:06 -08:00
Alex Kotliarskyi
d723e17629 [ReactNative] Copy assets to corresponding folders on Android 2015-06-01 12:21:53 -08:00
Brent Vatne
c700f71cb5 [Docs] Add link to Homebrew in tutorial, suggestion for node install 2015-06-01 12:42:49 -07:00
Brent Vatne
0c8c57503e Merge pull request #1126 from enaqx/patch-1
Add *.log to website directory .gitignore
2015-06-01 12:10:12 -07:00
James Ide
d548c85da6 [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-01 10:50:06 -08:00
Felix Oghina
2b4daf228d Expose fontScale to JS 2015-06-01 10:25:38 -08:00
Brent Vatne
57ce9fb11a [package.json] Leave the protocol choice for a Github repo to npm
Summary:
Fixes #1371
Closes https://github.com/facebook/react-native/pull/1447
Github Author: Brent Vatne <brent.vatne@madriska.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-01 09:36:18 -08:00
Nick Lockwood
49e87af934 Fixed text update on OSS 2015-06-01 08:44:11 -08:00
Nick Lockwood
a2db4a4a5b Removed redundant JSON encode/decode from RCTDataManager
Summary:
@public

For some reason we were manually JSON-encoding the RCTDataManager responses, and then decoding them again on the JS side. Since all data sent over the bridge is JSON-encoded anyway, this is pretty pointless.

Test Plan:
* Test Movies app in OSS, which uses RCTDataManager
* Test any code that uses RKHTTPQueryGenericExecutor to make network requests (e.g. Groups)
* Test the Groups photo upload feature, which uses RKHTTPQueryWithImageUploadExecutor
2015-06-01 08:35:56 -08:00
Tadeu Zagallo
2deff61bde Merge pull request #1478 from tadeuzagallo/Update_Mon_1_Jun
Update mon 1 jun
2015-06-01 13:53:06 +01:00
Tadeu Zagallo
6e24a71d3d Updates from Mon 1 Jun 2015-06-01 12:51:34 +01:00
Tadeu Zagallo
b03446e27e [ReactNative] Stop traversing the whole view hierarchy every frame
Summary:
@public

`RCTUIManager` would traverse the whole view hierarchy every time there was any
call from JS to Native to call `reactBridgeDidFinishTransaction` on the views
that would respond to it. This is a deprecated method that is only implemented
by 3 classes, so for now we keep track of these views as they're created and
just iterate through them on updates.

Test Plan:
> NOTE: I tested this on UIExplorer, since the internally none of the classes are used

I tried to keep it simple, so I added the following to the old code:
```
__block NSUInteger count = 0;
UIView *rootView = _viewRegistry[rootViewTag];
RCTTraverseViewNodes(rootView, ^(id<RCTViewNodeProtocol> view) {
  count ++;
  if ([view respondsToSelector:@selector(reactBridgeDidFinishTransaction)]) {
    [view reactBridgeDidFinishTransaction];
  }
});
NSLog(@"Views iterated: %zd", count);
```
The output after scrolling 20 sections of the `<ListView> - Paging` example was

```
2015-06-01 00:47:07.351 UIExplorer[67675:1709506] Views iterated: 1549
```

*every frame*

After the change

```
for (id<RCTViewNodeProtocol> node in _bridgeTransactionListeners) {
  [node reactBridgeDidFinishTransaction];
}
NSLog(@"Views iterated: %zd", _bridgeTransactionListeners.count);
```

```
2015-06-01 00:51:23.715 UIExplorer[70355:1716465] Views iterated: 3
```

No matter how many pages are loaded, the output is always 3.
2015-06-01 03:14:14 -08:00
Jiajie Zhu
df58789f22 [RN] fix duplicate observe 2015-05-31 14:46:38 -08:00
Peter Cottle
595eae8b67 [ErrorMessage] Change error message when app is not registered
Summary:
So when I first started porting JS files over from LearnGitBranching into a react native project, I some had require errors (for whatever reason) and I hit this error message a decent amount. I eventually understood it had nothing to do with failing to register the component (which btw sounds like some sign-up process, not actually an internal concept) but I figured we could expand on this message and describe why it might be happening.

I'm not 100% sure on what the second half should be, but open to feedback on this
Closes https://github.com/facebook/react-native/pull/826
Github Author: Peter Cottle <pcottle@fb.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-31 13:14:02 -08:00
Ben Alpert
c37509727f Set constructor properly in createReactNativeComponentClass
Summary:
Without this, the displayName property wasn't found when looking at
`.constructor` on a component instance. Fixes facebook/react-devtools#92.
Closes https://github.com/facebook/react-native/pull/1471
Github Author: Ben Alpert <balpert@fb.com>

Test Plan:
Used devtools on MoviesApp and saw RCTView instead of Unknown:

{F22491590}
2015-05-31 12:59:53 -08:00
Nick Lockwood
09cef03cd3 revert D2087892 2015-05-31 11:35:55 -08:00
Brent Vatne
62fef10755 Revert "[SampleApp] Remove $(SRCROOT) from INFOPLIST_FILE to fix agvtool"
This reverts commit 13316ef38074cad52c713eb694040a9d96f04fbb.
2015-05-31 10:08:48 -07:00
Brent Vatne
53a7e070b8 Merge branch 'babel-documentation' 2015-05-31 10:08:16 -07:00
Brent Vatne
13316ef380 [SampleApp] Remove $(SRCROOT) from INFOPLIST_FILE to fix agvtool 2015-05-31 10:08:05 -07:00
Brent Vatne
d6ac633de5 [Docs] Tweak wording of JavaScriptEnvironment docs 2015-05-31 10:07:42 -07:00
James Ide
69ce448de9 Merge pull request #1457 from christopherdro/timer-doc-fix
[Docs] Grammatical change / Timer
2015-05-30 18:22:05 -07:00
Christopher Dro
597f9d94fd Changes based on @brentvatne revision 2015-05-30 18:00:34 -07:00
Brent Vatne
e65eff8df6 [Docs] Add supported iOS version to getting started 2015-05-30 15:09:32 -07:00
Christopher Dro
47e56d778a Re-wording 2015-05-30 14:47:24 -07:00
Tadeu Zagallo
1c692e2eb6 [ReactNative] Use JSValueIsUndefined instead of comparing with JSValueMakeUndefined
Summary:
@public

Use JSValueIsUndefined instead of caching an JSValueMakeUndefined to compare with
as suggested in https://github.com/facebook/react-native/pull/1432#commitcomment-11437434

Test Plan: Run the RCTContextExecutor tests
2015-05-30 13:32:11 -08:00
Brent Vatne
39b2342ab9 [Docs] Add note about Chrome extensions interacting with debugger 2015-05-30 13:24:53 -07:00
Christopher Dro
5918be2325 Typo Fix
Oddly enough, adding `work` was the first change I wanted to do. :)
2015-05-30 00:46:30 -07:00
Christopher
2429324e79 [Docs] Gramatical change / Timer 2015-05-30 00:14:22 -07:00
Tadeu Zagallo
c60c1c0415 Merge pull request #1446 from tadeuzagallo/Update_Fri_29_May
Update fri 29 may
2015-05-30 02:35:08 +01:00
Tadeu Zagallo
8976a05fe1 [ReactNative][Travis] Use nvm with node v0.10 2015-05-30 02:16:51 +01:00
Tadeu Zagallo
3b6ed00ace [ReactNative] Remove AnimationUtils tests 2015-05-30 00:27:11 +01:00
Tadeu Zagallo
f8b3c98bc6 [ReactNative] Remove AnimationUtils tests 2015-05-29 15:24:47 -08:00
Christopher Chedeau
b9a47062a6 [ReactNative] Unbreak flow errors 2015-05-29 23:52:02 +01:00
Tadeu Zagallo
74c337f770 [ReactNative] Use Travis' Xcode 6.3 beta 2015-05-29 23:42:03 +01:00
Christopher Chedeau
6bffa6c8a8 [ReactNative] Unbreak flow errors 2015-05-29 14:24:00 -08:00
Tadeu Zagallo
1567e8224a Updates from Fri 29 May 2015-05-29 23:18:30 +01:00