Commit Graph

1644 Commits

Author SHA1 Message Date
Lukas Piatkowski d8f48d1b51 Refactor the packager server for further protocol changes
Reviewed By: cwdick

Differential Revision: D4543321

fbshipit-source-id: f7d5823b0d340f8ca17b3dd6caf4e158fa918bcf
2017-02-14 09:45:57 -08:00
Lukas Piatkowski e28a12c613 Introducing Responder and JSONObject to JSPackagerClient
Reviewed By: cwdick

Differential Revision: D4537115

fbshipit-source-id: 61ee03d3e700bbee8b1cdb02bbf31a8491ca7891
2017-02-14 09:45:57 -08:00
Lukas Piatkowski 47616d84d8 Split JSPackagerWebSocketClient into JSPackagerClient and ReconnectingWebSocket
Reviewed By: cwdick

Differential Revision: D4495054

fbshipit-source-id: 49c634dde789317270c711370dfbdc82f70f44cd
2017-02-14 09:45:57 -08:00
Adam Comella 186f308aec BREAKING: Android: Correct value of Dimensions.get('screen').fontScale
Summary:
The PR description has been updated to reflect the new approach.

**Breaking Change Summary**

On Android, the following properties now return a different number:
  - `Dimensions.get('window').fontScale`
  - `Dimensions.get('screen').fontScale`
  - `PixelRatio.getFontScale()`

This is a breaking change to anyone who was using these properties because the meaning of these properties has now changed.

These properties used to return a value representing font scale times density ([`DisplayMetrics.scaledDensity`](https://developer.android.com/reference/android/util/DisplayMetrics.html#scaledDensity)). Now they return a value representing just font scale ([`Configuration.fontScale`](https://developer.android.com/reference/android/content/res/Configuration.html#fontScale)).

**PR Description**

This PR changes a few things:
  - Correctly exposes the font scale to JavaScript as `Dimensions.get('screen').fontScale`. UIManager was exporting `DisplayMetrics.scaledDensity` under the name `fontScale`. How
Closes https://github.com/facebook/react-native/pull/11008

Differential Revision: D4558207

Pulled By: astreet

fbshipit-source-id: 096ce7b28051325dfd45fdb2a14b5e9b7d3bc46f
2017-02-14 08:45:38 -08:00
Aaron Chiu 7c82803c4d clean up ModuleHolder.java
Reviewed By: achen1

Differential Revision: D4548524

fbshipit-source-id: 5fab273e7a461c0312fa555aaccb8869843d9d95
2017-02-13 20:31:07 -08:00
Aaron Chiu 78801793f3 move the module creation out of the constants creation systrace
Reviewed By: achen1

Differential Revision: D4555801

fbshipit-source-id: 5ee338a686bca33f0a480bd6b428a44f626620d1
2017-02-13 19:31:04 -08:00
Aaron Chiu 50de41d5d6 log getConstants for Java modules
Reviewed By: fkgozali

Differential Revision: D4548706

fbshipit-source-id: ffcb6acd15e517ee13da88ef9a901f15e96a87c8
2017-02-13 14:45:17 -08:00
Adam Comella ea6845ca22 BREAKING: Android: Refactor so uimanager can depend on modules/core
Summary:
cc astreet

The goal of this PR is to enable the buck module `uimanager` to depend on `modules/core` without introducing any dependency cycles.

PR #11008 relies on this PR. PR #11008 needs `uimanager` to depend on `modules/core` so that `uimanager` can fire events using `RCTDeviceEventEmitter` which is in `modules/core`.

This PR moved a number of classes and interfaces:
  - `com.facebook.react.modules.debug.DeveloperSettings` -> `com.facebook.react.modules.debug.interfaces.DeveloperSettings`
  - `com.facebook.react.devsupport.DevOptionHandler` -> `com.facebook.react.devsupport.interfaces.DevOptionHandler `
  - `com.facebook.react.devsupport.DevSupportManager` -> `com.facebook.react.devsupport.interfaces.DevSupportManager`
  - `com.facebook.react.devsupport.DevServerHelper.PackagerStatusCallback` -> `com.facebook.react.devsupport.interfaces.PackagerStatusCallback`
  - The class `com.facebook.react.devsupport.StackTraceHelper.StackFrame` was renamed to `StackFram
Closes https://github.com/facebook/react-native/pull/12329

Differential Revision: D4551160

Pulled By: astreet

fbshipit-source-id: 3a78443c4f30469b13ddfbdcc9bbef6af9e8381a
2017-02-13 11:02:44 -08:00
Lukas Wöhrl 17604ec6fe Add support for space-between and space-around on align-content
Summary:
Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum.

Fix #229
Closes https://github.com/facebook/yoga/pull/364

Reviewed By: gkassabli

Differential Revision: D4528561

Pulled By: emilsjolander

fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
2017-02-11 08:48:24 -08:00
Emil Sjolander 427b92e210 Use Float.compare in java equals
Reviewed By: astreet

Differential Revision: D4531805

fbshipit-source-id: 723e15381e9fa39837a4c99f726501eda26af11b
2017-02-11 06:30:53 -08:00
Emil Sjolander 5194e0349c Always return undefined value if nothing is set
Reviewed By: astreet

Differential Revision: D4531779

fbshipit-source-id: 97a789e70dcf0fb5174e2039991e7a2b27f45f01
2017-02-11 06:30:53 -08:00
Emil Sjolander 21475e58b3 Expose layout border to java
Reviewed By: astreet

Differential Revision: D4543284

fbshipit-source-id: 6030915fc6f758e785a688f94c8ffbec7fbac8b8
2017-02-11 06:30:52 -08:00
Aaron Chiu 476b9f83a8 log CREATE_MODULE time of all non-laifiable modules
Reviewed By: fkgozali

Differential Revision: D4513014

fbshipit-source-id: f52c8286da3418c575e14bda0a04866719f2b1cb
2017-02-10 15:33:23 -08:00
Aaron Chiu 15ceed4069 annotate "CREATE_MODULE" QP log with the name of the module being created
Reviewed By: achen1

Differential Revision: D4513001

fbshipit-source-id: b98024796c0b0cd2489a67bf0695c86d994689d6
2017-02-10 12:56:08 -08:00
Lukas Piatkowski 6f2544a16b Extract the JSPackagerWebSocketClient into a reusable packagerconnection module
Reviewed By: cwdick

Differential Revision: D4488628

fbshipit-source-id: ad07b7bfe74c6916beceb0ebcc506a57319f4ae9
2017-02-10 10:47:04 -08:00
Lukas Piatkowski 3329969b63 Pass WebSocketSender wrapper instead of WebSocket to callback handler
Reviewed By: cwdick

Differential Revision: D4488064

fbshipit-source-id: eb7113f5f4ba65546c0bd0336dc65b6fae610a53
2017-02-10 10:47:04 -08:00
Andy Street 36ab9f6a60 Don't continue to execute UI operations after one has thrown an exception
Summary:
If we throw an exception from a UIOperation, the UI is likely in a bad state and we shouldn't execute any other operations on it. In non-dev mode, this would mean we've crashed and don't have to worry about that. But in dev mode, we may have shown a redbox and the instance is still active. This means doing something like reloading, which will trigger onPause and thus flush more UI operations, can crash the app while its sitting on a red box.

This diff aims to prevent that by no longer executing UI operations after one has thrown an exception.

Reviewed By: AaaChiuuu

Differential Revision: D4536925

fbshipit-source-id: 15c21bb76ad3419a54d9d5de94b6bd1f70a3e4a4
2017-02-10 07:02:33 -08:00
Andy Street b38f345d4c Guard activity lifecycle events with redbox
Summary: Activity lifecycle events in native modules can cause exceptions: we should redbox them like we do all other application-logic triggered exceptions.

Reviewed By: AaaChiuuu

Differential Revision: D4537111

fbshipit-source-id: 71abf8696173a3d647e858c4ea316a169ad2d8ef
2017-02-10 07:02:33 -08:00
Aaron Chiu 53a7d5822b don't call OnBatchComplete on specific modules unless we need to
Summary:
Don't call OnBatchComplete on NativeModules that have'nt been initialized.
Also a follow up to D4479604. This also removes the extra allocation of OnBatchCompleteListener per NativeModule that implements OnBatchCompleteListener.

This means NativeModules which implement OnBatchCompleteListener will have to be explicitly initialized or called into before the OnBatchCompleteListener of that NativeModule will be triggered.

Reviewed By: javache

Differential Revision: D4483682

fbshipit-source-id: 6a9431c82f72d17605d1c1e0ee9194f8d8fc2ddc
2017-02-09 22:30:03 -08:00
Aaron Chiu 9d7f2498f6 fix overriding RN Perf markers
Reviewed By: fkgozali

Differential Revision: D4513000

fbshipit-source-id: c7c24d3c4851f5719d998b4f08c338a73f47875f
2017-02-09 20:30:42 -08:00
Andy Street a99f6f51a9 Add GuardedRunnable in more places
Summary:
Depends on D4537287

Use new GuardedRunnable abstraction

Reviewed By: achen1

Differential Revision: D4537370

fbshipit-source-id: ad56eaa23c21624008d8ed48837a2d1020cfd2d9
2017-02-09 11:30:36 -08:00
Andy Street 08db896321 Add GuardedRunnable to run blocks of code on the UI thread with automatic redboxing
Summary: Like GuardedAsyncTask, et al, but for Runnables.

Reviewed By: achen1

Differential Revision: D4537287

fbshipit-source-id: 8ae60c7007843c0b7d8e5c3835d0847921fb3db5
2017-02-09 11:30:36 -08:00
Aaron Chiu 9f3e928f83 merge module info into ModuleHolder
Reviewed By: javache

Differential Revision: D4512982

fbshipit-source-id: e1272812f95d08f2c3eb834a18da842d425b3edb
2017-02-08 11:16:02 -08:00
Janic Duplessis 7555ae13d1 Init diffclamp node at 0 to avoid problems with NaN
Summary:
Some nodes have a value of NaN initially so if we assign the value of the input in the constructor it is possible we get NaN as a value and then it will break when trying to update the value. Initializing at 0 is actually fine with this node since it will get updated properly in the `update` method.

**Test plan**
Tested in an app that uses native animated diffclamp where I noticed the issue. Made sure this change fixed it.
Closes https://github.com/facebook/react-native/pull/12279

Differential Revision: D4527866

fbshipit-source-id: add3fc0d86ffcf4ddcd01ff3251f2373eeaa2cf5
2017-02-08 01:30:44 -08:00
Kevin Gozali 904afaf8c7 add perf marker for i18n assets module creation
Reviewed By: AaaChiuuu

Differential Revision: D4523956

fbshipit-source-id: b84a3d0887da512e3aebef5f02e77e992c151ec4
2017-02-08 00:45:46 -08:00
Valentin Shergin d8748233ca Removing `transformMatrix` and `decomposedMatrix` properties
Summary: We deprecated `transformMatrix` and `decomposedMatrix` in D3239960 10 months ago. This revision finally removes remains of this functionality from native code.

Reviewed By: mmmulani

Differential Revision: D4515760

fbshipit-source-id: b4d5b7e834ac4a775f4992b28270b4ff961889a6
2017-02-07 14:02:20 -08:00
Antonio Corrado 4c3f03e4c5 Setting min=max dimension is treated as setting dimension
Reviewed By: emilsjolander

Differential Revision: D4492395

fbshipit-source-id: 3f4293548399e006aa808b9586d24e77c7df1f21
2017-02-06 14:45:43 -08:00
awitherow a57ddd5d72 Allow specific border width styling
Summary:
ahmedre, is this in accordance to what you mentioned in comment https://github.com/facebook/react-native/issues/11042#issuecomment-269892926 ?

fixes #11042

NO TEST PLAN AS OF YET! NOT READY.

I am going to attempt to show this in my current application today.
Closes https://github.com/facebook/react-native/pull/11706

Differential Revision: D4494439

Pulled By: mkonicek

fbshipit-source-id: 2e1ee4c4a8347ddb29ee28bafe5ca5f7b6c04317
2017-02-06 09:58:31 -08:00
Lukas Wöhrl ccc56bba8f Added property display: flex and none
Summary:
Fix #241 and successor for #302

Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369

Reviewed By: astreet

Differential Revision: D4501141

Pulled By: emilsjolander

fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
2017-02-06 09:43:27 -08:00
Andrei Coman 968aa56ca3 Add border support to ScrollViews
Reviewed By: AaaChiuuu

Differential Revision: D4498409

fbshipit-source-id: e5baca47b647c4fcb37cdad8fad951f6749c65f8
2017-02-06 09:13:32 -08:00
Adam Comella 69e98cfc75 Android: Add onScroll event to TextInput
Summary:
Corresponding iOS PR: https://github.com/facebook/react-native/pull/11002

This adds an onScroll event to TextInput which is useful when a multiline TextInput has so much content that it is scrollable.

**Test plan (required)**

Verified the event works properly in a test app. Also, my team uses this event in our app.

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

Differential Revision: D4220941

Pulled By: mkonicek

fbshipit-source-id: 7e420579946f2ae840c9e1fcdc8afab68007da17
2017-02-06 07:28:28 -08:00
Satyajit Sahoo a06ced4b16 Add perspective transform support on Android
Summary:
Rebased #6926 against master.

Fixes #2915
Closes https://github.com/facebook/react-native/pull/11713

Differential Revision: D4513111

fbshipit-source-id: 9fb653c4bfd64eda12a605f6cabb0159b2af8f73
2017-02-04 11:13:32 -08:00
Oleg Lokhvitsky 0a71f48b13 Fix NetworkingModule losing Cookies when multiple CatalystInstances exist and one is destroyed
Differential Revision: D4451197

fbshipit-source-id: 905309f626a2295ecaa2451413e414eb827e10b0
2017-02-03 12:58:46 -08:00
Emil Sjolander 82f61b990a Pass parent with down with calculateLayout to allow percentages on root node
Reviewed By: astreet

Differential Revision: D4501016

fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb
2017-02-03 11:28:48 -08:00
Emil Sjolander 4b89a4ac20 Use fromInt() instead of indexing values() as it allocates a new array
Reviewed By: pasqualeanatriello

Differential Revision: D4494371

fbshipit-source-id: 11cff65114803e185bc67a96da0bf2a2c4a3e6d9
2017-02-02 15:28:31 -08:00
Martin Konicek 0ecc4047af Fix Buck files after removing RecyclerViewBackedScrollView
Summary:
Remove unused deps to fix broken CI: https://circleci.com/gh/facebook/react-native/15242

Missed this in 6ec5654e7a.

**Test plan (required)**

The `buck fetch` that's failing on CI worked locally.
Closes https://github.com/facebook/react-native/pull/12166

Differential Revision: D4501093

Pulled By: mkonicek

fbshipit-source-id: c48815de319d85ef0a3408d76b120090c02587ed
2017-02-02 05:28:34 -08:00
Pieter De Baets 4d2512aef9 Replace MethodCallResult with folly::Optional
Reviewed By: AaaChiuuu

Differential Revision: D4481987

fbshipit-source-id: 945dd671eb2482f3c6b626192aa2181c5bfd906f
2017-02-02 05:13:33 -08:00
Janic Duplessis ee737e7d1c Fix layout animations for views with a transform
Summary:
Fixes LayoutAnimation when animating the position of a view that has a transform, the animation would start at the wrong position, offset by the transform translation value. I noticed this bug while working on sticky headers using animated in the UIExplorer <ListView> - Paging example.

**Test plan**
Made a simple repro for the bug https://gist.github.com/janicduplessis/eb985dc3accfd5982c77761be692e395 and tested that it fixed it. Also tested that the UIExplorer <ListView> - Paging example with sticky headers worked properly with this fix.
Closes https://github.com/facebook/react-native/pull/12140

Differential Revision: D4494389

Pulled By: mkonicek

fbshipit-source-id: dd49cb2db9dd4950e293596fbc773f7d79e8b10a
2017-02-02 04:29:52 -08:00
Adam Comella 12c4868628 Android: Add overScrollMode prop to ScrollView
Summary:
This prop exposes the functionality provided by Android ScrollView's setOverScrollMode method.

One interesting thing to note is that, if you were to read the Android docs, you would think that the value "always" is the default over scroll mode. However, the docs are incorrect and "always-if-content-scrolls" is actually the default value (http://stackoverflow.com/a/27116306).

**Test plan (required)**

Verified this change in a test app. Also, our team uses this change in our app.

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

Differential Revision: D4500957

Pulled By: mkonicek

fbshipit-source-id: 873eba38183defba133c228e0c1038efa83297d3
2017-02-02 04:29:52 -08:00
Andrew Jack 9c3beb9896 saveToCameraRoll should use DCIM folder
Summary:
The DCIM folder is a better mapping to a "CameraRoll" than the "movies" or "pictures" directories.

https://developer.android.com/reference/android/os/Environment.html#DIRECTORY_DCIM
```
DIRECTORY_DCIM
The traditional location for pictures and videos when mounting the device as a camera.
Note that this is primarily a convention for the top-level public directory, as this convention makes no sense elsewhere.
```

**Test plan**

- Make sure tests pass on both Travis and Circle CI.
- Test `saveToCameraRoll` in an example app, and check it is saved to the expected folder in a photos app.
Closes https://github.com/facebook/react-native/pull/12059

Differential Revision: D4500946

Pulled By: mkonicek

fbshipit-source-id: 8af994492303c175374502dffe6fd2f3e4e9975e
2017-02-02 04:13:59 -08:00
Vojtech Novak 725e8aba3d clarify a message in preferences.xml
Summary:
Especially for newcomers, this may help since some may think the effect is immediate.
Closes https://github.com/facebook/react-native/pull/12066

Differential Revision: D4500929

Pulled By: mkonicek

fbshipit-source-id: dfa05134f208c084dacb3e490fe9eb8df323ffd5
2017-02-02 03:44:12 -08:00
Martin Konicek 6ec5654e7a BREAKING: Move RecyclerViewBackedScrollView out of open source
Summary: `RecyclerViewBackedScrollView` was added a long time ago to work around the scroll-back-when-data-is-added bug, but that has now been fixed directly in the `ScrollView` (`ReactScrollView.java`) in open source and internally.

Reviewed By: astreet

Differential Revision: D4482105

fbshipit-source-id: 208f21f00045d5c5a83b74ad69b3db6fa63391d7
2017-02-02 03:44:12 -08:00
Andy Street 866ac17331 Reset pointerEvents on null value
Summary: This was ignored before.

Reviewed By: javache

Differential Revision: D4495022

fbshipit-source-id: 9003fa109ef0274b2d1d023d9839a7027cbf522a
2017-02-01 11:13:32 -08:00
Satyajit Sahoo 295a0150d4 Support customizing thumb, track and progress colors for slider on Android
Summary:
**Motivation**

Ability to customize slider colors is desirable to match the brand. Currently iOS allows using images for slider parts, but android doesn't have any customization options. This PR adds support for customizing `thumbTintColor`, `trackTintColor` and `progressTintColor`.

**Test plan (required)**

Run UIExplorer example with the changes and verify everything works fine.

![image](https://cloud.githubusercontent.com/assets/1174278/22020752/f32a6eec-dcdf-11e6-928d-481bb28bd0a3.png)

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

Differential Revision: D4427474

fbshipit-source-id: ec3a38db600bac6108691a4cfa15e2409143b9f3
2017-02-01 00:43:29 -08:00
Satyajit Sahoo 31099aa233 Support tintColor and thumbTintColor for Switch on Android
Summary:
**Motivation**

`Switch` on Android doesn't allow changing the colors unlike iOS. Changing the colors is desirable in a lot of cases to match the brand colors.

The PR adds support for the `tintColor`, `onTintColor` and `thumbTintColor` props on Android, which more or less behave the same as iOS. The only difference is `tintColor` styles the border color on iOS, whereas it styles the background color on Android.

**Test plan (required)**

Run UIExplorer with the changes, and ensure that the switch example works properly. Here are screenshots from iOS and Android to compare.

![image](https://cloud.githubusercontent.com/assets/1174278/22018002/b05d6482-dcd2-11e6-9c00-f55a71d6ce29.png)

![image](https://cloud.githubusercontent.com/assets/1174278/22018012/b923e974-dcd2-11e6-8d4e-86994f5a66e6.png)

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

Differential Revision: D4427491

fbshipit-source-id: 16c569d2e2261daaea93fffa83198f8f6b59a6c8
2017-01-31 13:43:43 -08:00
Pieter De Baets 33fdce9088 Make consumption of NativeArray explicit
Reviewed By: mhorowitz

Differential Revision: D4415232

fbshipit-source-id: a27dd5cc3994c01fb1ca6e4c1d4f87cb8a95896a
2017-01-31 07:58:27 -08:00
Pieter De Baets f8c72f5441 Support invoking and returning arbitrary types from Java sync hooks
Reviewed By: mhorowitz

Differential Revision: D4409900

fbshipit-source-id: 347e33c442b32f64355d343308c218c15cf5a70f
2017-01-31 05:28:35 -08:00
Mani Ghasemlou cfb90284d6 Fix potential NPE in UIViewOperationQueue.
Summary:
We were noticing the following crash in our application, that was occurring fairly often, but still hard to reproduce:

```
12-12 10:37:35.342: E/AndroidRuntime(9064): FATAL EXCEPTION: main
12-12 10:37:35.342: E/AndroidRuntime(9064): Process: com.bloomberg.android.plus, PID: 9064
12-12 10:37:35.342: E/AndroidRuntime(9064): java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.uimanager.UIViewOperationQueue$UIOperation.execute()' on a null object reference
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQueue$2.run(UIViewOperationQueue.java:782)
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:829)
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQueue.access$1500(UIViewOperationQueue.java:44)
12-12 10:37:35.342: E/AndroidRuntime(9064): 	at com.facebook.react.uimanager.UIViewOperationQ
Closes https://github.com/facebook/react-native/pull/11428

Differential Revision: D4487841

Pulled By: astreet

fbshipit-source-id: ae49ef77967edea7514cbf40cb533c4b63fd34ae
2017-01-31 05:13:34 -08:00
Aaron Chiu 29616e3122 strip off RK/RCT prefix from NativeModules
Reviewed By: javache

Differential Revision: D4487530

fbshipit-source-id: ea16720dc15e490267ad244c43ea9d237f81e353
2017-01-31 04:58:29 -08:00
Aaron Chiu af111ab2ac pass AbstractDraweeControllerBuilder and CallerContext to Nodes
Reviewed By: yungsters

Differential Revision: D4487352

fbshipit-source-id: cf4540a5b2f8fc1444ff7ff0ce2ce280538f4f7b
2017-01-30 23:28:22 -08:00