Commit Graph

834 Commits

Author SHA1 Message Date
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
Siqi Liu ee0333c65d Enable Logging information from redboxes in Android Ads Manager to Scuba
Reviewed By: mkonicek

Differential Revision: D3433990

fbshipit-source-id: 54fa60fa746c9d0d834f86b7dd2e3ef18a694a32
2016-06-18 12:58:29 -07:00
Tim Yung a2f78825f2 RN: Increase Time Drift Threshold
Summary: Increases time drift threshold to reduce chance of false positives. Also, tweaked the error message to contain slightly more information.

Reviewed By: frantic

Differential Revision: D3450852

fbshipit-source-id: 7fbf3eb25543977f9767c7a57277db336006bd12
2016-06-17 16:28:27 -07:00
Ahmed El-Helw 99e2a67b39 Don't close reference to image in getSize
Summary:
ImageLoader improperly closes both the image reference
(which is shared) and the DataSource (which is shared, and should only be
handled by BaseDataSubscriber when it is correct).

Reviewed By: plamenko

Differential Revision: D3441752

fbshipit-source-id: bfb3d0281cd9ae789cba4079978ef46d295ac8f5
2016-06-17 11:58:38 -07:00
Felix Oghina bf79352e4f fix dialogmodule crashing with no fragment manager in onHostResume
Summary: This can happen now, we shouldn't crash. `showAlert` will crash instead if JS tries to call it.

Reviewed By: lexs

Differential Revision: D3450018

fbshipit-source-id: bbc062b357315f26ee98ed3b3a59db71dc5fc74a
2016-06-17 07:58:24 -07:00
Felix Oghina 49f20f4154 Add ReactInstanceHolder
Reviewed By: astreet

Differential Revision: D3328342

fbshipit-source-id: af4e825d0b7c2d3d4490094a939e97cc527dd242
2016-06-17 04:13:29 -07:00
Felix Oghina d78602b8cd show soft errors as redboxes in dev
Summary: These are generally things sent to console.error

Reviewed By: lexs

Differential Revision: D3445393

fbshipit-source-id: e76e82dbaa32dc71100ae6b1d721f80007d8cd3a
2016-06-17 03:28:39 -07:00
Andrei Coman 477cc52945 Use fresco cache to show low res image if available
Summary:
ImageView will now interrogate fresco cache for images that can be shown before
the one with the best fitting size is downloaded. Cache interrogation does not
take into account that the images from cache are smaller or bigger than the best
fit. Most of the cases, the smaller one will be displayed. It is also possible
that a bigger image is available for being displayed, but ideally we'd still
want the best fit to be shown, so as to not decode and resize images that are
too big.
I've added a ImageSource class to simplify things. This makes it easier to
lazy-parse the Uri's when necessary, and cache data related to that uri
and wether the image is local. This also gets rid of the Map, which makes
parsing the source a bit more elegant.

Reviewed By: foghina

Differential Revision: D3392751

fbshipit-source-id: f6b803fb7ae2aa1c787aa51f66297a14903e4040
2016-06-17 03:28:38 -07:00
Andrei Coman 675c55e8ad Update fresco from 0.10.0 to 0.11.0
Summary: Updating to new release from 16.06.2016.

Reviewed By: bestander

Differential Revision: D3444598

fbshipit-source-id: d8c14b3d088bab6c08effcdacde9bf2eccb20d68
2016-06-17 02:58:24 -07:00
Dave Miller 1f8cd9ddbc Add support placeholder in AdsManager for proper deep linking
Reviewed By: foghina

Differential Revision: D3444315

fbshipit-source-id: 894b7e7899bd59ac87b175cd2767afe5a741487f
2016-06-16 09:43:35 -07:00
Konstantin Raev 192f6ddf82 another fix to OSS tests
Summary: Closes https://github.com/facebook/react-native/pull/8151

Differential Revision: D3444091

fbshipit-source-id: a8a43a56332c66b0af84695aa54fb1e4c5d659f6
2016-06-16 04:14:28 -07:00
Konstantin Raev e514ff5ad4 Fixes Buck file in trunk
Summary: Closes https://github.com/facebook/react-native/pull/8150

Differential Revision: D3443995

fbshipit-source-id: 328cb9f9ef84dd2ddc0460940f54af2dbd807523
2016-06-16 02:43:51 -07:00
Krishna Monian 12a87b6674 Fix lost callbacks due to time drift between server and emulator
Reviewed By: yungsters

Differential Revision: D3434921

fbshipit-source-id: ec82374a8ed322d99beadac78a415f952ceb3ec8
2016-06-15 13:28:29 -07:00
Ahmed El-Helw f236667a17 Fix touch inspector when using Nodes
Reviewed By: astreet

Differential Revision: D3433927

fbshipit-source-id: 5b17a16191f167db8f4491da37a1735e725e99b8
2016-06-15 12:28:28 -07:00
Pieter De Baets 1579a72ca6 Implement {min,max}{Width,Height} in ReactAndroid
Reviewed By: astreet

Differential Revision: D3424294

fbshipit-source-id: 03ae663927600bff025cd953a9b6b221c8dd9f23
2016-06-15 09:58:53 -07:00
Pieter De Baets 0a9cc99a4f Update css-layout sync scripts
Reviewed By: emilsjolander

Differential Revision: D3424265

fbshipit-source-id: b1a765bbe11f776e418ae8b01c5c2a292f590a6b
2016-06-15 09:58:52 -07:00
Andrei Coman b7352b4667 Open source permissions
Summary:
This moves into open source the PermissionsModule and the activity and listener interfaces
necessary to make permissions work.
It also moves the PermissionsExample into the UIExplorer. In order to make this
work, the device has to be Android M and above, and the target sdk of the app has to be 23+, so I changed the uiexplorer manifest to
target that API. This has the unfortunate consequence that people testing on
devices with API 23+ will have to enable the `draw over other apps` setting that
react needs for RedBoxing. The app will automatically send the user to that screen,
so enabling the setting and resuming the app should be trivial.
For testing, try requesting permission for a permission that is currently
revoked. If a permission is granted, it can be revoked via adb (`adb shell pm
revoke com.your.app android.permission.PERMISSION_NAME`), and then requested.

Reviewed By: bestander

Differential Revision: D3431324

fbshipit-source-id: 8cbaea676d2b5727cb5191cdb77a02e213bf9ba3
2016-06-15 09:43:58 -07:00
Konstantin Raev 58881fc57f <Replace this line with a title. Use 1 line only, 67 chars or less>
Reviewed By: matryoshcow

Differential Revision: D3432084

fbshipit-source-id: fa94b1aca40c931cc273a5561adf37f458aaa0ff
2016-06-15 03:14:20 -07:00
Chris Hopman d344963123 Invert native dependency of new bridge -> old bridge
Reviewed By: mhorowitz

Differential Revision: D3409230

fbshipit-source-id: 541309ec953843477197e5a2b13730b8a38f608d
2016-06-13 18:43:42 -07:00
Andrei Coman 617a38d984 Support multi sources for images
Summary:
This adds support for specifying multiple sources for an image component, so that native can choose the best one based on the flexbox-computed size of the image.
The API is as follows: the image component receives in the `source` prop an array of objects of the type `{uri, width, height}`. On the native side, the native component will wait for the layout pass to receive the width and height of the image, and then parse the array to find the best fitting one. For now, this does not support local resources, but it will be added soon.
To see how this works and play with it, there's an example called `MultipleSourcesExample` under `ImageExample` In UIExplorer.

Reviewed By: foghina

Differential Revision: D3364550

fbshipit-source-id: 66c5aeb2794f2ffeff8da39a9c0b95155fb2d41f
2016-06-13 14:13:25 -07:00
Emil Sjolander 8afcaa36e6 Import latest css-layout
Summary:
Import latest master from css-layout.

This includes the following pull requests:
https://github.com/facebook/css-layout/pull/192
https://github.com/facebook/css-layout/pull/193
https://github.com/facebook/css-layout/pull/195
https://github.com/facebook/css-layout/pull/196

Reviewed By: javache

Differential Revision: D3411535

fbshipit-source-id: 95bee9bd0282f98f6fafa15335b910b644395ad3
2016-06-13 07:58:35 -07:00
Alexander Blom 933e17949b Run init on normal thread priority
Summary:
The default priority for AsyncTask is THREAD_PRIORITY_BACKGROUND which puts the thread in a limited cgroup that can utilize ~10% CPU time. Because the whole TTI depends on this task we should run it on a normal priority.

The priority will be reset for the nest task and this has been true since donut: https://github.com/android/platform_frameworks_base/blob/donut-release/core/java/android/os/AsyncTask.java

Reviewed By: astreet

Differential Revision: D3417232

fbshipit-source-id: e1e35f82b35b31ff7ebf4fc59509ca2df21e2bdd
2016-06-13 05:58:22 -07:00
Guillermo Orellana 87d65847e3 Typo in ReactContext.java
Summary:
Just a tiny typo
Closes https://github.com/facebook/react-native/pull/8066

Differential Revision: D3422819

fbshipit-source-id: f992054e712d081b1cd48c4db0d38cf6517043a7
2016-06-11 16:43:24 -07:00
Jing Chen 31e090c9ab Change loading dialog for JS in Android to use AlertDialog instead
Reviewed By: yungsters

Differential Revision: D3418605

fbshipit-source-id: 202b4872c6636a51c615ad82b444261acf83f396
2016-06-10 12:28:26 -07:00
Sokovikov c03b166854 line break mode for ios
Summary:
What do you think is ```lineBreakMode``` a good name? For android it is called ```ellipsize```.

<img src="https://cloud.githubusercontent.com/assets/1488195/15628555/7372f8d0-250c-11e6-8919-722f28a38d60.png"" width="300" />
Closes https://github.com/facebook/react-native/pull/7819

Differential Revision: D3417256

fbshipit-source-id: 189441a23ff554bf7f6d67fa8510959351e9e5cc
2016-06-10 04:28:37 -07:00
Fabian Eichinger d43e0db81e Add support for reverse flex directions on Android and iOS
Summary:
This PR adds support for both 'row-reverse' and 'column-reverse' for Android and iOS and is based on the changes in #6683 that looked like it's all but abandoned.
It also adds examples for the new directions to the "Layout - Flexbox" section of UIExplorer as well as some rad new colors to the section to make the difference between "row-reverse" and "flex-end" more apparent.

**Test plan (required)**
Tested inside of UIExplorer

Android
<img width="571" alt="screen shot 2016-06-05 at 7 42 14 pm" src="https://cloud.githubusercontent.com/assets/4332237/15807140/cf8e05de-2b55-11e6-9366-a2e3194cabf8.png">

iOS
<img width="578" alt="screen shot 2016-06-05 at 7 41 35 pm" src="https://cloud.githubusercontent.com/assets/4332237/15807143/dee8e9b8-2b55-11e6-8777-c30329fa54e8.png">
Closes https://github.com/facebook/react-native/pull/7938

Differential Revision: D3417182

fbshipit-source-id: e8c9f5976ca95b2d2069a5b31a20f6d6309eb3cc
2016-06-10 03:28:45 -07:00
Dave Miller b457af625a Add custom error reporter in Groups
Differential Revision: D3413351

fbshipit-source-id: 580782aac2966a07a3dbce9e9268392739e4803b
2016-06-09 14:13:27 -07:00
Ovidiu Viorel Iepure 7a635b2cd2 Open sourced CatalystTouchBubblingTestCase test for RN Android
Reviewed By: bestander

Differential Revision: D3411681

fbshipit-source-id: 7b511a0447c61d94cbd43b7983fb3f96c2fcbddf
2016-06-09 11:29:12 -07:00
Ovidiu Viorel Iepure a7e6eea919 Open sourced CatalystSubviewsClippingTestCase test for RN Android
Reviewed By: bestander

Differential Revision: D3411402

fbshipit-source-id: c4f51f0366c30815a3a409ee13b61900d882fcc9
2016-06-09 11:29:12 -07:00
Dave Miller 9bdb63c234 Add ability to dump a Native View Hierarchy
Differential Revision: D3411095

fbshipit-source-id: cc7e26eea63b0146250177c2e1b780ecc03da02f
2016-06-09 10:14:06 -07:00
Andy Street eef03fd552 Fix bug where UIOperations aren't executed after hosting Activity is paused.
Summary:
When we hit the back button and unmount the ReactRootView, we tell JS to unmount the application root node, which causes JS to asynchronously come back and tell the UIManager to drop the corresponding root view.

This issue was that by the time JS gets back to us, we likely will have already paused the UIManager frame callback which means the view unmounting never actually happens: it just gets stuck in the queue.

The solution is to immediately execute batches when they are enqueued when the frame callback isn't running.

Reviewed By: lexs

Differential Revision: D3398958

fbshipit-source-id: 0de81061a97a119be4cb0b12d6f01c1cec8e8171
2016-06-09 08:43:47 -07:00
Olivier Notteghem bb9ed2d24c Fix potential NPE is layout animation deletion code
Reviewed By: dmmiller

Differential Revision: D3403930

fbshipit-source-id: 20067542d06396997719bbe963ce87403fae5ac3
2016-06-08 08:13:32 -07:00
Olivier Notteghem c0ac0d5071 Fix missing check causing layout some animation code to be executed when it shouldn't
Reviewed By: dmmiller

Differential Revision: D3404149

fbshipit-source-id: 8663325fd3a4b9257d84075e22bd9cc59d6414ac
2016-06-08 08:13:32 -07:00
Konstantin Raev 525d35ba67 Reverted commit D3400379
Reviewed By: mhorowitz

Differential Revision: D3400379

fbshipit-source-id: b7e733e74bb0f4fbd597fd073826c399ece2c47f
2016-06-08 02:58:36 -07:00
Kyle Corbitt 7357ccc370 Allow CameraRoll to export videos
Summary:
This PR adds the ability to export videos to the CameraRoll on both Android and iOS (previously only photos were possible, at least on iOS). The API has changed as follows:

```
// old
saveImageWithTag(tag: string): Promise<string>

// new
saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<string>
```

if no `type` parameter is passed, `video` is inferred if the tag ends with ".mov" or ".mp4", otherwise `photo` is assumed.

I've left in the `saveImageWithTag` method for now with a deprecation warning.

**Test plan (required)**

I created the following very simple app to test exporting photos and videos to the CameraRoll, and ran it on both iOS and Android. The functionality works as intended on both platforms.

```js
// index.js

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  CameraRoll,
} from 'react-native';
import FS fro
Closes https://github.com/facebook/react-native/pull/7988

Differential Revision: D3401251

Pulled By: nicklockwood

fbshipit-source-id: af3fc24e6fa5b84ac377e9173f3709c6f9795f20
2016-06-07 16:43:42 -07:00
Janic Duplessis d4e7c8a055 Properly validate layout animation config
Summary:
The type key for a layout animation config must be supplied otherwise the app crashes (on Android). I added a isRequired check in JS as well as an explicit exception in java otherwise it crashed at a very hard to debug place. The crash happens when passing null to `Animation.setInterpolator` so this makes sure it never happens.

**Test plan (required)**

Tested that the error is caught properly in JS when passing an invalid animation config like

```
LayoutAnimation.configureNext({
  duration: 250,
   update: { type: undefined }, // or LayoutAnimation.Types.easeInEastOut in my case haha :)
});
```

Also tested the java exception.
Closes https://github.com/facebook/react-native/pull/7958

Differential Revision: D3401760

Pulled By: nicklockwood

fbshipit-source-id: 83c019d863c2b2294405b60e87297c562add0f49
2016-06-07 16:28:29 -07:00
Chris Hopman 0e50373b60 Invert native dependency of new bridge -> old bridge
Reviewed By: mhorowitz

Differential Revision: D3400379

fbshipit-source-id: d641846261977b4f77c2d215bef94e8e676e2c02
2016-06-07 16:28:29 -07:00
Chris Hopman 5b871ad9d7 Begin inverting dependency between new+old bridge
Reviewed By: mhorowitz

Differential Revision: D3306510

fbshipit-source-id: 312a498a4461e980f1f749fe7858a13be14dfa2f
2016-06-07 13:28:21 -07:00