Commit Graph

161 Commits

Author SHA1 Message Date
Nick Lockwood 11df4cb08c Fixed display of alerts on top of modal window
Reviewed By: javache

Differential Revision: D2616170

fb-gh-sync-id: f72f728008099fff6fc966d7a2ce4c0d27a4fefd
2015-11-05 03:54:31 -08:00
Bhuwan Khattar a4cc0c3ffd No `NSError *` over the bridge
Summary: I was getting the following error when running `testAsyncStorageTest`
```
uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (NSError)'
```

nicklockwood pointed out that it might be because we're attempting to send a `NSError *` over the bridge at some point. So I went looking for cases where that might happen and found this instance.

public

Reviewed By: jingc

Differential Revision: D2619240

fb-gh-sync-id: dc26ec268f976fec44f2804831398d3b01ab6115
2015-11-04 20:07:31 -08:00
Pieter De Baets 05996963c9 Cleanup RedBox display of native errors
Reviewed By: nicklockwood

Differential Revision: D2615507

fb-gh-sync-id: 94f8013b418a3b95508cc55b9302fde4325bfcbf
2015-11-04 12:12:33 -08:00
Nick Lockwood c5b990f65f Added lightweight generic annotations
Summary: public

Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.

Fixed some type bugs and improved bridge validation in a few places.

Reviewed By: javache

Differential Revision: D2600189

fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
2015-11-03 14:49:30 -08:00
Pawel Sienkowski 1efb9dc063 Remove invalid assertion from RCTUIManager
Reviewed By: javache

Differential Revision: D2606613

fb-gh-sync-id: e8d9bcf5d23b720230de4904cab577f097010150
2015-11-03 09:07:30 -08:00
Tadeu Zagallo 1c9a74bbd1 Kill UIManager lock
Summary: public

The UIManager had a lock around the enqueued ui blocks, but now all the operations
should happen on the shadow thread, so I added assertions to it and removed the
locks.

Reviewed By: nicklockwood

Differential Revision: D2605760

fb-gh-sync-id: e1bc649f759502e7e9fd059932e0cba38dba05bf
2015-11-03 03:57:27 -08:00
Ryan Olson cf0a28265a Use UIAlertController when available in AlertIOS
Reviewed By: nicklockwood

Differential Revision: D2579164

fb-gh-sync-id: 310361585f8380429b631194147553d014ca5076
2015-10-30 11:26:27 -07:00
Nick Lockwood b59f250214 Backed out D2540626
Reviewed By: jingc

Differential Revision: D2590392

fb-gh-sync-id: 2893a4ee6ddd0de12803560b355cee6f1b9d43e6
2015-10-28 11:46:26 -07:00
Pawel Sienkowski 6faface188 RCTUIManager's setFrame:forView: fix - add support for Modal
Reviewed By: javache

Differential Revision: D2585415

fb-gh-sync-id: f367cf5353593363357dd86ec959acb1676cba9b
2015-10-27 09:22:28 -07:00
Martin Kralik f916ec26a6 removed unnecessary dispatches to main queue
Summary: There is no point in dispatching to main thread if there is nothing to do there.
This place gets called basically any time a repeating js timer fires, which doesn't imply UI changes (although usually that's why people setup timers).
Combined with previous diffs that makes us not generate empty blocks (nil instead), this could be minor perf win in some rare cases.

This also changes semantic of `reactBridgeDidFinishTransaction` call a bit. Previously it was done no matter if UI has changed or not.
I think it should be safe, since seems like callees really care only about views being laid out.

Depends on D2571166. (not strictly speaking)

public

Reviewed By: jspahrsummers, nicklockwood

Differential Revision: D2571188

fb-gh-sync-id: 02d52e4615475072c3c27226e67c431a667ec990
2015-10-27 05:09:45 -07:00
Martin Kralik 28f5af0c39 nil instead of empty `RCTViewManagerUIBlock` blocks
Summary: Same as in previous diffs. Gets us into a better place to know if we really have UI updates and it's marginally more efficient.

Depends on D2571143. (not really)

public

Reviewed By: nicklockwood

Differential Revision: D2571166

fb-gh-sync-id: e8f34521ec2e12156a49f1cd655e92df1db34fca
2015-10-27 05:09:39 -07:00
Martin Kralik af70d05838 moved `reactBridgeDidFinishTransaction` calls
Summary: Previously `_bridgeTransactionListeners` were informed about `reactBridgeDidFinishTransaction` inside of one of the UI blocks.
That seems pretty arbitrary, doesn't really mean a "transaction" is really over (assuming transaction means all UI updates) and even when that block does nothing we still need to call these listeners, since there could be other UI blocks generated somewhere else!
So I've moved this call to a place that seemed better (=after all UI blocks are done), since all listeners are interested in knowing when layout has happened.

public

Reviewed By: nicklockwood

Differential Revision: D2571122

fb-gh-sync-id: 62be03ebc4353d6f6318c9765079b87b07483be2
2015-10-27 05:09:25 -07:00
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 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 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
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 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 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
Nick Lockwood 63a37be1dd Removed RCTCache
Reviewed By: @tadeuzagallo

Differential Revision: D2410542

fb-gh-sync-id: 98af1b51802e69e7ede9a31feda0df5a526a6db5
2015-10-08 05:37:29 -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
Chace Liang 8221c33650 Add Voice Over related change to AccessibilityManager.
Reviewed By: @hedgerwang

Differential Revision: D2491520
2015-10-01 18:19:24 -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
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
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
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
Nick Lockwood b450e36ef8 Fixed chrome debug persistence + crash
Reviewed By: @tadeuzagallo

Differential Revision: D2443181
2015-09-15 11:20:23 -07:00
Nick Lockwood 515d5a5f4b Added toggle items to dev menu
Reviewed By: @tadeuzagallo

Differential Revision: D2424595
2015-09-14 09:40:33 -07:00
Martin Konicek 56f77ec6ee Tweak debug menu labels
Reviewed By: @kmagiera

Differential Revision: D2430890
2015-09-11 17:01:40 -07:00
Nick Lockwood bb5522582d Fixed layout animation crash 2015-09-04 05:34:46 -08:00
Tj 58661978a7 [RCTDevLoadingView] Add ability to disable during development.
Summary:
I'd like this ability as this has a tendency to get in the way of some of the more complex UI pieces I have. Disabling RCT_DEV entirely is too much for me.
Closes https://github.com/facebook/react-native/pull/2451
Github Author: Tj <tfallon@mail.depaul.edu>
2015-09-04 03:46:06 -08:00
Nick Lockwood aa62a5e4e0 Send layout events on shadow queue
Summary:
We currently wait until after views have been updated on the main thread before sending layout events. This means that any code that relies on those events to update the UI will lag the atual layout by at least one frame.

This changes the RCTUIManager to send the event immediately after layout has occured on the shadow thread. This noticably improves the respinsiveness of the layout example in UIExplorer, which now updates the dimension labels immediately instead of waiting until after the layout animation has completed.
2015-09-03 03:42:26 -08:00
Alex Kotliarskyi c069035479 [React Native] Bring back .sourceURL 2015-09-02 14:12:48 -08:00
Nick Lockwood 848839858b Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.

This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.

The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.

  RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)

If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 06:11:24 -08:00
Tadeu Zagallo aee74efde7 [ReactNative] Add JSC profiler to Dev Menu
Summary:
Add JSC profiler to the dev menu and rename the pre-existent one to systrace.

For now it just outputs to the console, but a better workflow is on the way.
2015-08-28 10:31:47 -08:00
Pieter De Baets e15f584a3d Slim RCTSourceCode in production 2015-08-28 05:46:35 -08:00
Alexey Lang 2d2252cd50 Use native initialAppState to init app_state for AppStateIOS. 2015-08-25 09:32:28 -08:00
Matt Mahoney 36c1064033 [rn] Pass props when creating a view in RCTViewManager 2015-08-25 08:08:17 -08:00
Pieter De Baets 371aeceb72 Small perf improvement to RCTPerfStats and RCTBridgeModuleNameForClass 2015-08-25 04:48:39 -08:00
Nick Lockwood 4382c0e8f4 Fixed redbox rotation
Summary:
Added autoresizing constraints to the redbox layout so that it resizes correctly when the screen is rotated.
2015-08-25 02:20:26 -08:00
Nick Lockwood 88e0bbc469 Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
Nick Lockwood c27e5198e2 Add doc comment for mainScrollView 2015-08-21 04:00:03 -07:00
Nick Lockwood 2cd02d94ff Converted RCTRedBox to a bridge module 2015-08-21 02:53:55 -07:00
Alexsander Akers ee82a195f7 Set padding on ModalFullscreenView to offset status bar frame 2015-08-20 07:10:34 -07:00
Tadeu Zagallo 81fdf3e532 [ReactNative] Change RCTProfile API to be compatible with systrace 2015-08-20 00:47:23 -07:00