Граф коммитов

2107 Коммитов

Автор SHA1 Сообщение Дата
Philipp von Weitershausen ed903099b4 Add blob implementation with WebSocket integration
Summary:
This is the first PR from a series of PRs grabbou and me will make to add blob support to React Native. The next PR will include blob support for XMLHttpRequest.

I'd like to get this merged with minimal changes to preserve the attribution. My next PR can contain bigger changes.

Blobs are used to transfer binary data between server and client. Currently React Native lacks a way to deal with binary data. The only thing that comes close is uploading files through a URI.

Current workarounds to transfer binary data includes encoding and decoding them to base64 and and transferring them as string, which is not ideal, since it increases the payload size and the whole payload needs to be sent via the bridge every time changes are made.

The PR adds a way to deal with blobs via a new native module. The blob is constructed on the native side and the data never needs to pass through the bridge. Currently the only way to create a blob is to receive a blob from the server via websocket.

The PR is largely a direct port of https://github.com/silklabs/silk/tree/master/react-native-blobs by philikon into RN (with changes to integrate with RN), and attributed as such.

> **Note:** This is a breaking change for all people running iOS without CocoaPods. You will have to manually add `RCTBlob.xcodeproj` to your `Libraries` and then, add it to Build Phases. Just follow the process of manual linking. We'll also need to document this process in the release notes.

Related discussion - https://github.com/facebook/react-native/issues/11103

- `Image` can't show image when `URL.createObjectURL` is used with large images on Android

The websocket integration can be tested via a simple server,

```js
const fs = require('fs');
const http = require('http');

const WebSocketServer = require('ws').Server;

const wss = new WebSocketServer({
  server: http.createServer().listen(7232),
});

wss.on('connection', (ws) => {
  ws.on('message', (d) => {
    console.log(d);
  });

  ws.send(fs.readFileSync('./some-file'));
});
```

Then on the client,

```js
var ws = new WebSocket('ws://localhost:7232');

ws.binaryType = 'blob';

ws.onerror = (error) => {
  console.error(error);
};

ws.onmessage = (e) => {
  console.log(e.data);
  ws.send(e.data);
};
```

cc brentvatne ide
Closes https://github.com/facebook/react-native/pull/11417

Reviewed By: sahrens

Differential Revision: D5188484

Pulled By: javache

fbshipit-source-id: 6afcbc4d19aa7a27b0dc9d52701ba400e7d7e98f
2017-07-26 08:23:20 -07:00
Tomas Reimers 88a98455f6 Simplifying conditional logic.
Summary:
This should be functionally identical, but avoids unnecessary conditionals in the code.

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15147

Differential Revision: D5497883

Pulled By: javache

fbshipit-source-id: a4b182084ffce87adac56013a178fbc5a7a5d1bb
2017-07-26 07:08:51 -07:00
Aaron Chiu 042f254a12 make member variables private instead of protected
Reviewed By: sahrens

Differential Revision: D5425194

fbshipit-source-id: 69c06a8e38bf3c4d84c2c426325e92abf63b4cb7
2017-07-24 18:35:11 -07:00
Adam Comella fc38fe1736 DEPRECATION: Make NetInfo API cross platform and expose whether connection is 2g/3g/4g
Summary:
This change intends to fix 2 issues with the NetInfo API:
  - The NetInfo API is currently platform-specific. It returns completely different values on iOS and Android.
  - The NetInfo API currently doesn't expose a way to determine whether the connection is 2g, 3g, or 4g.

The NetInfo API currently just exposes a string-based enum representing the connectivity type. The string values are different between iOS and Andorid. Because of this design, it's not obvious how to achieve the goals of this change without making a breaking change. Consequently, this change deprecates the old NetInfo APIs and introduces new ones. Specifically, these are the API changes:
  - The `fetch` method is deprecated in favor of `getConnection`
  - The `change` event is deprecated in favor of the `connectionchange` event.
  - `getConnection`/`connectionchange` use a new set of enum values compared to `fetch`/`change`. See the documentation for the new values.
    - On iOS, `cell` is now known as `cellular`. It's worth pointing out this one in particular because the old and new names are so similar. The rest of the iOS values have remained the same.
    - Some of the Android enum values have been removed without a replacement (e.g. `DUMMY`, `MOBILE_DUN`, `MOBILE_HIPRI`, `MOBILE_MMS`, `MOBILE_SUPL`, `VPN`). If desirable, we could find a way to expose these in the new API. For example, we could have a `platformValue` key that exposes the platform's enum values directly (like the old `fetch` API did).

`getConnection` and `connectionchange` each expose an object which has 2 keys conveying a `ConnectionType` (e.g. wifi, cellular) and an `EffectiveConnectionType` (e.g. 2g, 3g). These enums and their values are taken directly from the W3C's Network Information API spec (https://wicg.github.io/netinfo/). Copying the W3C's API will make it easy to expose a `navigation.connection` polyfill, if we want, in the future. Additionally, because the new APIs expose an object instead of a string, it's easier to extend the APIs in the future by adding keys to the object without causing a breaking change.

Note that the W3C's spec doesn't have an "unknown" value for `EffectiveConnectionType`. I chose to introduce this non-standard value because it's possible for the current implementation to not have an `effectiveConnectionType` and I figured it was worth representing this possibility explicitly with "unknown" instead of implicitly with `null`.

**Test Plan (required)**

Verified that the methods (`fetch` and `getConnection`) and the events (`change` and `connectionchange`) return the correct data on iOS and Android when connected to a wifi network and a 4G cellular network. Verified that switching networks causes the event to fire with the correct information. Verified that the old APIs (`fetch' and 'change') emit a deprecation warning when used. My team is using a similar patch in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14618

Differential Revision: D5459593

Pulled By: shergin

fbshipit-source-id: f1e6c5d572bb3e2669fbd4ba7d0fbb106525280e
2017-07-24 15:50:53 -07:00
Benjamin Dobell 63c2ab3eb1 Request toolbar layout after drawable loads
Summary:
Fixes #11209

Updating action items in a `ToolbarAndroid`, or more specifically the native `ReactToolbar`, after the initial render presently will not always work as expected - typically manifesting itself as new action items not being displayed at all (under certain circumstances).

This seems to be happening because Fresco gets back to us asynchronously and updates the `MenuItem` in a listener. However when a keyboard is displayed the `Toolbar` is in a weird state where updating the `MenuItem` doesn't automatically trigger a layout.

The solution is to trigger one manually.

This is a bit wacky, so I created a sample project:

https://github.com/Benjamin-Dobell/DynamicToolbar

`master` demonstrates the problem. Run the project, the toolbar action item is scheduled to update every 2 seconds. It works fine _until_ you give the `TextInput` focus. Once you give it focus the action item disappears and it never recovers (despite on-going renders due to state changes).

You can then checkout the `fixed` branch, run `yarn` again, and see that problem is fixed. This branch is using a prebuilt version of React Native with this patch applied. Of course you could (and probably should) also modify `master` to use a version of RN built by the Facebook CI (assuming that's a thing you guys do).
Closes https://github.com/facebook/react-native/pull/13876

Differential Revision: D5476858

Pulled By: shergin

fbshipit-source-id: 6634d8cb3ee18fd99f7dc4e1eef348accc1c45ad
2017-07-24 11:47:18 -07:00
Tomas Reimers aa9a19ab8d Remove onScrollAnimationEnd
Summary:
<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15156

Differential Revision: D5479265

Pulled By: shergin

fbshipit-source-id: a2dfa3a4357e126838a17dac4797d1d845cd56ae
2017-07-24 00:32:17 -07:00
Summer Kitahara 794dddc5bd Show RN Dev Menu after 2 rage shakes
Reviewed By: achen1

Differential Revision: D5427430

fbshipit-source-id: cac761c550ff2627f1bbbbde9e9b8d3f122bbb45
2017-07-21 00:02:23 -07:00
Sandro Machado bdd46aa283 Fix `HEAD` http requests in Android
Summary:
Closes https://github.com/facebook/react-native/issues/7463.

This PR fixes the `HEAD` http requests in Android.
In Android all the HEAD http requests will fail, even if the request succeeds in the native layer due to an issue in the communication with the `OkHttp`.
Closes https://github.com/facebook/react-native/pull/14289

Differential Revision: D5166130

Pulled By: hramos

fbshipit-source-id: a7a0deee0fcb5f6a645c07d4e6f4386b5f550e31
2017-07-20 16:34:38 -07:00
Krzysztof Magiera b8fafb46c1 Stop native driver animations when value is set.
Summary:
This diff changes the behaviour of natively driven animations in case the node that they are being run for has its value changed using `setValue` or as a result of an incoming event.

The reason for changing that is to match the JS implementation of `setValue` which behaves as described above (see relevant code here: 7cdd4d48c8/Libraries/Animated/src/AnimatedImplementation.js (L743))

**Test Plan:**
Use this sample app: https://snack.expo.io/B1V7RX9r-
Change: `USE_NATIVE_DRIVER` const between `true` and `false`.
See the animation stops regardless of the state of `USE_NATIVE_DRIVER` unlike before when it would stop only when `USE_NATIVE_DRIVER` was set to `false`
Closes https://github.com/facebook/react-native/pull/15054

Differential Revision: D5463750

Pulled By: hramos

fbshipit-source-id: e164c5299588ba8cac2937260c9ba9f6053b04e5
2017-07-20 14:20:30 -07:00
Rex Rao f32627f890 Fix cropImage crash with float displaySize
Summary:
On Android, using `ImageEditor.cropImage` with `displaySize` option may causes crash with exception below:

```
FATAL EXCEPTION: mqt_native_modules
                                                   Process: me.sohobloo.test, PID: 11308
                                                   com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `int64', but had type `double'
                                                       at com.facebook.react.bridge.ReadableNativeMap.getInt(Native Method)
                                                       at com.facebook.react.modules.camera.ImageEditingManager.cropImage(ImageEditingManager.java:196)
                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                       at java.lang.reflect.Method.invoke(Method.java:372)
                                                       at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:345)
                                                       at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:141)
                                                       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                       at android.os.Handler.handleCallback(Handler.java:815)
                                                       at android.os.Handler.dispatchMessage(Handler.java:104)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                       at android.os.Looper.loop(Looper.java:194)
                                                       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                       at java.lang.Thread.run(Thread.java:818)
```

This is caused by getInt from `number` type of JS.

```javascript
      ImageEditor.cropImage(
        uri,
        {
          offset: {x: 0, y: 0},
          size: {width: 320, height: 240},
          displaySize: {width: 320.5, height: 240.5}
        }
      );
```
Closes https://github.com/facebook/react-native/pull/13312

Differential Revision: D5462709

Pulled By: shergin

fbshipit-source-id: 42cb853b533769b6969b8ac9ad50f3dd3c764055
2017-07-20 11:15:57 -07:00
Pieter De Baets ed3c018ee4 Remove legacy JSC profiler
Reviewed By: bnham

Differential Revision: D5433406

fbshipit-source-id: 8cbea8b9b46a0d9f29c57a5bcf605e6bb61ed8a7
2017-07-20 04:21:16 -07:00
Guichaguri bc0717c6cc Android: Added support to arrays in toBundle
Summary:
The support for `ReadableArray` in `toBundle` was never implemented, throwing an `UnsupportedOperationException` when trying to convert an array.

* Created `toList` -- A method that converts a `ReadableArray` to an `ArrayList`
* Modified `toBundle` to support arrays using `toList`
* Created `fromList` -- A method that converts a `List` to a `WritableArray`
* Modified `fromBundle` to also support lists using `fromList`

This PR allows `toBundle` and `fromBundle` (as well as `toList` and `fromList`) to work consistently without loosing information.

**Test Plan**

I've created three different arrays: one full of integers, one full of strings, and one mixed (with a integer, a boolean, a string, null, a map with a string and a boolean array), putting all of them inside a map.

After converting the map to a `Bundle` using `toBundle`, the integer array was retrieved through `Bundle.getIntegerArrayList`, the string array through `Bundle.getStringArrayList` and the mixed array through `Bundle.get` (casting it to an `ArrayList`)

After checking whether each value from the bundle was correct, I converted the bundle back to a map using `fromBundle`, and checked again every value.

The code and results from the test can be found in [this gist](https://gist.github.com/Guichaguri/5c7574b31f9584b6a9a0c182fd940a86).
Closes https://github.com/facebook/react-native/pull/15056

Differential Revision: D5460966

Pulled By: javache

fbshipit-source-id: a11b450eae4186e68bed7b8ce7dea8e5982e689a
2017-07-20 02:44:12 -07:00
Paco Estevez Garcia 0d16c7c982 Add app name to inspector device url
Reviewed By: bnham, Hypuk

Differential Revision: D5443705

fbshipit-source-id: 8c924948dd512be077e2f566da0cfc4110d5f843
2017-07-19 11:47:44 -07:00
Paco Estevez Garcia 90fad3c68b Add app name to PageInfo
Reviewed By: dcaspi

Differential Revision: D5436099

fbshipit-source-id: 73be706fbb36fe7c16b206de7ca3ba0cc3fa019b
2017-07-19 11:47:44 -07:00
sm2017 7e29b1fc77 Update WebSocketModule.java
Summary:
Convert to base64 not utf8

<!--
Thank you for sending the PR!

If you changed any code, please provide us with clear instructions on how you verified your changes work. In other words, a test plan is *required*. Bonus points for screenshots and videos!

Please read the Contribution Guidelines at https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md to learn more about contributing to React Native.

Happy contributing!
-->
Closes https://github.com/facebook/react-native/pull/15046

Differential Revision: D5451398

Pulled By: javache

fbshipit-source-id: b8c6c7b0fb50ca9558e92d3f63a088e343791b7f
2017-07-19 02:34:56 -07:00
Krzysztof Magiera b60a8dc6b9 Fix rotation matrix decomposition.
Summary:
This PR fixes an issue with rotation decomposition matrix on android.

The issue can be illustrated with this sample code https://snack.expo.io/r1SHEJpVb

It surfaces when we have non-zero rotation in Y or X axis and when rotation Z is greater than 90deg or less than -90deg. In that case the decomposition code doesn't give a valid output and as a result the view gets rotated by 180deg in Z axis.

You may want to run the code linked above on android and iOS to see the difference. Basically the example app renders first image rotated only by 89deg and the next one by 91deg. As a result you should see the second view being pivoted just slightly more than the first image. Apparently on android the second image is completely flipped:

iOS:
![screen shot 2017-07-07 at 12 40 30](https://user-images.githubusercontent.com/726445/27954719-7cf6d02c-6311-11e7-9104-5c3cc8e9b9c1.png)

Android:
![screen shot 2017-07-07 at 12 41 21](https://user-images.githubusercontent.com/726445/27954737-981f57e8-6311-11e7-8c72-af1824426c30.png)

The bug seemed to be caused by the code that decomposes the matrix into axis angles. It seems like that whole code has been overly complicated and we've been converting matrix first into quaternion just to extract angles. Whereas it is sufficient to extract angles directly from rotation matrix as described here: http://nghiaho.com/?page_id=846

This formula produces way simpler code and also gives correct result in the aforementioned case, so I decided not to debug quaternion code any further.

sidenote: New formula's y angle output range is now -90 to 90deg hence changes in tests.
Closes https://github.com/facebook/react-native/pull/14888

Reviewed By: astreet

Differential Revision: D5414006

Pulled By: shergin

fbshipit-source-id: 2e0a68cf4b2a9e32f10f6bfff2d484867a337fa3
2017-07-17 18:34:32 -07:00
Aaron Chiu a3142f50ed launch running setupReactContext in BG
Reviewed By: alexeylang

Differential Revision: D5185868

fbshipit-source-id: b7fcf289dca859d169eceb274f1fcd68e49a56d1
2017-07-14 17:39:36 -07:00
Paco Estevez Garcia a1e053cc50 Add Framework name to Attach selection
Reviewed By: Hypuk, javache

Differential Revision: D5389047

fbshipit-source-id: 90e2a5f805561e47e7705e7935ced7556a374616
2017-07-14 07:50:40 -07:00
Adam Comella 09401ed56f Android: Support setting background color on ARTSurfaceView
Summary:
This fixes support for the `backgroundColor` style prop on an `ART.Surface`.

`ARTSurfaceViewManager` inherits its `setBackgroundColor` implementation from `BaseViewManager`. This implementation broke in API 24 because API 24 removed support for `setBackgroundColor`on `TextureViews`. `ARTSurfaceView` inherits from `TextureView` so it also lost support for `setBackgroundColor`.

To fix this, the implementation of `ART.Surface's` `setBackgroundColor` was moved to the shadow node. The implementation now draws the background color on the canvas.

In a test app, verified that initializing and changing the background color on an `ART.Surface` works. Verified that the background renders as transparent when a background color isn't set. Also, this change is being used in my team's app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14117

Differential Revision: D5419574

Pulled By: hramos

fbshipit-source-id: 022bfed553e33e2d493f68b4bf5aa16dd304934d
2017-07-13 16:18:50 -07:00
Christian Brevik e2c87b59be Android: Set WebViewManager methods/fields as protected instead of private
Summary:
**Motivation**

See discussion in #10946. The motivation is to make `ReactWebViewManager` more extensible.

Re-using logic from the ReactWebViewManager when implementing your own custom WebView is a pain since so much of the logic is set as `private`.

This PR makes for easier extension/overriding of behavior, and less duplication of code, since most of the methods/fields are set as `protected` instead.

I've also made some "create" methods for the `WebView` and `WebViewBridge` so they can more easily be overridden.

**Test plan**
The test plan is the same as the other PR (#10946). I've made an simple test app which extends `RCTWebViewManager`: https://github.com/cbrevik/overrideWebview

See [CustomWebViewManager.java](https://github.com/cbrevik/overrideWebview/blob/master/android/app/src/main/java/com/overridewebview/CustomWebViewManager.java) for a simple implementation.

CC shergin (https://github.com/facebook/react-native/pull/10946#issuecomment-304763562)
Closes https://github.com/facebook/react-native/pull/14261

Differential Revision: D5413922

Pulled By: shergin

fbshipit-source-id: d2f6d478f2a147e2e7b5e05c195a8b28a0a3d576
2017-07-12 21:14:32 -07:00
Felix Oghina 999851a389 Update OSS Fresco dependency
Reviewed By: oprisnik

Differential Revision: D5406106

fbshipit-source-id: 3d928f431701b783fa0862d0dff818ec61d8b737
2017-07-12 07:54:09 -07:00
Alexander Komissarov 8f363b2c49 Converting more android support library dependencies in React Native. Now for v7
Reviewed By: achen1

Differential Revision: D5332443

fbshipit-source-id: 085be2d542feb29c3727958908648237c3ed0503
2017-07-10 17:18:11 -07:00
Nurzhan Bakibayev c00abe53c3 Move inspector proxy out of the packager
Reviewed By: pakoito

Differential Revision: D5369099

fbshipit-source-id: ff806d784b70804181c5c54837352f66e45d1b9e
2017-07-10 06:31:23 -07:00
Kevin Luvian e6941990ef Fixed new line and prioritise blurOnSubmit in multiline text input
Summary:
What existing problem does the pull request solve?
this fixes #13506 and #12717 where:
- there are some issues when pressing enter with some keyboard
- blurOnSubmit is not working with multiline

I think this should be in stable branch as this is pretty critical, isn't it?

- just create a TextInput with multiline and press enter with samsung keyboard
before, it won't create a new line, now it will.

- just create a TextInput with multiline and blurOnSubmit true and press enter
before, it won't blur, and wont create a new line (on some keyboard, it will create a new line), now it will blur only
Closes https://github.com/facebook/react-native/pull/13890

Reviewed By: achen1

Differential Revision: D5333464

Pulled By: shergin

fbshipit-source-id: a0597d1b1967d4de1486e728e03160e1bb15afeb
2017-07-09 15:34:10 -07:00
Seth Fitzsimmons 9afb71fde8 Replace React.createClass with create-react-class
Summary:
This replaces all uses of `React.createClass` with `createReactClass` from the `create-react-class` package, attempting to match use of `var` and `const` according to local style.

Fixes #14620
Refs #14712
Closes https://github.com/facebook/react-native/pull/14729

Differential Revision: D5321810

Pulled By: hramos

fbshipit-source-id: ae7b40640b2773fd89c3fb727ec87f688bebf585
2017-07-07 14:36:01 -07:00
Pieter De Baets 8548ca09f1 Remove unused RCTDebugComponentOwnership
Reviewed By: sahrens

Differential Revision: D5380887

fbshipit-source-id: ff81324718d64d7a04ef4bd293d30dd6f3aabb2a
2017-07-07 12:04:04 -07:00
Kathy Gray 6796abbe55 Using shared bridge path for RN
Reviewed By: javache

Differential Revision: D5002111

fbshipit-source-id: 86c2856145a6595823fd027145b050a6fba3d90d
2017-07-07 05:30:38 -07:00
Pieter De Baets a8a29a92a0 Simplify macro usage in MethodInvoker
Reviewed By: kathryngray

Differential Revision: D5363934

fbshipit-source-id: a9cffb10b4d6244d1d66267f6c1e07ba69663b9c
2017-07-07 03:06:21 -07:00
Pieter De Baets 465a68db1f Remove xcode_public_headers_symlinks from RN BUCK files
Reviewed By: dinhviethoa

Differential Revision: D5321259

fbshipit-source-id: b07ff4a01280251deb2113a62197d96d5c2e37a1
2017-07-06 12:16:20 -07:00
Alexander Komissarov 1ab96fd077 Converting android support library dependencies to be provided_deps in React Native.
Reviewed By: bestander

Differential Revision: D5326236

fbshipit-source-id: 3f2ca43a78c4c868ed6665b4d9f61630631f9502
2017-07-05 19:15:22 -07:00
Kathy Gray 3525998884 Setup experiment for split packages
Reviewed By: javache

Differential Revision: D5314224

fbshipit-source-id: b9bc28b8f4e058db1dcc0c17f7dc84bf15eb33f9
2017-07-04 04:01:14 -07:00
Kathy Gray e301a36606 Splitting packages into core bridge and core RN
Reviewed By: javache

Differential Revision: D4953811

fbshipit-source-id: 05ab9acc81e31bbb85005cd80eeebc550a6c452e
2017-07-04 04:01:14 -07:00
Kaibin Yin c42080eaaf add peeking feature in AndroidViewPage(RN)
Reviewed By: sahrens

Differential Revision: D5340198

fbshipit-source-id: b2986a320a39225882d4289b193e1d22e9e7547e
2017-06-30 22:21:06 -07:00
Joana Lopes 25d19e3830 Translating NativeArray into NativeMap on getConstants
Reviewed By: javache

Differential Revision: D5321741

fbshipit-source-id: 2465c69a5bd1d4f3cf20ba73e163372b12616312
2017-06-29 04:19:30 -07:00
Jean Lauliac 33057aacbf React Native: disable multipart bundle transmission for now
Reviewed By: davidaurelio

Differential Revision: D5329011

fbshipit-source-id: 5093bc5b1858314512313934fba04f4343fe0d5b
2017-06-29 04:19:30 -07:00
Janic Duplessis 960e5db0ed Add dev bundle download listener on Android
Summary:
This exposes a way to listen to JS bundle download events when creating a ReactInstanceManager. This can be used to display a custom native UI while the JS bundle is loading. It is a pretty specific use case but Expo will need this to display loading progress on the app loading splash screen.

**Test plan**
Tested by adding a listener to the ReactInstanceManager in the Expo app and checked that it gets called when the bundle is loading.
Closes https://github.com/facebook/react-native/pull/12984

Reviewed By: devknoll

Differential Revision: D4797638

Pulled By: hramos

fbshipit-source-id: 04d7cd4071535670c1bcb121566748e495197c80
2017-06-28 20:01:17 -07:00
Wenjia Ma f954f3d9b6 Add velocity to onScrollEndDrag event
Reviewed By: achen1

Differential Revision: D5330215

fbshipit-source-id: e45a302b325c38294324f4f384a5604355dc05aa
2017-06-27 15:57:00 -07:00
Alex Kring bb832e1238 Akring integration tests fix
Summary:
Fix a bug that allows us to run integration tests in our android project, where RN is specified as a module to our project.

sdkHandler does not exist. The android documentation suggests that we should be using android.ndkDirectory instead.

http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0

An alternative solution would be to set the environment variable ANDROID_NDK, but we do not want to rely on setting this environemnt variable at a system wide level.

We ran two tests.
1.) perform a gradle sync from within our Android studio project, and verify there is no error output.
2.) build android using ./gradleW, from command land. Verify there are no build errors.
Closes https://github.com/facebook/react-native/pull/14136

Differential Revision: D5327421

Pulled By: shergin

fbshipit-source-id: d9e18519a8ca318f2026eb409b90cb09e2adbda1
2017-06-26 21:01:17 -07:00
Pieter De Baets 83faa4b608 Simplify Catalyst handleMemoryPressure
Reviewed By: cwdick

Differential Revision: D5200555

fbshipit-source-id: 86f12acca33ece265d3482ba52de9afcc83173cd
2017-06-26 06:01:14 -07:00
Andrew Y. Chen 076eaec805 Revert D5238126: Add velocity to onScrollEndDrag event
Differential Revision: D5238126

fbshipit-source-id: a8b5f9445fa15a0ef0851303961dbf63b5d46623
2017-06-23 19:02:27 -07:00
Pieter De Baets e2628f93b5 Rename Executor to JSExecutor
Summary:
* Cleanup some header files so we use more forward declarations
* Rename Executor to JSExecutor.h
* Move some typedefs to more appropriate locations

Reviewed By: mhorowitz

Differential Revision: D5301913

fbshipit-source-id: e75154797eb3f531d2f42a5e95409f4062b85f91
2017-06-23 17:01:25 -07:00
Wenjia Ma d4cda7168f Add velocity to onScrollEndDrag event
Summary:
1. Calculated the fling slow down velocity using OnScrollDispatchHelper
2. Calculated the END_DRAG velocity using velocity tracker in VelocityHelper.
3. Change the interface of ReactScrollViewHelper to pass velocity on x & y.

Pending future work:
Calculate the velocity of BEGIN_DRAG, MOMENTUM_BEGIN and MOMENTUM_END
Add threshold in ScrollResponder.js instead of checking x & y velocity equal zero

Reviewed By: achen1

Differential Revision: D5238126

fbshipit-source-id: 35fb70dda8ab66cd152413cb9c1c041354f1c061
2017-06-23 14:00:57 -07:00
Andrew Y. Chen ecccd06662 API check for removeOnGlobalLayoutListener in ReactRootView
Reviewed By: AaaChiuuu

Differential Revision: D5308604

fbshipit-source-id: adf4abbdd59e54c18fcae946f2f7e3af89e7190c
2017-06-23 10:37:59 -07:00
Nick Eddy a6607968c4 Fixing drawing bug in ReactArt on Android
Summary: This change fixes rendering issues with arcs having an inner radius.  The root cause was a bug that lost the negative sign for counter-clockwise angles.  The previous code also incorrectly set the start angle to the end angle.

Differential Revision: D5298320

fbshipit-source-id: 4d11edfed5bdab0cf68313d22f94ef0e3711a1a8
2017-06-23 09:30:37 -07:00
Kathy Gray 2b89416ac0 Only load core modules once
Reviewed By: javache, AaaChiuuu

Differential Revision: D5303176

fbshipit-source-id: f00ecacaa695ce7a4f8b57c66cee38bb70883cae
2017-06-22 11:55:19 -07:00
Pieter De Baets d795fa1b2c Update native references to JSTimers
Reviewed By: AaaChiuuu

Differential Revision: D5294997

fbshipit-source-id: 3003d56f744af0c35b1ffef7bdd71617d4f948c3
2017-06-22 09:52:33 -07:00
Kathy Gray 4566f01fbd Fix package order on reactinstancemanager
Reviewed By: alexeylang

Differential Revision: D5296348

fbshipit-source-id: bfd859085758f1f78a927b2ad4464ed9aff82c58
2017-06-21 16:30:38 -07:00
Kathy Gray 5c5410459e Setting bridge up for sharing: allowing native modules to register after init
Reviewed By: javache

Differential Revision: D4945784

fbshipit-source-id: 80e7236e9ccd5d5c9a7fba7c96b98fc38b43a2fc
2017-06-21 12:08:45 -07:00
Nurzhan Bakibayev 1ae54b5108 Separate port constant for inspector proxy server.
Reviewed By: johnislarry

Differential Revision: D5282980

fbshipit-source-id: e714965e2bb4849e24138d326c757352b238aba6
2017-06-21 08:01:44 -07:00
Yu Wang 01adc71ade add cmd+opt+ctrl+D to globally invoke dev menu for Android
Reviewed By: frantic

Differential Revision: D5280788

fbshipit-source-id: ce11d122ee17a2ba8d8aa2e91fc6639610791577
2017-06-20 17:01:46 -07:00
Andrew Y. Chen 3c4057cbb4 Revert D5172643: [ReactImageView] Remove useless code from ReactImageView.RoundedCornerPostprocessor
Differential Revision: D5172643

fbshipit-source-id: d8d27586d81479c950fe3dd49b24ad5ee29861fc
2017-06-19 14:46:49 -07:00
Andrew Y. Chen e82ceb24eb Fix dev loading indicator
Reviewed By: AaaChiuuu

Differential Revision: D5277176

fbshipit-source-id: 04a8af068310490957e8bc1e690e2cdb927e4dff
2017-06-19 13:16:19 -07:00
Andrew Y. Chen 56969d51fa Don't crash if Window permission isn't granted for dev loading view
Reviewed By: AaaChiuuu

Differential Revision: D5263844

fbshipit-source-id: bf10375ddc43158ce77e09682605068e28f690ef
2017-06-19 08:22:23 -07:00
Pascal Hartig 2cc1195035 Fix license headers
Reviewed By: IanChilds

Differential Revision: D5255424

fbshipit-source-id: 23439ac035f74f2fd1c756b8185e39199e748e33
2017-06-15 07:45:46 -07:00
Aaron Chiu e48ad9609c tag INITIALIZE_MODULE marker with the non-zero instance key
Reviewed By: javache

Differential Revision: D5255044

fbshipit-source-id: 9bd72970488cfba4271562e83416f6515b9e77b3
2017-06-15 02:50:37 -07:00
Pieter De Baets 559805d0b0 Remove SetBuilder
Reviewed By: AaaChiuuu

Differential Revision: D5237184

fbshipit-source-id: dde09febd0d4a5a42a62c7c6fbda3e6713d26152
2017-06-14 16:48:26 -07:00
Aaron Chiu 7464d5e1a2 use .contains
Reviewed By: achen1

Differential Revision: D5242469

fbshipit-source-id: d666b1264e6e40bb2649ab91bc63ecb6decb1532
2017-06-14 16:31:10 -07:00
Pieter De Baets 534bbfac8f Report Java stack from errors from sync native module calls
Reviewed By: mhorowitz

Differential Revision: D5069794

fbshipit-source-id: ede314034a2eb6b063a22dbd6e5d13c8ad66e20c
2017-06-14 09:32:37 -07:00
Pieter De Baets ce6fb337a1 Breaking - remove unused registration of JS modules
Summary: It's now unnecessary to declare which JS modules you want to expose on your package. To upgrade, remove all overrides of `createJSModules` and keeping calling your JS modules as before.

Reviewed By: AaaChiuuu

Differential Revision: D5229259

fbshipit-source-id: 1160826c951433722f1fe0421c1200883ba1a348
2017-06-14 03:52:17 -07:00
Pieter De Baets 53d5504f40 Stop requiring registration of callable JS modules
Reviewed By: AaaChiuuu

Differential Revision: D5229073

fbshipit-source-id: d6d1967982ae379733a7e9667515ca9f074aadd4
2017-06-13 05:46:31 -07:00
Xin Lux Liu 947d77dab5 Revert D5176953: [rn] Remove DialogWhenLarge style from devsupport
Differential Revision: D5176953

fbshipit-source-id: 9e43fc71841dcd0edb43ed9de407bab9bb759f3a
2017-06-11 18:34:29 -07:00
Andrew Y. Chen ac19ddeea8 Revert D5176953: [rn] Remove DialogWhenLarge style from devsupport
Differential Revision: D5176953

fbshipit-source-id: 130e4180de02d4ad14a9c4c5d7a672741b8f40b7
2017-06-11 17:32:18 -07:00
Owen Auch e8df8d9fd5 Corrected spelling of the word "properties" in error message in ReactAndroid/build.gradle
Summary:
The misspelling in the error message bothered me.

N/A
Closes https://github.com/facebook/react-native/pull/14425

Differential Revision: D5225388

Pulled By: shergin

fbshipit-source-id: b20f31f0685099ae1d1c3dd2de74dfb33eadfd6e
2017-06-11 00:15:40 -07:00
Aaron Chiu a1321aedd7 add a bunch of debug log statements
Reviewed By: achen1

Differential Revision: D5216191

fbshipit-source-id: 8e8e05d4bcd8b2112fbd15b3809946f1caa0edbe
2017-06-09 15:49:57 -07:00
Ben Nham 2984628357 add marker surrounding entire native module creation
Reviewed By: javache

Differential Revision: D5200856

fbshipit-source-id: 35b0e627224d518126a1cfdd36d6af264dd186cf
2017-06-09 06:22:39 -07:00
Ben Nham 80bc07fd60 add support for multiple bridge listeners
Reviewed By: AaaChiuuu

Differential Revision: D5200830

fbshipit-source-id: 2a12267edddd2558146721e02a0b80d649755050
2017-06-09 06:22:39 -07:00
Aaron Chiu c639a1f802 fix dev reloading
Reviewed By: achen1

Differential Revision: D5187906

fbshipit-source-id: 8c35ee0747bdc0f6748ecdca54e223eafe37e105
2017-06-08 19:31:21 -07:00
Pieter De Baets a9e8b7bca5 Remove unused package_js.py
Reviewed By: AaaChiuuu

Differential Revision: D5200573

fbshipit-source-id: 5bc5cc66d3ce979a6ca2db9241e1de4eab45f234
2017-06-08 03:45:41 -07:00
Aaron Chiu f978109281 Ingore two other test of similar nature (and failure)
Reviewed By: javache

Differential Revision: D5208387

fbshipit-source-id: b32412c1591b2e3e461a3c2a3f99beb9ca7cd552
2017-06-08 02:30:03 -07:00
Pieter De Baets 81c2f3b189 Cleanup Platform
Reviewed By: dcaspi

Differential Revision: D5185504

fbshipit-source-id: 4f7e9f9068598418b346a7370f6be241a0784b60
2017-06-07 10:19:01 -07:00
Aaron Chiu ce52f404f2 remove some markers
Reviewed By: fkgozali

Differential Revision: D5196382

fbshipit-source-id: b12b56a7f7d1c4309ebcb61e840cc570d87acf3b
2017-06-06 20:45:33 -07:00
Andrew Y. Chen 37d4fd3ab6 Remove DialogWhenLarge style from devsupport
Reviewed By: AaaChiuuu

Differential Revision: D5176953

fbshipit-source-id: 52f426a0fbcdb07e1d250215342dceaeb6040261
2017-06-06 14:46:22 -07:00
Aaron Chiu 2dfcde4c7b Ignore CatalystNativeJSToJavaParametersTestCase for now
Reviewed By: javache

Differential Revision: D5189336

fbshipit-source-id: a9d9e6ff17bf85af5e0e6146b13e2f96022435ba
2017-06-06 13:17:32 -07:00
Michał Gregorczyk 46b3a89a70 Stop SystraceMessage markers with SystraceMessage.endSection
Reviewed By: javache

Differential Revision: D5182628

fbshipit-source-id: f5112a434cb7564410b0e2e69840e45a0777a184
2017-06-06 11:20:47 -07:00
Pieter De Baets 964c3a1b7a Don't include JNI dep in OSS build
Summary:
When circle is using Buck, it uses prebuilt native libraries. I added this dependency internally to avoid callers having to depend on it explicitly but it looks like that broken open-source.
Closes https://github.com/facebook/react-native/pull/14343

Differential Revision: D5191531

Pulled By: javache

fbshipit-source-id: 5397026daac085694b3320bf6d3e7b3f5d680691
2017-06-06 10:34:23 -07:00
Kathy Gray 3c89bafad5 Reducing lock contention in module creation
Reviewed By: javache

Differential Revision: D5147499

fbshipit-source-id: b420cc67ee97fd8cf4bb390098465f968478509f
2017-06-06 09:02:12 -07:00
Michał Gregorczyk e55583e59f Fix oss build
Reviewed By: javache

Differential Revision: D5189534

fbshipit-source-id: 6096754e3caaa88a3283b3773723fac154cf989d
2017-06-06 08:30:50 -07:00
Ognjen Dragoljevic e0bdb7cbcf Remove useless code from ReactImageView.RoundedCornerPostprocessor
Reviewed By: achen1

Differential Revision: D5172643

fbshipit-source-id: c2d89bdfde2c4f4ef51bf3f529fa58112fb65a2d
2017-06-06 05:15:51 -07:00
Summer Kitahara aeccbd6906 Updating shake handling for Android in ShakeDetector and DevSupportManagerImpl
Summary: If you use a ShakeDetector, you can specify the minimum number of shakes required to trigger a shake handler.  Otherwise, the minimum number of required shakes is set to 1 by default.

Reviewed By: achen1

Differential Revision: D5155604

fbshipit-source-id: 5073fa37d4c223eb18e85b5e850b95d37136e3d2
2017-06-05 21:35:33 -07:00
Aaron Chiu e9e2de0ca2 properly clean up ReactAppTestActivity
Reviewed By: achen1

Differential Revision: D5183260

fbshipit-source-id: 263a289ff2332b39693830f77e705544e10b18ff
2017-06-05 13:15:54 -07:00
Aaron Chiu 37536e93b7 properly clean up RN
Reviewed By: javache

Differential Revision: D5170608

fbshipit-source-id: 065cf4ba4244c26bf5fdf9f5183a6bb1295676ad
2017-06-02 23:47:37 -07:00
Aaron Chiu 888a1e63d5 remove unused var
Reviewed By: shergin

Differential Revision: D5175318

fbshipit-source-id: 61d75bb386918e297f26d8772a5463c257a1590a
2017-06-02 14:32:00 -07:00
Michał Gregorczyk 20217873d4 Prepare RN libs for so merging
Reviewed By: javache

Differential Revision: D5150741

fbshipit-source-id: 06e64ee1c4784e64307ef7a40003867ca0c8a8e2
2017-06-02 14:19:57 -07:00
xiaenlong 70b3f2aa7f Fix `InspectorPackagerConnection` creates too many Threads when WebSo…
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [ ] Provide a **test plan** demonstrating that the code is solid.
- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

InspectorPackagerConnection now creates a new OkHttpClient when previous connection fails. If the failures occur frequently, many Threads are created in `WebSocketCall.enqueue()`. On my Pixel phone, I have seen up to 260 Threads named "OkHttp ConnectionPool" alive at the same time. So, why don't we consider reusing the existing OkHttpClient instance ?

N/A

Sign the [CLA][2], if you haven't already.

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

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/14301

Differential Revision: D5172277

Pulled By: javache

fbshipit-source-id: 7d417fa0675eb627f0b1ca41847b75686c8d1f3e
2017-06-02 09:16:41 -07:00
Pieter De Baets 79500f81a9 Fix Travis CI runs
Summary: Closes https://github.com/facebook/react-native/pull/14286

Differential Revision: D5164925

Pulled By: javache

fbshipit-source-id: 0ebe028ab58f37a9afc8b615fe346d7af9180040
2017-06-02 09:03:18 -07:00
Pieter De Baets 53169b0de3 Minimize time holding lock in UIViewOperationQueue
Reviewed By: AaaChiuuu

Differential Revision: D5154725

fbshipit-source-id: 06a113c4235ee63030f240f43a83aac074a23909
2017-06-02 08:31:00 -07:00
Aaron Chiu c57d7eaf43 remove unused file
Reviewed By: fkgozali

Differential Revision: D5168258

fbshipit-source-id: 2535aa5592d5cf49e94fd6999e8121ef97e42d39
2017-06-02 08:17:06 -07:00
Pieter De Baets 220ff2321a Avoid calls to ReactBridge.staticInit being stripped
Reviewed By: michalgr

Differential Revision: D5166720

fbshipit-source-id: 15ce78b2bbafa9506e9023d7d931092ebd963eea
2017-06-01 13:47:40 -07:00
Pieter De Baets bd5051adeb Move xreact/jni to react/jni
Reviewed By: mhorowitz

Differential Revision: D5155612

fbshipit-source-id: 871a23916c0069498691dc0dd3c94fd2e404cec9
2017-06-01 05:53:25 -07:00
Aaron Chiu 8394f9b553 add Systrace to render logic
Reviewed By: achen1

Differential Revision: D5153246

fbshipit-source-id: 4f6f6c7117734552682995fc74a3a926a63feb28
2017-05-31 21:47:04 -07:00
Seth Kirby 5db26380dd Avoid using path for normal border cases
Reviewed By: ahmedre

Differential Revision: D5111224

fbshipit-source-id: c188f83339ed011272f80b4fac35f47f8d72d30b
2017-05-31 15:52:26 -07:00
Seth Kirby 2143df8cb6 Minor refactor and fix before changes
Reviewed By: ahmedre

Differential Revision: D5111225

fbshipit-source-id: 466272026224b67d6291a295efad9e3def35e0e9
2017-05-31 15:52:26 -07:00
Seth Kirby 02856938ea Avoid using path for normal border cases
Reviewed By: achen1

Differential Revision: D5111223

fbshipit-source-id: d85da53a9409efc2edb1ca6ecb040a30a35266b8
2017-05-31 15:52:26 -07:00
xiatian c2eb9f4689 Update CatalystInstanceImpl.java
Summary:
This change is very simple, fix a wrong spelling.
Closes https://github.com/facebook/react-native/pull/14268

Differential Revision: D5153788

Pulled By: javache

fbshipit-source-id: a163e1032661f54a802b3bfcbdf802a80b88545d
2017-05-31 02:46:24 -07:00
Aaron Chiu 8125ce520d don't block attaching ReactRootView on measuring
Reviewed By: achen1

Differential Revision: D5117394

fbshipit-source-id: 00f65a59247a75d4b42240fe25935aa9bd8948b1
2017-05-31 02:25:31 -07:00
Jonas Lundberg adaf2bf277 Android: Make lineHeight accept decimal values
Summary:
Make android-version accept a decimal
number as lineHeight.

Credits where due, solution was given in this
issue: facebook/react-native#10607

According to the w3 spec the property
line-height should accept decimal values
(and it does on iOS) but the android
version has the wrong data-type for the
shadowed method, resulting in a stacktrace
saying:
com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError:
expected dynamic type `int64', but had type `double'

Setting it to a float makes it accept
decmial values as it should.

* Create an app without this commit and create the same app with this commit:
In both apps:
- Leave line-height undefined. Behavior is unaffected by this commit.
- Set lineHeight to a integer number. Behavior is unaffected by this commit.
- Set lineHeight to a decimal number. Line height is now rendered with decimals in the app with this fix.

* Run android integration tests to see nothing
  else broke.

Sign the [CLA][2], if you haven't already.

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

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13843

Differential Revision: D5152982

Pulled By: shergin

fbshipit-source-id: cda3b72497a6c27d6948b31ec846640a8913775a
2017-05-30 19:01:34 -07:00
Pieter De Baets f0e4a6cd2c Add missing Java files to RN fbjni sync
Reviewed By: mhorowitz

Differential Revision: D5129224

fbshipit-source-id: d9fb5f95505f6be7d3d87ead67dbfaa951c03434
2017-05-30 03:19:04 -07:00
Saleel Salam 7807247905 Add 'thirdPartyCookiesEnabled' prop on WebView to enable third party …
Summary:
…cookies on Android Lollipop or later versions.

Third party cookies in WebView are [disabled by default](https://developer.android.com/reference/android/webkit/CookieManager.html#setAcceptFileSchemeCookies(boolean)) on Android Lollipop or later versions. This prevented users from logging in by using _Login by Facebook_ method (in redirect mode) in Android Webview.

This PR exposes a prop `thirdPartyCookiesEnabled` which will enable third party cookies in Android Webview. This setting is ignored on versions below Android Lollipop and on iOS as third party cookies are enabled in them by default.

Appropriate documentation was added in code and they were reflected in the website.
Closes https://github.com/facebook/react-native/pull/14013

Differential Revision: D5145059

Pulled By: shergin

fbshipit-source-id: 67bcb3a497a9c6f6db1d12e8d16197d2facd157e
2017-05-28 21:30:20 -07:00
Valentin Shergin bac84ce207 BREAKING: Better TextInput: `contentSize` property was removed from `<TextInput>.onChange` event (Second attempt)
Summary:
`contentSize` was removed from both iOS and Android, tests was updated.
USE `onContentSizeChange` INSTEAD.

Why?
 * It always was a hack;
 * We already have dedicated event for it: `onContentSizeChange`;
 * `onChange` has nothing to do with layout actually;
 * We have to maintain `onChange` handler as fast and simple as possible, this feature complicates it a lot;
 * It was undocumented feature;
 * We already have native auto-expandable <TextInput>, so it illuminates 99% current use cases of this feature.

Reviewed By: mmmulani

Differential Revision: D4989881

fbshipit-source-id: 674bb98c89ada1fca7b3b20b304736b2a3b8304e
2017-05-28 20:16:04 -07:00
Emil Sjolander 3af9be52b2 Downgrade okhttp in open source
Reviewed By: yungsters

Differential Revision: D5144011

fbshipit-source-id: ef897bf7e03b84e4e60ec6607027666608a460cb
2017-05-27 09:15:20 -07:00
Adam Comella 26ee9b94d4 Android: Allow WebView to handle about:blank
Summary:
On some devices, we saw many Chrome windows open when the WebView attempted to send the user to about:blank. This change allows the WebView to handle about:blank which prevents the Chrome windows from opening and gives the user a better experience.

Verified that the WebView no longer opens the device's browser when navigating to about:blank. My team has been using this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14173

Differential Revision: D5142352

Pulled By: hramos

fbshipit-source-id: 1070d4381b385a5bf1829fd8e97efba2045f7968
2017-05-26 17:00:51 -07:00
Pieter De Baets e9fc7311c4 Cleanup markers in getConstants
Summary:
* Only add the moduleName to the outer marker
* Include module init in the marker time
* Include the WritableNativeArray time in CONVERT_CONSTANTS
* Stop all markers from finally block in case of exception

Reviewed By: kathryngray

Differential Revision: D5031411

fbshipit-source-id: bf86ee3d59f2cb38866afd52e84af5699db1a003
2017-05-26 09:30:36 -07:00
Valentin Shergin 35393524a9 Fixed <TextInput>.onContentSizeChange on Android
Summary:
Previously <TextInput>'s onContentSizeChange event fires very rearly, usually just once after initial layout. This diff fixed that.
I also considered to a bunch of another things to get the native notification, but I found that overriding `onTextChanged` is the most reliable, easy and effitient way to implement this.

I tried/considered:
 * onLayout (does not fire)
 * OnPreDrawListener (fires to often)
 * OnGlobalLayoutListener (does not fire)
 * OnLayoutChangeListener (does not fire)
 * isLayoutRequested (too hacky)

(I also fixed the <AutoExpandingTextInput> demo to illustrate the fix.)

And just heads up, we will remove `contentSize` info from `onChange` event very soon.

GH issue: https://github.com/facebook/react-native/issues/11692

Reviewed By: achen1

Differential Revision: D5132589

fbshipit-source-id: e7edbd8dc5ae891a6f4a87b51d9450b8c6ce4a1e
2017-05-25 19:31:31 -07:00
Andrew Y. Chen 864c9f5248 Revert D5080735: [rn] Fix copy paste second attempt
Differential Revision: D5080735

fbshipit-source-id: 1783dddcf467c0103007db35643dc42bf8c526f4
2017-05-25 18:49:10 -07:00
Adam Comella e9ae31dfd6 Android: Fix memory leak in AccessibilityInfoModule
Summary:
This change fixes a memory leak in `AccessibilityInfoModule`.

Our tooling detected this memory leak. After this commit, we no longer see the leak in the tool. We've been using the change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14171

Differential Revision: D5128845

Pulled By: javache

fbshipit-source-id: b604902188eb8cc029b1ad39d087e199ae26877c
2017-05-25 03:01:31 -07:00
yk3372 9dc0385405 fix memory leak
Summary:
Signed-off-by: yk3372 <yk3372@gmail.com>

What existing problem does the pull request solve?

ViewManagersPropertyCache, ViewManagerPropertyUpdater static field not release when ReactInstanceManager called destroy.

I use this url to integrate RN:
[http://facebook.github.io/react-native/docs/integration-with-existing-apps.html](http://facebook.github.io/react-native/docs/integration-with-existing-apps.html)
and in Activity's onDestroy function add the follow code to release RN:
```java
mReactInstanceManager.destroy();
mReactInstanceManager = null;
```
and then when I exit activity, find the static field not release.
the follow is screen shot:
before:
![2017-05-23 17 41 16](https://cloud.githubusercontent.com/assets/1514899/26350318/53ea250c-3fe5-11e7-8eda-a0dcc20ba4f6.jpg)
after:
![2017-05-23 17 38 49](https://cloud.githubusercontent.com/assets/1514899/26350329/5e5b273e-3fe5-11e7-9b0b-a8b0e044abf3.jpg)
Closes https://github.com/facebook/react-native/pull/14172

Differential Revision: D5128834

Pulled By: javache

fbshipit-source-id: 657763fa21fd8826b4060f9a17e7f35f0e1e04d3
2017-05-25 03:01:31 -07:00
Daniel Cestari fe229f8104 Move to{HashMap,ArrayList} up to Readable{Map,Array}
Summary:
NativeReadable{Map,Array} classes have convenient to{HashMap,ArrayList}
methods that make it easier to interoperate with existing Java code
from within a ReactNative application (e.g., Native Module) ...

Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

NativeReadable{Map,Array} classes have convenient to{HashMap,ArrayList}
methods that make it easier to interoperate with existing Java code
from within a ReactNative application (e.g., Native Module)

These changes make these same methods available to any code using
the Readable{Map,Array} interfaces, instead of forcing consumers to
cast their generic instances into the NativeReadable* equivalents

Moving this methods up to the interfaces also makes it easier to
write unit tests for Native Modules - using the JavaOnly{Map,Array}
implementations of Readable{Map,Array} - while still relying on the
to{HashMap,ArrayList} methods

* Write a native module that receives a JSON object as `ReadableMap` and a JSON array `ReadableArray`.
* Print out the result of `toHashMap` and `toArrayList`.
* Make sure `NativeReadable{Map,Array}` works:
  * Call the native module's method from JavaScript, passing an `Object` and an `Array`.
  * Compare the printed values with the passed content.
* Make sure `JavaOnly{Map,Array}` works:
  * Call the native module's method from the Java code and pass a `JavaOnlyMap` and a `JavaOnlyArray`.
  * Compare the printed values with the passed content.

**Please advise if there is an automated test suite where I could add a case for this.**
Closes https://github.com/facebook/react-native/pull/14072

Differential Revision: D5123120

Pulled By: javache

fbshipit-source-id: 343f4396b99e03ecaf47993db6955d7932152f77
2017-05-24 13:01:00 -07:00
Pieter De Baets 275ba316c3 Remove unused MessageQueueThreadRegistry
Reviewed By: astreet

Differential Revision: D5111966

fbshipit-source-id: 2d96c0fe0bb8f7e5c88e200dc09feee265c24890
2017-05-24 10:16:32 -07:00
Emil Sjolander e656adcaa8 Parse YogaValue from string. inverse of toString()
Reviewed By: kittens

Differential Revision: D5120456

fbshipit-source-id: 6ac7cff2a040778e63a953070e1bd7e768fedaa7
2017-05-24 08:06:09 -07:00
Kathy Gray f46eaa30cf Provide sync vs async interface for bundle loading via parameter
Reviewed By: javache

Differential Revision: D5104317

fbshipit-source-id: ffacb57d85c24795a3acc2faba2ff5824cc739b2
2017-05-24 07:31:36 -07:00
James Pearce 692fb94a6e Rogue apostrophe
Summary:
English :)
Closes https://github.com/facebook/react-native/pull/14138

Differential Revision: D5114337

Pulled By: javache

fbshipit-source-id: 73cfc4d3b31b4a86ac6fec0293a4f1246c911414
2017-05-24 02:45:27 -07:00
Swordsman-Inaction 663df57c62 Add viewIsDescendantOf for UIManager on Android
Summary:
Add the ability for UIManager to check if a node is an ancestor of anther one on Android like #7876 did on iOS
Closes https://github.com/facebook/react-native/pull/13129

Differential Revision: D4938319

Pulled By: hramos

fbshipit-source-id: abe20779be2142a1ea9ac46f52d8cd8609236419
2017-05-23 11:04:27 -07:00
Adam Ernst 0ee8786cd8 Handle [native code] stack frames
Reviewed By: ashwinb, javache

Differential Revision: D5104078

fbshipit-source-id: edefc7cb7e1d401155372c917875ad8b14af94e9
2017-05-22 15:47:32 -07:00
Kevin Gozali 3d3f74dc72 move @ReactMethod to the codegen'ed class so impl class don't need it anymore
Reviewed By: javache

Differential Revision: D5074121

fbshipit-source-id: 1b23a5d26ffe27c5093677ae7ecca424b232c8aa
2017-05-22 11:46:07 -07:00
Aaron Chiu 784f89d0c9 fix lint
Reviewed By: javache

Differential Revision: D5103275

fbshipit-source-id: 1df50ecef7b16289eecadde3c193db086eef1fc7
2017-05-22 03:15:41 -07:00
Pieter De Baets 247e8142e3 Remove NativeSoftError from OSS
Reviewed By: amnn

Differential Revision: D5095340

fbshipit-source-id: c4515140843c031490dbce5b297e6544919ac5ab
2017-05-22 02:32:23 -07:00
Aaron Chiu 213ea30346 Don't enqueue another UI operation if we're already on the UI thread
Reviewed By: alexeylang

Differential Revision: D5085488

fbshipit-source-id: 0613c1403a67d63ad06ce2db9950d902f1c6473a
2017-05-20 20:45:34 -07:00
Valentin Shergin f085d2bac0 Fixed small bag in computing contentSize of TextInput
Reviewed By: AaaChiuuu

Differential Revision: D5091491

fbshipit-source-id: ece8ac30b930aafc32a7994057d305025e4b032e
2017-05-19 11:37:27 -07:00
Pieter De Baets 74a70fea97 Add some helper methods to JStackTraceElement
Reviewed By: mhorowitz

Differential Revision: D5069764

fbshipit-source-id: e2073ab824c357b28e00838abc768d402905207d
2017-05-19 04:15:45 -07:00
Pieter De Baets 99f8c5df37 Sync fbjni to React Native
Reviewed By: mhorowitz

Differential Revision: D5086537

fbshipit-source-id: a95863113b3c63530a2550d29dfdc9626be86dc0
2017-05-19 04:15:45 -07:00
Emil Sjolander c6dd3d137b Add missing okio deps
Reviewed By: bestander

Differential Revision: D5094495

fbshipit-source-id: 395d63ff82022c83f58cae8b0005e0ec735ab958
2017-05-19 04:15:45 -07:00
Alexey Lang 523a103108 Make Systrace less noisy in Java
Reviewed By: AaaChiuuu

Differential Revision: D5087152

fbshipit-source-id: 5aa911e834be2ee0d8c5c53ec71e617d02da564f
2017-05-19 02:47:06 -07:00
Alex Kotliarskyi 3f8af2deee Better context for "Calling JS function after bridge has been destroyed" warning
Reviewed By: AaaChiuuu

Differential Revision: D5091701

fbshipit-source-id: 9bf66cf35ffc3ade82a0ee61227760f0946d410d
2017-05-18 17:02:06 -07:00
Greg Herlihy b5eb104617 Fix view collapsing
Summary:
Make more views collapse on Android by designating FLEX_BASIS, FLEX_GROW and FLEX_SHRINK as "layout-only" props.

Relies on existing layout tests.

See Issue #13622
Closes https://github.com/facebook/react-native/pull/13868

Reviewed By: astreet

Differential Revision: D5035864

Pulled By: javache

fbshipit-source-id: d2c9e0b33b07e51b19afc383ef913ac41b70415c
2017-05-18 11:31:52 -07:00
Andrew Y. Chen 6c4e8d74cd Fix copy paste second attempt
Reviewed By: AaaChiuuu

Differential Revision: D5080735

fbshipit-source-id: c76fb204c114b8a8fc884aa208ad5fa9bba01fcb
2017-05-18 09:46:04 -07:00
Emil Sjolander 93a1d592d6 Update okhttp3
Reviewed By: bestander

Differential Revision: D5078004

fbshipit-source-id: 79c66cedeeb682d8bb4e67798b41115899fd1c81
2017-05-18 08:16:02 -07:00
Aaron Chiu 658f632f59 add Systrace to ReactRootView
Reviewed By: alexeylang

Differential Revision: D5085095

fbshipit-source-id: 0ec42ecede72baa5f761c525fe9fd210361181be
2017-05-18 06:51:40 -07:00
David Aurelio d7659a0ec6 Move stack trace formatting in own class
Summary: Moves stack trace formatting logic into its own class to facilitate reusage from custom exception managers.

Reviewed By: javache

Differential Revision: D5086336

fbshipit-source-id: f434a1621c599c5c49991b3bfe5f66d05f84b5c9
2017-05-18 05:32:55 -07:00
Kathy Gray cc16830cfb Clean up package and imports left over from bridge merge
Reviewed By: javache

Differential Revision: D5077810

fbshipit-source-id: 2f569bfc9d0c45d2ca93b6e036efdaec9511633c
2017-05-17 07:46:53 -07:00
Andrew Y. Chen 4a225f79a3 Make ReactShadowNode's toString useful
Reviewed By: AaaChiuuu

Differential Revision: D5054307

fbshipit-source-id: af548077e9efabcdd9d86c3c06f6408a022762b8
2017-05-16 11:16:28 -07:00
Nitin George 06993fb780 Fix - NetInfoModule intialization
Reviewed By: AaaChiuuu

Differential Revision: D5065578

fbshipit-source-id: 618fbd036bbcbdcafe751802380c1047375ccf19
2017-05-16 10:47:14 -07:00
Dmitry Petukhov 36405d13ff Implemented linear gradient fill in Android
Summary:
Partial implementation of "TODO(6352048): Support gradients etc.": linear gradient fill implemented.

We implemented a custom Color Picker based on ReactART.

<img width="268" alt="screen shot 2016-12-19 at 12 27 09 pm" src="https://cloud.githubusercontent.com/assets/18415611/21309512/5033b5a4-c5e7-11e6-9558-5571d18210e9.png">
Closes https://github.com/facebook/react-native/pull/11541

Differential Revision: D5061836

Pulled By: ericvicenti

fbshipit-source-id: ec8b7a0a6f3d2d1a2c1b394d4960d3365ad6fb44
2017-05-16 00:03:08 -07:00
Paco Estevez Garcia 93f07ed31d Inspector crashes with NetworkOnMainThreadException in Android
Reviewed By: johnislarry

Differential Revision: D5062290

fbshipit-source-id: 0307d2d950b6f54c36f882470c3ac4c5cfb1c5b7
2017-05-15 12:18:02 -07:00
Pieter De Baets 0c1e009ad9 Disable SamplingProfiler for OSS builds
Summary:
It depends on symbols that are not available.
Closes https://github.com/facebook/react-native/pull/13950

Reviewed By: cwdick

Differential Revision: D5053724

Pulled By: javache

fbshipit-source-id: 9d5676ce5e4ad3ceeb20aeb8c48429319d48799e
2017-05-15 08:01:56 -07:00
Pieter De Baets 6221053179 Improve systrace markers
Reviewed By: mhorowitz

Differential Revision: D4860135

fbshipit-source-id: ce963010883e6b9cc8e34f7ff01b4018cd195eba
2017-05-12 18:07:49 -07:00
ivmarkov 28748f165b Support custom packager port when debugging on Android
Summary:
This three liner addresses the issue described by Rovack here: #9935

Basically, changing the React Native Packager port from 8081 to, say, 8088 does work, *except* if you want to debug your code with ChromeDevTools (i.e. selecting "Debug JS Remotely" from the Android app dev menu).

The analysis of Rovack, pointing to a hard-coded port in DevServerHelper.getHostForJSProxy() was *spot on* - many thanks to him.
Closes https://github.com/facebook/react-native/pull/12095

Differential Revision: D5044330

Pulled By: mkonicek

fbshipit-source-id: c07f59f700683ffba84f03d44f82b394e2e899c1
2017-05-12 13:31:24 -07:00
Emil Sjolander 54548894d0 Fix flex basis not accounting for max size constraint
Reviewed By: gkassabli

Differential Revision: D5044314

fbshipit-source-id: d9f9db832e4943a57a89c9d162ff6077b709795a
2017-05-12 09:18:56 -07:00
Pieter De Baets 6e2c07534e Fix Circle CI builds
Summary: Closes https://github.com/facebook/react-native/pull/13945

Differential Revision: D5052083

Pulled By: javache

fbshipit-source-id: eeda8253d26c2dfd0d20b93b238377fe92e3ca3c
2017-05-12 08:35:30 -07:00
Emil Sjolander 81b9e108bb Big refactor moving most logic into DebugComponent
Reviewed By: passy

Differential Revision: D5027780

fbshipit-source-id: 95a95b3572747aa2088f8f9b35a160257eb59269
2017-05-12 04:03:30 -07:00
Aaron Chiu c7317c5e61 make the CREATE_MODULE marker actually end
Reviewed By: fkgozali

Differential Revision: D5024378

fbshipit-source-id: 6f25ecd15e25a6d9aabaa52013c2abe24a3f8fb9
2017-05-11 20:00:21 -07:00
Georgiy Kassabli 70b7488f97 Adding node type and moving rounding dependency to rely on that type
Reviewed By: emilsjolander

Differential Revision: D5025107

fbshipit-source-id: a8d66e2f9c5d02ab080784cc474be583a09b92e2
2017-05-11 08:17:58 -07:00
Kathy Gray 8b53a2b29b Merging cxxbridge and bridge packages
Reviewed By: javache

Differential Revision: D5027875

fbshipit-source-id: 47e081069d4219bdb29f63ce8a78c1f31a590da7
2017-05-11 03:50:52 -07:00
Michael Lee 48c27b9a6c Fix gradle build due to renamed boost directory
Reviewed By: yungsters

Differential Revision: D5033507

fbshipit-source-id: 1ab1126e0beb0a72f5a090a7cfeee0d5d99b0d16
2017-05-10 06:03:06 -07:00
Pieter De Baets 567015fa04 Mark ByteBuffer methods as const
Reviewed By: emilsjolander

Differential Revision: D5020648

fbshipit-source-id: 6e60b80cb3d4718bab25dd6ca9627aee862117db
2017-05-10 04:32:54 -07:00
Ben Nham 65f22a5190 log script name with bundle loading perf event
Reviewed By: javache

Differential Revision: D5010638

fbshipit-source-id: 2e139201a8374245fa1dedc4f11a716dcf700fd7
2017-05-10 04:09:19 -07:00
Lukas Piatkowski 5dcfb2c6ad Add SamplingProfilerMethod to CSDevelopmentGlobalStateManager
Reviewed By: cwdick

Differential Revision: D5010523

fbshipit-source-id: ad602dfae039e0cbb7c62d42d75a93d1aa2d3aa4
2017-05-10 04:09:19 -07:00
Lukas Piatkowski 621148d724 Extract bundle download logic from DevServerHelper to BundleDownloader
Reviewed By: cwdick

Differential Revision: D4729058

fbshipit-source-id: 6ffbe4dbd916ac7ac6afffba2cf070aab9cb87b9
2017-05-10 04:09:19 -07:00
Lukas Piatkowski 9468c5a733 Added method handler for Sampling Profiler that uses only JSCcontext and JSC API
Reviewed By: cwdick

Differential Revision: D4689688

fbshipit-source-id: d1f9df0b3dcb21420cf813888c19f2d9a9aa5646
2017-05-10 04:09:19 -07:00
Fred Liu a324dfbd51 Allow Android videos to be shown in the CameraRoll selector
Summary:
Currently, Android camera roll videos cannot be retrieved in RN since

1) `CameraRollManager.java` doesn't do anything with the `assetType` param
2) Unspecifying MIME types doesn't show videos

This diff allows videos to be shown in the `CameraRoll.getPhotos(..)` call by reading `assetType`. Future diffs will come where the thumbnail and other info will be returned as well.

Reviewed By: furdei

Differential Revision: D5019202

fbshipit-source-id: a920273761b31f1a59ba6b8bc49c05852506829c
2017-05-10 03:31:24 -07:00
Aaron Chiu 20c2ae85f0 allow calling NativeViewHierarchyManager.addRootView() off the UI thread
Reviewed By: yungsters, shergin

Differential Revision: D4998706

fbshipit-source-id: f95cdcb0d193ffff2dfe39f9523a222d958ba5c6
2017-05-08 11:31:19 -07:00