Commit Graph

7236 Commits

Author SHA1 Message Date
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
ahanriat c658cc545f Fix navigation card stack pan responder
Summary:
Hi folks !
🔧 Fix the navigation card stack pan responder when the `vertical` direction is enabled.

**Issue:**
When using a `ScrollView` with the `vertical` direction enabled, the pan handler catch the gesture before the `ScrollView`.

I don't know why there was no default value here for `RESPOND_POSITION_MAX_VERTICAL` 5162eb3254
ericvicenti could you tell me what you think about setting a default value for `RESPOND_POSITION_MAX_VERTICAL` ? 😃

Thanks !!

**EDIT June 15, 2016**
I'll update this PR this week end to provide a way to give custom values as there is no magic value for `RESPOND_POSITION_MAX_VERTICAL`

**EDIT June 24, 2016**
I've added a props `gestureResponseDistance` to control both the `RESPOND_POSITION_MAX_VERTICAL` and `RESPOND_POSITION_MAX_HORIZONTAL`
Closes https://github.com/facebook/react-native/pull/8076

Differential Revision: D3605973

Pulled By: ericvicenti

fbshipit-source-id: 158d88cf8ebbab742bf0b38c217ae502e9dd1963
2016-07-25 11:58:44 -07:00
Yann Pringault 1234d27478 Uniformize links in LayoutPropTypes docs
Summary:
The links was a mix of W3Schools, CSS-Tricks and MDN.

Everything is now a MDN link now. [Why?](http://www.w3fools.com/)
Closes https://github.com/facebook/react-native/pull/9005

Differential Revision: D3613520

fbshipit-source-id: 86585613a822a9027f42b61ac5d0abb7c351fa80
2016-07-25 09:43:34 -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
StevenChung d15d6d7ce0 Update NavigatorIOS.ios.js
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

> **Unless you are a React Native release maintainer and cherry-picking an *existing* commit into a current release, ensure your pull request is targeting the `master` React Native branch.**

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

I'm new to React-Native and noticed a broken link in the documentation.  It's just a quick fix.

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Mat
Closes https://github.com/facebook/react-native/pull/8982

Differential Revision: D3612982

fbshipit-source-id: 2996730e51ae7a243697f305cd2ed2eb0d2985a8
2016-07-25 04:43:37 -07:00
Emil Sjolander 471eefcb74 Move dirty layout into css-layout
Reviewed By: majak

Differential Revision: D3610634

fbshipit-source-id: 1dc9017c0a34ced231b5bebe334591f3d0b89bf3
2016-07-25 03:58:41 -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
GevaZeichner feb2825757 A fix for npmlog error
Summary:
Added a fix to the GettingStarted guide, for when npmlog module isn't found.
Solution copied from: https://github.com/tj/n/issues/101#issuecomment-40827196
Closes https://github.com/facebook/react-native/pull/8994

Differential Revision: D3612345

Pulled By: JoelMarcey

fbshipit-source-id: 10e7381adc530bb97c795cae022da3525745122a
2016-07-24 18:43:27 -07:00
Grey Vugrin 143b6493b0 Add AppRegistry to imports in example
Summary:
Missing import throws variable error
Closes https://github.com/facebook/react-native/pull/8988

Differential Revision: D3611142

fbshipit-source-id: b50edf52cdf6c723abaa7bd021cf11ee5b4d874d
2016-07-23 16:43:27 -07:00
Wenjing Wang 15dfa5b224 Reverted commit D3598946
Reviewed By: majak

Differential Revision: D3598946

fbshipit-source-id: fb70f5b031a85f30a6207eb95b7fd0ccd7d78039
2016-07-23 01:28:31 -07:00
Konstantin Raev 64b09290f7 Reverted commit D3604593
Differential Revision: D3604593

fbshipit-source-id: fe792739dbe4af294ef0071b4db4ab181adcb874
2016-07-23 00:28:27 -07:00
Scott Wolchok eb59ae8423 Set trackingName for RCTImageLoader requests
Reviewed By: javache

Differential Revision: D3600853

fbshipit-source-id: 46ef2d0e54e4ce417cc3d4138c8d8f60d5c34173
2016-07-22 16:58:33 -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
Olivier Notteghem 32a717892c safeguard for missing ImageLoader native module
Differential Revision: D3604593

fbshipit-source-id: f7f77bfb01ca51e660b68945ff7271a492df1bcb
2016-07-22 13:13:40 -07:00
Emil Sjolander 55638f804d Move dirty layout into css-layout
Reviewed By: majak

Differential Revision: D3598946

fbshipit-source-id: fdbbbf3b9bd262e0b14b5b9a40171a1c039695a7
2016-07-22 11:43:21 -07:00
Scott Wolchok 0e65456d9c plumb trackingName through to native requests
Reviewed By: javache

Differential Revision: D3600752

fbshipit-source-id: 84cea3b67daa67b92a8845454aecf1462c857b50
2016-07-22 11:28:56 -07:00
Pieter De Baets 82c8129627 Fix double React perflogger creation
Reviewed By: mmmulani

Differential Revision: D3599003

fbshipit-source-id: 25090309c92127b403d1df6a8b7c18ad5a088b5e
2016-07-22 09:58:29 -07:00
Dhananjoy Biswas 09fff496c9 Remove redundant destructuring
Summary: Closes https://github.com/facebook/react-native/pull/8964

Differential Revision: D3605729

fbshipit-source-id: 517a06d5100742af2fa57bc5ccf8e8e957165f7c
2016-07-22 09:58:29 -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
Siqi Liu 235c059605 Support API "scrollTo" in RecyclerViewBackedScrollView on Android
Summary:
In Android `RecyclerViewBackedScrollView` didn't provide the `scrollTo` API, however iOS does.
If a ListView was created with `RecyclerViewBackedScrollView` as its `renderScrollComponent`, then calling `scrollTo` wouldn't work.

This diff enables the `scrollTo` API in `RecyclerViewBackedScrollView` on Android.

Reviewed By: dmmiller

Differential Revision: D3605233

fbshipit-source-id: f192053361f45453e5fce3fb6038ab03ac4025af
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
Chris Hopman e7fba4c123 Remove some throw specifications
Reviewed By: mhorowitz

Differential Revision: D3588394

fbshipit-source-id: 56e24f28b1f4eba2564007b395afcac6fa5cb209
2016-07-21 17:43:27 -07:00
Nicolas Charpentier 20f48debb6 Fix broken links in Handling Touches documentation
Summary:
Fixes #8943.
Closes https://github.com/facebook/react-native/pull/8948

Differential Revision: D3601794

Pulled By: hramos

fbshipit-source-id: 559ed4796505a28797b0ac6c094a961c61ef88b4
2016-07-21 14:58:31 -07:00
Paul O’Shannessy 5db5ee9f55 Upgrade to React v15.3.0-rc.2
Summary:
There were several fixes to how calls to propType checkers. This is to
account for the new deprecation warning - React.PropTypes will not be
part of production builds in the future.

Note: There is still a warning about an invalid argument to `React.PropTypes.oneOf` (React is running that validation sooner now). Specifically [both of these](b1e49832ef/Libraries/Components/Touchable/TouchableWithoutFeedback.js (L44-L45)) because `View.AccessibilityTraits` is actually undefined in tests (didn't look into why you conditionally set that).

**Test plan (required)**

`npm test` & fixed all warnings due to proptype secret
Closes https://github.com/facebook/react-native/pull/8758

Reviewed By: zpao

Differential Revision: D3564288

Pulled By: bestander

fbshipit-source-id: 1ff1f90907f41855e364048aa730ccd239c522b4
2016-07-21 09:13:29 -07:00
Serhij Korochanskyj b8576312ca Fix BackAndroid subscriptions calls
Summary:
`BackAndroid` JS event subscriptions should be called in reverse order
(the subscription from the latest `addEventLister` should run first).

Also if listener returns true, don't call other listeners.

**Motivation**: We use `BackAndroid` listeners to prevent closing screens with user's input.
When we have two screens in stack (each screen with listener, which show alerts),
we want to show alert only from the last screen listener, not from all.
Closes https://github.com/facebook/react-native/pull/8929

Differential Revision: D3598978

Pulled By: dmmiller

fbshipit-source-id: a7b0762b36a60755a844e90fffd58887f89c9ffb
2016-07-21 08:58:24 -07:00
skatpgusskat 631785f2ee Change RCTImageLoader's Cache System to default NSURLRequest's cache system
Summary:
Before this PR, ```RCTImageLodaer```'s Cache was too big(200MB on disk) and It doesn't work with HTTP Cache-Control header. So to provide dynamic image, the users must have to add random value on url( ex. adding current date) to avoid cache.

So I change that cache system to default ```NSURLRequest```'s cache system, which is well-working with HTTP specs. As the discussion on this issue #7571 , making custom cache policy processor is not ready yet and useless, over-tech things, I think.

Even we have no plan about image cache system(or would change plan later), before having a nice plan, I think we should let user use image module with common HTTP Specs.

So I remove custom ```NSURLCache```, and make logic like below,

1. try fetch image,

2. on response, get ```Date``` on response's header and make ```cacheKey``` with ```Date```.
> (why? because if ```NSURLRequest```'s response was cached, the response's ```Date``` header dosen't change.)

3. find decoded imag
Closes https://github.com/facebook/react-native/pull/8235

Reviewed By: bnham

Differential Revision: D3469086

Pulled By: javache

fbshipit-source-id: 35a5552cda6e6c367481020bbf3c28eb4a9d0207
2016-07-21 07:58:51 -07:00
Janic Duplessis 5903949ad6 Load local assets synchronously to prevent image flicker
Summary:
This uses `[UIImage imageNamed:]` to load local assets that are bundled using `require('../image/path.png')` and makes sure it is done synchronously on the main queue to prevent images from flickering. This improves user experience a lot when using large local images and prevents icon flickers to match the behaviour of most native apps.

This adds to methods to the ImageLoader protocol, one to tell if the image loader must be executed on the url cache queue and one to tell if the result of the image loader should be cached. I then use these to make the LocalImageLoader bypass the url cache queue and avoid caching images twice.

Note that this doesn't affect debug builds since images are loaded from the packager.

I'm not sure if we want to still support async loading of local images as I'm not sure how much of a perf difference this will make. Maybe someone at fb can benchmark this see how it affects your apps but there wasn't a noticeable one in mine. Also I only enabled this for loading png and jpg im
Closes https://github.com/facebook/react-native/pull/8102

Reviewed By: bnham

Differential Revision: D3433647

Pulled By: javache

fbshipit-source-id: 37bd6aff20c0465c163db3cdbcaeaedff55f7b1f
2016-07-21 07:58:51 -07:00
Pieter De Baets 7e5de707be Remove deprecated RCTImageLoader methods
Reviewed By: mmmulani

Differential Revision: D3586474

fbshipit-source-id: b2be11d3673c3db1f3a79e0c4abfead8c988d82a
2016-07-21 07:58:51 -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
Fadil Sutomo faabeadebf Fix JSX string props quote convention
Summary:
Not sure if I misunderstand the previous JSX convention. But I found that in JSX string props, double-quote is preferred instead.

https://github.com/facebook/react-native/blob/master/.eslintrc#L182

![screen shot 2016-07-21 at 5 32 04 am](https://cloud.githubusercontent.com/assets/6204776/17006166/137db7ae-4f09-11e6-871b-2cf99960e3a1.png)
Closes https://github.com/facebook/react-native/pull/8933

Differential Revision: D3597084

fbshipit-source-id: 606a2123f1a1ff1fe2234b636b68b3273ebf6ebb
2016-07-20 20:13:27 -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
Emil Sjolander 0df569dc7f Handle children internally in CSSLayout
Reviewed By: javache

Differential Revision: D3588205

fbshipit-source-id: 27f701a9a85cc0e86bb1d233a6bc74b529a8d4d4
2016-07-20 13:28:30 -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
Emil Sjolander c7ff46bf55 Make isTextNode a prop instead of a function
Reviewed By: javache

Differential Revision: D3586184

fbshipit-source-id: 8b269c11c5d47efb6b788be68336845399292168
2016-07-20 08:59:00 -07:00
Emil Sjolander 1af9270e45 Revamp API
Reviewed By: majak

Differential Revision: D3579423

fbshipit-source-id: 040ecab2f20216aa136ccb8a9e7e15ffa882b313
2016-07-20 08:58:59 -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
Emil Sjolander 768caf5e08 Use library style import for CSSMacros
Reviewed By: javache

Differential Revision: D3576815

fbshipit-source-id: 8d8cf34f701529b272f564088fb1b28708ec27a9
2016-07-20 07:28:36 -07:00
Charles Dick b25005a833 AdsManager now uses new react native QPL identifiers
Reviewed By: fkgozali

Differential Revision: D3543775

fbshipit-source-id: b7a6f811c579d35913ad5e480e1a5bc486a6172d
2016-07-20 07:28:36 -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
Emil Sjolander 1aa7ad0ab8 CamelCase
Reviewed By: majak

Differential Revision: D3576069

fbshipit-source-id: cecda2cdb67f2f66ac92e336068d58731ccdb101
2016-07-20 06:43:32 -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
Dan Caspi 654e4bed2e Better folly::dynamic ==> JSValue conversion
Reviewed By: lexs

Differential Revision: D3347854

fbshipit-source-id: 95b81152d1b0d5fe41e01991c44f5d1110be7ddb
2016-07-20 04:28:37 -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
Emil Sjolander 0587c85094 Add [RCTShadowView isCSSLeaf] for skipping css tree of children
Summary: RCTShadowText currently overrides a couple methods from RCTShadowView to reset the count of the cssNode children to 0. This diff instead moves that logic into RCTShadowView behind a configurable flag making it easier to reason about.

Reviewed By: javache

Differential Revision: D3586434

fbshipit-source-id: 4389a8119dc49e3fc4357174c87c0c69287ae385
2016-07-20 02:58:39 -07:00
Emil Sjolander 102577565a Remove fillCSSNode method
Summary: fillCSSNode was only ever used in RCTShadowView to set the child count which is already performed in insert/remove subview calls and in RCTShadowText is was used to set the measure function which can be done in the initializer instead.

Reviewed By: majak, javache

Differential Revision: D3586418

fbshipit-source-id: de2155daf0f1702c8977bf23183a3b6a650d016b
2016-07-20 02:58:39 -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
Mengjue Wang a527ef2032 Fix Popover problem for RTL 1/n
Summary: Change modal.js to support RTL

Reviewed By: javache

Differential Revision: D3580776

fbshipit-source-id: e9ef3f340f52e38fd905dce6d14a74d3bd7b7982
2016-07-19 10:43:29 -07:00