Commit Graph

862 Commits

Author SHA1 Message Date
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
Martin Kralik a496baa68c reintroduced coalescing key for events
Summary: This was previously removed in D2884587, but we will need it going forward. See D3092867 for reasons why it's necessary again.

Reviewed By: javache

Differential Revision: D3092848

fb-gh-sync-id: 0d10dbac4148fcc8e035d32d8eab50f876d99e88
fbshipit-source-id: 0d10dbac4148fcc8e035d32d8eab50f876d99e88
2016-04-01 06:54:49 -07:00
Martin Kralik 8f07b01ac8 move `RCTBatchedBridge` interface to a private header
Summary:Interface to `RCTBatchedBridge` was being declared in two different implementation files. This is suboptimal, since it makes it hard to mock that class in a test.
So I've merged and moved these two definitions in `RCTBridge+Private.h`, so it's still obvious it's a private class, but can be included if you really need it.

Reviewed By: javache

Differential Revision: D3126135

fb-gh-sync-id: 173e4c5c2925be387b92deb7f99952ca7bf28588
fbshipit-source-id: 173e4c5c2925be387b92deb7f99952ca7bf28588
2016-04-01 06:54:49 -07:00
Jason Prado 9d49cf095b Revert FBReactKit: use indirect jumps to external functions
Reviewed By: rnystrom

Differential Revision: D3117661

fb-gh-sync-id: 05b7f796b58656aa13e4be78a562e07d18cf9488
fbshipit-source-id: 05b7f796b58656aa13e4be78a562e07d18cf9488
2016-03-30 16:40:23 -07:00
Walter Luh ac534387f8 RN: Packager URL defaults to port 8081 if no port in bundleURL
Summary:The packager url for the persistent connection relied on a port
in the bundleURL, so we need to insert a sensible default. Otherwise,
issues occur: https://github.com/facebook/react-native/issues/6581

Reviewed By: bestander

Differential Revision: D3113034

fb-gh-sync-id: 4eac52631ad7abd343b75a4488bb591b5caf2145
fbshipit-source-id: 4eac52631ad7abd343b75a4488bb591b5caf2145
2016-03-30 12:38:19 -07:00
Tadeu Zagallo 99c7de2600 Stop the runloop from invalidate instead of dealloc
Summary:We were calling `CFRunLoopStop` from `-dealloc` in the `JSCExecutor`, but dealloc
is not guaranteed to run in the same thread. Move it to `-invalidate` instead.

Reviewed By: javache

Differential Revision: D3092645

fb-gh-sync-id: 94b51fec4a9fe0784feeb83d1b0c41de1cd7c052
fbshipit-source-id: 94b51fec4a9fe0784feeb83d1b0c41de1cd7c052
2016-03-30 08:12:18 -07:00
Tadeu Zagallo 2be42abbc2 Fix flowIDMap being accessed from multiple threads simultaneously
Summary:`flowIDMap` lives on the bridge to map from the IDs used for the flow events in
JS and the ones generated by `RCTProfile` in the native side.

It was being accessed from multiple threads (the various modules' queues in the
bridge and the JS thread), so we lock before touching it.

Reviewed By: javache

Differential Revision: D3102745

fb-gh-sync-id: 93d012d124e8b5d1a390c10a98ef5e3a068ccf63
fbshipit-source-id: 93d012d124e8b5d1a390c10a98ef5e3a068ccf63
2016-03-30 08:08:18 -07:00
Pieter De Baets 5bbf88be5a Fix OSS project configuration
Reviewed By: bestander

Differential Revision: D3114557

fb-gh-sync-id: 7e519f6304efc4ce17e5751ef65c5b4fac2baf5f
fbshipit-source-id: 7e519f6304efc4ce17e5751ef65c5b4fac2baf5f
2016-03-30 03:12:27 -07:00
Jason Prado 2bcf4bef2b FBReactKit: use indirect jumps to external functions
Reviewed By: as106

Differential Revision: D3105839

fb-gh-sync-id: 24a8a215f65908b577891fb4b38366bad35cf6fc
fbshipit-source-id: 24a8a215f65908b577891fb4b38366bad35cf6fc
2016-03-29 20:18:22 -07:00
Marc Horowitz 2115664456 Pull CADisplayLink into a separate file
Reviewed By: javache

Differential Revision: D3107921

fb-gh-sync-id: 2982043280f925d390e4bebf3884d4762ac62cc6
fbshipit-source-id: 2982043280f925d390e4bebf3884d4762ac62cc6
2016-03-29 19:53:20 -07:00
Adam Ernst e28bfdd61a Remove apparently unused _runBlock: method
Reviewed By: nicklockwood

Differential Revision: D3088409

fb-gh-sync-id: 279ce18f2a336819dbdc54087b1b7e203fbecac2
shipit-source-id: 279ce18f2a336819dbdc54087b1b7e203fbecac2
2016-03-23 18:30:23 -07:00
Adam Ernst a16771c5dc Remove unused RCTBridgeModuleClassIsRegistered
Reviewed By: nicklockwood

Differential Revision: D3088367

fb-gh-sync-id: e91a8905bb361bcb430d3efc0dd56ab53321572e
shipit-source-id: e91a8905bb361bcb430d3efc0dd56ab53321572e
2016-03-23 17:23:20 -07:00
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