Commit Graph

849 Commits

Author SHA1 Message Date
Tadeu Zagallo e291cda380 remove extra thumb directive from trampoline
Differential Revision: D3087319

fb-gh-sync-id: 667582a468f2b3686b897a1f0aa9b3b966519c86
shipit-source-id: 667582a468f2b3686b897a1f0aa9b3b966519c86
2016-03-23 10:09:28 -07:00
Martín Bigio 24508d0d58 register `nativeRequire` on JS thread
Reviewed By: tadeuzagallo

Differential Revision: D3087194

fb-gh-sync-id: 9c7bb37260dd202d1ee54606007be02de6c0fb55
shipit-source-id: 9c7bb37260dd202d1ee54606007be02de6c0fb55
2016-03-23 09:28:31 -07:00
Martín Bigio 8edc35004c Move preloaded modules to startup code section
Summary:We found that moving the preloaded modules to the startup section of the RAM Bundle improves TTI quite a bit by saving lots of through the bridge calls and injecting multiple modules at once on JSC. However, doing this on a non hacky way required a lot of work. The main changes this diff does are:
  - Add to `BundleBase` additional bundling options. This options are fetched based on the entry file we're building by invoking a module that exports a function (`getBundleOptionsModulePath`).
  - Implement `BundleOptions` module to include the `numPreloadedModules` attribute as a bundle additional option. This value is computed by getting the dependencies the entry file has and looking for the first module that exports a module we don't want to preload. The `numPreloadedModules` attribute is then used to decide where to splice the array of modules.
- Additional kung fu to make sure sourcemaps work for both preloaded and non preloaded modules.

Reviewed By: davidaurelio

Differential Revision: D3046534

fb-gh-sync-id: 80b676222ca3bb8b9eecc912a7963be94d3dee1a
shipit-source-id: 80b676222ca3bb8b9eecc912a7963be94d3dee1a
2016-03-23 09:28:31 -07:00
Jakub Woyke 2ec88028f5 Add .thumb to RCTProfileTrampoline-arm.S
Reviewed By: jasonprado

Differential Revision: D3079658

fb-gh-sync-id: a20195f8be1c90a4feb6ec30a6a06edc5cc59ccd
shipit-source-id: a20195f8be1c90a4feb6ec30a6a06edc5cc59ccd
2016-03-22 18:34:27 -07:00
Jakub Woyke 236dadad96 Add .thumb to RCTProfileTrampoline-arm.S
Reviewed By: jasonprado

Differential Revision: D3079658

fb-gh-sync-id: a5b1d877bd26186942e39e9efd97e7df4c07c36f
shipit-source-id: a5b1d877bd26186942e39e9efd97e7df4c07c36f
2016-03-22 18:25:23 -07:00
Satish Sampath 78ad15d85b Fix arc focus build
Reviewed By: majak

Differential Revision: D3081868

fb-gh-sync-id: c776cf5de04cecdf6b8e0b9a11ef590b12f2b875
shipit-source-id: c776cf5de04cecdf6b8e0b9a11ef590b12f2b875
2016-03-22 10:58:29 -07:00
Alexey Lang 030e34959e Don't schedule script execution on the main thread
Reviewed By: martinbigio

Differential Revision: D3069375

fb-gh-sync-id: baa9e4217957c82eb0bba05a8e93527476084a3b
shipit-source-id: baa9e4217957c82eb0bba05a8e93527476084a3b
2016-03-22 09:33:28 -07:00
Emily Janzer 7035ada867 Use 'background' app state when app is foregrounded from notif
Summary:Changing app state back to 'background' for UIApplicationWillEnterForegroundNotification.

On iOS we use the 'background' app state to determine whether a notification was tapped to foreground the app vs. received while app was already active. The PR https://github.com/facebook/react-native/pull/6379 changed RCTAppState so that it returned 'active' when app was being foregrounded from a notification; this changes it back to 'background' so that we can distinguish between the two cases again

Reviewed By: hedgerwang

Differential Revision: D3078746

fb-gh-sync-id: 8b5e9118a7e14f15871bfb68e9f85d20108b1faf
shipit-source-id: 8b5e9118a7e14f15871bfb68e9f85d20108b1faf
2016-03-21 18:39:21 -07:00
Nick Lockwood d033c45f93 Extracted rootview-specific shadowview logic into new class
Summary:It was hard to understand which parts of the shadowview API are designed to be called only on the root view, and which were applicable to any view.

This diff extracts rootview-specific logic out into a new RCTRootShadowView class.

Reviewed By: majak

Differential Revision: D3063905

fb-gh-sync-id: ef890cddfd7625fbd4bf5454314b441acdb03ac8
shipit-source-id: ef890cddfd7625fbd4bf5454314b441acdb03ac8
2016-03-21 03:21:27 -07:00
Michelle Hwang 14555063bb backout (and remove) props.lineBreakMode from Text
Reviewed By: jingc

Differential Revision: D3063164

fb-gh-sync-id: 81776866c09bb06411b9660f1f4833ba515e046a
shipit-source-id: 81776866c09bb06411b9660f1f4833ba515e046a
2016-03-17 11:48:24 -07:00
Martín Bigio dd2415df73 seek & read RAM Bundle
Summary: For RAM bundling we don't want to hold the entire bundle in memory as that approach doesn't scale. Instead we want to seek and read individual sections as they're required. This rev does that by detecting the type of bundle we're dealing with by reading the first 4 bytes of it. If we're dealing with a RAM Bundle we bail loading.

Reviewed By: javache

Differential Revision: D3026205

fb-gh-sync-id: dc4c745d6f00aa7241203899e5ba136915efa6fe
shipit-source-id: dc4c745d6f00aa7241203899e5ba136915efa6fe
2016-03-17 10:35:28 -07:00
Nick Lockwood 4c7c365623 Fix background color glitch
Summary:Because the source of truth for backgroundColor is the shadow view, it's possible for the default RCTView backgroundColor to get overwritten by the current shadowView backgroundColor when the view is first created. This overridden value will then be used as the default whenever the background color is reset, which may not be be appropriate for other components that use RCTView.

This diff fixes the bug by ensuring that the view props (and therefore the default color) are set *before* the background color is propagated from the shadowView.

Reviewed By: furdei

Differential Revision: D3064128

fb-gh-sync-id: ac36007c094c7201a5c4fd93399dee4d3eb9a043
shipit-source-id: ac36007c094c7201a5c4fd93399dee4d3eb9a043
2016-03-17 09:40:28 -07:00
Alexey Lang 24f7d88c98 Fix showing RCTPerformanceLogger data
Reviewed By: nicklockwood

Differential Revision: D3064023

fb-gh-sync-id: df9358dddfcc79e12a65a8b9c182615be64fc468
shipit-source-id: df9358dddfcc79e12a65a8b9c182615be64fc468
2016-03-17 07:27:27 -07:00
Pieter De Baets 92b5db00e0 Remove unusued RCTJSCExecutor methods
Reviewed By: majak

Differential Revision: D2916155

fb-gh-sync-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050
shipit-source-id: fc07d9518b4135c165fc5e8a5ce904c6b0f4b050
2016-03-16 10:23:20 -07:00
Pieter De Baets bebd9c423f Add debug tool to get shadowView from UIView
Reviewed By: nicklockwood

Differential Revision: D3058618

fb-gh-sync-id: 8e6c0ad328fa767f43438c9461b8374d1279931b
shipit-source-id: 8e6c0ad328fa767f43438c9461b8374d1279931b
2016-03-16 10:18:22 -07:00
Thomas Beverley 0be6031bc6 Added mediaPlaybackRequiresUserAction to WebView
Summary:Just added a pass through to the `WebView` for `mediaPlaybackRequiresUserAction` and `setMediaPlaybackRequiresUserGesture` to allow auto-playing audio and video elements
Closes https://github.com/facebook/react-native/pull/5956

Differential Revision: D3053554

Pulled By: mkonicek

fb-gh-sync-id: a1f362c1551de1a0218f5d23c70668e4c8078993
shipit-source-id: a1f362c1551de1a0218f5d23c70668e4c8078993
2016-03-16 10:03:26 -07:00
Alexey Lang 26d9417f2b Track native modules which use the main thread for initialization or gathering constants
Reviewed By: majak

Differential Revision: D3054146

fb-gh-sync-id: fd4f4c0dff3144d22357ea798d3131aee578d509
shipit-source-id: fd4f4c0dff3144d22357ea798d3131aee578d509
2016-03-16 09:48:42 -07:00
Pieter De Baets c1762c7bdb Backed out changeset 14a8c290bb874ab3e954b45f6fb29d71d019adc2.
Summary: This is causing issues for some internal layouts. Will fix upstream and then pull this in again.

Reviewed By: majak

Differential Revision: D3058597

fb-gh-sync-id: 2e9499d2fd0322ddd87b11f285eeb08fd51977b7
shipit-source-id: 2e9499d2fd0322ddd87b11f285eeb08fd51977b7
2016-03-16 08:53:25 -07:00
Nick Lockwood ded362af81 Fixed bug in defaultView logic
Summary: In my recent refactor to remove defaultViews, I added a check for null json values to determine if defaultView needed to be created. Unfortunately this was checking for nil instead of NSNull.

Reviewed By: javache

Differential Revision: D3058383

fb-gh-sync-id: 2a21dd0beb0302a94ed5379d39a102cde1316a9d
shipit-source-id: 2a21dd0beb0302a94ed5379d39a102cde1316a9d
2016-03-16 07:57:26 -07:00
Oleg Lokhvitsky 6c5195fb3a Update Layout.c to fix flexbox layout bug“
Differential Revision: D3049303

fb-gh-sync-id: 14a8c290bb874ab3e954b45f6fb29d71d019adc2
shipit-source-id: 14a8c290bb874ab3e954b45f6fb29d71d019adc2
2016-03-15 14:34:26 -07:00
Pieter De Baets b653d43e2e Update Dimensions when device orientation changes
Reviewed By: nicklockwood

Differential Revision: D2939877

fb-gh-sync-id: ec6161448bff34c07b93f19e1ee953657675bad5
shipit-source-id: ec6161448bff34c07b93f19e1ee953657675bad5
2016-03-15 05:49:25 -07:00
Alexey Lang f6853b8eac Add more performance logs and improve Systrace support
Reviewed By: tadeuzagallo

Differential Revision: D3040998

fb-gh-sync-id: c5ab4e5bcc073f94a2d309bfa7698919cf7e8856
shipit-source-id: c5ab4e5bcc073f94a2d309bfa7698919cf7e8856
2016-03-15 05:41:28 -07:00
Alexey Lang 79d6ced103 Improve Systrace support
Reviewed By: javache

Differential Revision: D3041704

fb-gh-sync-id: 11df4570988a6fa31beb5ab34b92debb63fade4c
shipit-source-id: 11df4570988a6fa31beb5ab34b92debb63fade4c
2016-03-15 05:01:24 -07:00
Morgan Pretty 2605a2299f Actually use the 'defaultValue' property in AlertViewIOS.
Summary:The AlertViewIOS component takes in a 'defaultValue' for the text input but never actually sets it, this PR actually sets the value.
Closes https://github.com/facebook/react-native/pull/6257

Differential Revision: D3052412

Pulled By: nicklockwood

fb-gh-sync-id: 32285330f17ccf47189dbc8fcab48f3712fee59b
shipit-source-id: 32285330f17ccf47189dbc8fcab48f3712fee59b
2016-03-15 04:26:25 -07:00
aleclarsoniv 64a09feaf7 Add 'props.lineBreakMode' to Text
Summary:I've tested this manually, but I'm not sure how to write a test for this. Hopefully someone can help out there. The least I could do is provide a starting point for a PR to be accepted.

Additionally, I've renamed the existing `NSLineBreakMode` enum converter (inside `RCTConvert`) to use dashes in the names instead of camelcase (eg: `word-wrapping` instead of `wordWrapping`).

Fixes #6338
Closes https://github.com/facebook/react-native/pull/6339

Differential Revision: D3052391

Pulled By: nicklockwood

fb-gh-sync-id: 1536dfc139d7995095e9ee9d5f13ca86f90783c5
shipit-source-id: 1536dfc139d7995095e9ee9d5f13ca86f90783c5
2016-03-15 04:16:30 -07:00
Nick Lockwood 688bb17777 Fixed sticky header touch handling bug
Summary:In order to ensure that the docked sticky header in a ListView receives touches correctly, RCTScrollView has a custom hitTest implementation that checks the sticky headers for touches prior to checking any other views.

There was a bug in this implementation that meant that sticky views would get touch priority even if the touch was outside the bounds of the scrollView. This meant that sticky headers that scrolled off the top of the list would intercept touches intended for views placed above the scrollView.

This diff fixes that bug by checking that the touch is inside the scrollview before checking for sticky header touches. I've also limited the custom hit test logic to just the currently docked header, as the other sticky header views do not require special treatment.

Reviewed By: javache

Differential Revision: D3041236

fb-gh-sync-id: a2a3474dda03d5b51688bd575195a67956184bbe
shipit-source-id: a2a3474dda03d5b51688bd575195a67956184bbe
2016-03-14 04:08:21 -07:00
Martín Bigio f99468de65 Sourcemaps support for RAM
Summary:This rev adds support for production sourcemaps on RAM.

When we inject a module into JSC we use the original `sourceURL` and specify the `startingLineNumber` of the module relative to a "regular" bundle. By doing so, when an error is thrown, JSC will include the provided `sourceURL` as the filename and will use the indicated `startingLineNumber` to figure out on which line the error actually occurred.

To make things a bit simpler and avoid having to deal with columns, we tweak the generated bundle so that each module starts on a new line. Since we cannot assure that each module's code will be on a single line as the minifier might break it on multiple (UglifyJS does so due to a bug on old versions of Chrome), we include on the index the line number that should be used when invoking `JSEvaluateScript`. Since the module length was not being used we replaced the placeholder we have there for the line number.

Reviewed By: javache

Differential Revision: D2997520

fb-gh-sync-id: 3243a489cbb5b48a963f4ccdd98ba63b30f53f3f
shipit-source-id: 3243a489cbb5b48a963f4ccdd98ba63b30f53f3f
2016-03-13 11:14:32 -07:00
Martín Bigio 7338c5704e Random Access Modules native infra
Summary:At the moment, to initialize a React Native app, the entire JS bundle needs to be loaded. Parsing JS code takes a while which makes paying for every feature the app has very expensive on start up. Even worse, as the bundle gets bigger and bigger because the app has more and more features, start up time becomes slower.

This rev introduces the few remaining pieces of infrastructure to load JS modules incrementally. This way, on start up we only inject into JSC the modules we actually need. More importantly, by using this piece of infrastructure, the app start up time won't be affected as the JS bundle increases it's size.

Props to davidaurelio and tadeuzagallo for the original work. I'm just wrapping their work.

Differential Revision: D2995425

fb-gh-sync-id: caaaa880b5370c3bb36a11ae694dc303cd53d0e2
shipit-source-id: caaaa880b5370c3bb36a11ae694dc303cd53d0e2
2016-03-13 11:14:26 -07:00
Kyle Corbitt 299cd4cd01 Fix empty ScrollView warnings
Summary:Currently, an empty `<ScrollView />` on iOS always throws the warning "Sticky header index 0 was outside the range {0, 0}".

This is because the error-reporting code relies on the assumption that `stickyHeaderIndices` exists, and when it doesn't the error check thinks there's an index when there really isn't.

Note that this only changes error reporting and won't affect apps out of debug mode.

**Test plan**
I created a sample app and included an empty `<ScrollView />`. Without this change the "Sticky header..." warning was displayed on every run through. With this change implemented, the warning went away.
Closes https://github.com/facebook/react-native/pull/6417

Differential Revision: D3042178

Pulled By: nicklockwood

fb-gh-sync-id: 7afefd428a5fcb03867bcb69e46c46fe1ae9151e
shipit-source-id: 7afefd428a5fcb03867bcb69e46c46fe1ae9151e
2016-03-11 12:24:22 -08:00
Tadeu Zagallo de53ef1c9a Add systrace controls window
Summary:Add a couple functions to show and hide a small window with buttons to start/stop
systrace and reload the current bridge. After stop profiling, the results will
be saved to a temporary file, and a share sheet will show up with the file attached
so that you can send it to your computer whatever way is more convenient.

Depends on D2700069

Reviewed By: jspahrsummers

Differential Revision: D2811560

fb-gh-sync-id: 5e91ece3a7ea748d4cb5fbc612a9b76ab80fc8f3
shipit-source-id: 5e91ece3a7ea748d4cb5fbc612a9b76ab80fc8f3
2016-03-11 06:21:26 -08:00
Marc Horowitz 225899dcf0 Declare RCTPerformanceLogger functions RCT_EXTERN
Reviewed By: nicklockwood

Differential Revision: D3035404

fb-gh-sync-id: 0b733a95b57aa79659c7feee961c92bd3f25c03f
shipit-source-id: 0b733a95b57aa79659c7feee961c92bd3f25c03f
2016-03-11 03:18:21 -08:00
Mike Grabowski 2bb2522f1e Don't lose NSError code in RCTJSErrorFromNSError()
Summary:Fixes #6171

Send original error code back to JS - this reverts old functionality according to https://github.com/facebook/react-native/issues/6171#issuecomment-189332649, that is 3c541ca540/React/Base/RCTUtils.m (L299)
Closes https://github.com/facebook/react-native/pull/6201

Differential Revision: D2988618

Pulled By: javache

fb-gh-sync-id: 85a280b76e557bffc4d952ed7f39eeb8a88b66ba
shipit-source-id: 85a280b76e557bffc4d952ed7f39eeb8a88b66ba
2016-03-11 02:55:22 -08:00
Nick Lockwood 520ad05ba0 Removed unnecessary exportedConstants
Summary: The exportedConstants method incurrs a penalty at bridge startup time for every module that implements it. This diff removes exportedConstants from a few modules that don't really need to use it.

Reviewed By: majak

Differential Revision: D2982341

fb-gh-sync-id: be016187d7b731a073311daacfcf88a0402e1688
shipit-source-id: be016187d7b731a073311daacfcf88a0402e1688
2016-03-10 10:21:34 -08:00
Ken Wheeler ec9efb8a01 Updating AppState to support the inactive state.
Summary:**Motivation**

AppStateIOS never currently returns `inactive` as a possible state. I had a requirement that when inactive, certain portions of the app should be blacked out in accordance with compliance rules. This is not possible currently, due to `inactive` never being returned. This PR fixes that.

**Test plan**

All base tests are passing. Are there AppState specific tests in place at the moment that I'm missing?

**Demonstration**

![appstate](https://cloud.githubusercontent.com/assets/286616/13640546/1cb6eeb0-e5e3-11e5-8d64-332ea3383a54.gif)
Closes https://github.com/facebook/react-native/pull/6379

Differential Revision: D3035530

Pulled By: nicklockwood

fb-gh-sync-id: 93deccc8184816809926dca8a95f2bebd1434987
shipit-source-id: 93deccc8184816809926dca8a95f2bebd1434987
2016-03-10 08:30:24 -08:00
Nick Lockwood 62177dbb3b Removed defaultViews
Summary:When a component prop is set to null/undefined, and doesn't have a default value specified in `getDefaultProps`, the null value is sent over the bridge as a sentinel to reset to the original native value.

On iOS this is handled by creating a default view instance for each view type. The default view is then used to look up the unmodified value for any prop that is reset.

This is rather expensive however, as it means that for complex views (e.g. WebView, MapView), a minimum of two instances will be created even if only one is needed, and the default view will remain even after all actual view instances have been released.

This diff replaces the default view mechanism with a system where the default value of each prop is recorded the first time it is set. This avoids the need to keep an extra copy of the whole view.

The only exception is for props that use the `RCT_CUSTOM_VIEW_PROPERTY` macro, which includes the default view as part of the interface. To avoid a breaking change, a default view will still be created for views that use this macro, but only if they are sent a null value (so very rarely, in practice). In a future update we may deprecate or replace `RCT_CUSTOM_VIEW_PROPERTY` if there are significant benefits to doing so.

Reviewed By: javache

Differential Revision: D3012115

fb-gh-sync-id: 259348e54aa8342f444ad182b6f883d2dd684973
shipit-source-id: 259348e54aa8342f444ad182b6f883d2dd684973
2016-03-09 08:56:46 -08:00
Mark Wang 6d0272af42 Fix potential unused variable error
Summary: If we're compiling with `-Wunused-variable` and `__IPHONE_OS_VERSION_MIN_REQUIRED` >= 8.0, this would cause an build error.

Reviewed By: javache, majak

Differential Revision: D3019904

fb-gh-sync-id: d4482d7d070f8d896acd44b03ebc70bacd9f2f3f
shipit-source-id: d4482d7d070f8d896acd44b03ebc70bacd9f2f3f
2016-03-08 10:16:30 -08:00
Janic Duplessis 102a31c13e Fix RefreshControl layout on screen rotation and consecutive pull to refresh not working properly
Summary:Fixes the RefreshControl layout after a screen rotation. See #6311 for a more detailed explanation. I fixed it by adjusting the frame of the RefreshControl in `layoutSubviews` of the parent ScrollView.

While working on fixing this I noticed that when doing a 'pull to refresh' and then not scrolling and wait for it to end the next one will not behave like the first one (it will require pulling further down for the spinner to start spinning). I fixed that too by scrolling the scrollview back to 0 manually before calling `UIRefreshControl.endRefreshing`.

**Test plan (required)**
Tested using the UIExplorer RefreshControl example.

When doing a pull to refresh and then rotating the screen the RefreshControl must stay positioned properly.
Doing multiple consecutive pull to refresh without scrolling after should all behave the same.

Fixes #6311
Closes https://github.com/facebook/react-native/pull/6359

Differential Revision: D3023727

fb-gh-sync-id: f50ae52ea769c2b3e5025c362544a8809a71aa00
shipit-source-id: f50ae52ea769c2b3e5025c362544a8809a71aa00
2016-03-08 04:00:34 -08:00
Tadeu Zagallo 24c458aa08 Fix JS deallocation on load errors
Summary:Fixes #6281

The JS executor is invalidated from `[RCTBatchedBridger stopLoadingWithError:]`
which prevented another blocks that depended on the executor to run in the bridge
invalidation.

Reviewed By: javache

Differential Revision: D3018299

fb-gh-sync-id: 4f482b9b697bfabd24b405398d25c72b9e1a3c84
shipit-source-id: 4f482b9b697bfabd24b405398d25c72b9e1a3c84
2016-03-07 09:46:36 -08:00
Nick Lockwood 006907bdaa Initialize bridge on a background queue
Summary: This diff adds support for initializing the bridge on an arbitrary thread. This is helpful if you want to defer bridge creation, or prevent it from delaying your app startup.

Reviewed By: javache

Differential Revision: D2965725

fb-gh-sync-id: 8065fa89e850031c72ee4427351300986985e9de
shipit-source-id: 8065fa89e850031c72ee4427351300986985e9de
2016-03-07 09:31:26 -08:00
Martín Bigio cde58a61aa Rename dev menu option to Hot Reloading on boths ios and android
Reviewed By: sam-swarr

Differential Revision: D3013121

fb-gh-sync-id: 4fc5ff73425c1d896bc4fb0085d39b5eef7e0e94
shipit-source-id: 4fc5ff73425c1d896bc4fb0085d39b5eef7e0e94
2016-03-06 10:12:25 -08:00
Kyle Corbitt 2d27cf0ceb Don't warn when jsSchedulingOverhead is negative
Summary:This commit modifies the jsSchedulingOverhead warning to only fire if the JS clock is more than 5 seconds ahead of the native clock. This fixes the issue in #1598 for the common case when there's only a minor difference between the two clocks, while still keeping a sanity check if they're extremely off.

cc nicklockwood tadeuzagallo
Closes https://github.com/facebook/react-native/pull/5731

Differential Revision: D3014985

Pulled By: tadeuzagallo

fb-gh-sync-id: bf57e48b7d97ad02d2aefb6e5aac845824a6fdb0
shipit-source-id: bf57e48b7d97ad02d2aefb6e5aac845824a6fdb0
2016-03-04 17:30:06 -08:00
Eric Lo 8c25181c44 Add onShow callback for RCTModalHostView
Summary: Added ability to include a callback to the modal. The callback is invoked when the modal is shown.

Reviewed By: javache

Differential Revision: D3005212

fb-gh-sync-id: 12648e17bd1cf831daf65529b87ae8cfdb901c65
shipit-source-id: 12648e17bd1cf831daf65529b87ae8cfdb901c65
2016-03-03 12:43:36 -08:00
Nick Lockwood dc13115445 Dispatch module setup asynchronously to avoid blocking main thread when bridge starts
Summary:Initializing native modules can block the main thread for tens of milliseconds when it starts up, making it difficult to instantiate the bridge on demand without causing a performance blip.

This diff splits up the initialization of modules so that - although they still happen on the main thread - they don't block the thread continuously.

Reviewed By: javache

Differential Revision: D2965438

fb-gh-sync-id: 38c9c9d281e4672b5874d68b57d4c60d1d268344
shipit-source-id: 38c9c9d281e4672b5874d68b57d4c60d1d268344
2016-03-03 02:21:36 -08:00
Eloy Durán 6bae7f93f5 Add suggested ‘view size’ powers to -[RCTShadowView setFrame:]
Summary:The UICollectionView example is actually my use-case, which is discussed in a
bit more detail [here](https://github.com/alloy/ReactNativeExperiments/issues/2).

----

This is useful when wrapping native iOS components that determine their
own suggested size and which would be too hard/unnecessary to replicate
in the shadow view. For instance a `UICollectionView` that after layout
will update its `contentSize`, which could be used to suggest a size to
the shadow view.

The reason for adding it to -[RCTShadowView setFrame:] is mainly so it
can be used via the existing -[RCTUIManager setFrame:forView:] API and
because it might not be a feature you want to expose too prominently.

An origin of `{ NAN, NAN }` is used as a sentinel to indicate that the
frame should be used as a size suggestion. The size portion of the rect
may contain a `NAN` to skip that dimension or a suggested value for the
dimension which will be used if no explicit styling has been assigned.

Examples:

* Without any expl
Closes https://github.com/facebook/react-native/pull/6114

Differential Revision: D2994796

Pulled By: nicklockwood

fb-gh-sync-id: 6dd3dd86a352ca7d31a0da38bc38a2859ed0a410
shipit-source-id: 6dd3dd86a352ca7d31a0da38bc38a2859ed0a410
2016-03-01 10:14:32 -08:00
Nick Lockwood 35da174339 Added unit tests for module init
Summary: The module initialization process is complex and full of race conditions. This diff adds a set of unit tests that verify that modules setup happens in the correct order, and enforces all the various conditions for main/background init.

Reviewed By: javache

Differential Revision: D2994145

fb-gh-sync-id: 92ea84508cdeeb280ff0fb9e9b2dffa8dbc37e66
shipit-source-id: 92ea84508cdeeb280ff0fb9e9b2dffa8dbc37e66
2016-03-01 09:44:37 -08:00
Pieter De Baets f67fa82008 Add UIManager.measureInWindow to get window coordinates
Summary: When embedding in a hybrid app, we sometimes present new modal views or windows that have a different frame from the original root view. This API allows us to get coordinates in the application's window frame, which should be valid in any fullscreen view.

Reviewed By: majak

Differential Revision: D2939827

fb-gh-sync-id: 06b93cc2cb3519a25819c6efa445c779314dd673
shipit-source-id: 06b93cc2cb3519a25819c6efa445c779314dd673
2016-03-01 06:51:33 -08:00
Marc Horowitz ffdd3e43b0 remove dead code
Summary: This property is now in the bridge.

Reviewed By: tadeuzagallo

Differential Revision: D2985894

fb-gh-sync-id: 38821e0c5998bc96fc8f6164fbbc82c721f5c5ad
shipit-source-id: 38821e0c5998bc96fc8f6164fbbc82c721f5c5ad
2016-02-29 10:09:54 -08:00
Marc Horowitz f331a58ed0 Move initialization of RCTBatchedBridge into its own method.
Summary: This makes room for local development without touching OSS code.

Reviewed By: tadeuzagallo

Differential Revision: D2986122

fb-gh-sync-id: 2f23088a078b0f0fb4b74946490fd5b67b01c0ac
shipit-source-id: 2f23088a078b0f0fb4b74946490fd5b67b01c0ac
2016-02-29 10:05:57 -08:00
Nick Lockwood d7d47d8120 Defer constants gathering until after setup
Reviewed By: javache

Differential Revision: D2986095

fb-gh-sync-id: 1f449e69ca74466e7951d621ceaf624abe034139
shipit-source-id: 1f449e69ca74466e7951d621ceaf624abe034139
2016-02-29 09:50:32 -08:00
Nick Lockwood 8d44c2db4f Fix bridge tests
Summary:The `RCTDevMenu.hotLoadingAvailable` check always returned YES if `bridge.bundleURL` was nil. This caused the `setHotLoadingEnabled:` method to repeatedly reload the bridge, resulting in the following tests failing:

`- [RCTBridgeTests testHookRegistration];`
`- [RCTBridgeTests testCallNativeMethod];`

Also, the `RUN_RUNLOOP_WHILE()` macro did not actually assert when timing out, and the logic in `- [RCTBridgeTests tearDown];` was broken in such a way that tests would always take 5 seconds to run (and then timeout silently). This adds an assertion, and removes the broken nil check for `jsExecutor`.

Reviewed By: majak

Differential Revision: D2988885

fb-gh-sync-id: 91307585ac8acb0181f0cddeeddf6cb4b198e4fe
shipit-source-id: 91307585ac8acb0181f0cddeeddf6cb4b198e4fe
2016-02-29 09:26:06 -08:00