Граф коммитов

1790 Коммитов

Автор SHA1 Сообщение Дата
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 13316ef380.
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
Tadeu Zagallo ef4f143ae0 [ReactNative] Update objc-test to run on iOS 8.3 2015-05-29 23:17:59 +01:00
Tadeu Zagallo bb7ae59a12 [ReactNative] Update OSS screenshort tests 2015-05-29 13:59:18 -08:00
Joshua Sierles d4da4e3fd9 capitalize sample app name to avoid issues with JSX 2015-05-29 22:51:04 +02:00
Joshua Sierles f9b3f9121f update JS environment documentation for Babel, and explain what a transpiler does. 2015-05-29 22:50:03 +02: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
Brent Vatne 1a4f270931 Merge branch 'debugging-docs' 2015-05-29 13:04:54 -07:00
Brent Vatne ee8ba19ab1 [Docs] Tweak debugging docs to be more concise 2015-05-29 13:04:25 -07:00
Flip Stewart 1a3ee99365 [Docs] Clean up debugging docs 2015-05-29 13:03:33 -07:00
Alex Kotliarskyi 228dc5f936 [MAdMan] Possibly fix "Cannot find breadcrumb interpolators for -1" 2015-05-29 11:23:40 -08:00
Joshua Sierles 1e863ad192 add README for react-native cli 2015-05-29 21:00:51 +02:00