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

913 Коммитов

Автор SHA1 Сообщение Дата
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
Andy Street b5c3550857 Don't hard crash if you get a null stack trace in Android
Summary: If stacktrace-parser can't parse a stack trace, it'll return null. This can cause us to accidentally enter a crash loop where whenever you start your app, you load the last JS bundle you had, get a crash, and then hard crash trying to print the stack trace.

Reviewed By: frantic

Differential Revision: D3528141

fbshipit-source-id: 1146f43bc40492bfa79b6a1c0f81092383896164
2016-07-07 09:15:04 -07:00
Janic Duplessis 2537157d99 Implement TextInput onContentSizeChange
Summary:
This adds proper support for tracking a TextInput content size as discussed in #6552 by adding a new callback that is called every time the content size changes including when first rendering the view.

Some points that are up for discussion are what do we want to do with the onChange callback as I don't see any use left for it now that we can track text change in onChangeText and size changes in onContentSizeChange. Also a bit off topic but should we consider renaming onChangeText to onTextChange to keep the naming more consistent (see [this naming justification](https://twitter.com/notbrent/status/709445076850597888)).

This is split in 2 commits for easier review, one for iOS and one for android.

The iOS implementation simply checks if the content size has changed everytime we update it and fire the callback, the only small issue was that the content size had several different values on initial render so I added a check to not fire events before the layoutSubviews where at this point the value is g
Closes https://github.com/facebook/react-native/pull/8457

Differential Revision: D3528202

Pulled By: dmmiller

fbshipit-source-id: fefe83f10cc5bfde1f5937c48c88b10408e58d9d
2016-07-07 09:00:01 -07:00
Alexander Blom be0abd17e5 Remove a bunch of copies
Reviewed By: astreet

Differential Revision: D3475592

fbshipit-source-id: 37148bb8d8d47e9301ad549b183029337f7c4ca0
2016-07-07 09:00:01 -07:00
Alexander Blom 95401aba72 Create tracing name in C++ instead of Java
Reviewed By: mhorowitz

Differential Revision: D3469140

fbshipit-source-id: 77a00a7150573e44f219972556cbb936a57d7054
2016-07-07 09:00:00 -07:00
Tadeu Zagallo af24e8001a Add new FileSourceProvider
Reviewed By: michalgr

Differential Revision: D3207541

fbshipit-source-id: d53599c3cf36ae7c89e85a29f637987bc7139159
2016-07-07 08:44:30 -07:00
Alexander Blom f11a783e64 Make packager reconnect less noisy
Reviewed By: frantic

Differential Revision: D3509012

fbshipit-source-id: 66742ebed80ecf48ce8291b1816ef0ec672febee
2016-07-07 08:44:29 -07:00
Mike Lambert 6779d13dcb Reverted commit D3528215
Summary:
So `PanReponder.onPanResponderRelease/onPanResponderTerminate` receive a `gestureState` object containing a `onPanResponderTerminate.vx/vy` property. On Android and iOS, they appear to be orders of magnitude different, which appear to be due to the different scale of timestamps that are used when generating touch events.

This pull request fixes the timestamps to be milliseconds on both platforms (since I assume iOS is the more authoritative one, and is the one that `react-native-viewpager`'s vx thresholds written written to compare against.)

As far as I can tell, the RN code doesn't use the `vx/vy` properties, so they should be okay. And looks like the RN code only cares about relative values of `startTimestamp/currentTimestamp/previousTimestamp` though, so should be fine too. it's quite possible there will be downstream android breakage with this change, particularly for those who are already compensating for the RN discrepancy.
Closes https://github.com/facebook/react-native/pull/8199

Differential Revision: D3528215

Pulled By: davidaurelio

fbshipit-source-id: d81732e50a5ece2168e8347309d8d52a0db42951
2016-07-07 08:16:26 -07:00
Mike Lambert 4f5c2b48fe Fix timestamps on android touch events to use milliseconds, to be consistent with iOS
Summary:
So `PanReponder.onPanResponderRelease/onPanResponderTerminate` receive a `gestureState` object containing a `onPanResponderTerminate.vx/vy` property. On Android and iOS, they appear to be orders of magnitude different, which appear to be due to the different scale of timestamps that are used when generating touch events.

This pull request fixes the timestamps to be milliseconds on both platforms (since I assume iOS is the more authoritative one, and is the one that `react-native-viewpager`'s vx thresholds written written to compare against.)

As far as I can tell, the RN code doesn't use the `vx/vy` properties, so they should be okay. And looks like the RN code only cares about relative values of `startTimestamp/currentTimestamp/previousTimestamp` though, so should be fine too. it's quite possible there will be downstream android breakage with this change, particularly for those who are already compensating for the RN discrepancy.
Closes https://github.com/facebook/react-native/pull/8199

Differential Revision: D3528215

Pulled By: dmmiller

fbshipit-source-id: cbd25bb7e7bb87fa77b661a057643a6ea97bc3f1
2016-07-07 05:59:43 -07:00
Marc Horowitz a7d032b707 Display JS exceptions and stacks in a red box
Reviewed By: astreet

Differential Revision: D3510875

fbshipit-source-id: a7042434b68cb849f5b0c4ef782befff6a27ef5c
2016-07-06 16:13:21 -07:00
Marc Horowitz 7f790dc0de Pull an updated version of fbjni into RN OSS
Differential Revision: D3521227

fbshipit-source-id: 57db97ea2af2b2c9e55f380ce05d9e78a5f9d48c
2016-07-06 12:58:42 -07:00
Dave Miller 8c9f190038 Fix Spacing lifecycle issue introduced by D3516692
Summary: D3516692 incorrectly assumed that the Spacing object was immutable.  This is not true as it can change in a measure pass on the shadow thread while the UI is displaying some other data.  This fixes it to just pull the values we need and pass them instead of the object.

Reviewed By: foghina

Differential Revision: D3523004

fbshipit-source-id: 056baecf60a9c2f2494d173a3c60396a93b97d42
2016-07-06 11:14:05 -07:00
Alexander Blom c57eb94b34 Execute init task on thread pool executor
Reviewed By: foghina

Differential Revision: D3522112

fbshipit-source-id: 8a0880d0e7bf3e0bce02c44e8d504f01ab47beb8
2016-07-06 10:43:24 -07:00
Dave Miller c3f2bba834 Fix padding with Text on Android
Summary: Text was not correctly respecting padding.  We would account for it when measuring, but then not actually apply the padding to the text.  This adds support for proper padding

Reviewed By: andreicoman11

Differential Revision: D3516692

fbshipit-source-id: 9a0991d89e9194c0e87af0af56c6631a6b95700a
2016-07-06 09:43:37 -07:00
Siqi Liu ac18025d7c Change the Exception Message of Time Drift
Summary: We prefer not showing the accurate time information in the exception message of time drift, in order to be able to group this kind of exception only by exception message.

Reviewed By: foghina

Differential Revision: D3515390

fbshipit-source-id: f38bf3091ba749d4daeae24f7d42653b76c3289c
2016-07-05 09:58:29 -07:00
David Aurelio bd60d828c5 Remove `node_modules/react` from the list of discoverable haste modules
Summary: This removes `node_modules/react` from the list of directories that are used for haste module resolutions. Modules required from React are now imported with `require('react/lib/…')`.

Reviewed By: astreet

Differential Revision: D3509863

fbshipit-source-id: 32cd34e2b8496f0a6676dbe6bb1eacc18124c01e
2016-07-05 06:44:33 -07:00
danielbasedow 4ac4f86bf5 Add ping to WebSocket
Summary:
Idle WebSocket connections get reset after a few minutes of inactivity. To prevent this, most WebSocket implementations offer sending special ping messages. This PR adds a method `sendPing()` to  WebSocket. Ping payloads are not supported.

Manual testing can be done by adding `connection.on('ping', _ => console.log('Received ping'));` to a ws connection or using a packet sniffer while sending pings.
Closes https://github.com/facebook/react-native/pull/8505

Differential Revision: D3516260

Pulled By: dmmiller

fbshipit-source-id: cfebf5899188ae53254d5be6b666a9075e0eed89
2016-07-05 05:58:23 -07:00
Andy Street 950cefa2d6 Add debug statements to UIManager
Summary: These are helpful for development and shouldn't affect anything when DEBUG=false

Reviewed By: lexs

Differential Revision: D3515015

fbshipit-source-id: 0bd5ff833f90fea8e70b3103eb1f9bc803bef27c
2016-07-05 04:28:21 -07:00
Konstantin Raev 1d86be3a6e Turned on old bridge for OSS
Summary:
This should revert back to using old bridge by default until we fix gradle script to build new bridge for OSS correctly
Closes https://github.com/facebook/react-native/pull/8539

Differential Revision: D3514263

Pulled By: bestander

fbshipit-source-id: db9e0232b9bde27206814212dedc487c366e3511
2016-07-03 14:43:20 -07:00
Konstantin Raev f78e819f20 Reverted commit D3510867
Differential Revision: D3510867

fbshipit-source-id: 365eb22e143f1c0eec6e4b8810c93dbb0e9fbbfa
2016-07-02 13:43:23 -07:00
Marc Horowitz 8b2adeaa2e Pull an updated version of fbjni into RN OSS
Differential Revision: D3510867

fbshipit-source-id: b4f3300ef003c57aa7d4f3513bca537c464f7647
2016-07-01 16:28:47 -07:00
Chris Hopman bf79f87895 Make the new bridge the default
Reviewed By: astreet

Differential Revision: D3507482

fbshipit-source-id: b62f3bf0fe1dd4f49594e441f4e00b9e20ec972b
2016-07-01 14:43:22 -07:00