Commit Graph

529 Commits

Author SHA1 Message Date
Pawel Sienkowski 576f5d79af Introduction of RCTRootViewDelegate
Reviewed By: adamjernst

Differential Revision: D2532327

fb-gh-sync-id: 0d018a6c2842f8021718fb7387ee6acb5d894645
2015-10-26 15:41:36 -07:00
Pawel Sienkowski 46803f0617 Size flexibility modes for RCTRootView
Reviewed By: javache

Differential Revision: D2526355

fb-gh-sync-id: 095a43bc01f883fdfdad3a086a35682c20c05597
2015-10-26 15:41:29 -07:00
Tadeu Zagallo a044ade333 Update button and add comments to Perf Monitor
Summary: public

Rename the dev menu button and add comments to the private method
used.

Reviewed By: ndfred

Differential Revision: D2576599

fb-gh-sync-id: cd5cde7562dcbc243663ac68d2b9cac5c0a984ab
2015-10-24 14:03:27 -07:00
PJ Cabrera 7882506c75 Send the evaluation of the injectedJavaScript prop back to the React Native side
Summary: We have a use case in the development of our app, where we are rendering some HTML content in a web view. But this content comes from the back end, and varies in height. There are other components on the page, so it's not a full screen web view. We need to dynamically alter the web view height, to fit the HTML content without scrolling, and to push the non-web view content on the screen down.

The solution I came up with, was to use the _loadingFinish callback, to send the evaluation of the injectedJavaScript property back to the React Native side. In my example above, injecting 'document.getElement(elementId).offsetHeight' evaluates to the height of the element, with margins and borders applied, and once returned to the RN app, it can change the app state and cause the web view height to be adjusted.
Closes https://github.com/facebook/react-native/pull/2753

Reviewed By: svcscm

Differential Revision: D2578688

Pulled By: mkonicek

fb-gh-sync-id: fc9c0d0f84994a409e037016a555534549f8957a
2015-10-23 20:24:26 -07:00
Tadeu Zagallo 9069bdf1c2 Introduce Perf Monitor
Summary: public

Kill `RCTPerfStats` and introduce the new `RCTPerfMonitor`, including memory
usage, JSC heap size, number of RN views in screen, FPS (both on UI and JS threads)
and more to come.

It removes all the previous traces that were previous spread across the bridge
and the dev menu and moves everything to be more contained, so the whole thing
can be safely striped in production.

Reviewed By: nicklockwood

Differential Revision: D2575158

fb-gh-sync-id: 6a6d0c4422adbddeeefddd32ec3409a7095ff2a9
2015-10-23 10:56:56 -07:00
Nick Lockwood cae4761006 Use arrays for module method data
Summary: public

Use arrays instead of dictionaries for encoding module method information.

This further reduces UIExplorer startup JSON from 16104 bytes to 14119 (12% reduction)

Reviewed By: javache

Differential Revision: D2570057

fb-gh-sync-id: 4a53a9ead4365a136e7caeb650375733e1c24c0e
2015-10-23 10:16:26 -07:00
Pieter De Baets 039dab078a Fix configuration for OSS UIExplorer tests
Reviewed By: nicklockwood

Differential Revision: D2575356

fb-gh-sync-id: 0ab5bd29aa3c17a8cb067a8a17abed3e178c5bcf
2015-10-23 09:35:25 -07:00
Nick Lockwood b0b9a56ef8 Fixed ActivityIndicatorIOS layout
Summary: public

This has been broken for a while. The styles in the JS were being set on the container instead of the activity view itself.

Also, due to the way frames were set directly on layer properties instead of the view, resizing didn't work properly because the UIImageView inside the UIActivityView was not being realligned when the bounds changed. This also caused problems for other controls such as maps, where it was fixed with a method override, but the simpler solution is just to set the view center and bounds directly.

Before: {F23631143}
After: {F23631144}

Reviewed By: javache, tadeuzagallo

Differential Revision: D2575156

fb-gh-sync-id: e82e56d36648e7c924df77da1750e03037b5d5be
2015-10-23 09:13:24 -07:00
rocman 772010a9af Add controller to closest parent on time so as to fix the automaticallyAdjustContentInsets feature.
Summary: Here's the bug to fix:
https://github.com/facebook/react-native/issues/898
Closes https://github.com/facebook/react-native/pull/3509

Reviewed By: svcscm

Differential Revision: D2574869

Pulled By: javache

fb-gh-sync-id: 8d947c2a0edcfb695c2e209c7b44ae6417b6233e
2015-10-23 03:15:25 -07:00
Pieter De Baets afea653cbc Measure script conversion time in RCTPLScriptExecution
Reviewed By: alexeylang

Differential Revision: D2570036

fb-gh-sync-id: a3ca8cdf0420b0da12b65ac0a672179940b2f818
2015-10-22 06:41:28 -07:00
Nick Lockwood ae5de54f00 Reduced module config data
Summary: public

We're sending a lot of module config data when the app first starts, and much of this is redundant.

UIExplorer current sends 19061 bytes of module config JSON. This diff reduces that to 16104 (15% saving) by stripping modules that have no methods or constants, and removing method types unless method is async.

Reviewed By: tadeuzagallo, javache

Differential Revision: D2570010

fb-gh-sync-id: 8c0abbd1cdee3264b37a4f52e852008caaffb9c5
2015-10-22 05:53:26 -07:00
Tadeu Zagallo 71da2917e5 Remove retainArguments from RCTModuleMethod's invocation
Summary: public

Fixes #2527

We were re-using the same invocation for every module's method, but calling
`[NSInvocation retainArguments]`, so the arguments would never be released.

Reviewed By: nicklockwood

Differential Revision: D2559997

fb-gh-sync-id: eafa3b3517c7cab3539954e26e250f7f668eee50
2015-10-22 04:04:25 -07:00
Alexey Lang 8ad09987e5 Log bundle size.
Reviewed By: javache

Differential Revision: D2564757

fb-gh-sync-id: c4429b735482ee6405b936e2dcdf610e9c6ad35f
2015-10-21 10:55:25 -07:00
Nick Lockwood c76c22249d Clear cache entry when calling multiRemove
Reviewed By: javache

Differential Revision: D2560487

fb-gh-sync-id: 4d2c192cc659f118fd5667da2a029457328eae9f
2015-10-20 11:50:30 -07:00
Nick Lockwood dbe37e7898 Improved AsyncLocalStorage performance
Reviewed By: javache

Differential Revision: D2540626

fb-gh-sync-id: f94def7463075d40c2dcfea1cb4c01502aefa117
2015-10-20 09:42:23 -07:00
Tadeu Zagallo 89c1747c33 Implement asm trampoline rather forwardInvocation
Summary: public

The profiler overrides all the methods of all the BridgeModules, and in order to
`start` and `end` the profiler at the function invocation time it used `NSInvocation`,
which is slow.

Replace it with a simple assembly method based on `objc_msgSend`.

Reviewed By: jspahrsummers

Differential Revision: D2550807

fb-gh-sync-id: 88ca08f9d6bfcd3035bda9304c93566c8818b46f
2015-10-20 04:14:09 -07:00
Tadeu Zagallo 31f9a690f3 Flush queue every 5ms during JS execution
Summary: public

Implement the iOS side of the optmisation previously implemented in android
(D2485402)

Depends on D2540746

Reviewed By: javache

Differential Revision: D2541118

fb-gh-sync-id: f3590600a6defa2da75c5b7b2cced6ad8bfea6cb
2015-10-19 08:04:24 -07:00
James Ide 45d2c691a3 Start to use the Obj-C JSContext instead of the C API
Summary: The Obj-C API is usually easier to work with, and also makes it very easy to use the C API when necessary (performance, for example). This diff just switches the designated initializer of RCTContextExecutor to take a JSContext instead of JSGlobalContextRef, but the old initializer still works if needed.

I was doing some memory leak investigation and it is easier with ARC so I wanted to incrementally move the executor to Obj-C.
Closes https://github.com/facebook/react-native/pull/2159

Reviewed By: svcscm

Differential Revision: D2554890

Pulled By: tadeuzagallo

fb-gh-sync-id: 75b96d04cddff68fa3daf5d0fafdffad21dae307
2015-10-19 03:51:20 -07:00
Patrik Tomas Chamelo 1511d8ca1d Invoking devMenu from RCTBridge in prod will crash
Summary: While we shouldn't invoke `bridge.devMenu` in production, doing it will result into a crash.

1. `devMenu` internally calls `RCTBridgeModuleNameForClass([RCTDevMenu class])`
2. `RCTBridgeModuleNameForClass()` calls `moduleName`
3. In the release code `RCTDevMenu` doesn't export the `moduleName` class method.
Closes https://github.com/facebook/react-native/pull/2910

Reviewed By: svcscm

Differential Revision: D2550797

Pulled By: tadeuzagallo

fb-gh-sync-id: 5dfbf905e5a02d9fd3b52f8b3d6eefc4e3ff30b2
2015-10-16 12:15:25 -07:00
Ryan Olson 1091ecd8e0 Respect destination vaules in LayoutAnimation create
Reviewed By: nicklockwood

Differential Revision: D2544389

fb-gh-sync-id: 9e6abdbd1f500578369e5f2c3e34d7f5ef047f5e
2015-10-16 08:39:22 -07:00
Frédéric Sagnes 4a3857ef1d Use JSStringCreateWithUTF8CString and skip NSString decoding when loading the bundle
Summary: public

Benchmarking our startup path has shown we spend a lot of time decoding strings (iPhone 4S / iPhone 5):

* reading a 2MB JS bundle: 35ms / 15ms
* decoding is to an `NSString`: 186ms / 78ms
* transforming that to a `JSString`: 29ms / 10ms

Instead of going through an `NSString` transformation, we generate a null-terminated bundle (0.1ms / 0.05ms to copy the data) and use `JSStringCreateWithUTF8CString` (121ms / 53ms) to generate the string. That makes decoding 70% faster.

Reviewed By: javache

Differential Revision: D2541140

fb-gh-sync-id: 09a016b8edfd46a9b62682c76705564d2024e75e
2015-10-16 08:11:25 -07:00
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