Commit Graph

1487 Commits

Author SHA1 Message Date
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
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 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
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
Tadeu Zagallo f8b3c98bc6 [ReactNative] Remove AnimationUtils tests 2015-05-29 15:24:47 -08:00
Christopher Chedeau 6bffa6c8a8 [ReactNative] Unbreak flow errors 2015-05-29 14:24:00 -08:00
Tadeu Zagallo bb7ae59a12 [ReactNative] Update OSS screenshort tests 2015-05-29 13:59:18 -08:00
Krzysztof Magiera e2dc2db9dc [react_native] JS files from D2091817: Support nested text nodes in TextInput. 2015-05-29 12:39:47 -08:00
Krzysztof Magiera ff48f78742 [react_native] JS files from D2091792: Introduce vitual text node and adapt TextViewManager to shadowview-less design. 2015-05-29 12:37:55 -08:00
Alex Kotliarskyi 228dc5f936 [MAdMan] Possibly fix "Cannot find breadcrumb interpolators for -1" 2015-05-29 11:23:40 -08:00
Nick Lockwood 36c33b4a60 Fixed delayed text layout bug 2015-05-29 10:43:13 -08:00
Alex Akers 4097459dc9 [React Native] Remove layout-only nodes from RCTText in RN OSS 2015-05-29 06:22:45 -08:00
Alex Akers 40da2c7e08 [React Native] Add E2E tests for Catalyst that test login, app launcher, and opening UIExplorer, MAdMan, Groups 2015-05-29 05:30:09 -08:00
Nick Lockwood 03889780b9 [WIP] Added loadingView property to RCTRootView 2015-05-28 13:20:46 -08:00
Leonardo YongUk Kim 7e0064f097 Add the license field on package.json
Summary:
Add the license field on package.json
Closes https://github.com/facebook/react-native/pull/1409
Github Author: Leonardo YongUk Kim <dalinaum@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-05-28 12:00:46 -08:00
Christopher Chedeau 3c1eaf7a6e [ReactNative] Fix inspect element crash 2015-05-28 10:03:06 -08:00
Bill Fisher 474ac651d5 [ReactNative] Allow decomposedMatrix style property to go to native view 2015-05-28 09:32:50 -08:00
Nick Lockwood 45c1dc1c65 Fixed text background color
Summary:
@public

This fixes an issue with the containerBackgroundColor property of `<Text>` nodes, where containerBackgroundColor was being overridden by the backgroundColor. I also fixed up the example so that it demonstrates the feature more clearly.

Test Plan:
* Check UIExplorer text example
* Run Catalyst snapshot tests and check MAdMan, Groups
2015-05-28 09:31:57 -08:00
Jason Prado 656c5e4e27 Revert "[ReactNative] Add completionBlock to -[RCTBridge enqueueJSCall:args:]"
Test plan: broke catalyst apps

Summary: This reverts commit 9fba6a360dc5f8bf.

fbobjc/Tools/revert

Reverter: jprado

@build-break

commit 9fba6a360dc5f8bf014f3d3c584c545b16da5100
Author:     Tadeu Zagallo <tadeuzagallo@fb.com>
AuthorDate: Thu May 28 08:29:19 2015 -0700
Commit:     Service User <svcscm@fb.com>
CommitDate: Thu May 28 09:53:53 2015 -0700

    [ReactNative] Add completionBlock to -[RCTBridge enqueueJSCall:args:]

    Summary:
    @public

    Allow to pass an optional completion block to the bridge JS calls.

    The block will be called from the JS thread, after the javascript has finished
    running and the returned calls have been processed/dispatched to the native modules.

    Test Plan: Added `testCallbackIsCalledOnTheRightTime` to `RKBatchedBridgeTests`
2015-05-28 09:30:51 -08:00
Nick Lockwood ff49d86aed Implemented fast path for same borders/radii 2015-05-28 09:16:44 -08:00
Tadeu Zagallo 3b24f52a20 [ReactNative] Add completionBlock to -[RCTBridge enqueueJSCall:args:]
Summary:
@public

Allow to pass an optional completion block to the bridge JS calls.

The block will be called from the JS thread, after the javascript has finished
running and the returned calls have been processed/dispatched to the native modules.

Test Plan: Added `testCallbackIsCalledOnTheRightTime` to `RKBatchedBridgeTests`
2015-05-28 08:53:53 -08:00
Tadeu Zagallo ebae151f24 [ReactNative] Update sane fork + FileWatcher config 2015-05-28 07:12:41 -08:00
Georgiy Kassabli d63440576d Added accessibility sample for React Native 2015-05-28 04:22:57 -08:00
Tadeu Zagallo 6075cef070 [ReactNative] Relax flow jest-cli regex 2015-05-28 01:48:16 -08:00
Tadeu Zagallo 71216de931 [ReactNative] Fix sample app tests
Summary:
@public

After the refactor on RCTText, update the SampleApp's test to use the
accessibilityLabel instead of attributedText

Test Plan: Run the SampleApp tets
2015-05-28 01:45:36 -08:00
Tadeu Zagallo 21b3304a95 [ReactNative] Add option to file watcher to ignore node_modules 2015-05-28 01:18:47 -08:00
Tadeu Zagallo 4fc15dbf17 [ReactNative] Implement proper event coalescing 2015-05-27 20:41:20 -08:00
Tadeu Zagallo 17e9cd6297 [ReactNative] Fix UIExplorer tests
Summary:
@public

Update RootView load check due to the updates to RCTText and the snapshot
reference images due to the updates to rendering

Test Plan: Run the UIExplorer tests
2015-05-27 18:16:02 -08:00
Tadeu Zagallo 380ba2aab4 [ReactNative] Add babel to package.json 2015-05-27 17:00:14 -08:00
Tadeu Zagallo 626e435c12 [ReactNative] Update flow commoner tests regex 2015-05-27 16:33:31 -08:00
Nick Lockwood acc42e193d Big reduction in blending 2015-05-27 16:10:54 -08:00
Nick Lockwood 455281e44d Fixed crash in RCTContextExecutor when requireJSRef == undefined 2015-05-27 08:50:03 -08:00
Nick Lockwood 8d992262ed Fixed loading flicker on RCTRootView 2015-05-27 02:51:32 -08:00
Spencer Ahrens a4442e4576 [ReactNative] rename nativeProps const to NativeProps 2015-05-26 19:28:07 -08:00