Commit Graph

287 Commits

Author SHA1 Message Date
Pieter De Baets 0222107170 Customize main thread initialization of native modules (2nd try)
Reviewed By: majak

Differential Revision: D3671197

fbshipit-source-id: e8df7669be79303d335f2c881e97310b5fed47f9
2016-08-05 11:28:32 -07:00
Mengjue Wang f0fb228ec7 Provide forceRTL for LTR language to test
Summary:
1. Provide forceRTL function for developer to test RTL layout in LTR language bundle in I18nUtil and expose it in I18nManager.
2. Rename `allowRTL` and `setAllowRTL` functions

Reviewed By: fkgozali

Differential Revision: D3663693

fbshipit-source-id: 3db13a44c069ae73d1728c211306422db5dd8122
2016-08-04 12:28:30 -07:00
Dotan Nahum 77e48f1782 Make MessageQueue to emit "SPY" events in a way that can be extensible
Summary:
This PR adds a capability for MessageQueue to emit "SPY" events in a way that can be extensible, to later allow for a tooling ecosystem to grow, one example is the existing [Snoopy](https://github.com/jondot/rn-snoopy) tool that is, for now, forced to work with monkeypatches, and after this PR will be able to use a "formal" way to trace queue events.

After this change, we can wire a "spy" into a queue that will expose the events in different and interesting ways, see below (done with Snoopy):
  <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>
  <img src="https://github.com/jondot/rn-snoopy/blob/master/media/snoopy-filter.gif?raw=true" alt="Aggregating and Charting Events with Bar" width="400px"/>

This removes the hardcoded `SPY_MODE` flag and instead uses a function that can be injected from outside world.

```javascript
MessageQueue.spy((info)=>console.log("event!", info)
```

It also creates
Closes https://github.com/facebook/react-native/pull/9160

Differential Revision: D3669053

Pulled By: javache

fbshipit-source-id: 3e4462aa77fc8514d2ea4f15430f7bec57b583a4
2016-08-04 08:43:31 -07:00
Daniel Schmidt c2cf510ff8 Improve the BackAndroid example to be more clear
Summary:
The example of `BackAndroid` caused a bit of confusion for beginners (see #8822), so I thought we should clarify the functionality a bit. I added a comment indicating that a user would have to implement `this.onMainScreen` and `this.goBack` on their own, this was the original problem.
Closes https://github.com/facebook/react-native/pull/8829

Differential Revision: D3660332

fbshipit-source-id: d84a29586c6a1a439f386e6b88220d7b0a275129
2016-08-02 18:30:38 -07:00
Pieter De Baets b83ccb5749 Reverted commit D3580025
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 4422b6b97ef844158e369e022d62d6f0ae641222
2016-08-02 14:13:27 -07:00
Lukas Piatkowski ec0ccf599a #15 Add a button in devtools to start/stop the Sampling Profiler
Differential Revision: D3555704

fbshipit-source-id: 4add16c923fcfd306892efec4630c24ae438d6dd
2016-08-02 11:14:06 -07:00
Pieter De Baets e762d961cd Use new enqueueJSCall method everywhere
Reviewed By: majak

Differential Revision: D3605263

fbshipit-source-id: 215f896d675b937593c8b796ed6ec5261ac74dbf
2016-08-02 11:14:06 -07:00
Pieter De Baets 47d6d289d4 Customize main thread initialization of native modules
Reviewed By: mhorowitz

Differential Revision: D3580025

fbshipit-source-id: 18abc15b894c745f584d91da47035c6db036aafa
2016-08-02 10:27:25 -07:00
Siqi Liu 43f73f675f Enable websocket interception in RN network inspector tool
Summary:
This diff enables network inspection for WebSocket APIs, so by now XMLHttpRequest, Fetch and WebSocket are all supported. Android and iOS are both supported.

This diff monkey-patches the RCTWebSocketModule which WebSocket API builds on, and now it is able to intercept all WebSocket requests when app is running. The intercepted information of a WebSocket includes url, protocols, status, messages (sent and received), close reason, server close event and server error information, etc.

Reviewed By: davidaurelio

Differential Revision: D3641770

fbshipit-source-id: 393df0da74ed95b1fd60e38b0d67ed61b3dd5ff3
2016-08-02 08:28:39 -07:00
Siqi Liu 1e8b83d2e6 Add unique ids to the intercepted XHR objects to make the tracking correctly across inspector restarts.
Summary: In previous `XHRInterceptor`, it sometimes crashes when restarting the network inspector because the id of the XHR objects are not unique all time. Fix this in diff by adding a global id "generator" for all intercepted xhr objects in order to make it safe across inspector restarts.

Reviewed By: davidaurelio

Differential Revision: D3641624

fbshipit-source-id: f9a1589f278023243aa182d3da93ce69c985587c
2016-08-02 08:28:39 -07:00
Charles Dick aba87550cc upload JSC heap capture to bundle server
Reviewed By: bestander

Differential Revision: D3642116

fbshipit-source-id: 9626078bb0f087f55d8270c8e0b082c74bd2df9d
2016-08-02 08:13:57 -07:00
Siqi Liu b5abb87a6f Fix the potential bug for network inspector when receiving xhr objects without an "_index" property
Summary: It sometimes happens that there are already some existing `XMLHttpRequest` objects before we turn on the network inspector. So it is a must to check whether a `XMLHttpRequest` object has a property `_index` to determine if it should be tracked.

Reviewed By: davidaurelio

Differential Revision: D3635184

fbshipit-source-id: a5552d7244c994b0fe782ac35baae39ec7488494
2016-07-28 14:13:46 -07:00
Siqi Liu f20d5ed67f Intercept XMLHttpRequest network operations and gather their information in inspector tool
Summary:
This diff
- creates `XHRInterceptor` to intercept all XMLHttpRequest network operations in React Native by monkey-patching.
- enables `XHRInterceptor` in RN development tool "inspector".

This interception and inspector tool work well on both Android and iOS. And this supports interception on any network API based on XMLHttpRequest, especially the Fetch API.

By now, we can intercept 12 information fields of a XMLHttpRequest including method, url, data sent, status, response type, response size, requestHeaders, responseHeaders, response, responseURL, responseType and timeout.

Follow-up:
- Will add UIs in the inspector on top of this diff, to display all the network operation information. (Not in this diff just to make this shorter)
- Will extend this to gather other valuable information towards one XMLHttpRequest.
- Should support other network request APIs like WebSocket.

Reviewed By: davidaurelio

Differential Revision: D3598873

fbshipit-source-id: 3221050ab2ebd876a718fc326646c344d0944a5f
2016-07-27 12:28:32 -07:00
Paul O’Shannessy 5db5ee9f55 Upgrade to React v15.3.0-rc.2
Summary:
There were several fixes to how calls to propType checkers. This is to
account for the new deprecation warning - React.PropTypes will not be
part of production builds in the future.

Note: There is still a warning about an invalid argument to `React.PropTypes.oneOf` (React is running that validation sooner now). Specifically [both of these](b1e49832ef/Libraries/Components/Touchable/TouchableWithoutFeedback.js (L44-L45)) because `View.AccessibilityTraits` is actually undefined in tests (didn't look into why you conditionally set that).

**Test plan (required)**

`npm test` & fixed all warnings due to proptype secret
Closes https://github.com/facebook/react-native/pull/8758

Reviewed By: zpao

Differential Revision: D3564288

Pulled By: bestander

fbshipit-source-id: 1ff1f90907f41855e364048aa730ccd239c522b4
2016-07-21 09:13:29 -07:00
Serhij Korochanskyj b8576312ca Fix BackAndroid subscriptions calls
Summary:
`BackAndroid` JS event subscriptions should be called in reverse order
(the subscription from the latest `addEventLister` should run first).

Also if listener returns true, don't call other listeners.

**Motivation**: We use `BackAndroid` listeners to prevent closing screens with user's input.
When we have two screens in stack (each screen with listener, which show alerts),
we want to show alert only from the last screen listener, not from all.
Closes https://github.com/facebook/react-native/pull/8929

Differential Revision: D3598978

Pulled By: dmmiller

fbshipit-source-id: a7b0762b36a60755a844e90fffd58887f89c9ffb
2016-07-21 08:58:24 -07:00
Adalbert Gorecki 6d1277065d Show the right error message in the console
Summary:
Just a small update to fix the error message in `Alert.js`.

In my app, I'm using https://github.com/zo0r/react-native-push-notification to show local notifications. When the notification is tapped, I'm trying to show an alert with the notification text, but this results in an error (which is not the problem I'm addressing here). Unfortunately the wrong parameter was passed to the `console.warn`, so you couldn't see what the error message was.

Before:
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 35" src="https://cloud.githubusercontent.com/assets/666322/16910168/7b45c7ac-4cd7-11e6-8d3e-3861d2fc648c.png">
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 43" src="https://cloud.githubusercontent.com/assets/666322/16910173/854fc0ea-4cd7-11e6-956f-93ee68a09bd6.png">

After fix:
<img width="416" alt="bildschirmfoto 2016-07-18 um 10 50 35" src="https://cloud.githubusercontent.com/assets/666322/16910168/7b45c7ac-4cd7-11e6-8d3e-3861d2fc648c.png">
<img width="416" alt="bildschirmfoto 2016
Closes https://github.com/facebook/react-native/pull/8861

Differential Revision: D3586453

fbshipit-source-id: bf81e42bd4450ef15a301e7367e94355379c442e
2016-07-19 07:28:34 -07:00
Pieter De Baets 7fa677f7c3 Add MessageQueue method for executing function and returning its result
Reviewed By: majak

Differential Revision: D3175793

fbshipit-source-id: e1e66e3dcde8b1fb35973340e12d947a0e955775
2016-07-18 07:13:32 -07:00
yueshuaijie f38d9a1147 Fix description of AlertIOS.prompt()'s parameter defaultValue.
Summary:
The description of `AlertIOS.prompt()` parameter `defaultValue` is wrong, correct it.
Closes https://github.com/facebook/react-native/pull/8793

Differential Revision: D3566939

fbshipit-source-id: c6378d8142c66e9f9b854f216afcf10c489ec750
2016-07-14 19:28:20 -07:00
Mengjue Wang 471ee87445 Wrap native module I18nManager with a new RCTI18nManager.js and fix current use of native module I18nManager
Summary: create new RCTI18nManager.js to warp-up native module I18nManager and fix current use of it.

Reviewed By: ericvicenti

Differential Revision: D3547427

fbshipit-source-id: 53a695c94ca6bba2f566d0725c553e58d60bf451
2016-07-11 20:58:32 -07:00
David Aurelio 2426b3b5ec Prevent tests with invalid UTF-8 from failing when jest reads them from the cache
Summary: The utf-8 test was failing when run from Jest’s cache, because it contained unicode escape sequences for stray high and low surrogates. Somewhere in the process of transpiling, caching on disk, and reading from the cache, those stray surrogates are changed to U+FFFD (REPLACEMENT CHARACTER / �). This diffs changes the method of creating these strings from literals to `String.fromCharCode`, which survives the process as intended.

Reviewed By: bestander

Differential Revision: D3534711

fbshipit-source-id: 365bace77a1f914e6e2fbb3430b3e0ea6cec5e83
2016-07-08 12:35:53 -07:00
David Aurelio bd60d828c5 Remove `node_modules/react` from the list of discoverable haste modules
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.

Reviewed By: astreet

Differential Revision: D3509863

fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
2016-07-05 06:44:33 -07:00
Konstantin Raev 1d86be3a6e Turned on old bridge for OSS
Summary:
This should revert back to using old bridge by default until we fix gradle script to build new bridge for OSS correctly
Closes https://github.com/facebook/react-native/pull/8539

Differential Revision: D3514263

Pulled By: bestander

fbshipit-source-id: db9e0232b9bde27206814212dedc487c366e3511
2016-07-03 14:43:20 -07:00
Jan Kassens eb28c90205 Sort keys in createStrictShapeTypeChecker message
Summary:
The keys were in random order which made this warning less useful when there are
many keys.

Reviewed By: spicyj

Differential Revision: D3504322

fbshipit-source-id: c184aa447c985a0149cbfa8c90c6daf9632b6226
2016-07-01 15:43:23 -07:00
Christoph Pojer 89a9ca6688 Update some JS in preparation for some Jest updates.
Summary:
* Next version of Jest doesn't allow non test files in __tests__ folders.
* I'm trying to switch all tests off of jsdom on react-native. This should save 500ms of time when running a single test because jsdom is slow to load and react-native is also not supposed to run in a DOM environment, so let's not pretend we are providing the DOM in tests.
* Make the bridge config configurable so that when we disable automocking and we reset the registry we can redefine the value.

Oh also, stop using lodash in Server.js. First off, lodash 3 doesn't work in Jest's node env because it does some crazy stuff, second because we don't need to load all of lodash for debounce.

Reviewed By: davidaurelio

Differential Revision: D3502886

fbshipit-source-id: 1da1cfba9ed12264d81945b702e7a429d5f84424
2016-06-30 01:58:40 -07:00
Tim Yung de6ab1c6f4 RN: Implement `defineLazyObjectProperty`
Reviewed By: sahrens

Differential Revision: D3500318

fbshipit-source-id: 275c5b9a2b747174fb23b80896e2270eb2131e4b
2016-06-29 16:43:17 -07:00
Chris Hopman df6d18358e Serialize params when making/queuing native call
Reviewed By: mhorowitz

Differential Revision: D3460507

fbshipit-source-id: a0600ffe3da89791af3eb64fc2973eb6aafa7d2b
2016-06-23 14:58:58 -07:00
Leon 57d85f1c3e Fixing Syntax Error "errorMessage" is read-only
Summary:
Changed const to let, to dodge the following issue:

> "errorMessage" is read-only
>   203 |         const errorMessage = `Callback with id ${cbID}: ${module}.${method}() not found`;
>   204 |         if (method) {
> > 205 |           errorMessage = `The callback ${method}() exists in module ${module}, `
>       |           ^
>   206 |           + `but only one callback may be registered to a function in a native module.`;
>   207 |         }
Closes https://github.com/facebook/react-native/pull/8347

Differential Revision: D3475525

Pulled By: javache

fbshipit-source-id: e03b3b3411606e6798dc42c785f847c2eda03b0c
2016-06-23 03:13:28 -07:00
Christine Abernathy 22f59a88a6 Improve autogen for reference docs including jsdoc support
Summary:
As part of improving the API and Component reference docs #8154 this pull request adds the following:

- jsdoc support for API docs. See the AlertIOS changes as an example.
- type definitions support and added to both API and Component docs. This is supported via react-docgen and jsdoc.
- better formatting of method properties (now shown in a table).

FYI, API and Component docs were previously generated in two different ways. Components were using react-docgen and that basically remains as-is. APIs were using custom parsing code and that's been switched to use a jsdoc parser + react-docgen as an option for typedefs (it could also use the jsdoc parser).

Two docs have been updated to showcase how we'd like the new docs to look:

- AlertIOS (API): showing method parameters, examples, typedefs, more details overall.
- Statusbar (Component): showing method parameters, typedefs, more details overall.

**Note**: To convert new API docs to use the new format, add `jsdoc` to the initial file comment. C
Closes https://github.com/facebook/react-native/pull/8196

Differential Revision: D3465037

Pulled By: lacker

fbshipit-source-id: 78415d44bc5be02db802f5b1f7a0b249689abdf7
2016-06-21 14:28:43 -07:00
Alexey Lang b36eaeda5d Replace RCT_DEV with RCT_PROFILE
Reviewed By: javache

Differential Revision: D3462735

fbshipit-source-id: 44513a9540b3111e036c4b14e0fda2d34b43cdf6
2016-06-21 12:15:45 -07:00
Pieter De Baets 979d1c7e71 Make MessageQueue module/method tables DEV-only
Reviewed By: lexs

Differential Revision: D3431065

fbshipit-source-id: fcb90bd53460064f8a0efee346ed3b87886e7b60
2016-06-15 07:58:48 -07:00
Satyajit Sahoo 803cb61346 Show better error message when accessing React APIs on React Native
Summary:
**Motivation:**

Lots of examples on the web still have the old way to import React APIs from React Native. Also when someone upgrades to latest version of React Native without reading the release notes can get confused. This PR adds getters for  `createClass` and `Component` and throws an error with a better error message when they are accessed.

![screenshot_20160614-125622](https://cloud.githubusercontent.com/assets/1174278/16034600/47c70222-3230-11e6-9fe4-1a3493708829.png)

**Test plan:**

Trying to use `ReactNative.createClass` or `ReactNative.Component` will throw an error with this error message.

There's currently a bug in `symbolicateStackTrace` which actually crashes the app after showing the error due to the `stack` being null when updating the stack trace. But that's a separate issue which should be fixed separately. For now, to prevent the crash, we need to add the following before the return statement here - https://github.com/facebook/react-native/blob/master/Libraries/JavaScriptAppEn
Closes https://github.com/facebook/react-native/pull/8099

Differential Revision: D3430468

Pulled By: javache

fbshipit-source-id: c098e51e1f2c276d87eca6da3bd91a457d7840c5
2016-06-14 06:28:26 -07:00
Pieter De Baets 3f1bca7d26 Fix truncate tests
Reviewed By: bestander

Differential Revision: D3424960

fbshipit-source-id: 0f434d80e6e26cfc9f01800c266dd1a3710fe459
2016-06-13 10:13:36 -07:00
Pieter De Baets 2151dfbb24 Open source jest tests for open source components
Reviewed By: bestander

Differential Revision: D3424368

fbshipit-source-id: 116229b64ecc7d8846e803e29fad377a4fb800bb
2016-06-13 08:28:50 -07:00
Pieter De Baets c25e48abfc Allow additional information to be passed to systrace events
Summary: Expose the ability to provide extra information to Systrace events from JS. This is specifically useful for instrumenting generic recursive method that are defined completely through their params.

Reviewed By: tadeuzagallo

Differential Revision: D3423595

fbshipit-source-id: 7f2dedf02bf901401a6b391b85b1a0bb6782349c
2016-06-13 04:28:38 -07:00
Igor Avramovic 7c3364196a Reverted commit D3369528
Differential Revision: D3369528

fbshipit-source-id: 4400411f43bc8396b3692d80b797eceed8899452
2016-06-03 05:43:26 -07:00
Igor Avramovic c55e3649dd Lazy load platform specific code
Differential Revision: D3369528

fbshipit-source-id: 0fbc63fbac5e96468598fb3d0a86c6b20f96f39d
2016-06-02 17:43:25 -07:00
Alex Kotliarskyi 0d1d7ba2b7 Remove dead SourceMap code
Summary:
In several pervious diffs we have moved symbolication of JS stack traces
to the packeger. This lets us save a bunch of memory (~80MB) and CPU on device,
reduces dependency on JS after exception occured.

This diff cleans up a bunch of code that was used to do symbolication on client side.

Reviewed By: javache

Differential Revision: D3348676

fbshipit-source-id: 88baa5c502836c9ca892896e1ee5d83db37486d3
2016-06-01 13:59:16 -07:00
Sean Kinsey a96fcc7ce1 Optimize and flowify mapWithSeparator
Summary:
Update mapWithSeparator so that Flow can reason about the arguments and return
type. For simplicity, it is expected that the type of the separator will be the
same as that of the mapped item.

Reviewed By: vjeux

Differential Revision: D3323557

fbshipit-source-id: 75b59e928d4e8c309b5933499a14744370ee5660
2016-05-26 12:28:55 -07:00
Basil Hosmer ac5636dd59 explicit type args in react-native-github
Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
2016-05-24 18:28:26 -07:00
Ben Alpert 8876eaaea0 Set up Systrace during initialization
Summary: When we're profiling, we want to load Systrace immediately and profile all the startup and initial render code. The code here used to load Systrace during startup only if `__DEV__` but would always start profiling once Systrace was otherwise required. That seems pretty hard to reason about, so I'm switching to always requiring Systrace during the startup path and enabling profiling if appropriate. In actual production that'll always be false, of course.

Reviewed By: javache

Differential Revision: D3338216

fbshipit-source-id: f173e82f34e110d83e7ff04f11af9b302a54b859
2016-05-24 12:13:24 -07:00
Pieter De Baets 4880309e72 Prevent Systrace from including React in the preloaded modules section
Reviewed By: tadeuzagallo

Differential Revision: D3304923

fbshipit-source-id: 25dea5b57002578ccb3e38e8946c6b73db008ed0
2016-05-23 04:58:24 -07:00
Alexander Blom 2a67f9b249 Move infoLog to OSS
Reviewed By: sahrens

Differential Revision: D3310270

fbshipit-source-id: 93261e6083a35e6869b384c8c230c861427e4060
2016-05-17 12:43:40 -07:00
Ben Alpert a95405f419 Update to React 15.1.0-alpha.1
Reviewed By: zpao

Differential Revision: D3283057

fbshipit-source-id: c37ea3818597e5c0f37ed3c7502c791c02183ea8
2016-05-10 15:58:24 -07:00
Pieter De Baets 57ceeafd4f Move UI-specific logic from NativeModules to UIManager
Summary: Move all requires of UIManager to UIManager.js, so we can load the view manager configuration lazily when UIManager is required.

Reviewed By: majak

Differential Revision: D3270147

fb-gh-sync-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
fbshipit-source-id: 8208ee8d5919102ea5345e7031af47ee78162fe0
2016-05-09 08:21:19 -07:00
Alexander Blom abca466037 Remove name property from native modules
Reviewed By: javache

Differential Revision: D3275674

fb-gh-sync-id: 7c100c78576b48f3163c37b93499dd54da73b96c
fbshipit-source-id: 7c100c78576b48f3163c37b93499dd54da73b96c
2016-05-09 05:46:23 -07:00
Alexander Blom 097f59112f Make MessageQueue.RemoteModules lazy
Reviewed By: javache

Differential Revision: D3252400

fb-gh-sync-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
fbshipit-source-id: 11a31fd2e1e41c6a3ad538b08ef177207780bd88
2016-05-06 04:14:23 -07:00
Alexander Blom 041185edfd Let JS modules use strings instead of ids on Android
Reviewed By: nicklockwood

Differential Revision: D3229626

fb-gh-sync-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
fbshipit-source-id: f8b2e8c9fc0d25d67f623cdbbe9930a02a40d1de
2016-05-04 10:29:26 -07:00
Janic Duplessis 169cfb5a52 Remove the need for allowTopLevelThis in transform-es2015-modules-commonjs
Summary:
This make the transform behave closer to the standard for modules.

This removes the few places that a top level this was used to refer to the global space. It also clean up the usage of `GLOBAL` to use `global` instead as this is what is used everywhere else in the code base. We still define `GLOBAL` for compatibility with other modules.

**Test plan**
Clear the packager cache to make sure the transforms run again. (node ./local-cli/cli.js start --reset-cache).
Run the Movies example (UIExplorer is broken atm) and make sure there are no errors.
Closes https://github.com/facebook/react-native/pull/6255

Differential Revision: D3037227

Pulled By: mkonicek

fb-gh-sync-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
fbshipit-source-id: bcf1350ae7a6e92c77d3a87fc9d6e42eb93cb9b9
2016-04-29 16:15:34 -07:00
Sebastian Markbage 373537b281 Deprecate transformMatrix and decomposedMatrix
Summary:
transformMatrix only worked on iOS and there is an equivalent API that (mostly)
works cross platform.

decomposedMatrix could technically be passed on Android but it wasn't document and explicitly flagged as not working.

My goal is to deprecate both uses and then the only supported API is the `transform: [{ matrix: ... }]` form.

The only difference is that on Android the matrix gets decomposed.

Currently there is some special cased magic that renames transform -> transformMatrix or decomposedMatrix depending on platform.

https://github.com/facebook/react/blob/master/src/renderers/native/ReactNative/ReactNativeAttributePayload.js#L50

Therefore I'm adding an alias for both native platforms called just "transform".

Next I'll swap over the JS to always target the name "transform". The only difference is how the value is marshalled over the bridge in processTransform.

To do this, I have to clean up a few callers. Mostly that's just swapping to the new API.

For buildInterpolator this is a bit trickier but this fixes it for all our use cases (which is only the Navigator in AdsManager).

Reviewed By: vjeux

Differential Revision: D3239960

fb-gh-sync-id: 838edb6644c6cdd0716834f712042f226ff3136f
fbshipit-source-id: 838edb6644c6cdd0716834f712042f226ff3136f
2016-04-29 14:19:25 -07:00
Charles Dick 24b2990467 Capture heap from the dev menu
Reviewed By: foghina

Differential Revision: D3229856

fb-gh-sync-id: c6321cfb309c93572a51bba625d63246a75f0254
fbshipit-source-id: c6321cfb309c93572a51bba625d63246a75f0254
2016-04-29 07:35:22 -07:00
Dave Miller 3a5457cd7c Add support for setChildren
Summary: This adds support for UIManager.setChildren on Android like D2757388 added for iOS.

Reviewed By: andreicoman11

Differential Revision: D3235369

fb-gh-sync-id: b538556ec4abdb606f9be26d1b74734046bca0cd
fbshipit-source-id: b538556ec4abdb606f9be26d1b74734046bca0cd
2016-04-29 04:03:24 -07:00
Christoph Pojer d363b1f2e2 Update Jest APIs on fbsource
Reviewed By: javache

Differential Revision: D3229435

fb-gh-sync-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
fbshipit-source-id: b0e252d69e1f399a946fca6e98ef62ff44c2ef9c
2016-04-27 19:16:32 -07:00
Andy Street 50d8d46733 Add ability to expose sync hooks from Java to JS
Summary:
This only works for the new cxx bridge (hopefully open sourcing soon!).

This diff allows Java native modules to expose synchronous hooks to JS via the ReactSyncHook annotation. The methods will appear in JS on the native module object (e.g. you would do `require('UIManager').mySyncHook('foo');`) which allows us to enforce that required native modules are installed at build time. In order to support remote debugging, both the args and return type must be JSON serializable (so that we can go back across to the device to resolve synchronous hooks).

Follow ups will be integration tests, adding support for return types besides void, and adding support for remote debugging.

Reviewed By: mhorowitz

Differential Revision: D3218794

fb-gh-sync-id: 7e3366a8254276f5a55eb806287419287ca9182b
fbshipit-source-id: 7e3366a8254276f5a55eb806287419287ca9182b
2016-04-27 07:51:28 -07:00
Mike Grabowski edf8888fb9 Platform.select method
Summary:
Kudos to frantic for this amazing idea! Works really well (yet so simple!)

Basically we had a discussion with vjeux and frantic and others in the PR #7033 how to handle platform-specific stylesheets in a similar to F8 app way.

There were quite a few nice ideas there, however that one seems to be the smallest yet the most powerful.

Basically there's a `Platform.select` method that given an object, will select a `obj[Platform.OS]` value.

It works with styles:
`Platform.select({ ios: {}, android: {} })`

with messages:
`<Text>{Platform.select({ ios: 'Check the App Store', android: 'Check Google Play' })}</Text>`

and also works well with components (similar to Wallmart idea of <PlatformSwitch />) - relevant example included in diff.
Closes https://github.com/facebook/react-native/pull/7220

Differential Revision: D3221709

Pulled By: vjeux

fb-gh-sync-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
fbshipit-source-id: 0a50071f2dcf2273198bc6e2c36e19bca97d7be9
2016-04-25 16:32:20 -07:00
Sebastian Markbage 47a470a97c Move React Core Integration to a Dependency
Summary:Adding the react native renderer dependency and various fixes to support React 15.

Don't use dispatchID for touchableHandleResponderGrant

This callback argument was removed because "IDs" no longer exist. Instead, we'll
use the tag from the event target.

The corresponding PR on React Core is: https://github.com/facebook/react/pull/6338

Reviewed By: spicyj

Differential Revision: D3159788

fb-gh-sync-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
fbshipit-source-id: 60e5cd2aa0af69d83fcdac3dfde0a85a748cb7b9
2016-04-21 09:28:23 -07:00
David Aurelio fcc89e9d92 Add support for missing XHR response types
Summary:Fixes #6679

This adds support for the missing response types to XMLHttpRequest.
Don?t ship this yet. This is completely untested. yolo and stuff.
Closes https://github.com/facebook/react-native/pull/6870

Reviewed By: bestander

Differential Revision: D3153628

Pulled By: davidaurelio

fb-gh-sync-id: 76feae3377bc24b931548a9ac1af07943b1048ac
fbshipit-source-id: 76feae3377bc24b931548a9ac1af07943b1048ac
2016-04-11 05:54:28 -07:00
Nick 2a03182b1c CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
Andrei Coman ac03c47895 Use monotonic clock instead of currentTimeMillis
Reviewed By: javache

Differential Revision: D3115208

fb-gh-sync-id: c0fef5a162ab023d55736b38c51c87b8759f089d
fbshipit-source-id: c0fef5a162ab023d55736b38c51c87b8759f089d
2016-03-30 12:47:20 -07:00
Andy Street ede99eeadd Backed out changeset 13a4ea1d64ce
Reviewed By: ericvicenti

Differential Revision: D3093064

fb-gh-sync-id: c9b68c8c5ab8ddaf77570d2cf8024e36925e5e76
fbshipit-source-id: c9b68c8c5ab8ddaf77570d2cf8024e36925e5e76
2016-03-29 03:42:18 -07:00
Satyajit Sahoo 6c22a2174e Fix fetching sourcemap in genymotion. Fixes #5338
Summary:Source maps are broken on Genymotion right now as they aren't being loaded from the correct URL. refer - https://github.com/facebook/react-native/issues/5338#issuecomment-188232402

**Test plan**

Build and install UIExplorer from master branch in genymotion and enable hot reload. When you change a file and save it, you'll see a Yellow box due to source map fetching failed, as per the referenced comment.

Doing the same for this branch doesn't produce any yellow boxes.
Closes https://github.com/facebook/react-native/pull/6594

Differential Revision: D3088218

Pulled By: martinbigio

fb-gh-sync-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
shipit-source-id: 0d1c19cc263de5c6c62061c399eef33fa4ac4a7b
2016-03-24 12:06:45 -07:00
Sokovikov 67efe4c1a9 custom back button handler
Summary:sometimes it is nessesary to handle back button
specifically for component, by changing its state.
 For ex. exit from edit mode.
Closes https://github.com/facebook/react-native/pull/5062

Differential Revision: D3084590

Pulled By: ericvicenti

fb-gh-sync-id: 13a4ea1d64ce725daa5d3af0d629a0c132a3f3d5
shipit-source-id: 13a4ea1d64ce725daa5d3af0d629a0c132a3f3d5
2016-03-23 12:22:20 -07:00
Andre Giron fd2cf119b1 Fix issue #6300: Improve error message for unregistered callbacks.
Summary:Fix for issue #6300:
Motivation: When more than one callback is registered to a native module, the error message that a user receives is not indicative of what is really happening.
Closes https://github.com/facebook/react-native/pull/6436

Differential Revision: D3087551

Pulled By: tadeuzagallo

fb-gh-sync-id: 93c703348dc53b75c5b507edc71754680ab5c438
shipit-source-id: 93c703348dc53b75c5b507edc71754680ab5c438
2016-03-23 10:08:29 -07:00
Martín Bigio 1ef9e4dc59 Make HMR compatible with numeric IDs
Summary:We recently refactor the packager to transform the module names into numeric IDs but we forgot to update the HMR call site. As a consequence, HMR doesn't work the first time a file is saved but the second one.

This is affecting master as of 3/20. If we don't land this before v0.23 is cut we'll have to cherry pick it. This rev does *not* need to be picked on v0.22.

Reviewed By: bestander

Differential Revision: D3075192

fb-gh-sync-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
shipit-source-id: 410e4bf8f937c0cdb8f2b462dd36f928a24e8aa8
2016-03-21 15:51:24 -07:00
Satyajit Sahoo 97a97b3c11 Tweak error message for HMR
Summary:The error messages are iOS specific right now. This PR improves them to include the Android bits also.

![screenshot_20160322-000431](https://cloud.githubusercontent.com/assets/1174278/13929839/2bccce5e-efc2-11e5-9db3-f72dcf486412.png)
Closes https://github.com/facebook/react-native/pull/6546

Differential Revision: D3077815

Pulled By: martinbigio

fb-gh-sync-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
shipit-source-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
2016-03-21 14:08:26 -07:00
Martín Bigio bcb37c0b6a inline `__accept` call so that sourcemaps work
Summary:Sourcemaps on HMR where a couple of line off. The problem is that since the `__accept` call doesn't go through the sourcemaps pipeline we need to make sure that call is a single-line one.

This was originally written in a single line but I incorrectly updated it on 436db67126. Would be great having test coverage for this.

Reviewed By: davidaurelio

Differential Revision: D3075164

fb-gh-sync-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701
shipit-source-id: c77ea99f26bdd675f241c5d20a620eb4ddfbf701
2016-03-20 17:39:22 -07:00
Pieter De Baets b653d43e2e Update Dimensions when device orientation changes
Reviewed By: nicklockwood

Differential Revision: D2939877

fb-gh-sync-id: ec6161448bff34c07b93f19e1ee953657675bad5
shipit-source-id: ec6161448bff34c07b93f19e1ee953657675bad5
2016-03-15 05:49:25 -07:00
David Aurelio 06b5bda349 Bring back "Use numeric identifiers when building a bundle"
Summary:This brings back "Use numeric identifiers when building a bundle", previously backed out.
This version passes on the correct entry module name to code that decides transform options.

Original Description:
Since the combination of node and haste modules (and modules that can be required as both node and haste module) can lead to situations where it’s impossible to decide an unambiguous module identifier, this diff switches all module ids to integers. Each integer maps to an absolute path to a JS file on disk.

We also had a problem, where haste modules outside and inside node_modules could end up with the same module identifier.

This problem has not manifested yet, because the last definition of a module wins. It becomes a problem when writing file-based unbundle modules to disk: the same file might be written to concurrently, leading to invalid code.

Using indexed modules will also help indexed file unbundles, as we can encode module IDs as integers rather than scanning string IDs.

Reviewed By: martinbigio

Differential Revision: D2855202

fb-gh-sync-id: 9a011bc403690e1522b723e5742bef148a9efb52
shipit-source-id: 9a011bc403690e1522b723e5742bef148a9efb52
2016-03-14 16:17:20 -07:00
Frank Yan d815d1df9a Move cssVar out of react-native-github
Reviewed By: jingc

Differential Revision: D3008870

fb-gh-sync-id: 2c3d9a13ba6952540369cb68d96d375cb8cf757a
shipit-source-id: 2c3d9a13ba6952540369cb68d96d375cb8cf757a
2016-03-04 13:22:03 -08:00
Frank Yan 8f3e5b1e93 Update usage names of React Native color palette
Reviewed By: weicool

Differential Revision: D2978557

fb-gh-sync-id: ef6b6b24e7db7faf3aecee0a9755565e1b41be58
shipit-source-id: ef6b6b24e7db7faf3aecee0a9755565e1b41be58
2016-03-03 00:51:31 -08:00
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Satyajit Sahoo 7c2c6a9d3f Show a Toast for HMR
Summary:This is just to try out the experience with HMR if we show toasts (might be annoying). Let's try it out before deciding on merging/closing.

Related #5906
Closes https://github.com/facebook/react-native/pull/5947

Differential Revision: D2987132

fb-gh-sync-id: 7bfbb6e1f0363a416805b67eb5674f79ac0881ad
shipit-source-id: 7bfbb6e1f0363a416805b67eb5674f79ac0881ad
2016-02-27 15:58:35 -08:00
Martín Bigio 436db67126 Allow parents to accept children modules
Summary:In order to be able to Hot Load Redux stores and modules that export functions, we need to build infrastructure to bubble up the HMR updates similar to how webpack does: https://webpack.github.io/docs/hot-module-replacement-with-webpack.html.

In here we introduce the minimum of this infrastructure we need to make this work. The Packager server needs to send the inverse dependencies to the HMR runtime that runs on the client so that it can bubble up the patches if they cannot be self accepted by the module that was changed.

This diff relies on https://github.com/facebook/node-haste/pull/40/files which adds support for getting the inverse dependencies.

Reviewed By: davidaurelio

Differential Revision: D2950662

fb-gh-sync-id: 26dcd4aa15da76a727026a9d7ee06e7ae4d22eaa
shipit-source-id: 26dcd4aa15da76a727026a9d7ee06e7ae4d22eaa
2016-02-26 15:17:43 -08:00
Nick Lockwood 4b4455f827 Removed 'screen' option from snapshot API
Summary:Unfortunately the 'screen' option in the `UIManager.takeSnapshot` API appears to work only on the iOS simulator, not on an actual device.

This diff removes the 'screen' option until a solution can be found that works on the device.

(Taking a snapshot of the window still works fine - it just won't include the status bar, etc.)

Reviewed By: javache

Differential Revision: D2971091

fb-gh-sync-id: 026b9d4eb2f59f686f58c18a16381ff325df612b
shipit-source-id: 026b9d4eb2f59f686f58c18a16381ff325df612b
2016-02-24 09:06:31 -08:00
Frank Yan 9d1abf0cd5 Add the latest FIG colors to React Native color palette
Reviewed By: weicool

Differential Revision: D2965103

fb-gh-sync-id: 104d524af0547895ff976bcf4d68f199f1b6537b
shipit-source-id: 104d524af0547895ff976bcf4d68f199f1b6537b
2016-02-23 16:12:31 -08:00
Nick Lockwood ac12f98689 Added support for taking snapshots of the screen, window or individual views
Summary:This adds a `takeSnapshot` method to UIManager that can be used to capture screenshots as an image.

The takeSnapshot method accepts either 'screen', 'window' or a view ref as an argument.

You can also specify the size, format and quality of the captured image.

I've added an example of capturing a screenshot at UIExplorer > Snapshot / Screenshot.
I've also added an example of sharing a screenshot to the UIExplorer > ActionSheetIOS demo.

Reviewed By: javache

Differential Revision: D2958351

fb-gh-sync-id: d2eb93fea3297ec5aaa312854dd6add724a7f4f8
shipit-source-id: d2eb93fea3297ec5aaa312854dd6add724a7f4f8
2016-02-23 02:26:33 -08:00
Satyajit Sahoo 14ec6f011e Use promises in 'NetInfo'
Reviewed By: svcscm

Differential Revision: D2938010

fb-gh-sync-id: 4a24ce680b37e49759f3325987b4b440eb033b94
shipit-source-id: 4a24ce680b37e49759f3325987b4b440eb033b94
2016-02-15 13:34:33 -08:00
Matthew Dapena-Tretter bb3d8d5350 Ensure recursion is terminated on objects with cyclical references
Reviewed By: spicyj

Differential Revision: D2922542

fb-gh-sync-id: 3820569027a5906ff844f1cda5e2e65c2692e235
shipit-source-id: 3820569027a5906ff844f1cda5e2e65c2692e235
2016-02-12 14:56:00 -08:00
Adam Miskiewicz e018aa3100 Enable HMR
Reviewed By: svcscm

Differential Revision: D2932137

fb-gh-sync-id: 8bfab09aaac22ae498ac4fa896eee495111abc0d
shipit-source-id: 8bfab09aaac22ae498ac4fa896eee495111abc0d
2016-02-12 08:10:33 -08:00
Satyajit Sahoo 8eddead868 Add a deprecatedCallback helper
Reviewed By: svcscm

Differential Revision: D2926943

fb-gh-sync-id: 104bcd076f6427aac92e98081e492101ca78de26
shipit-source-id: 104bcd076f6427aac92e98081e492101ca78de26
2016-02-12 06:21:35 -08:00
Andrei Coman 228a1fe7d4 Expose screen metrics and window metrics
Summary:
public
https://github.com/facebook/react-native/pull/4935 changed the window dimensions for android by replacing them with the actual screen dimensions. This changes the window dimensions back to their original values and adds `Dimensions.get('screen')` for the actual screen dimensions of the device.

Reviewed By: astreet

Differential Revision: D2921584

fb-gh-sync-id: 5d2677029c71d50691691dc651a11e9c8b115e8f
shipit-source-id: 5d2677029c71d50691691dc651a11e9c8b115e8f
2016-02-11 06:33:36 -08:00
Konstantin Raev 6f1417c849 CI now builds docs website and deploys it to /%version% path
Summary:
Copy of #5760 reverted merge.

We need to preserve history of docs changes on the webserver.
The goal is to allow users to browse outdated versions of docs.
To make things simple all websites will be released to https://facebook.github.io/react-native/releases/version/XX folder when there is a branch cut.

I switched from Travis CI to Cirle CI because it works faster and I am more familiar with it.

How it works:

1. If code is pushed to `master` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/next folder.
Github will serve this website from https://facebook.github.io/react-native/releases/version/next URL.
All relative URLs will work within that website

2. If code is pushed to `0.20-stable` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/0.20 folder.
Github will serve this website from https://facebook.github.io/react-native/releases/v
Closes https://github.com/facebook/react-native/pull/5873

Reviewed By: svcscm

Differential Revision: D2926901

Pulled By: androidtrunkagent

fb-gh-sync-id: 16aea430bac815933d9c603f03921cc6353906f1
shipit-source-id: 16aea430bac815933d9c603f03921cc6353906f1
2016-02-11 06:17:42 -08:00
Dave Miller c9a1956c4f Fix promises on iOS to no longer wrap values in Arrays
Summary:
public
In 9baff8f437 (diff-8d9841e5b53fd6c9cf3a7f431827e319R331), I incorrectly assumed that iOS was wrapping promises in an extra Array.  What was really happening is that all the callers were doing this.  I removed the wrapping in the callers and the special case handling MessageQueue.

Now one can pass whatever object one wants to resolve and it will show properly in the resolve call on the js side.  This fixes issue https://github.com/facebook/react-native/issues/5851

Reviewed By: nicklockwood

Differential Revision: D2921565

fb-gh-sync-id: 9f81e2a87f6a48e9197413b843e452db345a7ff9
shipit-source-id: 9f81e2a87f6a48e9197413b843e452db345a7ff9
2016-02-10 07:25:35 -08:00
Renyu Liu 843b556769 Fix the perspective projection
Reviewed By: kukulski

Differential Revision: D2907261

fb-gh-sync-id: 3954b015ece9c4339a674c4fcc2c2c7187b6da41
shipit-source-id: 3954b015ece9c4339a674c4fcc2c2c7187b6da41
2016-02-08 15:06:32 -08:00
Fabian Eichinger 90403154a2 Snapshot the Set of listeners when dispatching a BackAndroid event
Summary:
…while an event is dispatched

While it is guarded, a copy of the Set is created before listeners are added or removed. The event dispatch loop continues with the old Set of listeners.

This PR modifies `BackAndroid` to match the proposal at the end of #5781.
Closes https://github.com/facebook/react-native/pull/5783

Reviewed By: svcscm

Differential Revision: D2911282

Pulled By: foghina

fb-gh-sync-id: 34964ec3414af85eb9574bbcef081238fc67ffaf
2016-02-08 03:23:35 -08:00
Spencer Ahrens 8f6e074bd6 Return objects with remove methods when subscribing to back or host state
Reviewed By: fkgozali

Differential Revision: D2907942

fb-gh-sync-id: 11666f2f8cd2432c42cc90bbf48ead02a75f8bc4
2016-02-05 20:35:36 -08:00
Martín Bigio 36efbc341d Hot Loading Indicators
Summary:
public

Introduce a header bar similar to the one shown when loading the bundle to indicate that the packager server is processing an HMR update. Hook into HMR events to show this bar when appropriate.

Reviewed By: javache

Differential Revision: D2873521

fb-gh-sync-id: a77cbb2368b75b045aa8c6ababce2f731baf514b
2016-02-01 12:42:33 -08:00
Janic Duplessis 1c6e837504 Add a deprecatedPropType module to show deprecation warnings
Summary:
To allow smoother API changes for users we often deprecate props and keep them around for a while before removing them. Right now it is all done manually, this adds a consistent way to show a warning when using a deprecated prop.

This also adds a deprecation warning of the website generated from the deprecatedPropType.

<img width="643" alt="screen shot 2016-01-26 at 7 43 08 pm" src="https://cloud.githubusercontent.com/assets/2677334/12600172/7af28fb0-c465-11e5-85e5-3786852bf522.png">

It also changes places where we added the warnings manually to use deprecatedPropType instead.
Closes https://github.com/facebook/react-native/pull/5566

Reviewed By: svcscm

Differential Revision: D2874629

Pulled By: nicklockwood

fb-gh-sync-id: c3c63bae7bbec26cc146029abd9aa5efbe73f795
2016-01-29 02:05:38 -08:00
Jan Kassens 4a226fc1af Add guard to ErrorUtils mock
Summary:
This method is defined in the implementation but is missing from the mock.

public

Reviewed By: cpojer

Differential Revision: D2875173

fb-gh-sync-id: 6544c34a3d707ff9cecacc0608ab8320b950bfb7
2016-01-28 12:08:50 -08:00
Tim Yung 23f772061d RN: Update / Fix PixelRatio Manual Mock
Reviewed By: cpojer

Differential Revision: D2872990

fb-gh-sync-id: 34c644ec79b424954a14e049b996c658f6b69610
2016-01-27 18:27:06 -08:00
Martín Bigio f2438b440d Hot Loading Sourcemaps
Summary:
public

To make sourcemaps work on Hot Loading work, we'll need to be able to serve them for each module that is dynamically replaced. To do so we introduced a new parameter to the bundler, namely `entryModuleOnly` to decide whether or not to process the full dependency tree or just the module associated to the entry file. Also we need to add `//sourceMappingURL` to the HMR updates so that in case of an error the runtime retrieves the sourcemaps for the file on which an error occurred from the server.

Finally, we need to refactor a bit how we load the HMR updates into JSC. Unfortunately, if the code is eval'ed when an error is thrown, the line and column number are missing. This is a bug/missing feature in JSC. To walkaround the issue we need to eval the code on native. This adds a bit of complexity to HMR as for both platforms we'll have to have a thin module to inject code but I don't see any other alternative. when debugging this is not needed as Chrome supports sourceMappingURLs on eval'ed code

Reviewed By: javache

Differential Revision: D2841788

fb-gh-sync-id: ad9370d26894527a151cea722463e694c670227e
2016-01-27 14:55:36 -08:00
David Aurelio a0c5fb99a0 Backout "Use numeric identifiers when building a bundle"
Summary:
public

The reverted change doesn’t play nice with inline requires, let’s revert it for now.
I will bring it back after fixing it or adapting inline requires

Reviewed By: martinbigio

Differential Revision: D2854771

fb-gh-sync-id: 32fdbf8ad51240a9075b26502decb6328eed4b29
2016-01-22 11:39:30 -08:00
Kyle Corbitt ba4101dc4a Simplified AlertIOS
Summary:
Ok, so this started as fixing #5273 but ended up getting a little more complicated. 😄

Currently, AlertIOS has the following API:

* `alert(title, message, buttons, type)`
* `prompt(title, defaultValue, buttons, callback)`

I've changed the API to look like the following:

* `alert(title, message, callbackOrButtons)`
* `prompt(title, message, callbackOrButtons, type, defaultValue)`

I know that breaking changes are a big deal, but I find the current alert API to be fairly inconsistent and unnecessarily confusing. I'll try to justify my changes one by one:

1. Currently `type` is an optional parameter of `alert`. However, the only reason to change the alert type from the default is in order to create one of the input dialogs (text, password or username/password). So we're in a weird state where if you want a normal text input, you use `prompt`, but if you want a password input you use `alert` with the 'secure-text' type. I've moved `type` to `prompt` so all text input is now done with `pro
Closes https://github.com/facebook/react-native/pull/5286

Reviewed By: svcscm

Differential Revision: D2850400

Pulled By: androidtrunkagent

fb-gh-sync-id: 2986cfa2266225df7e4dcd703fce1e322c12b816
2016-01-21 10:57:26 -08:00
David Aurelio cb4fca3590 Use numeric identifiers when building a bundle
Summary:
public

Since the combination of node and haste modules (and modules that can be required as both node and haste module) can lead to situations where it’s impossible to decide an unambiguous module identifier, this diff switches all module ids to integers. Each integer maps to an absolute path to a JS file on disk.

We also had a problem, where haste modules outside and inside node_modules could end up with the same module identifier.

This problem has not manifested yet, because the last definition of a module wins. It becomes a problem when writing file-based unbundle modules to disk: the same file might be written to concurrently, leading to invalid code.

Using indexed modules will also help indexed file unbundles, as we can encode module IDs as integers rather than scanning string IDs.

Reviewed By: martinbigio

Differential Revision: D2842418

fb-gh-sync-id: 97addd28e964ac5f2b5081dcd3f36124d2864df8
2016-01-21 10:37:15 -08:00
Dave Miller 9baff8f437 Make CameraRoll work with Promises
Summary:
public
This is the first module moving to the new model of working with Promises.

We now warn on uses of callback version.  At some point we will remove that.

Reviewed By: davidaurelio

Differential Revision: D2849811

fb-gh-sync-id: 8a31924cc2b438efc58f3ad22d5f27c273563472
2016-01-21 08:07:41 -08:00
Nick Lockwood cb45eaa0e8 Made Map & Set polyfills available globally
Summary:
public

Map and Set are a standard JavaScript features, but are only supported in a subset of JSC versions that we target (e.g. iOS 7's JSC doesn't support Set).

The consequence of this is that failing to require('Set') before using it won't error during testing on a modern OS, but will fail on older OS versions. This diff makes the Map and Set polyfills available globally to all RN apps to avoid that problem.

Reviewed By: davidaurelio

Differential Revision: D2833997

fb-gh-sync-id: 713d8b69f6a1bce2472a1b2e6b84f69d75f30289
2016-01-20 08:27:38 -08:00
Huang Yu 88c2aa61b9 fix lint warnings
Summary:
added two semi colons, separated from other lint commits to avoid potential conflicts
Closes https://github.com/facebook/react-native/pull/5217

Reviewed By: svcscm

Differential Revision: D2818391

Pulled By: mkonicek

fb-gh-sync-id: 94e3640a30fb7ab932b15bfd84a0ab346c82d5d7
2016-01-18 14:28:34 -08:00
Kyle Corbitt cd89016ee7 PixelRatio.pixel()
Summary:
This implements #5073. It adds a static method `PixelRatio.pixel()` which returns the smallest drawable line width, primarily for use in styles.

It also updates the example apps to use the new function.
Closes https://github.com/facebook/react-native/pull/5076

Reviewed By: svcscm

Differential Revision: D2799849

Pulled By: nicklockwood

fb-gh-sync-id: b83a77790601fe882affbf65531114e7c5cf4bdf
2016-01-15 05:15:31 -08:00
Christoph Pojer b84ad2ab0d Updates for haste2 inside of jest
Summary:
I'm working on deploying haste2 with jest. This updates all the files that require changes for this to work and they are backwards compatible with the current version of jest.

* package.json was just outdated. I think haste1's liberal handling with collisions made this a "non-issue"
* env.js didn't properly set up ErrorUtils, also unsure why that isn't a problem in jest right now already?
* some things were mocking things they shouldn't
* Because of the regex that matches against providesModule and System.import, it isn't possible to list module names more than once. We have multiple tests reusing the same providesModule ids and using System.import with modules that only exist virtually within that test. Splitting up the strings makes the regexes work (we do the same kind of splitting on www sometimes if we need to) and using different providesModule names in different test files fixes the problem. I think the BundlesLayoutIntegration-test is going to be deleted, so this doesn't even matter.

public

Reviewed By: voideanvalue

Differential Revision: D2809681

fb-gh-sync-id: 8fe6ed8b5a1be28ba141e9001de143e502693281
2016-01-08 06:52:29 -08:00
Martín Bigio fe77ce1c62 Show red boxes on HL mode
Summary:
public

We should further improve this on the future by showing the actual stacktrace instead of the `HMRClient` one. Also, we need to integrate this with the dev plugin that opens in the default editor the file/line the user clicks on.

Reviewed By: vjeux

Differential Revision: D2798889

fb-gh-sync-id: 2392966908c493e86e11b0d024e7b68156c9066c
2016-01-07 13:15:28 -08:00
Martín Bigio 54f2586735 Improve error message when devserver is not running
Summary:
public

If Hot Loading is enabled bu the packager server is not running, as the user updates files he'll see red boxes caused by the HMR runtime. The error those red boxes show is pretty weird for the end user. Lets improve the feedback we give!.

Reviewed By: vjeux

Differential Revision: D2795534

fb-gh-sync-id: dcc39e6682e0603bf10d0f5e623433262b745660
2016-01-04 09:56:30 -08:00