Commit Graph

2711 Commits

Author SHA1 Message Date
Pieter De Baets c92ad5f6ae Apple TV support 4: support for input (tvOS focus engine)
Reviewed By: shergin

Differential Revision: D4333546

fbshipit-source-id: 8655070e81dbb62a80ab1f00a43ef6c2d9654618
2016-12-19 06:28:40 -08:00
Alan Norbauer 4aabf4b6b3 Replace jest.resetModuleRegistry() with jest.resetModules()
Reviewed By: cpojer

Differential Revision: D4344961

fbshipit-source-id: 45453ec7ee3211743946ab9156f51430322b5832
2016-12-18 17:13:38 -08:00
Kevin Lacker 9f3ef48f65 Added info about a cancelable option for Alerts on Android.
Summary:
In the 8e2906ae89 commit there was implemented a cancelable option for Alerts. It wasn't clear from the docs about this option and the additional Alert method's parameter.
Closes https://github.com/facebook/react-native/pull/11292

Differential Revision: D4342707

Pulled By: lacker

fbshipit-source-id: dc243b868106e705040e77bc90d4d9b8c2dc26eb
2016-12-16 16:28:31 -08:00
Leland Richardson 71f32fb5a3 Fix documentation for scrollResponderScrollNativeHandleToKeyboard
Summary:
I'm pretty sure this is supposed to be "bottom" as opposed to "top", as it's the offset from the keyboard, which is at the bottom of the screen.
Closes https://github.com/facebook/react-native/pull/11446

Differential Revision: D4339957

Pulled By: lacker

fbshipit-source-id: 62dca544a0167704d76cd972c44570f277ea63aa
2016-12-16 15:13:36 -08:00
tychota 25cd2c5d7b Deprecate RecyclerViewBackedScrollView
Summary:
cc brentvatne

potential reviewers mkonicek and kmagiera

**Motivation for making this change.**

The previous PR was closed : #11095 but the followup actions was never done

I reopened a really similar one so it get merged
RecyclerView is no more used at Facebook (according to previous PR)

According to brentvatne, their were two motivations for RecyclerView:
* ListView with ScrollView component used to bounce back on row insert, but this is now fixed
* This made possible to implement certain performance improvements, but the maintenance cost was not worth the risk

With RN 0.37, the actual code in React Native make the app crash:
- see #10560

I spend one hour investigating this and did also require brent time at exponent slack. I think other people are struggling too.

**Test plan**

<img width="708" alt="screen shot 2016-12-13 at 23 42 22" src="https://cloud.githubusercontent.com/assets/13785185/21162483/dbeb642e-c18d-11e6-9c32-1fe73f1826c1.png">

**Code formatting**

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

Differential Revision: D4340640

Pulled By: mkonicek

fbshipit-source-id: 64c5cf060f2eb035d4d6199b30f0e73afc520180
2016-12-16 12:28:36 -08:00
pedramsaleh 20938ae88c Fixed typo in docs.
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.**

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

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. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see
Closes https://github.com/facebook/react-native/pull/11459

Differential Revision: D4339946

Pulled By: lacker

fbshipit-source-id: d95e7c62dbf7bf6fd2ab3739b3d64bfcbe83e24a
2016-12-16 10:28:34 -08:00
Adam Comella c0ea23cfb0 Android: Expose textBreakStrategy on Text and TextInput
Summary:
Android has a text API called breakStrategy for controlling how paragraphs are broken up into lines. For example, some modes support automatically hyphenating words so a word can be split across lines while others do not.

One source of complexity is that Android provides different defaults for `breakStrategy` for `TextView` vs `EditText`. `TextView`'s default is `BREAK_STRATEGY_HIGH_QUALITY` while `EditText`'s default is `BREAK_STRATEGY_SIMPLE`.

In addition to exposing `textBreakStrategy`, this change also fixes a couple of rendering glitches with `Text` and `TextInput`. `TextView` and `EditText` have different default values for `breakStrategy` and `hyphenationFrequency` than `StaticLayout`. Consequently, we were using different parameters for measuring and rendering. Whenever measuring and rendering parameters are inconsistent, it can result in visual glitches such as the text taking up too much space or being clipped.

This change fixes these inconsistencies by setting `breakStrategy` and `hyphenat
Closes https://github.com/facebook/react-native/pull/11007

Differential Revision: D4227495

Pulled By: lacker

fbshipit-source-id: c2d96bd0ddc7bd315fda016fb4f1b5108a2e35cf
2016-12-16 01:28:45 -08:00
zongjingyao eba356fb13 result in RCTAsyncStorage.multiGet could be null.
Summary:
App will crash if result is null.
Closes https://github.com/facebook/react-native/pull/10338

Differential Revision: D4335305

Pulled By: lacker

fbshipit-source-id: 4910bfd7c56525a2ef1b252b56b8debd21fa2bae
2016-12-15 22:43:30 -08:00
Neo 4cb8a852a1 fix typo
Summary: Closes https://github.com/facebook/react-native/pull/11249

Differential Revision: D4338083

Pulled By: lacker

fbshipit-source-id: bc997c9fb0c4af0667234d4920ea9a73ac86d2fb
2016-12-15 21:13:38 -08:00
Steven Goff 4394419b60 Android Text component allowFontScaling
Summary:
The reason for this change is to implement `allowFontScaling` on the Android's React Native Text component.  Prior to this PR `allowFontScaling` only works for iOS.

The following link contains images of `allowFontScaling` working in Android on small, normal, large, and huge system fonts (from native Android display settings)

http://imgur.com/a/94bF1

The following link is a video of the same thing working on an Android emulator

https://youtu.be/1jTlZhPdj9Y

Here is the sample code snippet driving the video/images
```
render() {
    const size = [12, 14, 16, 18];
    return (
      <View style={{backgroundColor: 'white', flex: 1}}>
        <Text>
          Default size no allowFontScaling prop (default true)
        </Text>
        <Text allowFontScaling={true}>
          Default size allowFontScaling: true
        </Text>
        <Text style={{ marginBottom: 10, }} allowFontScaling={false}>
          Default size allowFontScaling: false
        </Text>

        { size.map(
Closes https://github.com/facebook/react-native/pull/10898

Differential Revision: D4335190

Pulled By: lacker

fbshipit-source-id: 0480809c44983644ff2abfcaf4887569b2bfede5
2016-12-15 17:43:35 -08:00
Eric Vicenti cbc413ba87 Revert D4321763: Use native driver even if gestures are enabled
Differential Revision: D4321763

fbshipit-source-id: b43a733ea2234dd46add817bb83cca366ef83093
2016-12-14 15:28:32 -08:00
Üstün Ergenoglu 3785db2fb1 Add property to force HW acceleration on Android for modal windows
Summary:
When using React Native on Android on top of a game as an overlay, dialog windows sometimes get created with hardware acceleration disabled. This causes the UI to be unresponsive and anything that uses a TextureView stops working. Added a property for the modal view to make sure hardware acceleration flag is enabled when it's set to true.

**Test plan (required)**

set `hardwareAccelerated` property for Modal to force hardware acceleration on dialog windows on Android. Does nothing on iOS.
Closes https://github.com/facebook/react-native/pull/11421

Differential Revision: D4312912

Pulled By: andreicoman11

fbshipit-source-id: 9db6b2eca361421b92b24234b3501b5de0eecea7
2016-12-14 10:28:33 -08:00
unordered 8ec774396c fix ios formdata boundary include slash
Summary:
some server not work when upload a file with FromData in ios.
the reason is that there is a slash in boundary, like:
```
multipart/form-data; boundary=b/QeEbFgqK9PCZo4T/eXv7f.T74SHd5MxCZ846AsTz-yNV0xrRR_Zks4fkNMCzJck9ZE8o

// koa request.js (line 548)
  is(types) {
    if (!types) return typeis(this.req);
    if (!Array.isArray(types)) types = [].slice.call(arguments);
    return typeis(this.req, types);
  }

// type-is index.js (line 237)
function normalizeType (value) {
  // parse the type
  var type = typer.parse(value)

  // remove the parameters
  type.parameters = undefined

  // reformat it
  return typer.format(type)
}

// media-typer
var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
```

thanks for dougwilson 's [answer](https://github.com/jshttp/media-typer/issues/5).
> The / is an illegal character for Content-Type, which is what this module parses
Closes https://github.com/facebook/react-native/pull/11342

Differential Revision: D4326750

Pulled By: javache

fbshipit-source-id: b1c78a335c95a5c223537545d87beaffe15d673d
2016-12-14 08:28:42 -08:00
Neo f8f70d2275 fix ListView to work with Native Animated.event
Summary:
suggested by janicduplessis in https://github.com/facebook/react-native/pull/9253#issuecomment-247862707
I'm using this in my own apps
Closes https://github.com/facebook/react-native/pull/11339

Differential Revision: D4325343

fbshipit-source-id: f1da26a2107093865f04e1d81245b33482776001
2016-12-13 20:43:53 -08:00
Jeff Morrison d926aecd77 fbsource
Reviewed By: samwgoldman

Differential Revision: D4314897

fbshipit-source-id: fbe11da4c63bf34d010220d74177cb3ca4cbee6d
2016-12-13 18:58:34 -08:00
Janic Duplessis 4220063f84 Use native driver even if gestures are enabled
Summary:
Gestures now work with native animations so we can enable it, it is also not needed anymore to check if the native module exists since we print a warning in the Animated module now.

**Test plan**
Tested that animations and gesture work properly in the UIExplorer example. Also been using native animations with NavigationExperimental (ex-nav) in an app for a while.
Closes https://github.com/facebook/react-native/pull/11234

Differential Revision: D4321763

Pulled By: ericvicenti

fbshipit-source-id: 255bed5bfed3b93bdc10939b5a03d4d8b00ceade
2016-12-13 13:43:45 -08:00
Alex Kotliarskyi 41f2169629 Improve TouchableOpacity
Summary:
I was comparing `<TouchableOpacity>` to `UIButton` in iOS and it just doesn't feel native. The initial delay was fixed by https://github.com/facebook/react-native/pull/10866 but still there is a lag between button release and animation.

I'm also not sure what `_hideTimeout` was used for. When logging `touchableHandle*` events looks like `touchableHandleActivePressIn` is called first, then `touchableHandleActivePressOut` and then `touchableHandlePress`. Which means the fade in animation from `touchableHandleActivePressOut` was interrupted by `touchableHandlePress`.

Reviewed By: vjeux

Differential Revision: D4309789

fbshipit-source-id: b6d4df544952e11c2ade97d860531cbb2fada36b
2016-12-13 11:28:30 -08:00
Anton Karpov 4252ac75ea fix babel 'strict mode' error
Summary:
need to remove function declaration in a lexically nested statement
because babel uses 'use strict' by default now
Closes https://github.com/facebook/react-native/pull/11390

Differential Revision: D4308275

fbshipit-source-id: 0d073361d25b23fb67f001225feb72532af38683
2016-12-11 00:43:30 -08:00
Adam Ernst 587606987f Rename and merge files for RCTWebSocketObserver protocol
Summary: No need to have two files; merge it into one and give it an appropriate name.

Reviewed By: javache

Differential Revision: D4296716

fbshipit-source-id: 904d13c23bb8d403b8efcb60f9a4aa5df5b08972
2016-12-08 07:44:37 -08:00
Adam Ernst 2b0c4591e2 Rename RCTWebSocketManager file to reflect its new contents
Reviewed By: javache

Differential Revision: D4296615

fbshipit-source-id: a48da3f0550398cb59478c7405fe971f9246910f
2016-12-08 07:44:37 -08:00
Adam Ernst d0c3e98d1d Eliminate RCTWebSocketManager
Summary: This singleton was unnecessary and can be implemented with a single `static` in `RCTDevMenu`. In another diff, I will rename `RCTWebSocketManager.{h,m}` to reflect the only class that remains.

Reviewed By: javache

Differential Revision: D4296551

fbshipit-source-id: 653971dfb31de5b0a161b531eed82a067f536ce3
2016-12-08 07:44:37 -08:00
Adam Ernst 2ca6138852 Start exposing RCTWebSocketObserver using a protocol
Reviewed By: javache

Differential Revision: D4296387

fbshipit-source-id: 33f92c36168dcb18356d0ccdaf902a84634d94b7
2016-12-08 07:44:37 -08:00
Adam Ernst 574e3daf9f Clean up RCTWebSocketObserver
Summary: Avoid using properties where unnecessary; stick to only one way to modify the delegate.

Reviewed By: javache

Differential Revision: D4296351

fbshipit-source-id: 94d0e3c90904ed584f691a3f28a15a7ac450c3e1
2016-12-08 07:44:37 -08:00
Adam Ernst 28e2f64d07 Remove unused queue ivar from RCTWebSocketManager
Reviewed By: javache

Differential Revision: D4296309

fbshipit-source-id: feee004e24abdb4b3626c5304f662ec3d71118b5
2016-12-08 07:44:37 -08:00
Adam Ernst ac489858f8 Clean up RCTWebSocketProxyDelegate a bit
Reviewed By: javache

Differential Revision: D4296294

fbshipit-source-id: b31e522c21ec490fdf98711655e5e8df22b32a12
2016-12-08 07:44:37 -08:00
Travis Stanley b203343b81 update comment to reflect change in function name to renderQuickActions
Summary:
Minor error in commen
Closes https://github.com/facebook/react-native/pull/11351

Differential Revision: D4293263

Pulled By: ericnakagawa

fbshipit-source-id: 19559b210336bfd05794a7585c0133a075e06398
2016-12-07 23:58:25 -08:00
Maxime Lapointe d56530d7d5 Reworking keyboardShouldPersistTaps to have a middle ground
Summary:
Right now, the ScrollView's keyboard hiding behavior is either all or nothing: Hide the keyboard on any tap, or do nothing ever. This PR introduces a third mode to keyboardShouldPersistTaps which is much closer to what I consider should be the default.

In the new behavior, the tap responding is done in the bubbling phase (instead of the capture phase like =true). As a result, a child can handle the tap. If no child does, then the ScrollView will receive the tap and will hide the keyboard. As a result, changing TextInput focus works as a user expects, with a single tap and without keyboard hiding. But taping on Text or on the empty part of the ScrollView hides the keyboard and removes the focus.

You can view the behavior in a monkey patched ScrollView demo on rnplay:
https://rnplay.org/apps/E90UYw
https://rnplay.org/apps/UGzhKA

In order to have a uniform props set, i added 3 values to the keyboardShouldPersistTaps:
'never' and 'always' are the same as false and true.
'handled' is the new behavior.

I don't
Closes https://github.com/facebook/react-native/pull/10628

Differential Revision: D4294945

Pulled By: ericvicenti

fbshipit-source-id: 1a753014156cac1a23fabfa8e1faa9a768868ef2
2016-12-07 21:43:35 -08:00
Eming Kwok 40b84fa5f8 fix memory leak in Chrome debugging
Summary:
`RCTWebSocketExecutor` saves every WebSocket callback when sending message to chrome, but does not clear them in a debug session until the JS bridge is reloaded, and there may be thousands of blocks saved in the callback table. This PR removes them after they are called.
Closes https://github.com/facebook/react-native/pull/11341

Differential Revision: D4295710

Pulled By: javache

fbshipit-source-id: 29a02d1aba320115bbb97aee8981e34b89303c91
2016-12-07 17:13:42 -08:00
Mike Grabowski 6feffe1de0 Better error for ART <Group />
Summary: Fixes #3815

Differential Revision: D4295976

Pulled By: javache

fbshipit-source-id: 034690d3bee75217d820d3361136a410a812cd2c
2016-12-07 17:13:42 -08:00
Pieter De Baets 59407f3660 Redo exported headers and include paths for opensource
Summary:
Xcode really sucks, per some discussion on e1577df1fd and https://developer.apple.com/library/content/technotes/tn2215/_index.html, if you use the headers phase, and mark headers in your static library as public, they will actually end up in the final package that's built and you can't submit to the app store! This changes our xcode setup to use a copy files phase instead.

I've also changed the header include path to be $(BUILT_PRODUCTS_DIR)/include, which is added to the include path by Xcode by default, so 3rd party libraries should not be impacted by these changes anymore.

Reviewed By: mkonicek

Differential Revision: D4291607

fbshipit-source-id: 969b9ebcbeb8161f85427f8c429e198d9d0fae30
2016-12-07 15:28:29 -08:00
Michał Gregorczyk d72c6fd500 Do not call `toString` on functions in buildStyleInterpolator
Reviewed By: vjeux

Differential Revision: D4292618

fbshipit-source-id: cd7cd1a88aeb2c800f2c2941c79855992613ec84
2016-12-07 11:58:28 -08:00
Martin Konicek 3ab508e99a Upselling ListView in ScrollView's docs
Summary:
Internal research at FB has shown that many devs don't know why they should use ListView instead of ScrollView, or that ListView even exists. This PR changes ScrollView's docs to upsell ListView.

I could put this as a separate guide in the docs, but I think this place will have the best possible reach for target audience.

Suggestions welcome. Let me know if it doesn't make sense or is too verbose.
Closes https://github.com/facebook/react-native/pull/11349

Differential Revision: D4292109

Pulled By: mkonicek

fbshipit-source-id: e4a14e5a55333c9282d0e407461505e71e850b20
2016-12-07 10:43:48 -08:00
Emil Sjolander 7f8c2985a8 Rename directories
Reviewed By: gkassabli

Differential Revision: D4284681

fbshipit-source-id: f0c6855c2c6e4389b7867f48f72cbb697830fc5a
2016-12-07 05:14:12 -08:00
David Aurelio d482743f91 Remove hmr require from initialization code
Reviewed By: cpojer

Differential Revision: D4265897

fbshipit-source-id: c39caeae875e6f5f5322542601e97cdf78f90dc6
2016-12-05 16:13:29 -08:00
Pieter De Baets 5ee8b41d56 Remove REACT_HEADERS from RN BUCK file
Reviewed By: emilsjolander

Differential Revision: D4231819

fbshipit-source-id: 78c1316d8e2bd8d9c0947b1c1c4dc857b74824ae
2016-12-05 10:43:33 -08:00
Adam Comella 2aca021504 iOS: Fix dequeueTasks crash in image loader
Summary:
This fixes a crash occurring [on this line](f9f32eb426/Libraries/Image/RCTImageLoader.m (L253)). It was reported in a comment in #10433.

The problem is that `task` is deallocated at this point and is unsafe to use. Removing it from `_pendingTasks` dropped its ref count to 0. [The ARC docs](http://clang.llvm.org/docs/AutomaticReferenceCounting.html#fast-enumeration-iteration-variables) state that, by default, loop variables in fast enumeration loops are not retained. That's why `task`'s ref count is 0.

It's likely we ran into this bug because the code disobeyed the [reverseObjectEnumerator docs](https://developer.apple.com/reference/foundation/nsarray/1415734-reverseobjectenumerator) which state that "you must not modify the array during enumeration". The default retention policy for fast enumeration seems to assume you follow this.

To fix this bug and avoid other potential pitfalls, the code now follows the docs and `_pendingTa
Closes https://github.com/facebook/react-native/pull/11296

Differential Revision: D4277167

Pulled By: javache

fbshipit-source-id: 1211b32935bab7f4080dc00b88d85348786e859a
2016-12-05 10:13:29 -08:00
gl8997@gmail.com 03fd91063b Update type check for NavigationCardStack
Summary:
The typecheck inside of NavigationCard is PropTypes.any while in NavigationCardStack it is  View.propTypes.style.

let's make them consistent to avoid unnecessary warnings. (e.g. trying to pass a animationStyle as cardStyle)
Closes https://github.com/facebook/react-native/pull/9808

Differential Revision: D4277323

Pulled By: ericvicenti

fbshipit-source-id: c30b4a21675cad98c19f5c6522e286d776bfa20d
2016-12-05 09:58:35 -08:00
Jake Dawkins 6234a5dfa2 Fix iOS Picker Item Colors
Summary:
I want to resolve #11170 by passing the `color` prop from `PickerIOS.Item` to its implementation.

In `RCTPicker.m`, the label.textColor was already being set and used, but there was nothing referencing the past prop. I passed the prop to the implementation, checked if it exists, and if not, set the default color, like before.

I visually tested the **Colorful Pickers** example in UIExplorer. Those picker `Item`s pass in a `color` prop.

![dec-01-2016 22-07-46](https://cloud.githubusercontent.com/assets/9259509/20821696/ae45d704-b812-11e6-9720-0045d6c0bcd4.gif)

The basic picker does not pass the color prop to the picker `Item`, and there are no errors. Basic functionality is still in tact:

![dec-01-2016 22-09-35](https://cloud.githubusercontent.com/assets/9259509/20821730/ee544f74-b812-11e6-9294-a1b45e78d9f7.gif)
Closes https://github.com/facebook/react-native/pull/11260

Differential Revision: D4272370

fbshipit-source-id: 5fa33c40526dda59ca2ab527c31351bcd27e5cf3
2016-12-03 18:58:29 -08:00
Emil Sjolander 85ac5fc354 Rename C api
Differential Revision: D4259190

fbshipit-source-id: 26c8b356ca464d4304f5f9dc4192bff10cea2dc9
2016-12-03 04:44:10 -08:00
Sagiv Ofek f9ab788c6b Add more info link for warnedMissingNativeAnimated
Summary:
Add link with more details of how to resolve warnedMissingNativeAnimated warning.
Closes https://github.com/facebook/react-native/pull/11224

Differential Revision: D4268352

fbshipit-source-id: 679574570aea2f4ec7083247d5b6dcba378e8560
2016-12-02 15:28:31 -08:00
Damien Varron e9d459275a Add missing closing brace in docs
Summary:
This is a minor documentation fix

fixes #11150
Closes https://github.com/facebook/react-native/pull/11253

Differential Revision: D4268276

fbshipit-source-id: 67c8f9b4c77a2c781c09376bf4fc15a61b3db490
2016-12-02 15:28:31 -08:00
Ben Kalman fb4f71f4ac Add missing backtick in PanResponder.js docs
Summary: Closes https://github.com/facebook/react-native/pull/11274

Differential Revision: D4268360

fbshipit-source-id: 8d92300830e4568de14350a539c11b8773c425c0
2016-12-02 15:13:34 -08:00
Ben Clayton 833961e05d <Text> Expose Android's includeFontPadding property to JavaScript.
Summary:
By default Android will put extra space above text to allow for upper-case accents or other ascenders. With some fonts, this can make text look slightly misaligned when centered vertically.

We have found that the effect is very noticeable with certain custom fonts on Android. On iOS the font aligns vertically as expected.

Android exposes a property `includeFontPadding` that will remove this extra padding if set to false. This PR exposes that to JS, and adds it to the documentation and UIExplorer.
Closes https://github.com/facebook/react-native/pull/9323

Differential Revision: D4266713

Pulled By: lacker

fbshipit-source-id: f9711254bc26c09b4586a865f0e95ef4bf77cf3f
2016-12-02 12:58:36 -08:00
Emil Sjolander 779508c0ba Rename enums
Differential Revision: D4244360

fbshipit-source-id: c9fcbdd231098c9ff230a6055676bbc7cbd11001
2016-12-02 05:58:45 -08:00
Adam Comella 23423774ba iOS: Fix an image loader crash
Summary:
Fixes #10433

The code didn't account for the fact that cancelLoad is set by two different threads. It gets set on the URL request queue when the request completes successfully and it gets set on the UI queue during cancelation. This oversight lead to a couple of different kinds of crashes.

1. Attempt to invoke a nil function -- We check that cancelLoad is non-nil and on the next line we call it. However, cancelLoad could have been set to nil by the other thread between the time it was verified to be non-nil and the time it was called. Consequently, the program will attempt to call nil and crash.

2. Block deallocated while it's executing -- Suppose cancelLoad points to a block, it is verified to be non-nil, and it is successfully invoked. In the middle of executing the block, cancelLoad, the last reference to the block, is set to nil. This causes the block to be deallocated and its captured values to be freed. However, the block continues executing and the next time it attempts to use a captured value
Closes https://github.com/facebook/react-native/pull/11145

Differential Revision: D4261499

Pulled By: javache

fbshipit-source-id: 46424c6dd8cfa085cef32d945308de07798040bc
2016-12-01 21:28:33 -08:00
Brent Vatne 346858a552 Add StyleSheet.setStyleAttributePreprocessor
Summary:
**Motivation**

On Exponent we load fonts dynamically and assign their native names by appending a session id, so that fonts from one Exponent "experience" do not clash with each other. So, before sending the `fontFamily` to native, we want to change it to the Exponent-scoped `fontFamily`.

Example:

```js
// Before rendering your app
StyleSheet.setStyleAttributePreprocessor('fontFamily', _processFontFamily);

function _processFontFamily(name) {
  // Pass system fonts through
  if (!name || Constants.systemFonts.indexOf(name) >= 0) {
    return name;
  }

  if (!Font.isLoaded(name)) {
    if (__DEV__) {
      console.error(`${name} is not a system font and has not been loaded through Exponent.Font.loadAsync. If you intended to use a system font, make sure you typed the name correctly and that it is supported by the current operating system. If this is a custom font, be sure to load it with Exponent.Font.loadAsync`);
    } else {
      return 'system';
    }
  }

  return `ExponentFont-
Closes https://github.com/facebook/react-native/pull/11138

Differential Revision: D4245518

Pulled By: mkonicek

fbshipit-source-id: bd2452b1129d6675aa7b88e41351f8bb61fa20a3
2016-11-29 15:28:32 -08:00
Gaëtan Renaudeau 20e99f5b93 Fix invariant in scrollResponderZoomTo
Summary:
This fixes a cryptic bug to appear when you try to use scrollResponderZoomTo in Android.
before this PR it would break with a `Error: TaskQueue: Error with task : invariant requires an error message argument` because the invariant() was not properly used..

Also, instead of detecting the platform, I think it's better practice to duck type.
Closes https://github.com/facebook/react-native/pull/11186

Differential Revision: D4246674

fbshipit-source-id: 47002a85d8252e5abbd1cd9ecef3d7676fa8615a
2016-11-29 14:43:38 -08:00
Sokovikov 837814240b unselectedItemTintColor property available since iOS10
Summary:
**motivation:**

make possible to use new tab bar property.

![1475603157804](https://cloud.githubusercontent.com/assets/1488195/19085757/8b7cc8a4-8a7c-11e6-82c7-7c76313fb545.jpg)

It is not working for previous versions but not failing.
https://developer.apple.com/reference/uikit/uitabbar/1648949-unselecteditemtintcolor
Closes https://github.com/facebook/react-native/pull/10241

Differential Revision: D4168046

Pulled By: mmmulani

fbshipit-source-id: aa0c9b36cbdbc50a9a60bbbc658355c3066ba1a5
2016-11-29 12:28:55 -08:00
Sokovikov a50bafa678 badgeColor property
Summary:
**motivation:**

make possible to use new tab bar item property

![1476033023249](https://cloud.githubusercontent.com/assets/1488195/19222245/f4c1292c-8e64-11e6-8a29-7b95b45e153c.jpg)
Closes https://github.com/facebook/react-native/pull/10315

Differential Revision: D4000011

Pulled By: mmmulani

fbshipit-source-id: 5c00b0b5f56c551cc4151fcc030da6c8bc1a3649
2016-11-29 11:43:31 -08:00
Alex Kotliarskyi 1fe0f4d8ec Add `deprecated` flag for nativeImageSource
Summary:
Looks like the native Image implementation used to treat old `image!` images slightly differently. This diff restores that behavior for `nativeImageSource`.

{F65080365}

Reviewed By: mmmulani

Differential Revision: D4240506

fbshipit-source-id: d8d39216f86df32e0614d7cdc95df2148c85077a
2016-11-28 15:58:36 -08:00