Commit Graph

1710 Commits

Author SHA1 Message Date
Valentin Shergin 7cdd4d48c8 Nits: `[NSNull null] was changed to `(id)kCFNull`
Reviewed By: javache

Differential Revision: D5398734

fbshipit-source-id: 823e860b5da9cc9850fafa49c1d9b746580856b0
2017-07-11 12:31:15 -07:00
Eli Perkins 78e2030e95 Clean up -[RCTRootView cancelTouches] header docs
Summary:
Just a little typo fixing and wording clean up around some header docs.
Closes https://github.com/facebook/react-native/pull/14947

Differential Revision: D5398609

Pulled By: javache

fbshipit-source-id: 3eb40ef3308130c1d28b2efc7bb64d493e98825b
2017-07-11 11:06:21 -07:00
Christian Brevik 684e03590b Support native ViewManager inheritance on iOS
Summary:
**Motivation**
This is a re-worked version of #14260, by shergin's suggestion.

For iOS, if you want to inherit from a native ViewManagers, your custom ViewManager will not automatically export the parents' props. So the only way to do this today, is to basically copy/paste the parent ViewManager-file, and add your own custom logic.

With this PR, this is made more extensible by exporting the `baseModuleName` (i.e. the iOS `superclass` of the ViewManager), and then using that value to re-establish the inheritance relationship in `requireNativeComponent`.

**Test plan**
I've run this with a test project, and it works fine there. But needs more testing.

Opened this PR as [per shergin's suggestion](https://github.com/facebook/react-native/pull/10946#issuecomment-311860545) though, so we can discuss approach.

**Discussion**
* Android already supports inheritance, so this change should be compatible with that. But, not every prop available on `UIManager.RCTView.NativeProps` is actually exported by every ViewManager. So should `UIManager.RCTView.NativeProps` still be merged with `viewConfig.NativeProps`, even if the individual ViewManager does not export/use them to begin with?
* Does this break other platforms? [UWP](https://github.com/Microsoft/react-native-windows)?
Closes https://github.com/facebook/react-native/pull/14775

Differential Revision: D5392953

Pulled By: shergin

fbshipit-source-id: 5212da616acfba50cc285e2997d183cf8b2cd09f
2017-07-10 16:01:12 -07:00
Nurzhan Bakibayev c00abe53c3 Move inspector proxy out of the packager
Reviewed By: pakoito

Differential Revision: D5369099

fbshipit-source-id: ff806d784b70804181c5c54837352f66e45d1b9e
2017-07-10 06:31:23 -07:00
Pieter De Baets f1cbb11620 Replace -[RCTConvert folly_dynamic:] with direct calls to convertIdToFollyDynamic
Reviewed By: kathryngray

Differential Revision: D5355734

fbshipit-source-id: 4ba1533b75c8e271a86a2d5cc3a3354e52f83db2
2017-07-10 05:31:04 -07:00
Pieter De Baets 20224b74a4 Remove deprecated RCTAssert aliases
Reviewed By: fromcelticpark

Differential Revision: D5380783

fbshipit-source-id: 790d7e1bc6d99411ecc471df88f7b1f31680e7a0
2017-07-07 12:21:59 -07:00
Pieter De Baets 6c2beaffdc Fix Travis podspec CI for Cxx bridge
Summary:
Fixed the test script to properly setup our third-party deps and tweaked the third-party specs a bit so they work correctly.

This currently works for projects using static libraries, but fails when using dynamic libraries (`--use-libraries`)

cc mhorowitz alloy
Closes https://github.com/facebook/react-native/pull/14100

Differential Revision: D5380728

Pulled By: javache

fbshipit-source-id: e78b6bd4466ebf2bf30b7e361eff10ec14b36a55
2017-07-07 02:32:07 -07:00
Valentin Shergin 2be921c88a Fixed possible inconsistency in view hierarchy caused by deleting animation
Summary:
This diff fixes a possibly inconsistent state of view hierarchy caused by async delayed deleting manipulation on UIView's tree.
Even if new approach may seem tricky, the previous one was just terribly wrong.

Reviewed By: javache

Differential Revision: D5374670

fbshipit-source-id: 36f27330aa8b0e4e00fe43739afe3bc6a8602e30
2017-07-06 12:16:20 -07:00
Pieter De Baets 51afde821d Remove some outdated references to xreact
Reviewed By: kathryngray

Differential Revision: D5339824

fbshipit-source-id: 486212dcf0e80036fa548a139e38358ae251ef2a
2017-07-04 08:00:44 -07:00
Valentin Shergin 6312d67bcb RCTAnimation & RCTLayoutAnimation were decoupled from RCTUIManager
Reviewed By: javache

Differential Revision: D5351726

fbshipit-source-id: f13e5cd47483f2d5f9b194c10ae3fb6e99e08d84
2017-07-03 16:15:50 -07:00
Pieter De Baets 12ab236629 Fix references to deprecated assets in separate bundles
Reviewed By: sahrens

Differential Revision: D5346879

fbshipit-source-id: 9d1008765514006deef2182e61f42a7247ea9a85
2017-06-30 07:00:12 -07:00
Alex Dvornikov 2f193b9bc1 Allow RCTModuleData to explicitly opt out from performing its set up on the main queue
Reviewed By: javache

Differential Revision: D5328995

fbshipit-source-id: 6ef6c260a01ee3b088665b13587ff25b84b51771
2017-06-28 06:16:54 -07:00
Pieter De Baets e2628f93b5 Rename Executor to JSExecutor
Summary:
* Cleanup some header files so we use more forward declarations
* Rename Executor to JSExecutor.h
* Move some typedefs to more appropriate locations

Reviewed By: mhorowitz

Differential Revision: D5301913

fbshipit-source-id: e75154797eb3f531d2f42a5e95409f4062b85f91
2017-06-23 17:01:25 -07:00
Mehdi Mulani dbd7a4e3a1 Revert D5197885 to unbreak Internal App
Reviewed By: shergin

Differential Revision: D5312189

fbshipit-source-id: 07f6944994068638703611db9522b1861f1688e2
2017-06-23 13:05:49 -07:00
Pieter De Baets d795fa1b2c Update native references to JSTimers
Reviewed By: AaaChiuuu

Differential Revision: D5294997

fbshipit-source-id: 3003d56f744af0c35b1ffef7bdd71617d4f948c3
2017-06-22 09:52:33 -07:00
Pieter De Baets c5004d5dd0 Make startup errors in the websocket executor invalidate the bridge
Reviewed By: mhorowitz

Differential Revision: D5226936

fbshipit-source-id: b6d605974674d0e6f86559f2583553e3636d389b
2017-06-22 08:37:13 -07:00
Nathaniel Rankin Webb 502604074c Fixed ScrollView's .scrollToEnd to refrain from exceeding start boundary.
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?

The problem occurs when a ScrollView's content height is smaller than the ScrollView height.  If the method `scrollToEnd` is called on the ScrollView, it will pull the content down until the bottom of the content is aligned with the bottom of the Scrollview container.

This fix will ensure the proper functionality: That the furthest the ScrollView can scroll down is to where the top of the content container is at the origin (i.e., the ScrollView scroll number cannot be less than 0).

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.

I tested on a scenario where the ScrollView is almost the full size of the screen, and the content of the ScrollView has a height of much less.  In this situation, the `scrollToEnd` method was executed and the content stayed in the same position.  This is the intended behavior.  If the content of the ScrollView is smaller than the height of the ScrollView, then the `scrollToEnd` method should not scroll anywhere.

**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 the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
Closes https://github.com/facebook/react-native/pull/12889

Reviewed By: javache

Differential Revision: D5289894

Pulled By: sahrens

fbshipit-source-id: df2e779ee855c1dea85d33649d754371ad244bca
2017-06-21 18:20:34 -07:00
dlowder-salesforce 31fe832d04 Fix Apple TV compile errors
Summary:
Apple TV compilation is currently broken in master -- this fixes it.

Existing tests will pass after this change.
Closes https://github.com/facebook/react-native/pull/14652

Differential Revision: D5295021

Pulled By: javache

fbshipit-source-id: 8b4b0db0afa1caeacac0ad01abbed80fa7e39738
2017-06-21 15:16:31 -07:00
Hank Brekke ec68536e08 iOS `presentationStyle` Modal Appearance
Summary:
When using `<Modal` on larger iOS devices, esp. iPad and iPhone 7 Plus devices, there is no way to use the system functionality for controlling the appearance of modals (`presentationStyle`), which improves the native system's animation and display of smaller content appearing within large horizontal space.

I've added a new picker for selecting a `presentationStyle` within  the RNTester app. See below for the appearance of this change, as well as the relevant changes to the RN documentation.

![may-22-2017 09-49-50](https://cloud.githubusercontent.com/assets/3521186/26315020/6d4b1cb0-3ed5-11e7-8ac8-a996f1ee00f9.gif)
<img width="1051" alt="screen shot 2017-05-22 at 9 50 12 am" src="https://cloud.githubusercontent.com/assets/3521186/26315021/6d4cbf7a-3ed5-11e7-9d13-a5d20c9f3533.png">
Closes https://github.com/facebook/react-native/pull/14102

Differential Revision: D5281990

Pulled By: shergin

fbshipit-source-id: 882d8cb79e7adb0b4437cdf26e5e7ab1fc04f4c1
2017-06-20 19:22:57 -07:00
Yu Wang 70e0455522 Implement nativeID prop to allow native code to reference react managed views in iOS
Reviewed By: javache

Differential Revision: D5228055

fbshipit-source-id: 8c934501d4ac946d80bf93d2ddb50f5fc38aea3c
2017-06-20 19:01:27 -07:00
Mehdi Mulani 112e3767ce Fix crash in AccessibilityManager
Summary:
Fix this crash by making sure the RCTDeviceInfo is doing things on the main thread.
This fixes #14043.

Reviewed By: ashwinb

Differential Revision: D5286746

fbshipit-source-id: cce3426a6e7e7221cff82f8bca663d9a060dd358
2017-06-20 18:45:58 -07:00
Valentin Shergin a04322fa1b Support `display: none;` style (iOS)
Summary:
Yes, `display: none;` did not work on iOS before this commit.
Now it "just works". It can be useful when some view needs to be hidden temporary and efficiently.

Reviewed By: javache

Differential Revision: D5173936

fbshipit-source-id: 83a03fff04dd3a872d7dd6bf673189f932906776
2017-06-20 17:16:46 -07:00
Valentin Shergin ac3f345b07 Fixed assertion caused by invalid layout of hidden Yoga nodes
Summary:
That's interesting!
If we apply `display: none;` style to some node, Yoga will stop calculation layout for this subtree (which is reasonable).
So, from RN perspective we have to stop applying layout for hidden subtree because it is meaningless and causes another errors.

Note: We do actually not support `display: none;` yet. It stops computing layout, but it does not hide the views!

Reviewed By: javache

Differential Revision: D5168651

fbshipit-source-id: 29a9385c76a0f9d637285fc0d268ccc39879ca0a
2017-06-20 17:16:46 -07:00
Valentin Shergin abfa63c67e Introducing -[RCTShadowView canHaveSubviews]
Summary:
Override `canHaveSubviews` in RCTShadowView subclass to disallow any nested content.
For now, this prop will be checked only in DEV mode for performance reasons.

Reviewed By: javache

Differential Revision: D5189083

fbshipit-source-id: 87087dd806e1fd7320128dab969b13642174f81c
2017-06-20 17:16:46 -07:00
Valentin Shergin d0ad6ad413 Removed support of mysterious "deprecated" scale in RCTImageSource
Reviewed By: fkgozali

Differential Revision: D5197885

fbshipit-source-id: 06b7ee0ed71e07f1db1db053fbbd5f9834d56586
2017-06-20 17:16:43 -07:00
Jonathan Ballerano eaac3b57ee Add a type cast to RCT_ENUM_CONVERTER for C++ compatibility
Summary:
C++ doesn't provide an implicit cast to an enum value from the enum's backing type. When a `.mm` file calls `RCT_ENUM_CONVERTER`, we end up with the following compiler error:
> Error: cannot initialize return object of type `<TypeName>` with an rvalue of type `NSInteger`

Since `RCT_ENUM_CONVERTER` is a macro, this error will appear whenever we try to expand the macro in a C++ context.

The project compiles and runs as expected when this additional cast is added 😃
Closes https://github.com/facebook/react-native/pull/14408

Reviewed By: javache

Differential Revision: D5215584

Pulled By: jballer

fbshipit-source-id: 7f4464afd7cd9dc9a014f646278bae20731f08ba
2017-06-15 19:07:21 -07:00
Marc Horowitz 4fd427e249 Remove unused folly/File.{h,cpp} from OSS React Xcode project
Summary: This fixes https://github.com/facebook/react-native/issues/14328

Reviewed By: javache

Differential Revision: D5254711

fbshipit-source-id: e9b81e537cca9d6648f44ed61acd127015d2e1f8
2017-06-15 13:05:05 -07:00
Alex Dvornikov c143313a20 Make RCTSamplingProfilerPackagerMethod not depend on RCTBridge
Reviewed By: javache

Differential Revision: D5245899

fbshipit-source-id: a99de4cbf0ddd9c8ee98cbbf438f8930a57e917c
2017-06-15 12:07:34 -07:00
Alex Dvornikov d27ff20588 Make RCTPackagerConnection not depend on RCTBridge
Reviewed By: javache

Differential Revision: D5245497

fbshipit-source-id: 3c41dca98fc39c77d4b3c8932ee2a5b84880cf8c
2017-06-15 12:07:34 -07:00
Viacheslav Radchenko 879edf0d05 Added RCTInspectorDevServerHelper call in FBReactJSExecutor. Added UTF8StringForSourceURL
Reviewed By: javache

Differential Revision: D5246399

fbshipit-source-id: 179ff0b69886c4ff71911fc7b1d3491ff4d5967d
2017-06-14 14:10:10 -07:00
Pieter De Baets 9250250364 Call Systrace.setEnabled from CxxBridge
Reviewed By: alexeylang

Differential Revision: D5247016

fbshipit-source-id: 7e31e38d7adae8d432a11199a1de572d082169e3
2017-06-14 11:16:05 -07:00
Pieter De Baets c25f356675 Avoid crash when accessing jsContextRef without an executor
Reviewed By: adamjernst

Differential Revision: D5237039

fbshipit-source-id: 6a86da90605b896093e0ef99b0fcf079bf9854bf
2017-06-14 05:32:27 -07:00
Pieter De Baets 64825389df Fix timers not firing when running in JS debugger
Reviewed By: mhorowitz

Differential Revision: D5227125

fbshipit-source-id: 3dadb3f2e2fd088853537c09cc019d7be6319444
2017-06-13 09:31:55 -07:00
Ben Nham 2984628357 add marker surrounding entire native module creation
Reviewed By: javache

Differential Revision: D5200856

fbshipit-source-id: 35b0e627224d518126a1cfdd36d6af264dd186cf
2017-06-09 06:22:39 -07:00
John O'Leary 62b20ce582 Scrollview updatedChildFrames data controlled by prop
Summary: Optimize ScrollView by adding flag "DEPRECATED_sendUpdatedChildFrames" to gate whether updatedChildFrames data is computed and propagated on scroll events.  The frame data is used in ListView by the onChangeVisibleRows prop.  When this prop is not defined, unnecessary computation in ScrollView should not be performed.

Reviewed By: sahrens

Differential Revision: D5174898

fbshipit-source-id: e3eaed8760b76becf14dfeb00122bdebdaeae4ef
2017-06-08 12:03:02 -07:00
Theo Yaung ba2e486b33 Connection management
Reviewed By: javache

Differential Revision: D5171773

fbshipit-source-id: 6421739736f732e021e85474253ab0ddb3804b0a
2017-06-08 07:45:53 -07:00
Pieter De Baets 81c2f3b189 Cleanup Platform
Reviewed By: dcaspi

Differential Revision: D5185504

fbshipit-source-id: 4f7e9f9068598418b346a7370f6be241a0784b60
2017-06-07 10:19:01 -07:00
Jean Regisser 5114b61b5e Add support for flashScrollIndicators on iOS
Summary:
Flashing scroll indicators is a standard behavior on iOS to show the user there's more content.

Launch RNTester on iOS, go to the ScrollView section, tap the "Flash scroll indicators" button.
You'll see this:

![Flash scroll indicators](https://cloud.githubusercontent.com/assets/57791/26250919/ebea607a-3cab-11e7-96c6-27579cc809ab.gif)

I've exposed the method `flashScrollIndicators` on all scrolling components that were already exposing a `scrollToXXX` method so it's usable from those components using a ref.

Let me know what you think.
Closes https://github.com/facebook/react-native/pull/14058

Differential Revision: D5103239

Pulled By: shergin

fbshipit-source-id: caad8474fbe475065418d771b17e4ea9766ffcdc
2017-06-06 13:06:48 -07:00
Dan Caspi e284a9db8c Create JS executor and context on main thread w/ custom JSC
Reviewed By: javache

Differential Revision: D5165405

fbshipit-source-id: 35e5cfdf0518968c095ba54ec980d2fe376fa20e
2017-06-06 04:45:51 -07:00
Valentin Shergin 072d2709df Introducing `-[RCTView reactAccessibleView]`
Summary:
Sometimes, when we implement some custom RN view, we have to proxy all accessible atributes directly to some subview which actually has accesible content. So, in other words, this allows bypass some axillary views in terms of accessibility.
Concreate example which this approach supposed to fix:
https://github.com/facebook/react-native/pull/14200/files#diff-e5f6b1386b7ba07fd887bca11ec828a4R208

Reviewed By: mmmulani

Differential Revision: D5143860

fbshipit-source-id: 6d7ce747f28e5a31d32c925b8ad8fd4b98ce1de1
2017-06-02 14:19:57 -07:00
adamjmcgrath 23a34d4c65 Ignore "Frame load interrupted" errors in UIWebView
Summary:
Am writing an OAuth flow using `WebView`, when the OAuth provider redirects back to the [redirect_uri](https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow#logindialog) I intercept the request using `onShouldStartLoadWithRequest`, get the access token from the url and close the `WebView`.

The problem I see is that when the OAuth provider redirects to the `redirect_uri` and I intercept it by returning false from `onShouldStartLoadWithRequest`, I get a WebKitErrorDomain error code 102 ("Frame load interrupted").

Looking at some other iOS libraries that implement OAuth with a WebView - it seems that the error can be ignored. eg.

https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKCoreKit/FBSDKCoreKit/Internal/WebDialog/FBSDKWebDialogView.m#L146

https://github.com/evernote/evernote-sdk-ios/blob/master/evernote-sdk-ios/internal/ENOAuthViewController.m#L147

You can recreate the error using a url that automatically redirects, eg http://www.facebook.com -> https://www.facebook.com

```js
<WebView
  source={{ uri: 'http://www.facebook.com' }}
  onShouldStartLoadWithRequest={(event) => {
    if (event.url.startsWith('https://www.facebook.com')) {
      return false;
    }
    return true;
  }}
/>
```
Closes https://github.com/facebook/react-native/pull/12482

Differential Revision: D5154115

Pulled By: shergin

fbshipit-source-id: 25151d00a1f97e17760617ee5aac6a0140c733c8
2017-05-31 00:16:13 -07:00
Stephen Bird f1284b8231 Add message to remind user to enable wifi
Summary:
Our iOS devs frequently turn off wifi and forget to turn it back on. This message should remind them that they need wifi to connect. Often they waste several minutes due to this problem.

I'm not sure if there's a test plan to apply here. Any suggestions?
Closes https://github.com/facebook/react-native/pull/13551

Differential Revision: D5149231

Pulled By: hramos

fbshipit-source-id: 0afc71024f10f802ac1a50435fb57fc10a02c819
2017-05-30 20:49:48 -07:00
Pieter De Baets 33e22486e9 Fix some issues with the React podspec for the Cxx bridge
Summary:
Trying to fix the RN Travis CI tests

Splitting off from https://github.com/facebook/react-native/pull/14100
Closes https://github.com/facebook/react-native/pull/14132

Reviewed By: ericvicenti

Differential Revision: D5112077

Pulled By: javache

fbshipit-source-id: cf030b927b0f28f2b494471498f1ddb2c0a5c1df
2017-05-30 11:15:19 -07:00
Adam Comella cfe003238a iOS: Introduce API for making screen reader announcements
Summary:
This change introduces some APIs that are useful for making announcements through the screen reader on iOS:
  - `announceForAccessibility`: The screen reader announces the string that is passed in.
  - `announcementFinished`: An event that fires when the screen reader has finished making an announcement.

You can already solve similar problems with RN Android using the `accessibilityLiveRegion` prop. Live regions are a different feature but they can be used to solve the same problem. This commit does not attempt to add live region support in RN iOS because Apple did not build live region support into iOS.

Verified that `announceForAccessibility` causes VoiceOver to announce the string when VoiceOver is enabled. Verified that `announcementFinished` fires with the appropriate data in the event object. Additionally, my team has been using this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14168

Differential Revision: D5137004

Pulled By: javache

fbshipit-source-id: b3c10f3dfc716430a16fcc98e1bb6fe52cabd6a5
2017-05-30 04:46:08 -07:00
Valentin Shergin e13b9c6e49 RCTTextField was spliited into two classes
Summary:
Motivation:
 * We maintain two different implementation of <TextInput> (multilined and singlelined), this change makes the implementations much similar which will help us to support and improve both of them in the (near) future;
 * We have to have separated RCTView-based container view for (TextField) to support sofisticated bordering and so on;
 * It opens to us possibility to unify UITextView and UITextField subclasses and remove code duplication across RCTTextView and RCTTextField;
 * Making things decoupled in general will allow us to fix existing bugs with events.

Reviewed By: mmmulani

Differential Revision: D5083010

fbshipit-source-id: 2f2d42c2244d2b39256c51480c1f16f4e3947c01
2017-05-29 16:01:11 -07:00
Valentin Shergin 44af4d19d3 Fixed <TextInput>'s padding and border size computation and layout
Summary: Previosly `borderWidth` did not affect actual content inset (which was a problem).

Reviewed By: mmmulani

Differential Revision: D5072483

fbshipit-source-id: d43cba7414a9335b9f9fd4d1565d7aee403cce0e
2017-05-29 16:01:04 -07:00
Janic Duplessis 1658f36630 Improve z-index implementation on iOS
Summary:
This avoids reordering views because it created some bugs when the native hierarchy is different from the shadow views. This leverages `layer.zPosition` and takes z-index in consideration when we check what view should be the target of a touch.

**Test plan**
Tested that this fixes some layout issues that occurred when using sticky headers in the Expo home screen.
Closes https://github.com/facebook/react-native/pull/14011

Differential Revision: D5108437

Pulled By: shergin

fbshipit-source-id: 0abfe85666e9d236a190e6f54cdd5453cacfbcac
2017-05-28 21:45:32 -07:00
Pieter De Baets a2e589eb23 Cleanup initialization of native modules in FBReactModule
Reviewed By: shergin

Differential Revision: D5111768

fbshipit-source-id: 9ad682b51ad34516576b6403220bb7d2870e0192
2017-05-26 04:17:19 -07:00
Pieter De Baets 03e1f40c1e Cleanup and document Value wrapper (retry)
Reviewed By: mhorowitz

Differential Revision: D5120975

fbshipit-source-id: 6e9c80a57fdcf7f3dad21d5521fb928b52c924c7
2017-05-26 04:17:19 -07:00
Adam Comella e40d1a1065 iOS: Introduce API for moving screen reader's focus
Summary:
This change introduces an API, `setAccessibilityFocus`, which moves the screen reader's focus to the passed in element. This causes VoiceOver to announce the element and draw a focus rectangle around it.

Similar functionality is already available in RN Android through the `sendAccessibilityEvent` method. Here's an example of what exists today in RN Android:

```
RCTUIManager.sendAccessibilityEvent(
  node,
  8 /* TYPE_VIEW_FOCUSED */);
```

Called `setAccessibilityFocus` on a couple of elements to verify that focus does indeed move when VoiceOver is enabled. Additionally, my team is using this change in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14169

Differential Revision: D5137002

Pulled By: javache

fbshipit-source-id: 466e8b187e625de7c0f0d36e0400327dcd8d192a
2017-05-26 03:19:21 -07:00
Adam Comella 35338e9008 iOS: Avoid adding extra spaces to accessibility label
Summary:
In some cases, `RCTRecursiveAccessibilityLabel` could return an accessibility label that had leading space, trailing space, or multiple spaces between words. This is because it always added a space before adding a label even if the label turned out to be empty.

This is fixed by being stricter about adding spaces.

Found test cases that used to introduce leading space, trailing space, or multiple spaces between words and verified that there aren't any extra spaces after the fix.

```
{/* Used to have leading space */}
<View accessible={true}>
  <View />
  <View accessibilityLabel='Two' />
  <View accessibilityLabel='Three' />
</View>

{/* Used to have 2 spaces between "One" and "Three" */}
<View accessible={true}>
  <View accessibilityLabel='One' />
  <View />
  <View accessibilityLabel='Three' />
</View>

{/* Used to have trailing space */}
<View accessible={true}>
  <View accessibilityLabel='One' />
  <View accessibilityLabel='Two' />
  <View />
</View>
```

Additionally, my team is using this fix in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14177

Differential Revision: D5127891

Pulled By: shergin

fbshipit-source-id: 42c3022895d844959e0037eaf381b326af3cd6d1
2017-05-24 23:15:41 -07:00
makadaw 5e97be8b1c Fix data race on read/write _instance variable in ModuleData class
Summary:
Thanks for submitting a PR! Please read these instructions carefully:

- [ ] Explain the **motivation** for making this change.
- [ ] Provide a **test plan** demonstrating that the code is solid.
- [ ] Match the **code formatting** of the rest of the codebase.
- [ ] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?
XCode  [Thread Sanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) find race condition while read/write `_instance` variable in RCTModuleData class. A bridge can check `hasInstance` method while instance writes.

All tests passed on my device.
These changes remove data race, you can turn it in scheme configuration ![](https://www.shinobicontrols.com/wp-content/uploads/2016/08/Enable_Sanitizer.png)
Closes https://github.com/facebook/react-native/pull/13757

Differential Revision: D4994041

Pulled By: javache

fbshipit-source-id: 631cd59bbcbde193937d8baf8358ff6868717a2e
2017-05-24 13:01:00 -07:00
Feng999 a3d58ba570 Update RCTScrollView.m
Summary:
fix problem of function scrollToEnd: There are some strange thing happened when contentSize.height(width)  is smaller than bounds.size.height(width).  In fact, there is no need to scroll in this case.

Thanks for submitting a PR! Please read these instructions carefully:

- [x] Explain the **motivation** for making this change.
- [x] Provide a **test plan** demonstrating that the code is solid.
- [x] Match the **code formatting** of the rest of the codebase.
- [x] Target the `master` branch, NOT a "stable" branch.

What existing problem does the pull request solve?

A good test plan has the exact commands you ran and their output, provides screenshots or videos if the pull request changes UI or updates the website. See [What is a Test Plan?][1] to learn more.

If you have added code that should be tested, add tests.

Sign the [CLA][2], if you haven't already.

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

Make sure all **tests pass** on both [Travis][3] and [Circle CI][4]. PRs that break tests are unlikely to be merged.

For more info, see the ["Pull Requests"][5] section of our "Contributing" guidelines.

[1]: https://medium.com/martinkonicek/what-is-a-test-plan-8bfc840ec171#.y9lcuqqi9
[2]: https://code.facebook.com/cla
[3]: https://travis-ci.org/facebook/react-native
[4]: http://circleci.com/gh/facebook/react-native
[5]: https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests
Closes https://github.com/facebook/react-native/pull/13180

Differential Revision: D4928778

Pulled By: javache

fbshipit-source-id: 8b74833593ee317df726a4035ec71bbc77d13afe
2017-05-24 11:45:46 -07:00
Kathy Gray f46eaa30cf Provide sync vs async interface for bundle loading via parameter
Reviewed By: javache

Differential Revision: D5104317

fbshipit-source-id: ffacb57d85c24795a3acc2faba2ff5824cc739b2
2017-05-24 07:31:36 -07:00
Pieter De Baets d59fd9e419 Revert D5087565: Cleanup and document Value wrapper
Differential Revision: D5087565

fbshipit-source-id: 8168bda39fac9384264e9d849b205a2c1d37dcfa
2017-05-24 07:31:36 -07:00
Pieter De Baets 374d08b8e4 Cleanup and document Value wrapper
Reviewed By: mhorowitz

Differential Revision: D5087565

fbshipit-source-id: 21b15dc4c476d6ecd7c42f9334c6995fa43810c2
2017-05-24 06:30:51 -07:00
David Aurelio a710f9a81e Move packager launcher scripts outside of `packager/`
Summary: in order to prepare open sourcing React Native Packager, we have to move scripts specific to React Native to a directory that will continue to exist.

Reviewed By: javache

Differential Revision: D5112193

fbshipit-source-id: eac77d0d981aecef7ee52365a6856340420a5638
2017-05-23 16:17:09 -07:00
Pieter De Baets 0357303f5b Schedule initializeBridge on the JS thread
Reviewed By: shergin

Differential Revision: D5044230

fbshipit-source-id: 87030e210af662bc12cfb57bc83e73a128303fb0
2017-05-17 09:02:43 -07:00
Pieter De Baets 8525aac769 Ensure enqueueJSCall's completion block is always dispatched after the actual JS call
Reviewed By: mhorowitz

Differential Revision: D4985694

fbshipit-source-id: 50ab14e7088a53e03d5ee70c8ea1e245f531dac1
2017-05-16 09:46:54 -07:00
Valentin Shergin ff42878a5c Introducing `-[RCTUIManager shadowViewForReactTag:]`
Reviewed By: javache

Differential Revision: D5042093

fbshipit-source-id: 7c154b660f51de6d575f3c4a70321415512e92a2
2017-05-16 09:46:53 -07:00
Pieter De Baets 49c4c0c942 Fix packager reload command not working
Reviewed By: yungsters, mmmulani

Differential Revision: D5061001

fbshipit-source-id: 8b75c95525f90955a8dc2054861ad3b6e25eab1d
2017-05-15 10:30:36 -07:00
Pieter De Baets 65aaa9c045 Fix memory leak in RN fbsystrace support
Reviewed By: alexeylang

Differential Revision: D5060485

fbshipit-source-id: f2ab38023f1870992c16bea08ee887261d0ca34b
2017-05-15 03:47:15 -07:00
Pieter De Baets 6221053179 Improve systrace markers
Reviewed By: mhorowitz

Differential Revision: D4860135

fbshipit-source-id: ce963010883e6b9cc8e34f7ff01b4018cd195eba
2017-05-12 18:07:49 -07:00
Pieter De Baets 885856c6a1 More attempts to fix Travis CI runs
Summary:
* Add RCTBridge+Private to exported headers for unit tests
* Fix tvOS build
Closes https://github.com/facebook/react-native/pull/13840

Reviewed By: ericvicenti

Differential Revision: D5027887

Pulled By: javache

fbshipit-source-id: 7a17ee2f84eb1cb87e71373444ef25559959c24a
2017-05-10 04:32:54 -07:00
Ben Nham 65f22a5190 log script name with bundle loading perf event
Reviewed By: javache

Differential Revision: D5010638

fbshipit-source-id: 2e139201a8374245fa1dedc4f11a716dcf700fd7
2017-05-10 04:09:19 -07:00
Valentin Shergin 712b1dd20a RCTUIManagerObserverCoordinator: new way to subscribe for granular notifications from UI Manager
Reviewed By: majak

Differential Revision: D4868591

fbshipit-source-id: 24a09ffa3e69dec5ce1f0a8715c7e4701d781996
2017-05-08 12:52:09 -07:00
Valentin Shergin 2a984326b0 Introducing `RCTAssertUIManagerQueue()`
Reviewed By: javache

Differential Revision: D4868564

fbshipit-source-id: b9b9f6cf8f31495bb0e82fb60b2402dde460ddb8
2017-05-08 12:52:09 -07:00
Valentin Shergin 5058e7eb05 Several layout related helper methods of RCTShadowView was moved to new (+Layout) category.
Reviewed By: javache

Differential Revision: D4865327

fbshipit-source-id: 4df71b57433370ee09c3f1288c4d6241a33f440a
2017-05-08 11:31:20 -07:00
Pieter De Baets 1dd7bc1515 Remove RCTPackagerClientResponder references from Xcode projects
Reviewed By: ericnakagawa

Differential Revision: D5012951

fbshipit-source-id: c31732829790a46c5ff5134a6b8421ce934f41b6
2017-05-05 13:20:57 -07:00
Pieter De Baets e7680131d7 Merge RCTPackagerClient into RCTPackagerConnection
Reviewed By: mmmulani

Differential Revision: D4988204

fbshipit-source-id: 78e0df5268bfc11e4e0edf8e60494e55022cd9f2
2017-05-05 08:49:28 -07:00
Marc Horowitz b2f3a65eab Rename xcodeproj's so Cxx is the default
Reviewed By: javache

Differential Revision: D4981939

fbshipit-source-id: d2935aa04f30f025c6d5499604aaddf359b8eb14
2017-05-03 14:52:56 -07:00
Marc Horowitz dd45e7e1c4 Switch default bridge to CxxBridge
Reviewed By: javache

Differential Revision: D4981911

fbshipit-source-id: 49900a0e86d13045aa8930a865b073e1dec35e93
2017-05-03 14:52:56 -07:00
Valentin Shergin 18e0f84349 Use just `_bridge` instead of `batchedBridge` when actual bridge is already batched one
Reviewed By: javache

Differential Revision: D4989251

fbshipit-source-id: 939b54459d14e9bddd60be82787c2ca4d116200c
2017-05-03 11:16:31 -07:00
Alexey Lang 1c07658a1e Log RCTPLTTI for Warm Start
Reviewed By: javache

Differential Revision: D4962773

fbshipit-source-id: d01f8fe0d4e2f1e7453df03f9a15482f2f065a13
2017-05-03 09:30:54 -07:00
Alex Dvornikov 366c15d2b2 Use RCTDevLoadingView in a sample app
Reviewed By: javache

Differential Revision: D4985384

fbshipit-source-id: 1d5a33a6746010d3cf4ac524468af21bb9599f3e
2017-05-02 10:01:14 -07:00
Valentin Shergin 18fd18e792 Assertion on attempt to get layout metrics from dirtied Yoga node
Reviewed By: javache

Differential Revision: D4865294

fbshipit-source-id: e1bd2f297af87ffa817003f9e4dae94ad2c96644
2017-05-01 12:16:42 -07:00
Lukas Wöhrl 992e37c8bc Fix sizing of non strech items
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. This introduces a new useLegacyStretchBehaviour flag on the config to opt out of this change as it is breaking.

See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506

Reviewed By: astreet

Differential Revision: D4954016

Pulled By: emilsjolander

fbshipit-source-id: d28bd5d174cd76951fb94df85e3b0cfab7f81ff7
2017-04-28 06:18:30 -07:00
Alex Dvornikov d1fb892715 Clean up after recent RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD changes
Reviewed By: javache

Differential Revision: D4969636

fbshipit-source-id: 49785dcf02e6544a313d82ccb26839ac2302c7d9
2017-04-28 05:35:41 -07:00
Pieter De Baets 96d13b663b Avoid presenting on view controller that's being dismissed
Summary:
Mitigates the issue in https://github.com/facebook/react-native/issues/10471, by not trying to present
a modal or alert view if the presenting view controller is already being dismissed.

Reviewed By: shergin

Differential Revision: D4962169

fbshipit-source-id: 593e3f21096458651d16677a3e030552f809bf02
2017-04-28 03:30:38 -07:00
Valentin Shergin ca07a5fd5f Adopting Yoga's YGConfig in RCTShadowView
Reviewed By: javache

Differential Revision: D4932540

fbshipit-source-id: 4a5ff3b34fc635b3291dff9a7c1a603179c90fa7
2017-04-27 13:05:55 -07:00
Alex Dvornikov db0c22192c Added support for synchronous methods in native modules on iOS
Reviewed By: javache

Differential Revision: D4947556

fbshipit-source-id: 0ef73dc5d741201e59fef1fc048809afc65c75b5
2017-04-27 12:03:30 -07:00
Valentin Shergin 91be5bfc86 Do not warn if `touch.force` is NaN
Reviewed By: jingc

Differential Revision: D4956972

fbshipit-source-id: e0d4d55e4e7ee352a8fc88a4cfd43dc3cabc9c48
2017-04-26 15:16:16 -07:00
Pieter De Baets 34bc6bd2ae Drop support for webworkers
Reviewed By: AaaChiuuu

Differential Revision: D4916449

fbshipit-source-id: a447233d3b7cfee98db2ce00f1c0505d513e2429
2017-04-25 05:37:54 -07:00
Alexey Lang 1bc9d448f5 Port perf metrics used in RCTBatchedBridge
Reviewed By: javache

Differential Revision: D4938279

fbshipit-source-id: c927261ff96c2eb07b7303ae96aae7600f2947f1
2017-04-25 02:32:25 -07:00
Valentin Shergin e7c6a4c038 Fixed crash caused by NaN values in RCTTouchEvent
Summary:
React Native uses JSON to marshal the data across the bridge.
And because of this we have to avoid using NaN and INF values in events and other pieces of data that suppose to be transfered to/from JS side.
(We also don't want to introduce additional wrapping/escaping semantics for perfomance reasons.)
So, we have to gate all particular cases where there is a possibility of NaN or INF values, and replace these value with something meaningful for each particular case.
We are using `0` as NaN substitution here because:
 * NaN in touch event is super rare case;
 * Conversion to `0` is fast;
 * `0` is okay value for product code in most cases;
 * In all cases `0` is decent analog to "undefined position on screen" for touch event;
 * Nobody will explicitly handle NaN case in product code, just because it is super rare case and actually indicates that something else went wrong.

Reviewed By: javache

Differential Revision: D4918669

fbshipit-source-id: e95fa29e59dcdc40b57519e307b74c1f293da188
2017-04-21 11:30:57 -07:00
Pieter De Baets 59378f71db Immediately trigger renderApplication from RCTRootView init
Reviewed By: fkgozali

Differential Revision: D4849610

fbshipit-source-id: 291a9bcdf0efe47d83130fe2675f3ef04a3f085b
2017-04-21 07:04:57 -07:00
William Schurman 39d19740d2 Expose shake-to-show dev menu setting via the bridge
Summary:
Apps commonly provide their own rage-shake menus or behaviors, including in dev builds where the dev menu is enabled on shake. Rather than try to override these settings via native code, it can be helpful to let the app define when to show the menu via the bridge.

See recent discussion in https://github.com/facebook/react-native/issues/1054
Closes https://github.com/facebook/react-native/pull/13563

Differential Revision: D4928745

Pulled By: javache

fbshipit-source-id: a5b30e1b198780bb560e1a6d528f727b3b7d4cb7
2017-04-21 03:02:52 -07:00
Pieter De Baets db8efd9c4b Split off websocket related items to RCTPackagerConnection
Reviewed By: cwdick

Differential Revision: D4588557

fbshipit-source-id: 3f4176b9bab2b06cacbb06f1ff514a5f99a76d73
2017-04-20 08:32:10 -07:00
wenzhao.yin 47f834a76d fix RCTMultipartDataTask Memory leaks
Summary:
In the Docs of `NSURLSession` ,

>IMPORTANT

>The session object keeps a strong reference to the delegate until your app exits or explicitly >invalidates the session. If you do not invalidate the session, your app leaks memory until it exits.

The RCTMultipartDataTask will cause memory leaks, it will make `RCTBatchedBridge` and ` RCTMultipartDataTask` will not release.

So call `[session finishTasksAndInvalidate];` at the end of `startTask` function.
Closes https://github.com/facebook/react-native/pull/12673

Reviewed By: shergin

Differential Revision: D4896497

Pulled By: javache

fbshipit-source-id: eb5f8761f67ad33a7de081a68a9a7e1d4329bfc0
2017-04-20 03:45:25 -07:00
Marc Horowitz 325228d6cf Remove RCTBatchedBridge rule and all uses from the tree
Reviewed By: AaaChiuuu, javache

Differential Revision: D4889438

fbshipit-source-id: ba103ace8802f0976e09af6b491442e9aa723f49
2017-04-19 17:00:43 -07:00
Connor McEwen 3122328023 Enable dev menu in tvOS simulator
Summary:
There was no easy way to pull up the dev menu in the tvOS simulator

Run the UIExplorer demo and press cmd+d to bring up the menu
Closes https://github.com/facebook/react-native/pull/13584

Differential Revision: D4916967

Pulled By: javache

fbshipit-source-id: 27f50031f65f35dad46ad5ade7b52c7d350b31a2
2017-04-19 15:29:56 -07:00
Emily Janzer bd0f9fbacb Only start observing in requestPermissions() if not already observing
Reviewed By: javache

Differential Revision: D4903744

fbshipit-source-id: d2700f59bae521de6c76f8a3d11d6d48f1c0e7d9
2017-04-19 11:30:36 -07:00
Andrew Tokarev 460e77d47d Fixing Race condition that happens with _wasBatchActive
Summary:
Issue Fix: #13485

Yet another race condition that was found by XCode's Thread Sanitizer.
Happens because wasBatchActive is read/write from multiple threads at the same time

- opened UIExplorer and see it works
- npm run test pass
- tested on own project as well

Signed CLA
Closes https://github.com/facebook/react-native/pull/13505

Differential Revision: D4906096

Pulled By: javache

fbshipit-source-id: 5d4329aafcfe9491ce0188fa1e2dd71e09b31031
2017-04-19 03:00:53 -07:00
Marc Horowitz e7fe3b165b Explicitly cast to (bool) where needed on objc with folly::dynamic
Reviewed By: yfeldblum

Differential Revision: D4711054

fbshipit-source-id: 00897ca703f0f3a8cddaf170fef53f9851b631af
2017-04-18 15:36:20 -07:00
Kevin Cooper e443b7379e More verbose error messages for iOS
Summary:
Output the reason for the error when failing to load source code. This was a big help when trying to diagnose https://github.com/facebook/react-native/issues/13299.

~~Unfortunately there still seems to be no way to get the offending line number (because `loadError.userInfo[RCTJSStackTraceKey]` is empty), but this is good enough.~~

Before:

```
[warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:510] Failed to execute source code. Unhandled JS Exception: SyntaxError
```

After:

```
[warn][tid:com.facebook.react.JavaScript][RCTJSCErrorHandling.mm:30] Couldn't get stack trace for http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:81886
[warn][tid:com.facebook.react.JavaScript][RCTBatchedBridge.m:510] Failed to execute source code. Unhandled JS Exception: SyntaxError Unexpected keyword 'var'
```
Closes https://github.com/facebook/react-native/pull/13561

Differential Revision: D4908501

Pulled By: javache

fbshipit-source-id: a316dc70739b917b3cc690309d0ff37a8bb5d412
2017-04-18 14:19:13 -07:00
Marc Horowitz 5e09242e26 Rename JSCSamplingProfiler to RCTJSCSamplingProfiler
Reviewed By: javache

Differential Revision: D4889427

fbshipit-source-id: 1f74416b858134ec3682b1302021131114763881
2017-04-18 13:22:01 -07:00
Douglas Lowder a97f494bf1 Add missing header to tvOS build
Summary:
**Motivation**

Without this change, unit tests and integration tests won't build and run for Apple TV.

**Test plan**

Run `scripts/objc-test-tvos.sh` after uncommenting the TEST line.
Closes https://github.com/facebook/react-native/pull/13456

Differential Revision: D4875309

Pulled By: javache

fbshipit-source-id: 9b6fa3b7107924ba0346bf8be63bba5fe45acb53
2017-04-12 16:15:15 -07:00
Pieter De Baets 9d1c62669b Add extra guards to DispatchMessageQueueThread
Reviewed By: bnham

Differential Revision: D4868432

fbshipit-source-id: 23d6c996aa97db82ea5e0e166e1988f4ce378b6f
2017-04-11 12:25:39 -07:00
Alex Dvornikov abd148fa21 Show redbox window on JS errors for debug builds
Reviewed By: javache

Differential Revision: D4860613

fbshipit-source-id: 255202df9401ffd1dfb48224dd89255eac76874e
2017-04-11 06:00:42 -07:00
Valentin Shergin ca6e0b37cf `reactRespondsToTouch:` was removed
Summary:
* It complicates Touch Handling mechanism.
* The same functionality can be (and should be) implemented via overriding standard `hitTest:` method.
* It was marked as deprecated a while ago.

Reviewed By: mmmulani

Differential Revision: D4667776

fbshipit-source-id: 2e047c3308563a2849ea351a242270f0800fead2
2017-04-10 12:32:31 -07:00