Commit Graph

6708 Commits

Author SHA1 Message Date
Chris Evans 5047f6f54c Add Copy Stack button to Red Box (iOS)
Summary:
Added a button to the iOS Red Box to enable copying of the error and stack trace to the clipboard to make it easier to paste the error and stack into bug reports or other text windows. Clicking the Copy button on the bottom of the RedBox screen or pressing Cmd-Option-C keyboard shortcut in the simulator will copy the full stack trace as text to the iOS pasteboard and when in the simulator you can then hit Command-C to get the text to the Mac's pasteboard for pasting in your favorite reporting/tracking app.

No tests for this change - I don't see any tests to extend for the RCTRedBoxWindow class. No impact on APIs or core React Native functionality. I validated it by running test React Native apps with red box errors and both hitting the copy button or using the command key shortcut in the emulator to get the text of the stack to the iOS pasteboard.
![redboxcopybutton](https://cloud.githubusercontent.com/assets/7173455/15258992/7b1e849c-1903-11e6-8813-6e853db5db54.png)
Closes https://github.com/facebook/react-native/pull/7557

Differential Revision: D3311743

Pulled By: javache

fbshipit-source-id: 76d1ac8ab93f40696c6a2369dae2245194db095a
2016-05-17 12:28:21 -07:00
Victor Calvello d62f9612f2 Add 'Vorterix' app to Showcase
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Prefer **small pull requests**. These are much easier to review and more likely to get merged. Make sure the PR does only one thing, otherwise please split it.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/mas
Closes https://github.com/facebook/react-native/pull/7590

Differential Revision: D3310675

fbshipit-source-id: 8dc4d50eed9237988b409c336695568832c0fe34
2016-05-17 12:13:32 -07:00
Martín Bigio fdc6240018 Reset hasError flag after HMR request
Summary:
This got broken recently. As a result of this, when a module throws while being required, either by regular load or hot reload, the module object is marked as `hasError`. Form that point all subsequent HMR updates will fail because it will think the module failed while executing the factory but the failure could have been on an old run of an old factory.

The fix is very simple: just reset `hasError` to false when accepting a module.
Closes https://github.com/facebook/react-native/pull/7567

Differential Revision: D3310685

fbshipit-source-id: 2f0b48ab7432b7c221d0c88a019a28969a8862b2
2016-05-17 11:58:31 -07:00
Alexander Blom 7446d42d33 Delete jsc-internal
Reviewed By: dcaspi

Differential Revision: D3304892

fbshipit-source-id: fd7ac66c81c93785c3c7887a107c8f1df222aefa
2016-05-17 11:28:34 -07:00
Ben Nham 5bb5ea7135 Reload image without dispatch_async if completion handler is already on main thread
Summary:
This works with D3305161 to minimize image flashing. After D3305161, the completion handler passed to `-[RCTImageLoader loadImageWithoutClipping:size:scale:resizeMode:progressBlock:completionBlock:]` may be called back on the main queue in the case of a cached image. In this case, we want to set the image view's image property synchronously rather than on the next runloop iteration via dispatch_async. This minimizes the amount of image flashing the user sees when displaying a cached image.

The exception to this case is for blurred images. A blur can be an expensive (taking multiple ms on the CPU), so we always make sure to perform the blur off the main queue even if the image is cached and the callback came back on the main queue.

Reviewed By: nicklockwood

Differential Revision: D3310176

fbshipit-source-id: 6820782527b65e4956879cf06e8ed2c09c622a58
2016-05-17 10:43:30 -07:00
Adam Comella fe5c0d2d06 iOS: Enable views to be nested within <Text>
Summary:
Previously, only Text and Image could be nested within Text. Now, any
view can be nested within Text. One restriction of this feature is
that developers must give inline views a width and a height via
the style prop.

Previously, inline Images were supported by using iOS's built-in support
for rendering images with an NSAttributedString via NSTextAttachment.
However, NSAttributedString doesn't support rendering arbitrary views.

This change adds support for nesting views within Text by creating one
NSTextAttachment per inline view. The NSTextAttachments act as placeholders.
They are set to be the size of the corresponding view. After the text is
laid out, we query the text system to find out where it has positioned each
NSTextAttachment. We then position the views to be at those locations.

This commit also contains a change in `RCTShadowText.m`
`_setParagraphStyleOnAttributedString:heightOfTallestSubview:`. It now only sets
`lineHeight`, `textAlign`, and `writingDirection` when they've actua
Closes https://github.com/facebook/react-native/pull/7304

Differential Revision: D3269333

Pulled By: nicklockwood

fbshipit-source-id: 2b59f1c5445a4012f9c29df9f10f5010060ea517
2016-05-17 10:43:30 -07:00
Sean Kelley 908041b80b Round alpha channel when interpolating colors to the nearest thousandth.
Summary:
This fixes an issue where animations for values near zero could end up formatted
with exponents (e.g. `1.452e-10`), which is not valid for an `rgba` color spec.
This commit arbitrarily rounds it to the nearest thousandth to prevent this type
of formatting while still maintaining high-enough resolution in the alpha channel.

One way this could bubble up to the user is as PropType validation failures:

```
Failed propType: Invalid prop `backgroundColor` supplied to `RCTView`: rgba(0, 0, 0, 9.838983123336224e-7)
```
Closes https://github.com/facebook/react-native/pull/7597

Differential Revision: D3310941

Pulled By: vjeux

fbshipit-source-id: 0c95facaef5b69c021662af9fb6f268d890ecc3e
2016-05-17 10:13:29 -07:00
David Aurelio 9092198b1b Terminate startup code with a null byte, too (indexed file random access bundles)
Reviewed By: javache

Differential Revision: D3310269

fbshipit-source-id: d0fbf5afd6baecf50ec568e8694a15c96e6a9c85
2016-05-17 09:58:44 -07:00
Alexander Blom f71329946c Don't barf if property throws
Reviewed By: davidaurelio

Differential Revision: D3305125

fbshipit-source-id: 48143195cd1d48a9f99f4d93dfdf62b51ba6b4c1
2016-05-17 05:13:24 -07:00
Michał Gregorczyk 89b68419ff Add jsc initialization markers to cxx bridge
Reviewed By: lexs

Differential Revision: D3303919

fbshipit-source-id: 0dbbe89de9de165a9d7a1597be050f37ed10a878
2016-05-17 04:28:25 -07:00
Fred Liu 12fcacb58f Full width styling for quick actions
Summary: - Used absolute positioning to render full-width quick actions

Reviewed By: fkgozali

Differential Revision: D3302467

fbshipit-source-id: cdcac88b20eff7a71be1ab8bb39e6888216dad84
2016-05-17 01:43:27 -07:00
Thorben Primke a52e684121 Updated Embed Into Existing Android App Readme
Summary:
Motivation: Fix the documentation so that others don't stumble.

**Test plan**: Integrating RN into an existing Android app doesn't cause the `ConnectivityManagerCompat` exception anymore.

 ---

The instructions where still pointing at maven central. This updates the dependency and provides instructions on how to reference the local maven folder in `node_modules`.
Closes https://github.com/facebook/react-native/pull/7586

Differential Revision: D3309932

fbshipit-source-id: 8e4fc4c0ae5641af886c9d9a0feb1c8172e94fcf
2016-05-16 23:43:22 -07:00
Tobias Ritzau ee77e50c4a Collapse native/{fb,jni,xplatinit} into one DSO
Reviewed By: dcolascione

Differential Revision: D3201488

fbshipit-source-id: 0cf965ee16e360329285d834a4c575d8f1061f15
2016-05-16 22:58:39 -07:00
Fred Liu c779e233b6 Improve SwipeableListView performance
Summary:
- Removed unnecessary rerending of `SwipeableListView` by properly managing `SwipeableListViewDataSource`
- Simplified `SwipeableRow` logic and improved swiping performance
- Added bounce effect
- Locked `ListView` from being scrollable when `SwipeableRow` is being swiped; behaviour mirrors that of Android on iOS and significantly improves framerates

Reviewed By: fkgozali

Differential Revision: D3307599

fbshipit-source-id: 168b6b72ef1f9e47d0145cf9e1baecbab3564b84
2016-05-16 20:28:27 -07:00
Yu Huang 34907c3810 Fix List View _updateVisibleRows firing for all row component at view loading time issue
Summary:
Sometimes list view row components(even the ones unseen) have a frame but its x and y is 0 or uninitialized at view loading time, which will lead to _updateVisibleRows firing for all the row components incorrectly at loading time.
This is to make the code more defensive.

Reviewed By: sahrens

Differential Revision: D3308515

fbshipit-source-id: 0e30fdf10345629bfd9de3fe0ad641bb1903fe00
2016-05-16 18:28:21 -07:00
Gabe Levi 0c40f96c32 Upgrade to v0.25.0
Reviewed By: jeffmo

Differential Revision: D3308221

fbshipit-source-id: c17b5ed861cfc201b8bd36f9c01218da25960001
2016-05-16 17:13:23 -07:00
邓国梁 2bb4e69382 add showcase for xiaoxian
Summary:
RT
Closes https://github.com/facebook/react-native/pull/7082

Differential Revision: D3306415

Pulled By: mkonicek

fbshipit-source-id: d2d3bfca68a890e10393c3904bdff222ec414865
2016-05-16 13:13:28 -07:00
Yu Zheng(Sam) 67d9a7bae9 Mark SupportAlertFragment and AlertFragment as Public to fix crash is…
Summary:
Hi,
This changelist is for fixing a crash issue on Android devices. For detail please see, https://github.com/facebook/react-native/issues/7080

In short, the crash occurred when a RN app with a Alert dialog shown at front switches back after it is destroyed at background due to lack of phone memory.

My fix is to let those Alert fragment classes accessible from android.support.v4.app.Fragment instantiate() function, so that it won't crash. And since other UI will be reloaded whatever, mListener is set to null to avoid any callback happen.
Closes https://github.com/facebook/react-native/pull/7105

Differential Revision: D3212435

Pulled By: mkonicek

fbshipit-source-id: d900a33a4f0fd49258be94c277def55555ec8d73
2016-05-16 12:58:30 -07:00
Janic Duplessis aac7f5b362 Fix tests buck build when running locally
Summary:
Got this error when trying to run instrumentation tests locally with `./scripts/run-android-local-integration-test.sh`

```
C:\Users\janic\Developer\react-native\ReactAndroid\src\androidTest\java\com\facebook\react\tests\DatePickerDialogTestCase.java:110: error: cannot access com.facebook.react.modules.core.DefaultHardwareBackBtnHandler
    return (DialogFragment) getActivity().getSupportFragmentManager()
                                         ^
  class file for com.facebook.react.modules.core.DefaultHardwareBackBtnHandler not found
C:\Users\janic\Developer\react-native\ReactAndroid\src\androidTest\java\com\facebook\react\tests\ViewRenderingTestCase.java:82: error: cannot access com.facebook.react.touch.ReactInterceptingViewGroup
    assertEquals("Incorrect (or not applied) opacity", expectedOpacity, view.getAlpha());
                                                                            ^
  class file for com.facebook.react.touch.ReactInterceptingViewGroup not found
C:\Users\janic\Developer
Closes https://github.com/facebook/react-native/pull/7575

Differential Revision: D3306330

fbshipit-source-id: a6d8afd060b54d56f9e2b97f45b642d7b7f46209
2016-05-16 12:28:40 -07:00
Tore Hanssen df40f482b0 Callback with image height and width from IOSImagePicker
Reviewed By: javache

Differential Revision: D3301645

fbshipit-source-id: c771d491447f8ed9dc6c8685e273b99656336b0a
2016-05-16 11:13:23 -07:00
Martín Bigio 6457effb7b Avoid clearing out factory on DEV mode
Summary:
grabbou pointed out this issue.

We recently started cleaning out the factory function after module are required to save some memory. This broke HMR on some edge cases because sometimes the factory function may need to be re-executed. This PR just wraps the optimization into `__DEV__` to make sure we don't use it while developing.
Closes https://github.com/facebook/react-native/pull/7568

Differential Revision: D3305120

Pulled By: martinbigio

fbshipit-source-id: 741cffbb327d118f0bd0ec34dc1af53d4f94880e
2016-05-16 10:43:21 -07:00
Alexander Blom 3fe2e6581c Remove duplicate install of nativeFlushQueueImmediate
Summary:
This was accidentally added twice.

**Test plan (required)**

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

Differential Revision: D3305537

Pulled By: astreet

fbshipit-source-id: 7d652f9c7762cb66715f1b7235a186513d9b938d
2016-05-16 10:28:45 -07:00
Martin Konicek 10429b5822 Test that Picker selection is updated correctly
Summary:
A React pull request broke the Picker: https://github.com/facebook/react/pull/6572
This pull request adds a test so that we prevent breakages like this in the future.

`PickerAndroidExample` in the UIExplorer before the breakage (video): https://vid.me/h5Rg
`PickerAndroidExample` in the UIExplorer after the breakage (video): https://vid.me/atFc

**Test plan**

`./scripts/run-android-local-integration-test.sh`

The test is failing, we can only merge this once React is fixed.

<img width="837" alt="screen shot 2016-05-04 at 5 13 31 pm" src="https://cloud.githubusercontent.com/assets/346214/15020827/aca8d718-121b-11e6-91f6-a338293d7d92.png">
Closes https://github.com/facebook/react-native/pull/7390

Differential Revision: D3305223

Pulled By: mkonicek

fbshipit-source-id: 89137812940c578efff3e76864ab7cadccc9f2ea
2016-05-16 09:13:28 -07:00
Nick Lockwood d2934e58b3 Expose UIManager queue via a static function to prevent race conditions
Summary: Having UI modules access the shadowQueue via UIManager.methodQueue is fragile and leads to race conditions in startup, sometimes resulting in an error where the methodQueue is set twice, or not at all.

Reviewed By: javache

Differential Revision: D3304890

fbshipit-source-id: 7198d28314dbec798877fcaaf17ae017d50157e9
2016-05-16 08:13:21 -07:00
Naman Goel 1673e00e2b correct flow types
Summary:
The function should have optional arguments, but not nullable types.
Closes https://github.com/facebook/react-native/pull/7580

Differential Revision: D3304994

Pulled By: davidaurelio

fbshipit-source-id: 9918817429126ea16dd3076b61a3493c3a3a8388
2016-05-16 07:58:26 -07:00
Alexander Blom f13322c820 Add support for dumping current React hierarchy
Reviewed By: sebmarkbage

Differential Revision: D3287391

fbshipit-source-id: 0ef1cd25a910dcc0a50ed52a2cc0ae702a9654f4
2016-05-16 07:28:29 -07:00
Alexander Blom 610cfdc819 Add support for custom files in BugReporting
Reviewed By: astreet

Differential Revision: D3287186

fbshipit-source-id: ce7000ac110b78a4fb94c66229046617c292675f
2016-05-16 07:28:29 -07:00
Pieter De Baets 6a3fc86778 Remove 64-bit restriction from React Native tests
Reviewed By: majak

Differential Revision: D3298189

fbshipit-source-id: f25b223d677a0ec8e1a665dd54de685e00d497b8
2016-05-16 05:28:23 -07:00
David Aurelio 2f41c56f59 change to fixed size offset table + indexed lookup
Reviewed By: javache

Differential Revision: D3281989

fbshipit-source-id: 52db9f441dd46024eafac46ae8d32b26640cad71
2016-05-16 04:43:24 -07:00
Nick Lockwood 516bf7bd94 Fixed NativeEventListener deregistration
Summary:
The `EmitterSubscription.remove()` method was previously calling `this.subscriber.removeSubscription(this)` directly, bypassing the mechanism in `NativeEventEmitter` that keeps track of the number of subscriptions.

This meant that native event modules (subclasses of `RCTEventEmitter`) would keep sending events even after all the listeners had been removed. This wasn't a huge overhead, since these modules are singletons and only send one message over the bridge per event, regardless of the number of listeners, but it's still undesirable.

This fixes the problem by routing the `EmitterSubscription.remove()` method through the `EventEmitter` so that `NativeEventEmitter` can apply the additional native calls.

I've also improved the architecture so that each `NativeEventEmitter` uses its own `EventEmitter`, but they currently all still share the same `EventSubscriptionVendor` so that legacy code which registers events via `RCTDeviceEventEmitter` still works.

Reviewed By: vjeux

Differential Revision: D3292361

fbshipit-source-id: d60e881d50351523d2112473703bea826641cdef
2016-05-16 04:13:56 -07:00
Alexander Blom 9a899bed65 Memoize lazy module configs
Reviewed By: javache

Differential Revision: D3293010

fbshipit-source-id: feab7bb0a1f8990baea9c0aca8c9c3cccbcb04e8
2016-05-16 03:58:23 -07:00
Dave Miller ccef1b2941 More touch logging
Reviewed By: andreicoman11

Differential Revision: D3298518

fbshipit-source-id: 0ddbba5c05848ac164f6f1562b26609924978169
2016-05-16 02:58:21 -07:00
Shane O'Sullivan fa5d1fefa1 Make the root view background color explicit
Summary:
The default white background for the root view causes an unattractive flash when loading any app with a non-white background.  Almost every developer has to search for how to fix it.

This change makes the background color explicit in the file, so it can be easily change to match the color of the splash screen and the main screen without having to search for it.

**Test plan (required)**
Launched my app and it still has a white flash for the background before loading the app.  I changed the background colors to other values and the flash was that color.
Closes https://github.com/facebook/react-native/pull/7570

Differential Revision: D3303451

Pulled By: vjeux

fbshipit-source-id: 61dbab768095c430bcb583bafb57575a7d767e6f
2016-05-14 22:43:20 -07:00
Yao Bin Then 433c0e8021 Add comments on NetInfo.js
Summary:
Further describe the methods available on NetInfo.

Question: How do I update the docs on the website?
Closes https://github.com/facebook/react-native/pull/7375

Differential Revision: D3303300

fbshipit-source-id: 4343d490f65e4e47b93f2c98a645cb675d2cf708
2016-05-14 21:50:24 -07:00
David Aurelio e34c9c4e5f Include forwarding modules into npm package
Reviewed By: bestander

Differential Revision: D3301666

fbshipit-source-id: 723d87f1df217f0f1f78661bb6c41a9bbfab6814
2016-05-14 16:28:26 -07:00
Spencer Ahrens c2a8e52d72 Fix source map utils
Reviewed By: javache

Differential Revision: D3302496

fbshipit-source-id: de15a289497119c7f600b8796452fc9573ea7394
2016-05-14 10:43:30 -07:00
Marc Horowitz 3a2d024514 avoid waiting on the main thread just to send a notification
Reviewed By: nicklockwood

Differential Revision: D3234837

fbshipit-source-id: 587a68df7d08999d4357583ba3160b315bd85239
2016-05-13 17:29:00 -07:00
Marc Horowitz 9e9dfd2ac9 Introduce non-copyable JSBigString for managing large strings efficiently
Reviewed By: astreet

Differential Revision: D3234836

fbshipit-source-id: 2b95b585dc1215988b88cf0d609c778a95b362a1
2016-05-13 17:29:00 -07:00
Marc Horowitz f433ed716c Make the pattern for adding systrace sections more concise
Reviewed By: astreet

Differential Revision: D3234834

fbshipit-source-id: 73e191deb4dd0e06d4c242e46a582051d4bcc9ba
2016-05-13 17:29:00 -07:00
Marc Horowitz 267264f1ec Add a bunch more systrace logging
Reviewed By: tadeuzagallo

Differential Revision: D3234831

fbshipit-source-id: 177f9b987e938c59d50fc07bce01fb5c912652e7
2016-05-13 17:29:00 -07:00
Marc Horowitz 86f2eb18e5 Support JS Systrace on all platforms
Reviewed By: tadeuzagallo

Differential Revision: D3234830

fbshipit-source-id: 94cc870d47d620c8bd8d35f83d0b017e5ddba90d
2016-05-13 17:29:00 -07:00
Marc Horowitz b7fe8e68be Finer granularity systracing
Reviewed By: astreet

Differential Revision: D3234826

fbshipit-source-id: 900ab93b847949413a134a87a20b0d826c58da3d
2016-05-13 17:29:00 -07:00
Marc Horowitz 86e18ace94 make RCTFBSystrace actually work
Reviewed By: tadeuzagallo

Differential Revision: D3234824

fbshipit-source-id: 9f2f7efd6877fe7b9096dedecb311d226eae7bc8
2016-05-13 17:29:00 -07:00
Marc Horowitz 418e16f711 Support flow events in RCTProfile
Summary: Add begin/end async flow to the callbacks for external profiling

Reviewed By: tadeuzagallo

Differential Revision: D3234812

fbshipit-source-id: cdbe46883fd566d50a04de9ad67f947876a78a0c
2016-05-13 17:29:00 -07:00
Marc Horowitz 05832c3469 Catch any std::exception from unbundling
Reviewed By: davidaurelio

Differential Revision: D3148408

fbshipit-source-id: 78dc47e1b092cb7fd06307d505a795d2009cee4d
2016-05-13 17:29:00 -07:00
Marc Horowitz 448b48ca85 remove useless text from js errors
Reviewed By: astreet

Differential Revision: D3127112

fbshipit-source-id: 56ee9da8cd7d409c7b13864e6d4cc863146d19f0
2016-05-13 17:29:00 -07:00
Marc Horowitz 7762297f77 add supportsWebWorkers
Reviewed By: lexs

Differential Revision: D3149754

fbshipit-source-id: 58bce886aff526bc7152eaca2f43a654dcb5ad2a
2016-05-13 17:29:00 -07:00
Adam Comella 03edc75b56 iOS: Provide correct animation function for hiding keyboard
Summary:
Currently, `7 << 16` is used as the animation easing function for both the showing and hiding of the keyboard.

Instead, `7 << 16` should be used for showing the keyboard and `6 << 16` for hiding the keyboard.

For details, see: http://stackoverflow.com/questions/18870447/how-to-use-the-default-ios7-uianimation-curve/19439283#19439283

**Test plan (required)**

Testing animating the position of a view to coordinate with the keyboard hiding and showing and it looks good.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/7372

Differential Revision: D3300464

Pulled By: nicklockwood

fbshipit-source-id: 3fdc161f709de11deb7de511aad28767f5d80bd6
2016-05-13 15:43:22 -07:00
Arno Fortelny cac5ce3b93 RefreshControl on initial render will not beginRefresh when refreshing state is false
Summary:
There's an edge case in the `RefreshControl` which causes it to show as refreshing when the state is set to false. When the component is initialized with `refreshing` set to `true` on initial render but set to `false` before `layoutSubviews` is called, it will call `beginRefresh` and ignore its state. That's because `layoutSubviews` never checks if `_currentRefreshingState` is in fact still `true`, it merely assumes it is.

This is fixed by simply doing a check for `_currentRefreshingState` before entering `beginRefresh` from `layoutSubviews`.
Closes https://github.com/facebook/react-native/pull/7556

Differential Revision: D3300124

fbshipit-source-id: d1dce8612e2c03b1f14284d513803d00af4b5c8a
2016-05-13 14:43:26 -07:00
Hedger Wang 8975bb8e70 `didFocus` event should fired after transition finishes.
Summary:
For now, we emit `didFocus` event before fully resetting the transition and
hiding the stale scenes, so handler for `didFocus` event does not get the right
scenes in place. We should emit the didFocus event after resetting the transition and
hiding the stale scenes.

Reviewed By: ericvicenti

Differential Revision: D3299002

fbshipit-source-id: 6a79528097aabc4f61d4dba322820c228c889a84
2016-05-13 12:58:24 -07:00