Commit Graph

4478 Commits

Author SHA1 Message Date
James Ide d3cbe8ff03 Merge pull request #4721 from dabit3/spelling-corrections
fixed various spelling errors
2015-12-10 15:31:28 -08:00
Nader Dabit 201a3d010a fixed various spelling errors 2015-12-10 17:27:46 -06:00
glevi@fb.com 53825f5206 Fix errors in fbobjc
Reviewed By: nicklockwood

Differential Revision: D2745907

fb-gh-sync-id: f4687313ad817bb1d5a56bb766d8efa4a2926da7
2015-12-10 13:56:44 -08:00
Brent Vatne c5c41d9d4c Update Animations.md - LayoutAnimation is no longer iOS only 2015-12-10 13:55:32 -08:00
Leland Richardson 3eb32cbb0e Animated.multiply and Animated.add to combine animated values
Summary:
This PR was created in response to feedback from an older PR: https://github.com/facebook/react-native/pull/2045

The `.interpolate()` API of Animated values is quite effective to accomplish transformations based on a single animated value, but currently there is a class of animations that is impossible: animations being driven by more than one value.

Usage would be like the following:

```js
getInitialState: function() {
  return {
    panY: new Animated.Value(0),
    offset: new Animated.Value(0),
  };
}
```

```js
var scale = Animated.add(panY, offset).interpolate({
  inputRange: [...],
  outputRange: [...],
});
```

I have a real use case for this, and I cannot think of any way to accomplish what I need without an API like this.

The animation I am trying to accomplish is I have a PanResponder being used to detect both x and y panning. The y-axis panning drives a 3d sroll-like animation (which we can call `panY`), and the x-axis panning is driving a "swipe-to-remove" animation (
Closes https://github.com/facebook/react-native/pull/4395

Reviewed By: svcscm

Differential Revision: D2731305

Pulled By: vjeux

fb-gh-sync-id: 3b9422f10c7e7f3b3ecd270aeed8ea92315a89e9
2015-12-10 13:30:27 -08:00
Thomas Parslow 3cfcd401c1 Support onLayout and onContentSizeChange attributes on ListView
Summary:
Docs say they're supported and presumably they should work exactly as for ScrollView but currently they are intercepted by the ListView
Closes https://github.com/facebook/react-native/pull/4712

Reviewed By: svcscm

Differential Revision: D2745080

Pulled By: vjeux

fb-gh-sync-id: 531907f03ae46d5200003cdb335c10b40c7d3bed
2015-12-10 12:46:31 -08:00
Nick Lockwood ac783a8a1b Fix retain cycle
Summary:
public

This fixes the following circular reference:

RCTComponentData
-> _bridge -> RCTBatchedBridge
-> _moduleDataByName -> __NSDictionaryI
-> RCTModuleData
-> _instance -> RCTUIManager
-> _componentDataByName -> __NSDictionaryI
-> RCTComponentData

Reviewed By: javache

Differential Revision: D2744742

fb-gh-sync-id: c282786f4dfb550185bc03d3e5e3d03048664c21
2015-12-10 12:14:34 -08:00
Nick Lockwood 88ac40666c Replaced RegExp method parser with recursive descent
Summary:
public

This diff replaces the RegEx module method parser with a handwritten recursive descent parser that's faster and easier to maintain.

The new parser is ~8 times faster when tested on the UIManager.managerChildren() method, and uses ~1/10 as much RAM.

The new parser also supports lightweight generics, and is more tolerant of white space.

(This means that you now can – and should – use types like `NSArray<NSString *> *` for your exported properties and method arguments, instead of `NSStringArray`).

Reviewed By: jspahrsummers

Differential Revision: D2736636

fb-gh-sync-id: f6a11431935fa8acc8ac36f3471032ec9a1c8490
2015-12-10 10:12:29 -08:00
Nick Lockwood ce7c0b735f Fixed image tinting
Summary:
public

A previous refactor introduced a bug where setting the tintColor of an <Image> to null no longer cleared the tint. This fixes it again.

Reviewed By: javache

Differential Revision: D2744279

fb-gh-sync-id: 1b5e0d546bf456d7b93e2ceee73c568c185c305c
2015-12-10 09:09:30 -08:00
Martin Konicek 6355011d17 Update Releases.md 2015-12-10 16:30:51 +00:00
Martin Konicek e56efc7df8 Update Releases.md 2015-12-10 16:29:19 +00:00
Martin Konicek f4e3512076 Add a guide for doing releases 2015-12-10 15:37:44 +00:00
Martin Konicek 651664b4ce Update breaking-changes.md 2015-12-10 15:25:49 +00:00
Nick Lockwood da153d3928 Fixed bug where module with moduleID of zero wouldn't be loaded
Reviewed By: jspahrsummers

Differential Revision: D2744167

fb-gh-sync-id: b442af60618703ab19290d042b3614984cd9a3ae
2015-12-10 07:12:29 -08:00
Nick Lockwood ec5ca67044 Fixed JS crash on Android when requiring a native module that doesn't exist
Summary:
public

NativeModule getters call the nativeRequireModuleConfig function to lazily load a module if it's not already available, but this crashes on Android since the nativeRequireModuleConfig hook hasn't been implemented yet. This diff checks that the hook exists before calling it.

Reviewed By: gsaraf

Differential Revision: D2744080

fb-gh-sync-id: cae9c8c45a4d3c80ceb8c10f3d4d59a8d9d3c7f8
2015-12-10 06:00:31 -08:00
Mike Armstrong 7f710f9050 Add fbsystrace markers using the legacyprofiler
Reviewed By: astreet

Differential Revision: D2728033

fb-gh-sync-id: 264d40930b8fec0262cbea36529bd8b11efcc58e
2015-12-10 04:39:31 -08:00
Nick Lockwood d138403c2e Added deferred module loading feature
Reviewed By: javache

Differential Revision: D2717687

fb-gh-sync-id: 4c03c721c794a2e7ac67a0b20474129fde7f0a0d
2015-12-10 04:31:30 -08:00
Dave Miller 5775d9e1d0 Update touch/measure/hotspot to all use same coordinate space
Reviewed By: astreet

Differential Revision: D2731165

fb-gh-sync-id: 729943233af66f139907cac2002fed4038b3fa6a
2015-12-10 03:01:37 -08:00
Qiao Liang 423202072c fix android movie example by adding missing permission
Summary:
```log
12-10 04:15:40.321 1482-1482/com.facebook.react.movies E/AndroidRuntime: FATAL EXCEPTION: main
                                                                         Process: com.facebook.react.movies, PID: 1482
                                                                         java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.conn.CONNECTIVITY_CHANGE flg=0x4000010 (has extras) } in com.facebook.react.modules.netinfo.ConnectivityModule$ConnectivityBroadcastReceiver@529210a0
                                                                             at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:778)
                                                                             at android.os.Handler.handleCallback(Handler.java:733)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                             at
Closes https://github.com/facebook/react-native/pull/4694

Reviewed By: svcscm

Differential Revision: D2743536

Pulled By: androidtrunkagent

fb-gh-sync-id: 7d93ca701c3d6b17add370ab13a68b150910e6a6
2015-12-09 22:40:28 -08:00
Spencer Ahrens 96c9ce811a Fix Text + TouchableWithoutFeedback
Summary:
Arrow functions don't have `arguments`...whoops :(

public

Reviewed By: vjeux, ericvicenti

Differential Revision: D2741448

fb-gh-sync-id: 15e9fb0446909e4cbbbb5e30024dde58d872e725
2015-12-09 17:18:26 -08:00
Felipe Martim 96553cf553 Add rotateX and rotateY transforms to Android Views .
Summary:
Setting rotateX and rotateY for Android Views.
Closes https://github.com/facebook/react-native/pull/4413

Reviewed By: svcscm

Differential Revision: D2741328

Pulled By: mkonicek

fb-gh-sync-id: 931027c006bc571ef374a7b82cc7074b8a34bc8d
2015-12-09 16:09:30 -08:00
Siddu Duddikunta 64a78ed74b Fix bug in Android elevation implementation
Summary:
If border radius is not set or is zero, then elevation will not
work properly. This bug seems to have been introduced when the
style in facebook/react-native#4180 was modified slightly to
produce commit b65f1f2234.
Closes https://github.com/facebook/react-native/pull/4555

Reviewed By: svcscm

Differential Revision: D2741203

Pulled By: mkonicek

fb-gh-sync-id: f4ee9ccdfc64374d58824a6e988409ac2b7532a4
2015-12-09 15:52:29 -08:00
Martin Konicek 2aa3e0dd1a Use the new Android Clipboard module
Summary:
public

- Open source the unit test for `ClipboardModule`, start using the `ReactTestHelper` in two unit tests
- Fixes a few references to "pasteboard" in strings

Reviewed By: bestander

Differential Revision: D2739614

fb-gh-sync-id: e076940a3ae5c22314e181a37fe2c3f77a18cf85
2015-12-09 15:21:30 -08:00
Martin Konicek 139f9945df Don't use arrow functions with Flow types to fix website generation
Summary:
Our custom jsdocs parser doesn't support the syntax yet.

public

Reviewed By: bestander

Differential Revision: D2739861

fb-gh-sync-id: eefc3c54b98e06597ca7d93396aa4fe3a92d4a58
2015-12-09 14:56:40 -08:00
Martin Konicek f9f123ba96 Sync internal shrinkwrap file to github 2015-12-09 22:32:20 +00:00
Martin Konicek a98c9eae52 Merge pull request #4151 from sunnylqm/patch-7
update the way of starting packager on windows
2015-12-09 22:24:25 +00:00
David Anderson fe3686e126 Fix asset httpServerLocation on Windows.
Summary:
Functions from the path module return paths with the native file system path separator. generateAssetModule is using path.join and path.dirname to generate httpServerLocation.  That means that on Windows systems, the generated URL path has backslashes rather than forward slashes which breaks the app's ability to retrieve image assets using require('./image.png').  This change fixes this by checking path.sep and replacing backslashes with slashes on systems that require it.
Closes https://github.com/facebook/react-native/pull/4416

Reviewed By: svcscm

Differential Revision: D2740529

Pulled By: mkonicek

fb-gh-sync-id: edae0f6762c7dc1db7af078209e38a2feab1e0a1
2015-12-09 14:08:28 -08:00
Thomas Parslow 053a2294b8 Add taggedTemplateLiteral to babelHelpers
Summary:
Needed to support tagged template literals (which are already enabled in babel). Not having this helper means we get a runtime crash.
Closes https://github.com/facebook/react-native/pull/4680

Reviewed By: svcscm

Differential Revision: D2740233

Pulled By: spicyj

fb-gh-sync-id: 12729f670b7942ad7a04bd50ae1eca35d2b1e410
2015-12-09 13:01:24 -08:00
Denis Koroskin c0c8e7cfdf Add support for `double` type in ReactPropGroup
Reviewed By: astreet

Differential Revision: D2735362

fb-gh-sync-id: a8eab400248fc4c8ad5d43e6a34cfd350dfb1d26
2015-12-09 12:39:38 -08:00
Martin Konicek e8659b3602 Remove all BUCK files 2015-12-09 20:25:19 +00:00
tantan 90c7ad112f add Clipboard component for ios and android
Summary:
add Clipboard component for ios and android
 ```javascript
    import Clipboard from 'react-native'

    Clipboard.get((content)=>{
          console.log('here is content in clipboard:%s',content)
    });
    var content = 'here is a string';
    Clipboard.set(content);
```
Closes https://github.com/facebook/react-native/pull/4384

Reviewed By: svcscm

Differential Revision: D2738881

Pulled By: mkonicek

fb-gh-sync-id: a06df32d1eb2824cc9ca3de9d45e4e67fd2edbc9
2015-12-09 10:04:21 -08:00
Tadeu Zagallo cd4574498d Use actual CADisplayLink timestamp for VSYNC
Summary:
public

Use the actual timestamp provided through `CADisplayLink` instead of the time
the handler is called.

Reviewed By: jspahrsummers

Differential Revision: D2739121

fb-gh-sync-id: 1da28190bb25351dc3dd94efaff21d49279a570f
2015-12-09 09:56:27 -08:00
Christopher Dro 86bb656e6f Add tintColor for buttons.
Summary:
Closes #3374
Closes https://github.com/facebook/react-native/pull/4590

Reviewed By: javache

Differential Revision: D2729616

Pulled By: mkonicek

fb-gh-sync-id: 4a3b6de10a09cad73dbd9d5d552adc3f6ba054e0
2015-12-09 05:19:25 -08:00
Tadeu Zagallo f8be783798 Document intentional retain cycle on RCTJavaScriptContext
Summary:
public

More people wanted to understand the motivation behind the intentional retain
cycle in `RCTJavaScriptContext`, add a small comment with some context.

Reviewed By: jspahrsummers

Differential Revision: D2738930

fb-gh-sync-id: d8c950778eb6bf3eaca627aabb6c98335d25d1fc
2015-12-09 04:43:29 -08:00
Brian Leonard 0ce2bce201 Allow other Xcode configurations with DEV=false
Summary:
Updates build script to fix https://github.com/facebook/react-native/issues/4362
Closes https://github.com/facebook/react-native/pull/4520

Reviewed By: svcscm

Differential Revision: D2730607

Pulled By: mkonicek

fb-gh-sync-id: 2fc4a9815f19ab867a6a3dc77cf1b6eac8a25616
2015-12-09 04:41:28 -08:00
Harry Moreno 54ec6e7cab Docs warn navigator ios
Summary:
ping https://github.com/facebook/react-native/issues/795#issuecomment-139895307
Closes https://github.com/facebook/react-native/pull/3087

Reviewed By: svcscm

Differential Revision: D2738947

Pulled By: mkonicek

fb-gh-sync-id: e29dfd933a8da42551576bdb1fb5c270039722ee
2015-12-09 04:34:30 -08:00
Martin Kralik 14478f6701 better error message for `propTypes` check
Summary:
When you did a typo in declaring a prop type (like using `boolean` insteal of `bool`) you'd got a bit misleading error message:
{F27113768}
The truth is that the prop type is defined, but not correctly. So I've changed the message in this case to be more accurate:
{F27113627}

public

Reviewed By: sahrens

Differential Revision: D2729340

fb-gh-sync-id: dd12c10a4f3a1c9825293f86481a082908127a76
2015-12-09 04:06:31 -08:00
Sebastian Markbage 8d397b4cbc Decouple Module System from Native Calls
Summary:
The JavaScript ecosystem doesn't have the notion of a built-in native module loader. Even Node is decoupled from its module loader. The module loader system is just JS that runs on top of the global `process` object which has all the built-in goodies.

Additionally there is no such thing as a global require. That is something unique to our providesModule system. In other module systems such as node, every require is contextual. Even registered npm names are localized by version.

The only global namespace that is accessible to the host environment is the global object. Normally module systems attaches itself onto the hooks provided by the host environment on the global object.

Currently, we have two forms of dispatch that reaches directly into the module system. executeJSCall which reaches directly into require. Everything now calls through the BatchedBridge module (except one RCTLog edge case that I will fix). I propose that the executors calls directly onto `BatchedBridge` through an instance on the global so that everything is guaranteed to go through it. It becomes the main communication hub.

I also propose that we drop the dynamic requires inside of MessageQueue/BatchBridge and instead have the modules register themselves with the bridge.

executeJSCall was originally modeled after the XHP equivalent. The XHP equivalent was designed that way because the act of doing the call was the thing that defined a dependency on the module from the page. However, that is not how React Native works.

The JS side is driving the dependencies by virtue of requiring new modules and frameworks and the existence of dependencies is driven by the JS side, so this design doesn't make as much sense.

The main driver for this is to be able to introduce a new module system like Prepack's module system. However, it also unlocks the possibility to do dead module elimination even in our current module system. It is currently not possible because we don't know which module might be called from native.

Since the module system now becomes decoupled we could publish all our providesModule modules as npm/CommonJS modules using a rewrite script. That's what React Core does.

That way people could use any CommonJS bundler such as Webpack, Closure Compiler, Rollup or some new innovation to create a JS bundle.

This diff expands the executeJSCalls to the BatchedBridge's three individual pieces to make them first class instead of being dynamic. This removes one layer of abstraction. Hopefully we can also remove more of the things that register themselves with the BatchedBridge (various EventEmitters) and instead have everything go through the public protocol. ReactMethod/RCT_EXPORT_METHOD.

public

Reviewed By: vjeux

Differential Revision: D2717535

fb-gh-sync-id: 70114f05483124f5ac5c4570422bb91a60a727f6
2015-12-08 16:03:37 -08:00
Gabe Levi 99bba8ca4e Use .flow files to tell Flow about react-native module
Reviewed By: jeffmo

Differential Revision: D2735788

fb-gh-sync-id: 7a15caa5effb89b902bba7e0031822f534813c52
2015-12-08 14:51:31 -08:00
James Ide fe69ac95bd Merge pull request #4654 from tyiu/master
Fix EmbeddedAppIOS documentation
2015-12-08 14:32:58 -08:00
Terry Yiu 16a29b0b87 Fix EmbeddedAppIOS documentation
Fix with correct init call on RCTRootView due to change in method signature from commit 261f9434e5
2015-12-08 14:30:07 -08:00
glevi@fb.com 066ebc021f Fix PickerIOSExample
Reviewed By: nicklockwood

Differential Revision: D2735834

fb-gh-sync-id: 8f2777ec2afe007523ea85cca27f40497910d2d1
2015-12-08 13:48:28 -08:00
Martín Bigio 202222504e Introduce `loadBundles`
Summary:
public

Introduce a new Polyfill module to load bundles. This polyfill contains the function to which System.import gets transformed into. It works similarly to require in the way it's registered. It keeps track of the bundles that have ever been requested using promises, either fulfilled or not. The use of promises makes the implementation quite easy as we don't need to differenciate whether the request has been started or not.

There're a couple of follow up steps that still need to get done:

- Included this polyfill on the ones we automatically include on the bundle.
- Modify the transform to include the modules the user is actually requesting and pipe that through loadBundles so that the promise, once resolved, has the ordered list of modules the user requested.
- Implement the actual native code that loads a bundle. This shouldn't be that taught  as native will be able to assume it will never receive the same request twice.

Reviewed By: davidaurelio

Differential Revision: D2727241

fb-gh-sync-id: 317d80754783caf43f10c71a34a4558a4d298d45
2015-12-08 12:31:36 -08:00
Konstantin Raev 56793e3f8d Fixed Flow error
Reviewed By: gabelevi

Differential Revision: D2734738

fb-gh-sync-id: 5ba3d4285185cd220a5bf6a26cb3818311822e52
2015-12-08 12:08:27 -08:00
Nick Lockwood 7b13ce30f2 Fix flow
Reviewed By: gabelevi

Differential Revision: D2734936

fb-gh-sync-id: 0c085c4968e52907a60bbd1d8af30dac6f449e46
2015-12-08 12:03:34 -08:00
David Aurelio d013554083 Prepend magic number to unbundle files
Summary:
In order to be able to reliable identify unbundles when loading files, prepend a magic number (0xFB0BD1E5)
public

Reviewed By: martinbigio

Differential Revision: D2734359

fb-gh-sync-id: b469e26459234e7f6270fffa0b872a93d137381d
2015-12-08 11:03:25 -08:00
Edvin Erikson c489660f26 Inspecting stateless components.
Summary:
Fixes #4602

Fixes a bug where the app crashes when you try to inspect a stateless
component.
Fixed by replacing all occurrences of the getPublicInstance method in
Libraries/Inspector/Inspector.js with the _instance property instead.
Defaults to an empty object if _instance is falsy.
Closes https://github.com/facebook/react-native/pull/4642

Reviewed By: svcscm

Differential Revision: D2734491

Pulled By: androidtrunkagent

fb-gh-sync-id: 4ea753b7e0ef3fd05af2d80abadc365c5c787f98
2015-12-08 10:13:25 -08:00
Konstantin Raev c9d796fc6a NetInfo: Cleaned up code and examples
Reviewed By: andreicoman11

Differential Revision: D2723578

fb-gh-sync-id: b7bb9ce69f24ff5dcf38409de92d57f53da003fa
2015-12-08 09:35:22 -08:00
Emilio Rodriguez e2c35dddba Added support for styling the PickerIOS
Summary:
 - PickerIOS accepts now a new prop: style
 - this prop modifies the native style of the RCTPicker allowing to modify the font size of the items (fontSize), color of the items (color, only 6 char HEX values for now) and alignment of the items (textAlign)
Closes https://github.com/facebook/react-native/pull/4490

Reviewed By: svcscm

Differential Revision: D2723190

Pulled By: nicklockwood

fb-gh-sync-id: ab9188192f1d0d087787dfed8c128073bfaa3235
2015-12-08 07:48:26 -08:00
Mike Armstrong e7a4b20d75 exceptions generated from incorrect arg usage on JSC trace and LegacyProfile functions
Reviewed By: astreet

Differential Revision: D2729015

fb-gh-sync-id: a3f56554ff6e77170e07aaf93934f93522b3a81b
2015-12-08 06:14:34 -08:00