Commit Graph

934 Commits

Author SHA1 Message Date
Daniel Braun 1bb1385c7d Webview: Fix broken fullscreen modals due to zero body height.
Summary:
Supersedes PR #8536
Fixes #5211

JavaScript plugins such as Fotorama are broken when attempting use its fullscreen feature.

If there's an absolute HTML element with 100% height under <body>, its height is 0 when rendered in the Android WebView.

This commit fixes it.
Closes https://github.com/facebook/react-native/pull/8830

Reviewed By: bestander

Differential Revision: D3632821

Pulled By: jamesgpearce

fbshipit-source-id: c185bcd30d1d214a357d0d8552d61d0ddfa5e6c6
2016-07-27 16:58:57 -07:00
Andrew Y. Chen aa32fd64a5 Add Airplane mode as a potential reason for debug server exceptions
Reviewed By: jingc

Differential Revision: D3632310

fbshipit-source-id: e6ccbfaaccf6853c615956842ea657eaba76cbe2
2016-07-27 16:28:27 -07:00
Mengjue Wang 5b4fb89e4c Fix UNSET problem for text alignment change
Summary: Use UNSET(-1) as default will lead wrong calculation for text alignment. Change it to Gravity.NO_GRAVITY to fix this problem.

Reviewed By: fkgozali

Differential Revision: D3624417

fbshipit-source-id: c116560e64600be60b2fe719f575701b00f20a97
2016-07-27 10:28:37 -07:00
Mengjue Wang 8c0a045c0d Connect the OS setting with isRTL
Summary: Provide two function in I18nUtil to get the device and app current using language. And Set isRTL with both allowRTL and current app using language.

Reviewed By: fkgozali

Differential Revision: D3603412

fbshipit-source-id: 6bb280d56af9a12901148df9fab368366073680f
2016-07-26 14:43:49 -07:00
Mengjue Wang 54a4450309 Change the textalign setter to support RTL
Summary: Change the textalign setter to support RTL. In order to support text alignment according to layout style, move the textalign setter bridge function from ReactTextViewManager.java to ReactTextShadowNode.java and calculate it correctly on RCTTextUpdate.

Reviewed By: dmmiller

Differential Revision: D3597494

fbshipit-source-id: e5ca17b99b4233cc49a447a34175473e339ff53d
2016-07-26 12:13:33 -07:00
Ben Alpert a2fb703bbb Convert from React.createClass to ES6 classes
Reviewed By: cpojer

Differential Revision: D3619143

fbshipit-source-id: e14e81468d467437ee3d79c34c34b7780a46ca1c
2016-07-26 01:13:31 -07:00
Sokovikov 857d2b8eae change lineBreakMode to ellipsizeMode
Summary:
lineBreakMode only in rc so I think we can replace property without any deprecation warnings. satya164
Closes https://github.com/facebook/react-native/pull/9008

Differential Revision: D3614901

fbshipit-source-id: 724227c0a89192825a24850b930b80884571a51f
2016-07-25 13:13:35 -07:00
Chris Hopman d67258eb91 Move some really old tests to the cxx bridge
Reviewed By: mhorowitz

Differential Revision: D3507905

fbshipit-source-id: cbe55495a991bf6eef961319ba8b219e660dce05
2016-07-25 12:29:25 -07:00
SangYeob Bono Yu d06bea4962 Add dep for android local unit tests
Summary:
`./scripts/run-android-local-unit-tests.sh` raise error
```
05: error: cannot access com.facebook.react.bridge.CatalystInstance
    verify(mCatalystInstanceImpl).loadScriptFromOptimizedBundle(
                                 ^
  class file for com.facebook.react.bridge.CatalystInstance not found
```
and this PR fix it.
Closes https://github.com/facebook/react-native/pull/8957

Differential Revision: D3613491

Pulled By: bestander

fbshipit-source-id: 53b52fca13482e6474d7ffec9c19c0e7d6e4d100
2016-07-25 09:13:38 -07:00
SangYeob Bono Yu 3b35732800 Add Share module
Summary:
revision of https://github.com/facebook/react-native/pull/5476

It has only one method `shareTextContent` and next will be`shareBinaryContent`.

In Android, Promise can't receive a result, because `startActivityForResult` is not working with `Intent.ACTION_SEND`. Maybe we can use `createChooser(Intent target, CharSequence title, IntentSender sender)` which requires API level 22.
Closes https://github.com/facebook/react-native/pull/5904

Differential Revision: D3612889

fbshipit-source-id: 0e7aaf34b076a99089cc76bd649e6da067d9a760
2016-07-25 03:43:29 -07:00
ASCE1885 c21d3a1029 fix NullPointerException Caused by manageChildren
Summary: Closes https://github.com/facebook/react-native/pull/8991

Differential Revision: D3612777

Pulled By: dmmiller

fbshipit-source-id: d8da5ef8354cdaf55d8a3efbc2bfbc2aef74a044
2016-07-25 02:28:32 -07:00
Ahmed El-Helw 5f41769485 Fix ViewPager behavior with Nodes
Summary: Add a batch addition operation for ViewPager.

Differential Revision: D3597840

fbshipit-source-id: 1c9c42e03da2492444298220e75f547b6567b4e5
2016-07-22 15:43:27 -07:00
ASCE1885 37e5f3b6ca fix mTimerIdsToTimers remove error
Summary:
In Timing.java, the key provided to the remove function of mTimerIdsToTimers is not correct, that may introduce bugs.
Closes https://github.com/facebook/react-native/pull/8966

Differential Revision: D3605291

Pulled By: astreet

fbshipit-source-id: 97563b6846e8f3f40d20b48b3852dd557c9932f3
2016-07-22 09:28:40 -07:00
Andy Street a07026d075 Put setChildren debug log in DEBUG clause
Summary:
Missed wrapping this previously :x
Closes https://github.com/facebook/react-native/pull/8930

Reviewed By: foghina

Differential Revision: D3593226

Pulled By: astreet

fbshipit-source-id: aea05a6fe7a806d0e31bb486d3de90fe18f2c15f
2016-07-22 06:13:32 -07:00
Dave Miller da063e3d55 Set Event timestamp internally
Summary: This is pure cleanup so that we can make sure that all events are living in the same time space (currently nano seconds).

Reviewed By: foghina

Differential Revision: D3593884

fbshipit-source-id: 71b084362008f1c93c21880630acf11f5c058355
2016-07-21 07:43:28 -07:00
Mengjue Wang 700e82f663 Provide I18n Module in OSS 3/3
Summary: expose context for I18nManagerModule and I18nUtil

Reviewed By: dmmiller

Differential Revision: D3575706

fbshipit-source-id: d432d3762df13f9a1b33a32eff306f88e49fe852
2016-07-20 15:29:27 -07:00
Mengjue Wang 566e0553ca Provide I18n Module in OSS 2/3
Summary: Add module dependence into RN

Reviewed By: dmmiller

Differential Revision: D3575689

fbshipit-source-id: bc8cd221ffa4fcdbdab97051c0f8dedd387d6ee1
2016-07-20 11:28:33 -07:00
Mengjue Wang 0ab1486f7e Provide I18n Module in OSS 1/3
Summary: Create I18nUtil and I18nManagerModule for OSS.

Reviewed By: dmmiller

Differential Revision: D3575674

fbshipit-source-id: aad96be167f3e7b0692a9cc2c7f8a558e7aa722a
2016-07-20 11:28:33 -07:00
Don Yu 12ec213c0d Add support for layout gravity to ToastAndroid
Summary: Add support for top, bottom, and center layout gravity to ToastAndroid

Reviewed By: AaaChiuuu

Differential Revision: D3590224

fbshipit-source-id: 84dbbcfbe4133f291d62723c5c261acd7b32b46e
2016-07-20 08:13:37 -07:00
Adam Comella c4ffc7d71c Android: Fix handling of line height with inline images
Summary:
This PR was split from a commit originally in #8619. /cc dmmiller

When an inline image was larger than the specified line height,
the image would be clipped. This changes the behavior so
that the line height is changed to make room for the inline
image. This is consistent with the behavior of RN for iOS.

Here's how the change works.

ReactTextView now receives its line height from the layout thread
rather than directly from JavaScript.

The reason is that the layout thread may pick a different line height.
In the case that the tallest inline image is larger than the line
height supplied by JavaScript, we want to use that image's height as
the line height rather than the supplied line height.

Also fixed a bug where the image, which is supposed to be baseline
aligned, would be positioned at the wrong y location. To fix this,
we use `y` (the baseline) in the `draw` method rather than trying
to calculate the baseline from `bottom`. For more information
see https://code.google.com/p/andro
Closes https://github.com/facebook/react-native/pull/8907

Differential Revision: D3592781

Pulled By: dmmiller

fbshipit-source-id: cba6cd86eb4e3abef6a0d7a81f802bdb0958492e
2016-07-20 07:13:37 -07:00
Andrew Jack c47f7457c0 Update OkHttp to 3.4.0 and Okio to 1.9.0
Summary:
- 3.3.1 wasn't compatible with Robolectric 3.0, however 3.4.0 [fixes](https://github.com/square/okhttp/issues/2533#issuecomment-230198063) this issue.
- Few other fixes to OkHttp mentioned in the [CHANGELOG.md](https://github.com/square/okhttp/blob/master/CHANGELOG.md)

> Fixes: #7743
>
- Android apps can recover from a `REFUSED_STREAM` in HTTP/2.
- A few other fixes mentioned in the [CHANGELOG.md](https://github.com/square/okhttp/blob/master/CHANGELOG.md)

- CircleCi
- Test with `/Examples` 
Closes https://github.com/facebook/react-native/pull/8672

Reviewed By: alsutton

Differential Revision: D3541293

Pulled By: bestander

fbshipit-source-id: 76429861b4f4df15cb9c18ab0f177daee3e1459d
2016-07-20 06:43:33 -07:00
Jon Vassbø b7bf24bc7f Support geolocation in android webview
Summary:
Makes sure request for geolocation use in the webview is handled.
This solves issue #7609

Currently use of geolocation in webview fails silently, as the permission request is never received by the native app.

**Test plan (required)**

1. Create new project with webview
2. Add javascript for geolocation:
```javascript
navigator.geolocation.getCurrentPosition(function (position) {
  console.log('success', position)
}, function (error) {
  console.log('could not determine position', error)
})
```
3. Run code and assert geolocation permission is requested, resulting in success (or error) callback being called
Closes https://github.com/facebook/react-native/pull/8305

Differential Revision: D3592887

fbshipit-source-id: 84fe2383fba8873431c5e89d154c0a4fd58ffb70
2016-07-20 05:43:25 -07:00
Adam Comella e1b3bbdb04 Android: Refactor HierarchyOptimizer in preparation of inline view support
Summary:
This PR was split from commits originally in #8619. /cc dmmiller

These refactorings to the HierarchyOptimizer are in preparation for implementing support for inline views in #8619.

**Refactoring 1: Collapse add*LayoutOnlyNodeToLayoutOnlyNode**

addLayoutOnlyNodeToLayoutOnlyNode and addNonLayoutOnlyNodeToLayoutOnlyNode
had nearly identical implementations. They both walk thru the ancestors
looking for a nonlayout-only node and adjusting the passed in index at each
step. This introduces a new function, walkUpUntilNonLayoutOnly, which
takes care of that responsibility. This simplifies addNodeToNode
because it can now consider the type of the parent and the type of
the child independently.

**Refactoring 2: Extract addGrandchildren**

Pull out addLayoutOnlyNode's logic into a helper called
addGrandchildren. We will need to call this method in
another place later.

**Test plan (required)**

This change was tested with UIExplorer and a small test app and it's being used in my team's app.
Closes https://github.com/facebook/react-native/pull/8908

Differential Revision: D3592783

Pulled By: dmmiller

fbshipit-source-id: a513e8d381e71112ce6348bbee7d4a7c62c33619
2016-07-20 04:28:36 -07:00
Konstantin Raev 702c14bdf2 Enabled Vertical ScrollView instrumentation test in SandCastle
Reviewed By: emilsjolander

Differential Revision: D3588423

fbshipit-source-id: ad2486b3da5fe7972e4ea9409a729d2ba2483782
2016-07-20 02:58:39 -07:00
Tobias Ritzau d343eaabff Added the native animation demo to the android UIExplorer
Reviewed By: javache

Differential Revision: D3569816

fbshipit-source-id: ab03f3f3ad10b3921d428628c87e4091c07ceafe
2016-07-19 02:43:24 -07:00
Yibin Chen 4ccd14f31a Integrating AutoUpdater's custom JS Bundle loading into Fb4a
Reviewed By: AaaChiuuu

Differential Revision: D3558831

fbshipit-source-id: b3909de774922fae903f3e8718fbfcd9b1ece2f8
2016-07-18 16:28:28 -07:00
Olivier Notteghem e27c1495bd network congestion improvements (part 1)
Reviewed By: dmmiller

Differential Revision: D3553287

fbshipit-source-id: ea33bb7d929cbc0229bfe8537c3a4fc58fe9691e
2016-07-18 12:13:29 -07:00
Janic Duplessis 80872ffccd Remove exported constants from RCTTimers to allow lazy initialization
Summary:
As per javache comments in #8734.

Also removes now useless feature detection check.

**Test plan**
Tested that rIC still works in UIExplorer example.
Closes https://github.com/facebook/react-native/pull/8795

Differential Revision: D3572566

Pulled By: javache

fbshipit-source-id: 261d13d8b03898313f8b4184d634c70f81a61b62
2016-07-15 13:58:40 -07:00
Michał Gregorczyk 3c0f428f05 Fix optimized bundle stuff.
Reviewed By: davidaurelio, tadeuzagallo

Differential Revision: D3563710

fbshipit-source-id: 2b0a982d388ee5f44b806f8e561ef49a3fd8c8ca
2016-07-14 15:28:46 -07:00
Felix Oghina b0c023c85c fix removing views from ViewPagerAndroid
Summary:
Two things in this diff:

1. Implemented `getItemPosition` in our adapter; the default implementation always returns POSITION_UNCHANGED, which is incorrect, and causes `destroyItem` to never (sometimes?) be called.
2. Fix `destroyItem`: this never worked. `destroyItem` is always called by the ViewPager after a `notifyDataSetChanged()`, so after `removeViewAt`, which removes the view from `mViews`, causing `destroyItem` to throw `IndexOutOfBoundsException` when it tries to get the view. Since our item objects are just views, use that instead of checking `mViews`.

Reviewed By: ahmedre

Differential Revision: D3555427

fbshipit-source-id: 900c2696162d07f507e850517d483b943ce39a35
2016-07-14 13:28:25 -07:00
David Aurelio df01215006 Reverted commit D3545345
Reviewed By: tadeuzagallo

Differential Revision: D3545345

fbshipit-source-id: d655918be7dcadaf8143800497e85f3de44bd48a
2016-07-14 10:58:27 -07:00
Alexander Blom 55fb4f4a75 Don't close WebSocket if it fails during connect
Summary: This is causing log spew in all Android RN apps because we try to close a non-existing web socket.

Reviewed By: foghina

Differential Revision: D3548998

fbshipit-source-id: 27392915bdf456c88f44c3b394c5c9d2ea1bab54
2016-07-14 07:43:32 -07:00
Janic Duplessis 18394fb179 Initial implementation of requestIdleCallback on Android
Summary:
This is a follow up of the work by brentvatne in #5052. This addresses the feedback by astreet.

- Uses ReactChoreographer with a new callback type
- Callback dispatch logic moved to JS
- Only calls into JS when needed, when there are pending callbacks, it even removes the Choreographer listener when no JS context listen for idle events.

** Test plan **
Tested by running a background task that burns all remaining idle time (see new UIExplorer example) and made sure that UI and JS fps stayed near 60 on a real device (Nexus 6) with dev mode disabled. Also tried adding a JS driven animation and it stayed smooth.

Tested that native only calls into JS when there are pending idle callbacks.

Also tested that timers are executed before idle callback.
```
requestIdleCallback(() => console.log(1));
setTimeout(() => console.log(2), 100);
burnCPU(1000);
// 2
// 1
```

I did *not* test with webworkers but it should work as I'm using executor tokens.
Closes https://github.com/facebook/react-native/pull/8569

Differential Revision: D3558869

Pulled By: astreet

fbshipit-source-id: 61fa82eb26001d2b8c2ea69c35bf3eb5ce5454ba
2016-07-13 18:58:20 -07:00
Chris Hopman c89c25f27d Make new bridge default in OSS
Reviewed By: bestander

Differential Revision: D3553208

fbshipit-source-id: 35d466e87032618978230b118772e366ba1deea9
2016-07-13 16:13:19 -07:00
Emil Sjolander 8dd8c41553 Point csslayout deps over to xplat
Reviewed By: bestander

Differential Revision: D3555221

fbshipit-source-id: cad4c74f4780c6d636fd244f7a4dcd1806241b25
2016-07-13 14:28:45 -07:00
Emil Sjolander 86e304f6a3 Move csslayout into xplat
Reviewed By: lucasr

Differential Revision: D3509483

fbshipit-source-id: dfd0b00002b7da6432667b4a795edb5a15cf9a88
2016-07-13 10:28:27 -07:00
Philipp von Weitershausen 08c375f828 Add responseType as a concept to RCTNetworking, send binary data as base64
Summary:
In preparation for Blob support (wherein binary XHR and WebSocket responses can be retained as native data blobs on the native side and JS receives a web-like opaque Blob object), this change makes RCTNetworking aware of the responseType that JS requests. A `xhr.responseType` of `''` or `'text'` translates to a native response type of `'text'`. A `xhr.responseType` of `arraybuffer` translates to a native response type of `base64`, as we currently lack an API to transmit TypedArrays directly to JS. This is analogous to how the WebSocket module already works, and it's a lot more versatile and much less brittle than converting a JS *string* back to a TypedArray, which is what's currently going on.

Now that we don't always send text down to JS, JS consumers might still want to get progress updates about a binary download. This is what the `'progress'` event is designed for, so this change also implements that. This change also follows the XHR spec with regards to `xhr.response` and `xhr.responseText`:

- if the response type is `'text'`, `xhr.responseText` can be peeked at by the JS consumer. It will be updated periodically as the download progresses, so long as there's either an `onreadystatechange` or `onprogress` handler on the XHR.

- if the response type is not `'text'`, `xhr.responseText` can't be accessed and `xhr.response` remains `null` until the response is fully received. `'progress'` events containing response details (total bytes, downloaded so far) are dispatched if there's an `onprogress` handler.

Once Blobs are landed, `xhr.responseType` of `'blob'` will correspond to the same native response type, which will cause RCTNetworking to only send a blob ID down to JS, which can then create a `Blob` object from that for consumers.

Closes https://github.com/facebook/react-native/pull/8324

Reviewed By: javache

Differential Revision: D3508822

Pulled By: davidaurelio

fbshipit-source-id: 441b2d4d40265b6036559c3ccb9fa962999fa5df
2016-07-13 04:58:37 -07:00
sathya 33a1f28654 Android WebView “tel:” links show web page not found - issue fixed
Summary:
Submitting PR #6810 -  Android WebView “tel:” links show web page not found - issue fixed.
'tel:' link web page not loading:
![screenshot_2016-07-01-19-48-05](https://cloud.githubusercontent.com/assets/11989113/16525364/b3e9f10c-3fc9-11e6-8119-93cdf24d54df.png)

After Fixing the issue:
![screenshot_2016-07-01-19-52-00](https://cloud.githubusercontent.com/assets/11989113/16525371/c0d74d92-3fc9-11e6-899b-570a940692f6.png)
Closes https://github.com/facebook/react-native/pull/8526

Differential Revision: D3554500

fbshipit-source-id: e8cc1ac4c36ddf0c6b261a29b2e038caddc03e75
2016-07-12 22:13:25 -07:00
Konstantin Raev 0d3c4f8e5e Temporarily enable ReactHorizontalScrollViewTestCase to run in SandCastle
Reviewed By: emilsjolander

Differential Revision: D3548925

fbshipit-source-id: f56a812316470f1ee4b6a53a83b439bf66f5035f
2016-07-12 08:58:24 -07:00
Michał Gregorczyk 1331e20db5 add API to CatalystInstanceImpl for executing optimized bundle
Reviewed By: tadeuzagallo

Differential Revision: D3545345

fbshipit-source-id: 538fec77b816c3fd767e8c2eda81c78971996b17
2016-07-12 08:13:32 -07:00
Michał Gregorczyk a665914d18 Unpack files required by optimized bundle format
Reviewed By: tadeuzagallo

Differential Revision: D3522855

fbshipit-source-id: 2d14db33ce9b98ea1aeea5a12e292e5926e43796
2016-07-12 08:13:32 -07:00
Michał Gregorczyk e632025917 Allow apps to provide JSBundleLoader of their choice
Reviewed By: tadeuzagallo

Differential Revision: D3522798

fbshipit-source-id: 90324e44a02ad78885ff3c2a33ba58d4ee6a021a
2016-07-12 08:13:31 -07:00
Tim Yung ed4db631fa RN: Change Time Drift Error into Warning
Summary: Changes the time drift error into a warning that will only get logged once per debugging session.

Reviewed By: jingc

Differential Revision: D3539067

fbshipit-source-id: 357db15750d867a91c39b5fc5fd6ed4ae2852bc7
2016-07-11 10:28:27 -07:00
Andy Street 6d3c7b8a4c Fix 'Unexpected EOF' in old bridge
Summary: This is caused by receiving \u2028/2029 in callbacks/function calls. The correct solution is to not evaluate these strings as scripts but instead parse them as json and pass them through the JSC API.

Reviewed By: lexs

Differential Revision: D3543098

fbshipit-source-id: 4d8acce1d510bb17361d32103d4738fc0208b0a8
2016-07-11 09:58:27 -07:00
Tadeu Zagallo 5d06918d07 Add new FileSourceProvider
Summary: Add a new interface to JSC that allows loading a file lazily from disk, i.e. using mmap, instead of loading the whole file upfront and copying into the VM.

Reviewed By: michalgr

Differential Revision: D3534042

fbshipit-source-id: 98b193cc7b7e33248073e2556ea94ce3391507c7
2016-07-11 06:58:26 -07:00
Emil Sjolander 70b989eb67 Revert land of css-layout PR #199
Reviewed By: bestander

Differential Revision: D3536627

fbshipit-source-id: e89b2a5fd38d1228bd8526c46bb26c594947837a
2016-07-08 16:48:13 -07:00
Michał Gregorczyk dd06b74157 Make SoLoader an external dependency
Reviewed By: bestander

Differential Revision: D3535233

fbshipit-source-id: 9fddb654123a7606d46069a98e2f68dec7f520fa
2016-07-08 16:48:13 -07:00
Emil Sjolander ca66383941 Correctly size cross axis when measuring flex basis
Summary:
https://github.com/facebook/css-layout/pull/199

- Nodes were measured with the assumption of being text nodes (height depends on width) when determining flex basis. This is not always true. Even when we are just interested in the main axis (flex basis) we need to correctly constrain the cross axis.
- Some tests were wrong. Measuring texts.big and expecting it to have textSizes.smallHeight which doesn't make a lot of sense.

Reviewed By: vjeux

Differential Revision: D3510163

fbshipit-source-id: ee53b548dd078005fdd153d279e4c7fef3dd02d0
2016-07-08 09:28:35 -07:00
Emil Sjolander 89a53b687c Use AT_MOST measurespec when onyl max dimension is defined
Summary:
https://github.com/facebook/css-layout/pull/200
Make use of max dimension styles to allow root to be measured with AT_MOST measure mode

Reviewed By: IanChilds

Differential Revision: D3513505

fbshipit-source-id: 169f49717e896eb6270b52fb7115ce005aa0e3a8
2016-07-08 03:58:28 -07:00
Clement Genzmer 80c23ae324 Reverted commit D3207541
Reviewed By: michalgr

Differential Revision: D3207541

fbshipit-source-id: 36366188b7cb74c51d4aa974abd4a648498bcf78
2016-07-07 14:58:43 -07:00