Commit Graph

871 Commits

Author SHA1 Message Date
Siqi Liu ac18025d7c Change the Exception Message of Time Drift
Summary: We prefer not showing the accurate time information in the exception message of time drift, in order to be able to group this kind of exception only by exception message.

Reviewed By: foghina

Differential Revision: D3515390

fbshipit-source-id: f38bf3091ba749d4daeae24f7d42653b76c3289c
2016-07-05 09:58:29 -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
danielbasedow 4ac4f86bf5 Add ping to WebSocket
Summary:
Idle WebSocket connections get reset after a few minutes of inactivity. To prevent this, most WebSocket implementations offer sending special ping messages. This PR adds a method `sendPing()` to  WebSocket. Ping payloads are not supported.

Manual testing can be done by adding `connection.on('ping', _ => console.log('Received ping'));` to a ws connection or using a packet sniffer while sending pings.
Closes https://github.com/facebook/react-native/pull/8505

Differential Revision: D3516260

Pulled By: dmmiller

fbshipit-source-id: cfebf5899188ae53254d5be6b666a9075e0eed89
2016-07-05 05:58:23 -07:00
Andy Street 950cefa2d6 Add debug statements to UIManager
Summary: These are helpful for development and shouldn't affect anything when DEBUG=false

Reviewed By: lexs

Differential Revision: D3515015

fbshipit-source-id: 0bd5ff833f90fea8e70b3103eb1f9bc803bef27c
2016-07-05 04:28:21 -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
Konstantin Raev f78e819f20 Reverted commit D3510867
Differential Revision: D3510867

fbshipit-source-id: 365eb22e143f1c0eec6e4b8810c93dbb0e9fbbfa
2016-07-02 13:43:23 -07:00
Marc Horowitz 8b2adeaa2e Pull an updated version of fbjni into RN OSS
Differential Revision: D3510867

fbshipit-source-id: b4f3300ef003c57aa7d4f3513bca537c464f7647
2016-07-01 16:28:47 -07:00
Chris Hopman bf79f87895 Make the new bridge the default
Reviewed By: astreet

Differential Revision: D3507482

fbshipit-source-id: b62f3bf0fe1dd4f49594e441f4e00b9e20ec972b
2016-07-01 14:43:22 -07:00
Felix Oghina adea8d5fc9 use MultiSourceHelper in PhotoViewer
Reviewed By: andreicoman11

Differential Revision: D3509011

fbshipit-source-id: 96fe96f28da24efb00b98589cea28e6c9cfc7180
2016-07-01 10:58:34 -07:00
Felix Oghina 2ce76771b5 extract MultiSourceHelper
Reviewed By: andreicoman11

Differential Revision: D3505224

fbshipit-source-id: e731325af7fd0c1cbd600695607302c968e0f36e
2016-07-01 10:58:33 -07:00
Felix Oghina 3d4adb8c34 extract ImageSource class for sharing
Summary: Move ImageSource out of ReactImageView so it can be used by other views dealing with images. Make ResourceDrawableIdHelper static in the process.

Reviewed By: dmmiller

Differential Revision: D3505103

fbshipit-source-id: 776a5b22a6934eeaa370826cb71c00cd937d3187
2016-07-01 10:58:33 -07:00
Franklyn Tackitt 22fbb6d46d Remove iOS platform check for running devtools
Summary:
Currently, DevTools only work under ios (although this is undocumented!),
because the JavaScriptEngine initialization process skips setupDevTools() on
android.

DevTools work fine with Android, as tested on 0.26, 0.27, and 0.28 using
Nuclide's inspector.

For reference, the relevant issue on react-devtools.
Closes https://github.com/facebook/react-native/pull/8095

Reviewed By: bestander

Differential Revision: D3492788

Pulled By: andreicoman11

fbshipit-source-id: 1eda9196d7125da19a8d7baaab22b61b744ca629
2016-07-01 04:28:48 -07:00
Felix Oghina 010e1977a8 Promote ResourceDrawableIdHelper to new module
Summary:
Found a couple of places where we were copy-pasting the logic `ResourceDrawableIdHelper` had. This class was only available on the image module and it had package visibility. I moved it to its own module so that we can easily use it from others.

This diff is pretty simillar to 54ed44628d but it fixes a bug due to which we had to revert it.

Reviewed By: andreicoman11

Differential Revision: D3499062

fbshipit-source-id: f912f57e5ac21a9f30fe42067c784f49fa46ed48
2016-07-01 04:28:48 -07:00
Konstantin Raev 88bd5e4d90 Reverted commit D3428952
Reviewed By: frantic

Differential Revision: D3428952

fbshipit-source-id: 61e5195399746d6511719971121c7c63f87ef4f4
2016-07-01 02:13:21 -07:00
James Ide a8011bbfdc Set LayoutParams in ReactTextView to fix crash
Summary:
ReactTextView occasionally crashes when `setText` is called. Doing some cursory research, it looks like this could be a bug in Android. We also suspect it might be related to removeClippedSubviews though.

The LayoutParams don't actually matter because RN controls layout, but on occasion (haven't narrowed down what this is...) `mLayout` is non-null and triggers relayout during `setText`, which fails because the LayoutParams are null. jesseruder came up with this fix and it appears to be working well.

Stack trace: http://pastebin.com/P8VbxvPz
Closes https://github.com/facebook/react-native/pull/7011

Differential Revision: D3508097

fbshipit-source-id: 12b4aa11e42112c8ba19a1af325e3ee9a232d08f
2016-06-30 20:50:09 -07:00
Andrew Y. Chen 2b88482701 Implement JavaOnlyArray#getType
Reviewed By: AaaChiuuu

Differential Revision: D3504601

fbshipit-source-id: 37dbbcdd8cc0523cb8f1673047995c4410e8f7be
2016-06-30 19:43:28 -07:00
Marc Horowitz ff31128200 Display JS exceptions and stacks in a red box
Reviewed By: frantic

Differential Revision: D3428952

fbshipit-source-id: e2b77487d54a3d89039661943061a0137f8410c0
2016-06-30 19:13:26 -07:00
Chris Hopman e19225aa64 assert that ShadowNodeRegistry is only accessed from one thread
Reviewed By: astreet

Differential Revision: D3461859

fbshipit-source-id: 790e831d2ca239110e00a5723be40e870ceab020
2016-06-30 15:13:39 -07:00
Chris Hopman c1f7aa3824 Change gradle ndk build inputs back to what they were
Reviewed By: bestander

Differential Revision: D3442666

fbshipit-source-id: 735cb7e908670fa9b1ec58a533a2c59008ccc154
2016-06-30 14:28:23 -07:00
Jimmy Mayoukou 31f30aa4b3 Return empty bundle when passing an empty map to toBundle
Summary:
(I swear this was working before...)

Right now, when passing an empty map to `toBundle` it returns null:
- It feels counter-intuitive to have the data modified without any good reason;
- It is different from what iOS does

This PR fixes this behavior by returning an empty `Bundle` instead of `null`.

It is a breaking change though, and I'm not sure where it goes with the new bridge.
Closes https://github.com/facebook/react-native/pull/7847

Differential Revision: D3504024

fbshipit-source-id: 97ca19259fdf3219e8237e44a313645503a695fd
2016-06-30 10:43:58 -07:00
Siqi Liu dc3fce06ea Add Copy and Dismiss Button in RN Android Red Box
Summary:
Add "Copy" and "Dismiss" button when the RN Android redbox is shown, consistent with that in RN iOS.
  - "Copy" button copies all the messages shown in the redbox to the host system clipboard, the solution is posting redbox messages to packager and the the packager copies the messages onto the host clipboard.
  - "Dismiss" button always exits the redbox dialog.
  - Add shortcut as "Dismiss (ESC)" and "Reload (R, R).

Notice: Copy button is only supported on Mac OS by now (warning in packager on other platforms), because it's not easy for us to test on Windows or Linux. Will put the codes for other platforms on Github issues, hoping anyone could help test and add this feature, then send us a pull request.

Redbox Dialog in RN Android before:
{F61310489}
Redbox Dialog in RN Android now:
{F61659189}

Follow-up:
- We can adjust the button styles in redboxes.
- We can consider to add shortcut for "Copy" button.

Reviewed By: foghina

Differential Revision: D3392155

fbshipit-source-id: fc5dc2186718cac8706fb3c17d336160e61e3f4e
2016-06-30 08:13:22 -07:00
Dave Miller ca0c6dbe36 Enable zoom on WebViews on Android
Summary: Make the behavior on a WebView allow pinch to zoom.  This matches what iOS has by default.  We may want to at some point put this behind a property but right now just make it work on Android.

Reviewed By: andreicoman11

Differential Revision: D3503429

fbshipit-source-id: adb2bb2c3de099aca08700786be7a132557a5e2a
2016-06-30 07:43:22 -07:00
Andy Street cf7b4e74f0 Use DISPLAY thread priority for main thread in React Native
Summary: In older versions of android, the main thread is given the same priority as all other threads (default). Instead, it should have a higher priority (DISPLAY) which will make sure it's scheduled instead of the background JS/native modules threads.

Reviewed By: majak

Differential Revision: D3497244

fbshipit-source-id: 15ab09f4ebcad2692ae1261f15aa2c6c39f72ee9
2016-06-29 14:13:26 -07:00
Tucker Connelly 3d3b067f6f Add zIndex support
Summary:
Adds zIndex support :)

**Test Plan**

Tested the following components by adding two of each, overlapping them, and setting a high zIndex on the first of the two:

ActivityIndicator
Image
MapView
Picker
ScrollView
Slider
Switch
Text
TextInput
View
WebView

Tested on Android 4.1 and iOS 8.4. Also tested updating zIndexes on Views in my own app.

<img width="359" alt="ios activityindicator" src="https://cloud.githubusercontent.com/assets/4349082/15633473/88f842cc-257b-11e6-8539-c41c0b179f80.png">
<img width="330" alt="android activityindicator" src="https://cloud.githubusercontent.com/assets/4349082/15633475/88f95784-257b-11e6-80c0-2bf3ed836503.png">
<img width="357" alt="ios image" src="https://cloud.githubusercontent.com/assets/4349082/15633474/88f93d80-257b-11e6-9e54-4ff8e4d25f71.png">
<img width="340" alt="android image" src="https://cloud.githubusercontent.com/assets/4349082/15633478/88fd2788-257b-11e6-8c80-29078e65e808.png">
<img width="342" alt="android picker" src="ht
Closes https://github.com/facebook/react-native/pull/7825

Differential Revision: D3469374

Pulled By: lexs

fbshipit-source-id: b2b74b71d968ebf73ecfd457ace3f35f8f7c7658
2016-06-29 07:43:23 -07:00
Andrei Coman f0f2645ec7 Backed out changeset 708058c5f244
Reviewed By: dmmiller

Differential Revision: D3496881

fbshipit-source-id: 0f2e0d5769d09e0c70feceda7ff7d959e3a9ef2e
2016-06-29 04:13:23 -07:00
Andrei Coman cbd8214b43 Reverted commit D3494715
Reviewed By: donyu

Differential Revision: D3494715

fbshipit-source-id: a96e12ddbf266804b1bb8ec169d3c01e8a029eb7
2016-06-29 02:43:19 -07:00
Martín Bigio 1762426e9c Revert change on ResourceDrawableIdHelper
Reviewed By: donyu

Differential Revision: D3494715

fbshipit-source-id: 807f3ea3db42a17e6f2eed63a72e0bccfc371a58
2016-06-28 15:58:19 -07:00
Martín Bigio eafc5dac62 Add support for `drawableLeft` and `drawablePadding` props
Summary: Add support inlining images into text inputs. For now this is only available on Android.

Reviewed By: andreicoman11

Differential Revision: D3470805

fbshipit-source-id: 14db05ec4d5af549bf314b903654314f39bf73ea
2016-06-28 14:13:48 -07:00
Martín Bigio 54ed44628d Promote ResourceDrawableIdHelper to new module
Summary: Found a couple of places where we were copy-pasting the logic `ResourceDrawableIdHelper` had. This class was only available on the image module and it had package visibility. I moved it to its own module so that we can easily use it from others.

Reviewed By: andreicoman11

Differential Revision: D3463697

fbshipit-source-id: 708058c5f2445e27b151d8a6f3b47fd23485bc88
2016-06-28 14:13:48 -07:00
leeight 658acba0b6 Add missing `java` directory in ReactAndroid/build.gradle
Summary:
Fix Android Studio warnings for https://github.com/facebook/SoLoader package.
Closes https://github.com/facebook/react-native/pull/8221

Differential Revision: D3492863

Pulled By: bestander

fbshipit-source-id: 984c24f3a3bc084adf1b79e24b33da0c01a6e4c6
2016-06-28 04:28:23 -07:00
Ovidiu Viorel Iepure e3b5948392 Open sourced CatalystUIManagerTestCase test for RN Android
Reviewed By: bestander

Differential Revision: D3436688

fbshipit-source-id: bed53f8f4aa8346d6f808c2d79eb9c279c2cd078
2016-06-27 09:13:53 -07:00
Omri Gindi 2fc0f4041e Add the onNewIntent listener to React Native Android
Reviewed By: foghina

Differential Revision: D3475896

fbshipit-source-id: d8e5d7734974132307a85d21e4c1602327a479fa
2016-06-27 09:13:53 -07:00
Chris Hopman d055ab548e Fix check for if we are ready to make js calls
Reviewed By: mhorowitz

Differential Revision: D3485010

fbshipit-source-id: 5a3ce9be6a88f02478fb711fd09c57e4b2ccfc0d
2016-06-24 19:28:34 -07:00
Franklyn Tackitt f7eca44046 Reverted commit D3443980
Summary:
Currently, DevTools only work under ios (although this is undocumented!), because the JavaScriptEngine initialization process skips setupDevTools() on android.

DevTools work fine with Android, as tested on 0.26, 0.27, and 0.28 using Nuclide's inspector.

For reference, [the relevant issue on react-devtools](https://github.com/facebook/react-devtools/issues/229).
Closes https://github.com/facebook/react-native/pull/8095

Reviewed By: javache

Differential Revision: D3443980

Pulled By: bestander

fbshipit-source-id: ce0f7dd62ae0f7dfe6654380821660f8660318a6
2016-06-24 13:28:42 -07:00
Franklyn Tackitt 1c290d69c1 Remove iOS platform check for running devtools
Summary:
Currently, DevTools only work under ios (although this is undocumented!), because the JavaScriptEngine initialization process skips setupDevTools() on android.

DevTools work fine with Android, as tested on 0.26, 0.27, and 0.28 using Nuclide's inspector.

For reference, [the relevant issue on react-devtools](https://github.com/facebook/react-devtools/issues/229).
Closes https://github.com/facebook/react-native/pull/8095

Reviewed By: javache

Differential Revision: D3443980

Pulled By: andreicoman11

fbshipit-source-id: 3d7b2e83cf4158a1228d2e21510509ab63411a5d
2016-06-24 08:28:32 -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
Ahmed El-Helw 747613920d Allow for customization of the RootViewManager
Reviewed By: astreet

Differential Revision: D3473916

fbshipit-source-id: 0db8748a39a08d28b44173f72d3f738ccb9b4242
2016-06-23 12:29:05 -07:00
Mike Lambert 6cd712713b Support selectable={true} property on Text fields on Android.
Summary:
Explain the **motivation** for making this change. What existing problem does the pull request solve?

This adds support for a text field that the user can click-and-drag to select text (which can then be copied using the native selected-text-hover-widget).

I'd love to add this to iOS too, but iOS appears to draw glyphs directly to the screen for its <Text> widget (versus using UITextField), so it might be too difficult to support there. But at least I can support my Android users with this change.

Let me know if/what kind of "demonstrate the code is solid" you would like for this. A screenshot of selected text with this property set?
Closes https://github.com/facebook/react-native/pull/8028

Differential Revision: D3474196

Pulled By: bestander

fbshipit-source-id: 8d3656681265a0e6229bfa13ff2ae021e894d3cd
2016-06-22 19:13:32 -07:00
Chris Hopman fdcb865cf3 Fix sending accessibility events to RN modals
Reviewed By: dmmiller

Differential Revision: D3472359

fbshipit-source-id: c82d8e254cdd0531eb52805a6f00e63cf783fdc8
2016-06-22 16:43:28 -07:00
Ahmed El-Helw c95d3ef147 Fix measure callback for TextInput on Nodes
Summary: Add a MeasureUtil class

Reviewed By: emilsjolander

Differential Revision: D3467598

fbshipit-source-id: 3ef0da1e4ef16c1f9756653d0aa2e8aa5a598eb1
2016-06-22 14:58:32 -07:00
Alex Kotliarskyi adcb9491bd Persistent websocket connection from Android to Packager
Reviewed By: astreet

Differential Revision: D3447685

fbshipit-source-id: 0e4e3fb02b84b9b15c2c798c0e4c89ff6fd1665c
2016-06-22 11:28:38 -07:00
Gaëtan Renaudeau af28de5300 Implement addUIBlock to allow third party to resolve a view
Summary:
This PR follows the work started in #6431 but instead of implementing the snapshot for Android, will just allow that feature to be implemented by a third party library.

The missing feature is the ability to resolve a View for a given tag integer. which is now possible with a `addUIBlock` on the `UIManagerModule` method where you give a `UIBlock` instance (a new class) that implements a `execute(NativeViewHierarchyManager)` function.

This is already possible in iOS API. a third party can use the `addUIBlock` too.
I have kept the name `addUIBlock` so it's the same as in the [iOS' API](https://github.com/facebook/react-native/search?q=addUIBlock&type=Code&utf8=%E2%9C%93).

 ---

With this PR a third party lib can now do...

```java
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
uiManager.addUIBlock(new UIBlock() {
  public void execute (NativeViewHierarchyManager nvhm) {
    View view = nvhm.resolveView(tag);
    ...do something with view... like... screenshot t
Closes https://github.com/facebook/react-native/pull/8217

Differential Revision: D3469311

Pulled By: astreet

fbshipit-source-id: bb56ecc7e8936299337af47ca8114875ee1fd2b0
2016-06-22 06:28:28 -07:00
Alexander Blom 0669a38b01 Convert field to local
Reviewed By: astreet

Differential Revision: D3463353

fbshipit-source-id: 57781197da57409b869755dbbddfe0f28c476bfb
2016-06-22 04:13:36 -07:00
Alexander Blom c32c9fdf25 Remove unused constructor of XReactInstanceManagerImpl
Reviewed By: astreet

Differential Revision: D3463336

fbshipit-source-id: cfad3710fe646373dbb34dfdda5d019caa52537c
2016-06-22 04:13:36 -07:00
Alexander Blom e54ff3d03f Make JSCConfig non-nullable
Reviewed By: andreicoman11

Differential Revision: D3463317

fbshipit-source-id: feeda132cd596317ca45b083d69ae8df3ffbd6f0
2016-06-22 04:13:36 -07:00
hi大头鬼hi 3e4f16a2a6 fix link
Summary:
fix link in comment
Closes https://github.com/facebook/react-native/pull/8295

Differential Revision: D3469079

Pulled By: javache

fbshipit-source-id: e4c4c3b8871bfac1ff49d5cb29305f96e30282b6
2016-06-22 03:28:26 -07:00
Krzysztof Magiera a59afb98d5 Decompose transform matrix in native (for android).
Summary:
This diff translates implementation of transform matrix decomposition from JS to java. This is to support offloading animations of transform property, in which case it is required that we can calculate decomposed transform in the UI thread.

Since the matrix decomposition code is not being used for other platform I went ahead and deleted parts that are no longer being used.

**Test plan**
Run UIExplorer Transform example before and after - compare the results
Closes https://github.com/facebook/react-native/pull/7916

Reviewed By: ritzau

Differential Revision: D3398393

Pulled By: astreet

fbshipit-source-id: 9881c3f565e2050e415849b0f76a0cefe11c6afb
2016-06-21 11:28:29 -07:00
Alexander Blom d63d4f0e9c Bind methods instead of using eval
Reviewed By: astreet

Differential Revision: D3417452

fbshipit-source-id: 437daa2dfcd01efb749465a94c1a72ce8a2cb315
2016-06-21 10:13:33 -07:00
hi大头鬼hi 99bbdff011 fix package name used in comment
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/8272

Differential Revision: D3462939

Pulled By: javache

fbshipit-source-id: af1e6af3807e22466ee9b364a1f09a4510553545
2016-06-21 06:13:37 -07:00
Chris Hopman 6128b7236f Synchronously fail when calling JS too early
Differential Revision: D3453476

fbshipit-source-id: 3fbfda46b4cb7d31f554df6760c5146c412ff468
2016-06-20 12:58:23 -07:00