Commit Graph

1612 Commits

Author SHA1 Message Date
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
Martin Konicek ad8cbb6dea Support ScrollView.scrollToEnd on Android natively
Summary:
This is a followup for https://github.com/facebook/react-native/pull/12088 and implements the scrolling to end on Android natively rather than sending a large scroll offset from JS.

This turned out to be an OK amount of code, and some reduction in the amount of JavaScript. The only part I'm not particularly happy about is:

```
// ScrollView always has one child - the scrollable area
int bottom = scrollView.getChildAt(0).getHeight() + scrollView.getPaddingBottom();
```

According to multiple sources (e.g. [this SO answer](http://stackoverflow.com/questions/3609297/android-total-height-of-scrollview)) it is the way to get the total size of the scrollable area, similar to`scrollView.contentSize` on iOS but more ugly and relying on the fact the ScrollView always has a single child (hopefully this won't change in future versions of Android).

An alternative is:

```
View lastChild = scrollLayout.getChildAt(scrollLayout.getChildCount() - 1);
int bottom = lastChild.getBottom() + scrollLayout.getPadd
Closes https://github.com/facebook/react-native/pull/12101

Differential Revision: D4481523

Pulled By: mkonicek

fbshipit-source-id: 8c7967a0b9e06890c1e1ea70ad573c6eceb03daf
2017-01-30 10:28:32 -08:00
Pieter De Baets 0e7d0ebd9a Delete ModuleRegistryHolder
Reviewed By: mhorowitz

Differential Revision: D4411478

fbshipit-source-id: 03f48f92f0d97bd5e3318f60c8357242fe9792cf
2017-01-30 09:43:48 -08:00
Aaron Chiu 0e0a6e8a29 move NativeModuleRegistry creation logic into it's own class
Reviewed By: javache

Differential Revision: D4479604

fbshipit-source-id: 297fccd25c7400176bcb7821b644d9b05e465ffa
2017-01-30 06:43:48 -08:00
Pieter De Baets 919e49a8b8 Pass expanded folly::dynamic as argument to sync nativeHook
Reviewed By: mhorowitz

Differential Revision: D4409865

fbshipit-source-id: f99e02e36bf691fa5b4a5affce1fa4fd4cf321a6
2017-01-30 06:43:48 -08:00
Pieter De Baets 2a638c2ee7 Remove unused functionality in CxxModuleWrapper
Reviewed By: mhorowitz

Differential Revision: D4409789

fbshipit-source-id: 91e70d8333141e1e4dcba0e2620ef2c744d0c9d3
2017-01-30 06:43:48 -08:00
Pieter De Baets 59226f022c Merge ReactMethod and ReactSyncHook
Reviewed By: astreet

Differential Revision: D4409726

fbshipit-source-id: 7a0091da754b114680772aa9c0a898b1aa721ba5
2017-01-30 06:43:48 -08:00
huangqi03 af5c21b1ef fix: webview.postMessage throws not a constructor in WebView in Android 4.1 ~ 4.3
Summary:
`new MessageEvent` not support for Android 4.1 ~ 4.3 WebView.

change

``` javascript
document.dispatchEvent(new MessageEvent('message', data)))
```

to

``` javascript
(function () {
  var event;
  var data = {};
  try {
    event = new MessageEvent('message', data);
  } catch (e) {
    event = document.createEvent('MessageEvent');
    event.initMessageEvent('message', true, true, data.data, data.origin, data.lastEventId, data.source);
  }
  document.dispatchEvent(event);
})()
```
Closes https://github.com/facebook/react-native/pull/11560

Differential Revision: D4461360

fbshipit-source-id: 110220817d9570e86b31dcf8fe85f6616d54d36e
2017-01-29 08:58:37 -08:00
Max Graey c68195929b Fix skew transform on native side (iOS & Android)
Summary:
According to #11992 fix skew transform in native code as well

janicduplessis vjeux
Closes https://github.com/facebook/react-native/pull/12106

Differential Revision: D4479880

fbshipit-source-id: d84780842b555f6352d84d229b5b6c5c3c6a0647
2017-01-28 12:43:30 -08:00
Aaron Chiu 9615d3bdb5 move ViewManager addition out of FlatUIImplementation
Reviewed By: achen1

Differential Revision: D4467400

fbshipit-source-id: 3027c1d4a2ccc691d474c0c06e61b47475e6bff7
2017-01-27 18:43:28 -08:00
Aaron Chiu 5c7009d147 log constants map conversion for UIManagerModule and I18N Module
Reviewed By: yungsters

Differential Revision: D4473401

fbshipit-source-id: 7c2a7484305a099fe6a49cbcd0a1d9d9d082a3f8
2017-01-27 18:13:34 -08:00
Pieter De Baets 5cbb05c9cc Use fbjni in JSLoader
Reviewed By: lexs

Differential Revision: D4392412

fbshipit-source-id: a363b26d16cf9e39f9fefd1afd299fae210663c7
2017-01-27 06:28:29 -08:00
Aaron Chiu 0bfb426877 add some markers to breakdown ReactInstanceManager.processPackages
Reviewed By: alexeylang

Differential Revision: D4469884

fbshipit-source-id: 891a37aaf2fc472b2614e551c3564075a1a43484
2017-01-26 18:13:27 -08:00
Gerald Monaco fc2936cea9 Don't require a DevSupportManager to create a DevInternalSettings
Summary: It should be possible to use the latter without using the former.

Reviewed By: ashwinb

Differential Revision: D4321776

fbshipit-source-id: 935fbb3fdb47369e18992aca0497d312ad6023bc
2017-01-26 17:28:29 -08:00
Emil Sjolander 3d1c8694d0 Format and run codegen
Reviewed By: dshahidehpour

Differential Revision: D4459455

fbshipit-source-id: fc1eca58fe897c8f4a2571638b4f7035d023b479
2017-01-26 13:43:35 -08:00
Lukas Piatkowski 25fba55708 If jsc cpu profile is taken with js1 the post processing will happen on js1
Reviewed By: cwdick

Differential Revision: D4442067

fbshipit-source-id: 8bd3c76e206da5e50b30307f0c070cc7d45071f2
2017-01-25 10:43:55 -08:00
Aaron Chiu 3589dec58e remove extraneous method data
Reviewed By: achen1

Differential Revision: D4454618

fbshipit-source-id: f3e68fa6e00e27e2ff7a2f20500092e1eeeb10a1
2017-01-24 16:13:28 -08:00
Emil Sjolander f249a78df6 Use findClassStatic instead of findClassLocal
Reviewed By: mhorowitz

Differential Revision: D4420352

fbshipit-source-id: 8c66c1b2213fe295334a9bdc4e1dd7e1a4285aae
2017-01-24 15:58:46 -08:00
Janic Duplessis 1100c40cb8 Fix TextInput placeholder font when using custom fonts. Fixes #4600
Summary:
When using a TextInput with a custom font, the placeholder didn't use that font. This is because ReactTextInputManager didn't use ReactFontManager to create the TypeFace which handles custom fonts.

**Test plan**
Tested in UI explorer by reproducing the bug with and testing that the custom font gets applied properly after the fix.
``` js
<TextInput
  placeholder="Hello"
  style={{ fontFamily: 'notoserif' }}
/>
```
Closes https://github.com/facebook/react-native/pull/12000

Reviewed By: hramos

Differential Revision: D4443713

fbshipit-source-id: e92c9822d9226681d7b00126dad95e5534c0c46e
2017-01-24 11:28:30 -08:00
Aaron Chiu ac1aba4b94 merge XReactInstanceManagerImpl into ReactInstanceManager
Reviewed By: thechefchen

Differential Revision: D4451958

fbshipit-source-id: 40b18b2836a723b11a8bf96d0b0a46cee3a571eb
2017-01-23 19:43:30 -08:00
Aaron Chiu 17c9939444 move ReactInstanceManager.Builder out of ReactInstanceManager into it's own class ReactInstanceManagerBuilder
Reviewed By: thechefchen

Differential Revision: D4451541

fbshipit-source-id: d9cbcb61b232e817a1f4ff7b067a8a4e0c17150a
2017-01-23 17:13:29 -08:00
Pieter De Baets 88eeea0995 Allow views to be collapsed when pointerEvents is set
Reviewed By: astreet

Differential Revision: D4440164

fbshipit-source-id: 88a710affea229228f9c96b82d0bcf4c81f3205d
2017-01-23 11:28:51 -08:00
Philipp von Weitershausen 16bb6e87ba XHR: support typed arrays for request payloads
Summary:
Support `xhr.send(data)` for typed arrays.

**Test plan:** run UIExplorer example on iOS and Android.
Closes https://github.com/facebook/react-native/pull/11904

Differential Revision: D4425551

fbshipit-source-id: 065ab5873407a406ca4a831068ab138606c3361b
2017-01-20 18:43:27 -08:00
Rene Weber 116916b98d TextInput: Avoid firing onSubmitEditing twice on Android
Summary:
For returnKeyType 'go', 'search' and 'send' Android will call
onEditorAction twice, once with IME_NULL and another time with the respective IME_ACTION.
This change makes sure to only fire one onSubmitEditing by always returning true in onEditorAction, which causes no subsequent events to be fired by android.

Fixes #10443

**Test plan**

1. Create view with TextInput having 'go', 'search' or 'send as `returnKeyType`
```javascript
<View>
           <TextInput
                returnKeyType='search'
                onSubmitEditing={event => console.log('submit search')}></TextInput>

           <TextInput
                returnKeyType='go'
                onSubmitEditing={event => console.log('submit go')}></TextInput>

         <TextInput
              returnKeyType='send'
              onSubmitEditing={event => console.log('submit send')}></TextInput>
</View>
```

2. Input some text and click submit button in soft keyboard
3. See event fired only once instead of two times
Closes https://github.com/facebook/react-native/pull/11006

Differential Revision: D4439110

Pulled By: hramos

fbshipit-source-id: 5573b7f15f862b432600ddd3d61a0852ce51b2b3
2017-01-20 17:58:29 -08:00
Aaron Chiu 5e9db574ee access view managers as Native Modules
Reviewed By: achen1

Differential Revision: D4338782

fbshipit-source-id: 1573e45ee3af5a44d033a166424e556b2c091fb6
2017-01-20 15:58:27 -08:00
Ashok Menon 2ade5f3781 stash the Source URL when loading a script.
Reviewed By: javache

Differential Revision: D4437195

fbshipit-source-id: 14698fc81bbe24cab81668bfb54578fc434abc58
2017-01-20 11:58:25 -08:00
Pieter De Baets c9ad00068b Cleanup RN instrumentation_tests BUCK-file
Reviewed By: bestander

Differential Revision: D4440069

fbshipit-source-id: 058e935ae60c4e71f033532e2942053633f9a662
2017-01-20 09:13:33 -08:00
Ashok Menon 22bff6bbc0 Delaying native module config collection.
Reviewed By: javache

Differential Revision: D4436427

fbshipit-source-id: de91473471a097a94c003f16f488b6118b52d689
2017-01-20 07:28:37 -08:00
Ahmed El-Helw 43dedbbd63 Fix typo in generated Yoga classes
Reviewed By: emilsjolander

Differential Revision: D4416273

fbshipit-source-id: fa3f87b86560121e1186cdc0ee295eb052fb3a97
2017-01-19 16:28:39 -08:00
Kevin Gozali 06956e83cd expose IS_TESTING for Platform module
Summary: Introduced IS_TESTING flag on Platform module for android as well. This is useful for testing environment.

Reviewed By: mmmulani

Differential Revision: D4429662

fbshipit-source-id: 33711d7fb5666f0bac8aee444b71261f7f12770f
2017-01-19 14:28:30 -08:00
sunnylqm 829019400a Change DomStorageEnabled default value to true
Summary:
Many websites use domstorage and never think of its unavailability, which usually leads to a blank page on android and hard for developers to debug. I think it's better to enable domstorage by default, for convenience and consistency to iOS and PC.
Closes https://github.com/facebook/react-native/pull/11333

Differential Revision: D4437165

Pulled By: hramos

fbshipit-source-id: a00441cb5214cca27927471d3a33f030b9ff9b52
2017-01-19 12:28:30 -08:00
Jakub Zika 35bcf1bacc Move AppCompat resource target used by React Native
Reviewed By: alsutton

Differential Revision: D4416749

fbshipit-source-id: 965a1245e7c2ffb20b34492c0cb399d3c6884dc6
2017-01-19 08:43:55 -08:00
Satyajit Sahoo 72be2d35cc Add selectionColor prop for Text on Android
Summary:
**Motivation**

Customizing the selection color allows to use brand colors in the app. The PR implements a `selectionColor` prop for `Text` component similar to `TextInput`.

**Test plan (required)**

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

![image](https://cloud.githubusercontent.com/assets/1174278/22023258/70197d84-dceb-11e6-8662-2879d78d14d4.png)

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

Differential Revision: D4430265

fbshipit-source-id: 462f16548d93ab03aadb27d6f12acf90842627ab
2017-01-18 12:58:44 -08:00