Commit Graph

508 Commits

Author SHA1 Message Date
Tadeu Zagallo 529687f923 Defer calls until bridge finishes loading
Summary: @​public

When de-batching the calls from native -> JS, some calls were being dispatched
before the bridge had finished loading, which would cause lost calls when running
on the `ContextExecutor` and redbox when running in the Chrome debugger

Reviewed By: @javache

Differential Revision: D2540746

fb-gh-sync-id: ece29406648d3cbcb42cef3b32b8774ff0c15fd8
2015-10-14 09:49:23 -07:00
Pieter De Baets 44c651037a Disable RCTLog completely in production
Reviewed By: @nicklockwood

Differential Revision: D2521718

fb-gh-sync-id: f06c9af3906ae8cebca0d318fc2b0e2d03671220
2015-10-13 07:31:25 -07:00
Alexey Lang aabdc9cc9f Improve RCTPerfomanceLogger
Reviewed By: @mikearmstrong001

Differential Revision: D2531397

fb-gh-sync-id: 3f6c1831c9a7b62f857deda7a535589970cf2052
2015-10-13 06:44:27 -07:00
Tadeu Zagallo baf5b7b4d5 De-batch native->js calls and react updates
Summary: @​public

Take a step back and de-batch the bridge calls so we can have better profiling data and a better starting point to work on future optimisations. Also gave a 10~15% win on first render.

Reviewed By: @javache

Differential Revision: D2493674

fb-gh-sync-id: 05165fdd00645bdf43e844bb0c4300a2f63e7038
2015-10-13 06:44:25 -07:00
Tadeu Zagallo f7065e5c0a Support start and stopping systrace from repl
Reviewed By: @jspahrsummers

Differential Revision: D2512911

fb-gh-sync-id: f5441219f9d7063b3602c55efac9f07407e33f56
2015-10-12 09:45:40 -07:00
Nick Lockwood 799168929c Unify XCAsset handling logic
Summary: @​public

This diff unifies the logic for detecting when images refer to XCAsset files into a single function (RCTXCAssetNameForURL) and uses it for both +[RCTConvert UIImage:] and RCTImageLoader.

I've also tightened the definition of XCAssets so that it only applies to images inside .car files, not any image inside the main bundle. This avoids using the +[UIImage imageNamed:] when not strictly necessary, which is desirable since that method is not thread-safe, and has undocumented caching behavior that is difficult to reason about.

Reviewed By: @javache

Differential Revision: D2526400

fb-gh-sync-id: 7199c2a44f1d55ff236d2c38a0a9368739b993d5
2015-10-12 04:15:27 -07:00
Pieter De Baets 903eaa863c Fix logic for loading images from asset catalogs in RCTConvert
Reviewed By: @nicklockwood

Differential Revision: D2526264

fb-gh-sync-id: 039b0438fbce7c3e752271adc8d5aa5d4fe915e5
2015-10-09 07:46:41 -07:00
Uri Baghin f52cd5dc1e Use path instead of resourceSpecifier so it unescapes.
Reviewed By: @nicklockwood

Differential Revision: D2526217

fb-gh-sync-id: c48af71402927b0aa4e9942e1825068af5334ab9
2015-10-09 06:39:43 -07:00
Nick Lockwood 7fe7a2a26b Improved JS bundle loading performance
Summary: @​public

RCTJavaScriptLoader was using an NSURLSessionDataTask to load local bundle.js files. While this works, it was non-optimal from a performance point of view.

Reviewed By: @tadeuzagallo

Differential Revision: D2522598

fb-gh-sync-id: b32981b3be4c336512d1462d3f4943b5aad34ae0
2015-10-08 12:39:52 -07:00
Nick Lockwood 91e6c98ecd Implemented inline image support for <Text>
Summary: @​public

This diff implements inline image support for <Text> nodes. Images are specified using <Image> tags, however all properties of the image are currently ignored apart from the source (including width/height styles).

Images are loaded asyncronously, and will trigger a text re-layout when they have loaded.

Reviewed By: @javache

Differential Revision: D2507725

fb-gh-sync-id: 59d0696d00a1bc531915cc35242a16b2dec96e85
2015-10-08 11:56:25 -07:00
Alexey Lang e3e9be9efb Log time to prepare native config
Reviewed By: @jspahrsummers

Differential Revision: D2517033

fb-gh-sync-id: fd560304f163b0ab9be592024e2a9b793fb990bc
2015-10-08 08:46:25 -07:00
Pieter De Baets 6ca8f4836d Disable RCTAssert completely in production builds
Reviewed By: @tadeuzagallo, @jspahrsummers

Differential Revision: D2521700

fb-gh-sync-id: f769afd98bb662e8bbe773adb45990f2175cdfe4
2015-10-08 08:26:20 -07:00
Nick Lockwood 63a37be1dd Removed RCTCache
Reviewed By: @tadeuzagallo

Differential Revision: D2410542

fb-gh-sync-id: 98af1b51802e69e7ede9a31feda0df5a526a6db5
2015-10-08 05:37:29 -07:00
Pieter De Baets 706cf38931 Fix Xcode analyzer warning
Reviewed By: @nicklockwood

Differential Revision: D2517025

fb-gh-sync-id: 3948f6b4255bc9035b2e7441469d0cc31c8027f8
2015-10-08 05:37:23 -07:00
James Ide cb8b656a82 Only handle accessibility notifications from the correct RCTAccessibilityManager
Summary: When you reload and create a new bridge, one of the things that happens during setup is that the RCTAccessibilityManager fires a notification. The old bridge would receive this notification from the new bridge's RCTAccessibilityManager, which we don't want, especially because the two are running on different shadow queues.

I believe this led to a gnarly crash in NSConcreteTextStorage because RCTMeasure in RCTShadowText.m was getting called for the old RCTText (getting destroyed) from a notification fired from the new shadow queue. The fix is for the UIManager to handle notifications only from its bridge's RCTAccessibilityManager. See #2001 for the kinds of crashes we were seeing.
Closes https://github.com/facebook/react-native/pull/3279

Reviewed By: @​svcscm

Differential Revision: D2521652

Pulled By: @nicklockwood

fb-gh-sync-id: a4ffe3ef8304667727e573e2a2e8b716e1d2f3e1
2015-10-08 04:00:41 -07:00
Robert Fleischmann 0de9e0104a Provide default loading view for React views in Wilde
Reviewed By: @javache

Differential Revision: D2496540

fb-gh-sync-id: 31488a6d1fc1f679ab4361d6a8d48f19b2347703
2015-10-06 10:39:28 -07:00
Pieter De Baets 9e81dec5e4 Only dismiss <Modal> once
Reviewed By: @nicklockwood

Differential Revision: D2512593

fb-gh-sync-id: b56eacd3965de76d6b7288199eabeaa5f63547cd
2015-10-06 10:29:27 -07:00
Pieter De Baets 06ef95799a Allow nil tabbar item icon
Reviewed By: @nicklockwood

Differential Revision: D2508310

fb-gh-sync-id: e4eaf1237cca380b74d154c3cda50379fbafcf00
2015-10-06 10:29:01 -07:00
Alexey Lang 7b514c63df Log native modules init time and config inject time separately
Reviewed By: @jspahrsummers

Differential Revision: D2508010
2015-10-05 11:05:23 -07:00
Pieter De Baets 0fb2fb37cc Silence analyzer warning for nil-checking NSNumber
Reviewed By: @jspahrsummers

Differential Revision: D2503068
2015-10-02 12:36:30 -07:00
Abhishek Sood e08a507f75 This reverts D2502620
Differential Revision: D2503381
2015-10-02 11:33:23 -07:00
Alexey Lang 737e011f96 log native modules init time and config inject time separately
Reviewed By: @tadeuzagallo, @jspahrsummers

Differential Revision: D2502620
2015-10-02 09:55:21 -07:00
Tadeu Zagallo 7a4348917f Guard against multiple calls from the dev menu
Summary: @​public

The RCTDevMenu always calls the handler, even with the state hasn't changed.
Guard against it.

Reviewed By: @javache

Differential Revision: D2499034
2015-10-02 04:54:23 -07:00
Tadeu Zagallo beab8d52d4 Fix racing conditions on the profiler
Summary: @​public

The flow event methods weren't properly synchronized and neither was the module
unhooking.

Reviewed By: @jspahrsummers

Differential Revision: D2498719
2015-10-02 04:18:21 -07:00
Tadeu Zagallo eee2fd1ca2 Fix RCTConvert analyser error
Summary: @​public

Fix analyser error on RCTConvert where a key used to subscript an
NSMutableDictionary could possibly be nil.

Reviewed By: @alexeylang, @jspahrsummers

Differential Revision: D2498988
2015-10-02 03:35:22 -07:00
Chace Liang 8221c33650 Add Voice Over related change to AccessibilityManager.
Reviewed By: @hedgerwang

Differential Revision: D2491520
2015-10-01 18:19:24 -07:00
Tadeu Zagallo d96748492f Fix ReactPerf markers in Systrace
Reviewed By: @spicyj

Differential Revision: D2468107
2015-10-01 15:05:28 -07:00
Pieter De Baets 9076b71ac3 Use bundleForClass instead of mainBundle to find resources
Reviewed By: @jspahrsummers

Differential Revision: D2485109
2015-09-29 10:36:23 -07:00
Pieter De Baets 3a664a0008 Log column number in RCTRedBox messages
Reviewed By: @jspahrsummers

Differential Revision: D2489364
2015-09-29 09:22:14 -07:00
Alexey Lang e727fc817b Pause JS DisplayLink if nothing to process.
Reviewed By: @jspahrsummers

Differential Revision: D2489107
2015-09-29 09:22:10 -07:00
Alex Kotliarskyi f07dd70051 Managed assets support for RCTConvert
Reviewed By: @nicklockwood

Differential Revision: D2443130
2015-09-29 09:21:39 -07:00
Justin Spahr-Summers 0ff3a421c9 Actually define RCTSetLogThreshold()
Summary: This function was declared, but never defined, so calling it would crash your application.

I also took this opportunity to ensure that the logging threshold is given a default value upon initialization, not just the first time `RCTGetLogThreshold()` is called.

@​public

Reviewed By: @tadeuzagallo

Differential Revision: D2475622
2015-09-28 04:23:26 -07:00
Christopher Chedeau bd36e40258 Fix width being ignored when has a value of 0
Summary: 8f6a96adbc added a test in isDimDefined that checks if `value > 0.0`, but unfortunately, it did not faithfully port the JavaScript version which is `value >= 0.0`: https://github.com/facebook/css-layout/blob/master/src/Layout.js#L306. Sadly, no test covered this so it went unnoticed.
Closes https://github.com/facebook/css-layout/pull/134

Reviewed By: @​svcscm

Differential Revision: D2481773

Pulled By: @vjeux
2015-09-25 15:42:21 -07:00
Jiajie Zhu 0fb3d8de83 revert D2372548 to fix initial app state issue
Reviewed By: @hedgerwang

Differential Revision: D2480492
2015-09-25 13:25:26 -07:00
Pieter De Baets 8f13560fd5 End slider interaction when touches are cancelled
Reviewed By: @jingc

Differential Revision: D2479259
2015-09-25 11:42:32 -07:00
Christopher Chedeau ec8b5425e5 Fix row height
Reviewed By: @frantic

Differential Revision: D2480265
2015-09-25 11:25:57 -07:00
Mike Armstrong 23564fe65a reduce leeway to 1, child clipping updated every scroll movement. This fixes scroll view behaviour
Reviewed By: @jspahrsummers

Differential Revision: D2479961
2015-09-25 10:24:02 -07:00
Cirkos 1ad1f45fe6 Reverted D2476924
Reviewed By: @mmmulani

Differential Revision: D2479710
2015-09-25 03:08:24 -07:00
Christopher Chedeau 03222d66bb Revert of [Fix dimension check for STRETCH children]
Summary: We had a layout issue in Ads Manager after updating to the latest version of css-layout on react-native. I bisected the change to 909c14117f. It changes the condition and breaks the behavior that we had. This change was not covered by a unit test so I added one.

Closes https://github.com/facebook/css-layout/pull/131

Reviewed By: @​svcscm

Differential Revision: D2476924

Pulled By: @vjeux
2015-09-24 14:11:47 -07:00
James Ide 944fa4d635 Suppress warning when checking for `JSGlobalContextSetName`
Summary: This API is defined only on iOS 8 and newer. There is a warning that the function is defined when checking if it exists since it is always defined in the iOS 8 SDK but not necessarily on iOS 7 phones. Use pragmas to silence the warning.
Closes https://github.com/facebook/react-native/pull/2475

Reviewed By: @​trunkagent, @vjeux

Differential Revision: D2443432

Pulled By: @tadeuzagallo
2015-09-24 08:20:11 -07:00
James Ide 7615d74d14 Check self.isValid in RCTBatchedBridge after initial script evaluation
Summary: I noticed that sometimes the batched bridge would be valid before `[self enqueueApplicationScript:url:onComplete:]` but then become invalid in the completion callback. This diff checks `self.isValid` inside of the callback.

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

Reviewed By: @​trunkagent, @jspahrsummers

Differential Revision: D2443438

Pulled By: @tadeuzagallo
2015-09-24 08:20:05 -07:00
Tadeu Zagallo 98378cab18 Add gluecode for systrace
Summary: @​public

Add gluecode to allow use to systrace as the backend of RCTProfile

Reviewed By: @jspahrsummers

Differential Revision: D2439181
2015-09-23 12:09:25 -07:00
rxb dcf245a9a2 Definable distance pagination for ScrollView
Summary: This is an enhancement for ScrollView that adds the ability to paginate based on a width other than the width of the ScrollView itself. This is a fairly common pattern used on apps like Facebook, App Store, and Twitter to scroll through a horizontal set of cards or icons:

![img_8726 2](https://cloud.githubusercontent.com/assets/451050/8017899/39f9f47c-0bd2-11e5-9c1d-889452f20cf7.PNG) ![img_8727 2](https://cloud.githubusercontent.com/assets/451050/8017898/39f962dc-0bd2-11e5-98b4-461ac0f7f21b.PNG)  ![img_8728 2](https://cloud.githubusercontent.com/assets/451050/8017900/39fd91a4-0bd2-11e5-8786-4cf0316295a0.PNG)

After trying to accomplish this only with JS, it appears that attempting to take over an in-progress native scroll animation with JS is always going to result in some amount of jankiness and jumping.

This pull request uses `scrollViewWillEndDragging` in RCTScrollView.m to adjust `targetContentOffset` based on two new optional props added to ScrollView. `snapToInterval` sets the multiple that the
Closes https://github.com/facebook/react-native/pull/1532

Reviewed By: @​svcscm, @​trunkagent

Differential Revision: D2443701

Pulled By: @vjeux
2015-09-23 11:47:25 -07:00
Yusef Napora 2f9bd1f62f App Extension support
Summary: This adds workarounds for the code that was preventing React from compiling when linked against an iOS App Extension target.

Some iOS APIs are unavailable to App Extensions, and Xcode's static analysis will catch attempts to use methods that have been flagged as unavailable.

React currently uses two APIs that are off limits to extensions: `[UIApplication sharedApplication]` and `[UIAlertView initWith ...]`.

This commit adds a helper function to `RCTUtils.[hm]` called `RCTRunningInAppExtension()`, which returns `YES` if, at runtime, it can be determined that we're running in an app extension (by checking whether the path to `[NSBundle mainBundle]` has the `"appex"` path extension).

It also adds a `RCTSharedApplication()` function, which will return `nil` if running in an App Extension. If running in an App, `RCTSharedApplication()` calls `sharedApplication` by calling `performSelector:` on the `UIApplication` class.  This passes the static analysis check, and, in my opinion, obeys the "spirit of th
Closes https://github.com/facebook/react-native/pull/1895

Reviewed By: @​svcscm

Differential Revision: D2224128

Pulled By: @nicklockwood
2015-09-22 10:46:26 -07:00
Aaron Chiu e665acca4b pull in github css-layout into fbobjc react native
Reviewed By: @vjeux

Differential Revision: D2448929
2015-09-20 20:35:29 -07:00
Pieter De Baets 19067a8fbc Prevent setFrame:forView: being called for invalidated views
Reviewed By: @vjeux

Differential Revision: D2459295
2015-09-18 17:33:25 -07:00
Marc Horowitz a87ba4ab4c Prepare the bridge for C++
Reviewed By: @nicklockwood

Differential Revision: D2432291
2015-09-18 15:04:28 -07:00
Dave Miller 4af2501e8e Remove an existing UIAlertViews when invalidating the RCTAlertManager
Reviewed By: @nicklockwood

Differential Revision: D2456795
2015-09-18 08:45:27 -07:00
James Ide 4fd03ba21a Finish up the work to send through the error cookie
Summary: - Includes the error cookie with soft exceptions as well since they too can be updated (requires tiny Android change too)
- Passes the error cookie through instead of leaving it unused
Closes https://github.com/facebook/react-native/pull/2198

Reviewed By: @​svcscm

Differential Revision: D2455391

Pulled By: @sahrens
2015-09-17 18:15:27 -07:00
Alexsander Akers 9a2d05d9b2 Move color processing to JS
Reviewed By: @vjeux

Differential Revision: D2346353
2015-09-17 17:20:45 -07:00