Commit Graph

910 Commits

Author SHA1 Message Date
Nick Lockwood 8cfa6b6ea6 Deprecated customDirectEventTypes, and removed from RCTScrollViewManager
Summary: Using customDirectEventTypes or customBubblingEventTypes causes a viewmanager to be initialized at app start. This diff deprecates those methods and removes their usage from RCTScrollViewManager.

Reviewed By: majak

Differential Revision: D3218973

fb-gh-sync-id: 295bef3be9623b49b0cdcbf8a56e10d9b28126d9
fbshipit-source-id: 295bef3be9623b49b0cdcbf8a56e10d9b28126d9
2016-04-28 07:44:19 -07:00
Pieter De Baets e195bf9495 Fix RCTJavaScriptContextCreatedNotification
Summary: The notification was previously sent from a block that only existed if RCT_DEV. This makes us always send this notification.

Reviewed By: majak

Differential Revision: D3235070

fb-gh-sync-id: bf3488d439bc2253fd12cbb10f670f54bb37eb6e
fbshipit-source-id: bf3488d439bc2253fd12cbb10f670f54bb37eb6e
2016-04-28 06:59:21 -07:00
Pieter De Baets feda8ce2ee Clean up RCTEventDispatcher code
Reviewed By: majak

Differential Revision: D3175583

fb-gh-sync-id: c751c9dc79edfd9cb6073a2ff5dd743a03334bc4
fbshipit-source-id: c751c9dc79edfd9cb6073a2ff5dd743a03334bc4
2016-04-28 05:48:21 -07:00
Nick Lockwood 9547a98a68 Fixed deadlock during app startup
Summary:
Now that we support initializing the bridge off the main thread, some of the assumptions in the bridge setup process are no longer safe.

In particular we were assuming that the JS executor and injected modules could always be synchronously initialized within bridge init, but that is only safe if those modules don't need to be set up on the main thread.

The setup for those modules was sync-dispatching to the main thread if bridge init happened on a background thread, and this lead to a deadlock under certain circumstances.

Reviewed By: javache

Differential Revision: D3224162

fb-gh-sync-id: 7319b70f541a46ef932cfe4f776e7e192f3ce1e8
fbshipit-source-id: 7319b70f541a46ef932cfe4f776e7e192f3ce1e8
2016-04-27 09:09:23 -07:00
Pieter De Baets 171c7230b1 Simplify message passing in JSC-executor
Reviewed By: tadeuzagallo

Differential Revision: D3179792

fb-gh-sync-id: 96b7c91209ccac745e0f64def0095efd6b1184ed
fbshipit-source-id: 96b7c91209ccac745e0f64def0095efd6b1184ed
2016-04-27 06:35:27 -07:00
Nick Lockwood c1aff6b116 Removed exported constants for fixed-size views
Summary: Creating a view instance just to get the default view size is quite expensive, and affects startup time for the bridge as it must be done on the main thread. I've removed these cases and simply hard-coded the sizes in the JS file. This will need to be updated if the view sizes ever change, but in practice that's very unlikely.

Reviewed By: javache

Differential Revision: D3218917

fb-gh-sync-id: 91a21dabb6046c5d4d5d0bec0845415cb3628ec3
fbshipit-source-id: 91a21dabb6046c5d4d5d0bec0845415cb3628ec3
2016-04-26 04:21:39 -07:00
Janic Duplessis baa3668160 Add support for delete animation in LayoutAnimation on iOS
Summary:This adds support for delete view animations in LayoutAnimation for iOS. It supports the same properties as the create animation (alpha, scale).

This allows making simple animations when removing a view which is normally hard to do in React since we need to not remove the view node immediately.

**Test plan**
Tested add/removing views in the UIExample explorer with and without setting a LayoutAnimation. Also tested that the completion callback still works properly. Tested that user interation during the animation is properly disabled.

![layout-anim2](https://cloud.githubusercontent.com/assets/2677334/14595471/86fb1654-050d-11e6-8b38-fe45cc2dcd71.gif)

I also plan to work on improving the doc for LayoutAnimation as well as making this PR for android too.
Closes https://github.com/facebook/react-native/pull/6779

Differential Revision: D3215525

Pulled By: sahrens

fb-gh-sync-id: 526120acd371c8d1af433e8f199cfed336183775
fbshipit-source-id: 526120acd371c8d1af433e8f199cfed336183775
2016-04-25 00:19:25 -07:00
Labeeb Panampullan 446d7b7c17 Fixed array bounds error in MapView
Summary: fixed a case where MapView could crash due to a race condition

Differential Revision: D3207304

fb-gh-sync-id: a63918d160258d76fce5d56994100a63f4c5fb68
fbshipit-source-id: a63918d160258d76fce5d56994100a63f4c5fb68
2016-04-22 10:59:29 -07:00
Andrew Gray 774296b263 Implemented stopLoading
Summary:**Motivation:** In my app, I'm using a WebView that loads content from my mobile site.  What I want to do is when a user presses a link on the loaded page, I want to stop the WebView's request, hijack the URL and open the URL in a new WebView, pushed to the top of the navigator stack.  To me, this gives the overall app a more native feel, instead of implementing a rudimentary navbar on the main WebView to go back.

**Attempted Workarounds:** I've attempted to get similar functionality by capturing the onNavigationStateChange event in the WebView, and then within calling goBack + pushing the new view to the navigator stack.  From a functionality standpoint, this works.  However, from a UI standpoint, the user can clearly see the webview change states to a new page + go back before having the new view pushed on top of their nav stack.
Closes https://github.com/facebook/react-native/pull/6886

Differential Revision: D3212447

Pulled By: mkonicek

fb-gh-sync-id: 05911e583d9ba54ddbd54a772153c80ed227731e
fbshipit-source-id: 05911e583d9ba54ddbd54a772153c80ed227731e
2016-04-22 08:15:25 -07:00
Alexey Lang 32a89493fb Fix leaked cookieMap in RCTJSCExecutor
Reviewed By: javache

Differential Revision: D3207245

fb-gh-sync-id: 1263974e2f94175cd4bf190cec446b88b5273aca
fbshipit-source-id: 1263974e2f94175cd4bf190cec446b88b5273aca
2016-04-22 06:44:26 -07:00
Pieter De Baets 8b1726bdad Improve error handling in require-unbundle
Reviewed By: davidaurelio

Differential Revision: D3207450

fb-gh-sync-id: 35247c265e35976dcee9fca4215403efa604479e
fbshipit-source-id: 35247c265e35976dcee9fca4215403efa604479e
2016-04-22 06:18:26 -07:00
Alexey Lang 033e7c80bf Support the bytecode cache for FBReactKit
Reviewed By: javache

Differential Revision: D3174040

fb-gh-sync-id: 8d1c43a55ec8764e5b51f13663613b0f7a4a581e
fbshipit-source-id: 8d1c43a55ec8764e5b51f13663613b0f7a4a581e
2016-04-21 08:59:43 -07:00
Pieter De Baets 2b69ec2589 Provide initial size to Modal
Reviewed By: majak

Differential Revision: D3202211

fb-gh-sync-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
fbshipit-source-id: 83a1d3d52df0dc68483639393ab64fd6f1281cb3
2016-04-21 08:57:19 -07:00
Mike Grabowski 0de8962e16 Do not make RCTDevLoadingView a keyWindow
Summary:Hey,

I have been going through some UIAlert related issues in the repo trying to fix them, and one of the steps to start reproducing them was to put `Alert.alert()` call right inside `componentDidMount`.

However, I've started noticing strange bugs as long as I didn't set 1second timeout.

Started digging in deeper, and I've noticed the `UIAlert` gets attached to the `RCTWindow()` mainViewController.

However - since RCTDevLoadingView adds a `keyWindow`, that is the window that will be returned at the time of the call and the window `UIAlert` will be attached to.

To visualise that better - you can take a look at these two frames when app is being loaded:
<img width="371" alt="screen shot 2016-04-20 at 22 02 45" src="https://cloud.githubusercontent.com/assets/2464966/14688596/ae8d292c-0743-11e6-8aeb-e45da391b5b5.png">
<img width="371" alt="screen shot 2016-04-20 at 22 02 58" src="https://cloud.githubusercontent.com/assets/2464966/14688599/b30798e8-0743-11e6-951a-463fe7324c56.png">

AFAIK we do
Closes https://github.com/facebook/react-native/pull/7098

Differential Revision: D3207395

Pulled By: javache

fb-gh-sync-id: f8dca063573ac6f2a0ec497138b2ed0a7b27788b
fbshipit-source-id: f8dca063573ac6f2a0ec497138b2ed0a7b27788b
2016-04-21 07:02:27 -07:00
Martin Kralik 85f7569ce6 fix incorrect layout for modal
Summary:We had an issue where a rendered modal would not end up using the full screen size, but a size computed based on its initial content.
Which is a small spinner in case of RelayContainer. So rarely we would end up with cut off view like this:
{F60650629}

This diff fixes this behavior by wrapping the content in another view. That makes the modal's wrapping VC's view resize just once when it's initially created. (Resize for the wrapping VC's view happened previously when the modal's content resized, which got us in the bad state.)

Reviewed By: javache

Differential Revision: D3202299

fb-gh-sync-id: 7c4dc1dbb27654292d07aef5916aa31df5cd4302
fbshipit-source-id: 7c4dc1dbb27654292d07aef5916aa31df5cd4302
2016-04-20 11:20:26 -07:00
Martin Kralik eff673572e pass flexiblity to shadowrootview on its creation
Reviewed By: javache

Differential Revision: D3177404

fb-gh-sync-id: 2116628461e37e9f1d1b3cbc6d6560675cadee7e
fbshipit-source-id: 2116628461e37e9f1d1b3cbc6d6560675cadee7e
2016-04-20 10:53:21 -07:00
Pieter De Baets 5cdfe0f4b1 Report JSC errors as JS exceptions
Summary:When JSC throws an error on startup (e.g. a SyntaxError) or when invoking a method that is not caught by RCTExceptionsManager, we previously just reported is a native error, with a (useless) native stack trace in the redbox. This changes that behaviour to report a JS stacktrace.

The same issue was previously reported here: https://github.com/facebook/react-native/pull/5677

Reviewed By: majak

Differential Revision: D3037387

fb-gh-sync-id: 06f8333e0eb50dcef0b26284754262301b8a5f08
fbshipit-source-id: 06f8333e0eb50dcef0b26284754262301b8a5f08
2016-04-20 09:13:29 -07:00
Nick Lockwood 546d140ec7 Fix array bounds crash in MapView
Summary: Under some circumstances, the calloutIndex might be > number of callout views, (possibly due to a race condition?). This prevents that from crashing.

Reviewed By: tadeuzagallo

Differential Revision: D3196010

fb-gh-sync-id: 6485e64c682937431cb8598d7f3f42e8d37eeff1
fbshipit-source-id: 6485e64c682937431cb8598d7f3f42e8d37eeff1
2016-04-19 05:03:22 -07:00
Li Jie 93b39b7326 Fix refreshing state
Summary:When RefreshControl.refreshing change twice within 250ms, it ignores the second changing.

**Test plan (required)**

```
refresh () {
  this.setState({
    refreshing: true
  })

  fetch('/api')
  .then(() => {
    this.setState({
      refreshing: false
    })
  })
  .catch((error) => {
    this.setState({
      refreshing: false
    })
  })
}

render() {
  return (
    <ScrollView
      refreshControl={
        <RefreshControl
          refreshing={this.state.refreshing}
          onRefresh={this.refresh.bind(this)}
        />
      }>
      <TouchableHighlight onPress={this.refresh.bind(this)}>
        <View>
          <Text>Touch Me!</Text>
        </View>
      </TouchableHighlight>
    </ScrollView>
  )
}
```

* Test Case 1: Touch "Touch Me!", if get response less than 250ms, the state is always refreshing.

* Test Case 2: Close network, Touch "Touch Me!", the state is always refreshing.
Closes https://github.com/facebook/react-native/pull/6737

Differential Revision: D3189627

fb-gh-sync-id: 81c1932408e1ab99732b8340a5e3bd557629a66b
fbshipit-source-id: 81c1932408e1ab99732b8340a5e3bd557629a66b
2016-04-17 00:33:25 -07:00
Sokovikov 849a0f31ac Allow to set refresh control title color
Summary:Closes #6812

![simulator screen shot 14 apr 2016 12 13 36](https://cloud.githubusercontent.com/assets/1488195/14521441/0abccf5c-0232-11e6-94dc-0ebdbfac4b3f.png)
Closes https://github.com/facebook/react-native/pull/6970

Differential Revision: D3189244

fb-gh-sync-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
fbshipit-source-id: 7625b6ab5859aaa20bc0cb379855c5daeb584abf
2016-04-16 15:15:25 -07:00
Martin Kralik db25ab4901 add missing RCTConvert import
Summary: `RCTComponentData` needs `RCTConvert` class, but it doesn't import it directly. This diff is changing it. Should be noop.

Reviewed By: fkgozali

Differential Revision: D3185141

fb-gh-sync-id: f845e3555d30c9fd9b39579194590ddf103a5a19
fbshipit-source-id: f845e3555d30c9fd9b39579194590ddf103a5a19
2016-04-15 13:24:21 -07:00
Oleg Lokhvitsky e02d400f53 Set autoresizingMask to redraw root when resizing RN window
Reviewed By: javache

Differential Revision: D3177081

fb-gh-sync-id: 987167033329413cd0a4b296ca849758ec87368c
fbshipit-source-id: 987167033329413cd0a4b296ca849758ec87368c
2016-04-14 14:27:23 -07:00
Pieter De Baets a8f4159fc7 Don't instantiate all native modules on invalidate
Reviewed By: majak

Differential Revision: D3175599

fb-gh-sync-id: 86b60a8bd757765d35cce6248a613c8167400bd9
fbshipit-source-id: 86b60a8bd757765d35cce6248a613c8167400bd9
2016-04-13 18:28:21 -07:00
Ian Yu-Hsun Lin 802fdefcd2 Fix spelling of descendant
Summary: Closes https://github.com/facebook/react-native/pull/6915

Differential Revision: D3162465

Pulled By: mkonicek

fb-gh-sync-id: e5237474f4ff901451c08bd904b78fabd15ab1dc
fbshipit-source-id: e5237474f4ff901451c08bd904b78fabd15ab1dc
2016-04-13 08:44:29 -07:00
skellyb c254d081fd endRefreshing animates scrollView to top inset instead of zero
Summary:To use a ScrollView and RefreshControl with a translucent navigation bar you have to set the top inset to the height of that bar, allowing the content to scroll underneath. After changes to RCTRefreshControl in  **v0.22**, `endRefreshing` always animates the offset to 0, hiding content behind the navigation bar. What you'd expect on iOS is for it to return to the bottom of the bar.

**Test plan**
To see this in action, refer to the UIExplorerApp. In RefreshControlExample.js if you set the ScrollView's `contentInset={{top: 100}}` you'll see the refresh control UI is where you'd expect, and after refresh the list returns to the correct position.
Closes https://github.com/facebook/react-native/pull/6848

Differential Revision: D3157934

Pulled By: mkonicek

fb-gh-sync-id: c2186a4541fb3988677f0851eb12c259cd003750
fbshipit-source-id: c2186a4541fb3988677f0851eb12c259cd003750
2016-04-13 08:15:24 -07:00
Justin Zeus b2eecdc90d Parse _Nonnull and _Nullable attributes in RCTParseMethodSignature
Differential Revision: D3171305

fb-gh-sync-id: 687b030e13e762110f9ea9b750b0bc09457229a5
fbshipit-source-id: 687b030e13e762110f9ea9b750b0bc09457229a5
2016-04-12 17:45:25 -07:00
Emil Sjolander 303428ea28 Import css-layout measure mode changes from pull request #163
Reviewed By: lucasr

Differential Revision: D3167760

fb-gh-sync-id: f4f13bcb09a2d8b2db2764bd31fa8cbd8edb484b
fbshipit-source-id: f4f13bcb09a2d8b2db2764bd31fa8cbd8edb484b
2016-04-12 07:02:29 -07:00
Emil Sjolander 8ef551174b backout update of css-layout. breaks ios <9
Reviewed By: javache

Differential Revision: D3164127

fb-gh-sync-id: 3926430f365711466ba93cd2eb7c91f31ef0c7f8
fbshipit-source-id: 3926430f365711466ba93cd2eb7c91f31ef0c7f8
2016-04-11 14:56:21 -07:00
Nick Lockwood c55ca61396 Dispatch view creation immediately instead of waiting for layout
Summary:All UIManager operations that affect the view hierarchy are executed via the `addUIBlock:` method, which queues them up to be executed after layout has been completed on the shadow queue.

One of the most expensive view operations is view creation, but since this doesn't actually depend on layout, there's no reason to delay it until the shadow operations have finished.

This diff modifies the `createView` method to dispatch view creation directly to the main thread instead of adding it to the UIBlock queue. This seems to result a measurable improvement in TTI.

(Credit to astreet, for implementing the same idea on Android, and thanks to oli for telling me about it!)

Reviewed By: javache

Differential Revision: D3155709

fb-gh-sync-id: 3ad1da9a8fee687aa7e0e023d668192d94dba340
fbshipit-source-id: 3ad1da9a8fee687aa7e0e023d668192d94dba340
2016-04-11 05:06:20 -07:00
Jonathan Ballerano 9923d3fa6f Use `loadRequest` instead of `reload` when initial load fails
Summary:On iOS, `WebView` will get stuck when the first request fails to load. The most common case where this could happen is when a user has limited or no connectivity.

Here's a repo with a sample app that demonstrates the problem and this fix: [https://github.com/jballer/react-native-webview-reload-example](https://github.com/jballer/react-native-webview-reload-example).

**Attempted workarounds**
- `WebView.reload()` fails internally because the `UIWebView`'s `currentRequest` doesn't have its `URL` set
- Setting `WebView.source.uri` won't do anything; the JS value value is unchanged and therefore doesn't cross the native bridge.
- Unmounting and remounting the `WebView` component would lose history and context if an error occurs on a request that's not the first request.

**Test plan (manual testing)**

1. Disable network connection
1. Relaunch application or reload JS
1. Enable network connection
1. Tap "reload" button
1. Observe whether page reloads
Closes https://github.com/facebook/react-native/pull/6873

Differential Revision: D3159219

Pulled By: javache

fb-gh-sync-id: 8893dd20dc9f4a1a00d14a488ce657cc50287a29
fbshipit-source-id: 8893dd20dc9f4a1a00d14a488ce657cc50287a29
2016-04-08 17:17:23 -07:00
Mart?n Bigio 648aaf440b Avoid crashing when executor is invalidated before it finishes loading RA Bundle
Reviewed By: alexeylang

Differential Revision: D3150719

fb-gh-sync-id: 46e516757e110e985980056f2a8b6eaa22e522b0
fbshipit-source-id: 46e516757e110e985980056f2a8b6eaa22e522b0
2016-04-08 07:34:28 -07:00
digeff 4c8a9f0d00 Added support for JavaScript third-party debuggers
Summary:* Add ability to configure the app that should open when starting debugging

axemclion discussed this feature with tadeuzagallo and martinbigio on: https://github.com/facebook/react-native/issues/5051
Closes https://github.com/facebook/react-native/pull/5683

Reviewed By: martinbigio

Differential Revision: D2971497

Pulled By: mkonicek

fb-gh-sync-id: 91c3ce68feed989658124bb96cb61d03dd032599
fbshipit-source-id: 91c3ce68feed989658124bb96cb61d03dd032599
2016-04-07 13:15:58 -07:00
Emil Sjolander 3b5a49bfb6 Import css-layout measure mode changes from pull request #163
Reviewed By: astreet

Differential Revision: D3059432

fb-gh-sync-id: 56cc13ffbc4805aa0789df62a04e19f23a438bd3
fbshipit-source-id: 56cc13ffbc4805aa0789df62a04e19f23a438bd3
2016-04-07 10:16:30 -07:00
Nick 2a03182b1c CHORE - Remove Trailing Spaces
Summary:Remove Trailing Spaces.

Why:
Sometimes there are conflicts with trailing spaces
Saves space
Those whose tools automatically delete them will have their pr watered down with trailing space removal
Closes https://github.com/facebook/react-native/pull/6787

Differential Revision: D3144704

fb-gh-sync-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
fbshipit-source-id: d8a62f115a3f8a8a49d5b07f56c540a02af38cf8
2016-04-06 09:21:53 -07:00
Martin Kralik 3874c01292 make `RCTEventDispatcher` dispatch events in incoming order
Reviewed By: javache

Differential Revision: D3138215

fb-gh-sync-id: 430b57d7bb8e3f0f90877b627bfd6a842719ba5d
fbshipit-source-id: 430b57d7bb8e3f0f90877b627bfd6a842719ba5d
2016-04-05 09:17:28 -07:00
Martin Kralik 8efc098646 fixed coalescing key generation for RCTTouchEvent
Summary:Turns our using the same coalescing key until a person removes all fingers off screen is not ideal.
It doesn't work in a case where the first finger starts moving on screen and then a second finger joins it later (almost any pinch gesture),
since we would try to coalesce move events from the start when only one finger was touching screen with events where two fingers were moving on screen.
That doesn't work and results in a crash.

I've changed the logic for generating the coalescing key in order to prevent this.
We no longer have a single key for a single gesture, but we change the key each time amount of fingers increases ("touchStart") or decreases ("touchEnd").

Reviewed By: javache

Differential Revision: D3138275

fb-gh-sync-id: c32230ba401819fe3a70d1752b286d849520be89
fbshipit-source-id: c32230ba401819fe3a70d1752b286d849520be89
2016-04-05 09:10:27 -07:00
Tadeu Zagallo 2f2703936d Use indirect jumps on armv7
Summary:Immediate jumps on arm cannot jump further than 32mb, which might be a problem for large binaries.

+ add the missing `.thumb_func` directive.

Reviewed By: michalgr

Differential Revision: D3121148

fb-gh-sync-id: a53ad0ac70af9df84437b37f19b8a1cb49dd6fa2
fbshipit-source-id: a53ad0ac70af9df84437b37f19b8a1cb49dd6fa2
2016-04-04 06:49:19 -07:00
Pieter De Baets d95757037a Update css-layout from github
Summary:Update to latest master version of css-layout. Update integration in RCTShadow(Root)View to match.

This solves the issue with items not strechting vertically in column layouts (https://github.com/facebook/css-layout/issues/127)

Reviewed By: vjeux

Differential Revision: D3120699

fb-gh-sync-id: beba162e1255d3527e1160e9bd414a712cb10713
fbshipit-source-id: beba162e1255d3527e1160e9bd414a712cb10713
2016-04-04 04:10:24 -07:00
Martin Kralik 02b6e38bee better event emitting II: no deadlocks
Summary:D3092867 / 1d3db4c5dc caused deadlock when chrome debugging was turned on, so it was reverted as D3128586 / 144dc30661.
The reason: I was calling `[_bridge dispatchBlock:^{ [self flushEventsQueue]; } queue:RCTJSThread];` from main thread and expecting it will `dispatch_async` to another,
since a held lock was being accessed the dispatched block and was released after the dispatch.
Turns out `RCTWebSocketExecutor` (which is used when chrome debugger is turned on) executes all blocks dispatched this way to `RCTJSThread` synchronously on the main thread.
This resulted in a deadlock. The "dispatched" block was trying to acquired lock which held by the same thread in the dispatching phase.

A fix for this is pretty simple. We will release the lock before dispatching the block.

However it's not super straightforward to see this won't introduce some race condition in a case with two threads where we would end up with events not being processed.
My thinking why that shouldn't happen goes like this: We could get in a bad state if `flushEventsQueue` would run on JS thread while `sendEvent:` is running on MT.
(I don't have a specific example how, maybe it's not possible. However when I show this case is safe we know we are good.)
The way how locking is setup in this diff the only possible scenario where these two threads would execute in these methods concurrently is JS holding the lock and MT going to enqueue another block on JS thread (since that's outside of "locked" zone).
But this scenarion can never happen, since if MT is about to enqueue the block on JS thread it means there cannot be a not yet fully executed block on JS thread.
Therefore nothing bad can happen.

So this diff brings back the reverted diff and adds to it the fix for the deadlock.

Reviewed By: javache

Differential Revision: D3130375

fb-gh-sync-id: 885a166f2f808551d7cd4e4eb98634d26afe6a11
fbshipit-source-id: 885a166f2f808551d7cd4e4eb98634d26afe6a11
2016-04-02 23:31:25 -07:00
Alex Kotliarskyi 144dc30661 Revert [RN][iOS] better event emitting
Reviewed By: sahrens

Differential Revision: D3128586

fb-gh-sync-id: 5c3c79fa983f6c1c43319a6c14049f99e0dfee8a
fbshipit-source-id: 5c3c79fa983f6c1c43319a6c14049f99e0dfee8a
2016-04-01 14:26:20 -07:00
Tisho Georgiev 8a3e1e92f3 Prevent loading message from resetting simulator orientation on every reload.
Summary:If you're working on an app that needs to support landscape, reloading the app causes the iPhone simulator to reset its orientation to portrait every time the `RCTDevLoadingView` shows up. This is because it sets the root VC to `RCTModalHostViewController`, which currently supports only portrait orientations on iPhone. Changing the root view to a vanilla `UIViewController` fixes the issue.

**Steps to Reproduce**

1. Create a blank RN project: `react-native init RNTest`
2. Open it up and run it.
3. Rotate to landscape `Cmd+Right Arrow`.
4. Reload by pressing `Cmd+R`.

**Expected**

The simulator stays in landscape mode.

**Actual**

The simulator goes back to portrait.
Closes https://github.com/facebook/react-native/pull/6765

Differential Revision: D3127339

Pulled By: javache

fb-gh-sync-id: e2543c90c8d116307dcefa89a417447c1f1a327f
fbshipit-source-id: e2543c90c8d116307dcefa89a417447c1f1a327f
2016-04-01 12:31:21 -07:00
Alexey Lang b57d90a479 Append D3126321
Reviewed By: javache

Differential Revision: D3126614

fb-gh-sync-id: b36bb5eaa306823dce4bd7276f2dd63a2e5cb759
fbshipit-source-id: b36bb5eaa306823dce4bd7276f2dd63a2e5cb759
2016-04-01 11:09:22 -07:00
Alexey Lang ef8ad82a62 Add more performance logs and Systrace events for RAM and bridge startup
Summary: Add more performance logs and Systrace events for RAM and bridge startup.

Reviewed By: javache

Differential Revision: D3126321

fb-gh-sync-id: bb059f1f0302b751c6bf97bbe6bdbaf0aba27e21
fbshipit-source-id: bb059f1f0302b751c6bf97bbe6bdbaf0aba27e21
2016-04-01 07:25:38 -07:00
Pieter De Baets b00c77af80 Increase RN devtools retry timeout
Summary:The 200ms timeout was causing resource issues and causing a lot of overhead when you're not running the devtools, since it will basically create a new socket every 200ms.

Also clean up the way we do logging so it's completely compiled out in prod, and standardize all the names we use for threading to lowercase react.

Reviewed By: frantic

Differential Revision: D3115975

fb-gh-sync-id: e6e51c0621d8e9fc4eadb864acd678b8b5d322a1
fbshipit-source-id: e6e51c0621d8e9fc4eadb864acd678b8b5d322a1
2016-04-01 07:02:25 -07:00
Martin Kralik 31bb85a210 limit fake scroll event emitting
Summary:A need for sending a scroll events outside of scrollview made D3092854 a bit clunky. This diff kinda fixes it by tightening up emitting of fake scroll events just to the only usecase we have right now.

Why not just simply construct the event in `RCTNavigator`, so we can drop the code from `RCTScrollView` altogether?
`RCTScrollEvent` is private to `RCTScrollView`, and that's good. We don't want anyone have an ability to make up scroll events. Even this existing functionality should be sunset one day when we better integrate with native gesture recognizers.

Depends on D3092867.

Reviewed By: javache

Differential Revision: D3120751

fb-gh-sync-id: 6519c055b983cfd48c4b4a9d619c4452e12efda1
fbshipit-source-id: 6519c055b983cfd48c4b4a9d619c4452e12efda1
2016-04-01 06:54:50 -07:00
Martin Kralik 1d3db4c5dc better event emitting
Summary:Previously, (mostly touch and scroll) event handling on iOS worked in a hybrid way:
* All incoming coalesce-able events would be pooled and retrieved by js thread in the beginning of its frame (all of this happens on js thread)
* Any non-coalesce-able event would be immediately dispatched on a js thread (triggered from main thread), and if there would be pooled coalesce-able events they would be immediately dispatched at first too.

This behavior has a subtle race condition, where two events are produced (on MT) in one order and received in js in different order.
See https://github.com/facebook/react-native/issues/5246#issuecomment-198326673 for further explanation of this case.

The new event handling is (afaik) what Android already does. When an event comes we add it into a pool of events and dispatch a block on js thread to inform js there are events to be processed. We keep track of whether we did so, so there is at most one of these blocks waiting to be processed. When the block is executed js will process all events that are in pool at that time (NOT at time of enqueuing the block).
This creates a single way of processing events and makes it impossible to process them in different order in js.

The tricky part was making sure we don't coalesce events across gestures/different scrolls. Before this was achieved by knowing that gestures and scrolls start/end with  non-coalesce-able event, so the pool never contained events that shouldn't be coalesced together. That "assumption" doesn't hold now.
I've re-added `coalescingKey` and made touch and scroll events use it to prevent coalescing events of the same type that should remain separate in previous diffs (see dependencies).

On top of it it decreases latency in events processing in case where we get only coalesce-able events. Previously these would be processed at begging of the next js frame, even when js would be free and could process them sooner. This delay is done, since they would get processed as soon as the enqueued block would run.

To illustrate this improvement let's look at these two systraces.
Before: https://cloud.githubusercontent.com/assets/713625/14021417/47b35b7a-f1d3-11e5-93dd-4363edfa1923.png
After: https://cloud.githubusercontent.com/assets/713625/14021415/4798582a-f1d3-11e5-8715-425596e0781c.png

Reviewed By: javache

Differential Revision: D3092867

fb-gh-sync-id: 29071780f00fcddb0b1886a46caabdb3da1d5d84
fbshipit-source-id: 29071780f00fcddb0b1886a46caabdb3da1d5d84
2016-04-01 06:54:50 -07:00
Martin Kralik b1b53aad8b coalescingKeys for RCTTouchEvent
Reviewed By: javache

Differential Revision: D3092864

fb-gh-sync-id: b703dca92578e05195eac9171b5b6eee83976cc9
fbshipit-source-id: b703dca92578e05195eac9171b5b6eee83976cc9
2016-04-01 06:54:50 -07:00
Martin Kralik 7c2b397b00 RCTTouchEvent's init takes coalescing key
Reviewed By: javache

Differential Revision: D3092861

fb-gh-sync-id: 69beb58c0a2ca3fe33712a57098c8b7300ad49f4
fbshipit-source-id: 69beb58c0a2ca3fe33712a57098c8b7300ad49f4
2016-04-01 06:54:49 -07:00
Martin Kralik cefc5a66f2 adding coalescing key generation for scroll events
Reviewed By: javache

Differential Revision: D3092857

fb-gh-sync-id: 79a1e235d97d484ee7247f17250759b161bc2c07
fbshipit-source-id: 79a1e235d97d484ee7247f17250759b161bc2c07
2016-04-01 06:54:49 -07:00
Martin Kralik a37075dcec RCTScrollEvent's init takes coalescing key
Reviewed By: javache

Differential Revision: D3092854

fb-gh-sync-id: 5aaab55638871510e6a46797189c123a0ecef6b7
fbshipit-source-id: 5aaab55638871510e6a46797189c123a0ecef6b7
2016-04-01 06:54:49 -07:00