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
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
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
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
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
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
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
Summary: These are generally things sent to console.error
Reviewed By: lexs
Differential Revision: D3445393
fbshipit-source-id: e76e82dbaa32dc71100ae6b1d721f80007d8cd3a
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
Summary: Updating to new release from 16.06.2016.
Reviewed By: bestander
Differential Revision: D3444598
fbshipit-source-id: d8c14b3d088bab6c08effcdacde9bf2eccb20d68
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
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
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
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
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
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