Commit Graph

2001 Commits

Author SHA1 Message Date
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