Граф коммитов

2762 Коммитов

Автор SHA1 Сообщение Дата
Valentin Shergin 89add2582d Fabric: Collecting mounting time inside `MountingTelemetry`
Summary:
Now we also collect mounting time inside MountingTelemetry.
We will use it soon.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D18285826

fbshipit-source-id: 512fc62c210a111614b0defb0d76cbd6228fe89f
2019-11-04 18:21:13 -08:00
Ramanpreet Nara 3beb8341fd Make RCTTVNavigationEventEmitter TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTTVNavigationEventEmitter TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18142252

fbshipit-source-id: c633a5a0abd9e980346379921b34219228153348
2019-11-04 16:07:24 -08:00
Ramanpreet Nara 7e5de4e241 Make RedBox TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RedBox TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18142255

fbshipit-source-id: 2d130aca93a88ac7c983ce0e4848955ffb0be518
2019-11-04 16:07:23 -08:00
Ramanpreet Nara fe3ae9dce8 Make RCTDevMenu and RCTDevSettings TurboModule-compatible
Summary:
Changelog:
[iOS][Added] - Make RCTDevMenu and RCTDevSettings TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18148890

fbshipit-source-id: bd4f0b2797e299cd963e34fa47044a9e1232efe0
2019-11-04 16:07:23 -08:00
Samuel Susla 1cfa1e6fa2 Remove -Wno-unguarded-availability from ReactInternal
Summary:
This will allow us to catch cases where we use iOS 10-only APIs on iOS 9

Changelog: [Internal]

Reviewed By: TheSavior, mmmulani

Differential Revision: D18275225

fbshipit-source-id: dc9c515415208db40750be997173ce5bd6eb494f
2019-11-04 12:03:10 -08:00
Peter Argany dc3b5ad275 Remove unneeded NSNotification center removeObserver
Summary:
A very common pattern I've seen in RN codebase:

     - (instancetype) init {
        [[NSNotificationCenter defaultCenter] addObserver:self ...]
      }

    - (void) dealloc {
       [[NSNotificationCenter defaultCenter] removeObserver:self ...]
     }

From Apple:

https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver?language=objc

> If your app targets iOS 9.0 and later or macOS 10.11 and later, you don't need to unregister an observer in its dealloc method.

RN targets iOS9+

Changelog: [Internal][Cleanup] Remove unneeded NSNotification center removeObserver

Reviewed By: shergin

Differential Revision: D18264235

fbshipit-source-id: 684e5f5555cec96b055b13cd83daaeb393f4fac9
2019-11-04 10:19:30 -08:00
Ramanpreet Nara 38678f75b4 Fix podspecs
Summary:
I kept on running `USE_FRAMEWORKS=1 update-pods && open RNTesterPods.xcworkspace` and adding missing dependencies until `RNTesterPods` started compiling without failure.

**Note:** I made sure to only commit the podfile changes from `update-pods`, **without** `USE_FRAMEWORKS=1`.

Changelog:
[iOS][Fixed] - Fix all RN Podspecs

Reviewed By: fkgozali

Differential Revision: D18284535

fbshipit-source-id: 44d288ae0e52dd2cbbe26bebe7df73ce05644b5d
2019-11-01 19:34:46 -07:00
Ramanpreet Nara 809d01095e Make RCTPerfMonitor TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTPerfMonitor TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18145947

fbshipit-source-id: df2f0d60a4924f094cc4ec311b6bf570fb9fb7e1
2019-11-01 12:06:21 -07:00
Ramanpreet Nara 7233ae4f11 Make RCTAppState TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTAppState TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D18142253

fbshipit-source-id: 5bd8afa6e3ee98f92aac3b2ebdfe63b9f7afc775
2019-11-01 12:06:21 -07:00
Ramanpreet Nara 6481a124da Make RCTKeyboardObserver TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTKeyboardObserver TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18130902

fbshipit-source-id: 79dff2aeede7cb2485d48597a1f80e546c107e7a
2019-11-01 12:06:20 -07:00
Ramanpreet Nara dc12676e3a Make RCTStatusBarManager TurboModule-compatible
Summary:
See title.

Changelog:
[iOS][Added] - Make RCTStatusBarManager TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18130374

fbshipit-source-id: 3ec226bcff17e47ffd9eba05e32c1eb68d6135b2
2019-11-01 12:06:20 -07:00
Valentin Shergin 41cf6da074 Fabric: Implementation of `RCTMountingTransactionObserving` protocol
Summary:
This diff finally uses all facilities from the previous diffs to build an implementation of  `RCTMountingTransactionObserving` protocol which does *not* require using expensive Objective-C runtime features.

In the coming diffs, we will see how it can/should be used.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18217101

fbshipit-source-id: 34f411dcb527dc81570c2f2833ce13b40e1450db
2019-11-01 09:38:25 -07:00
Valentin Shergin 20a0f224ba Fabric: Introducing `RCTMountingTransactionObserving` protocol
Summary:
See the comment in RCTMountingTransactionObserving first.

I think we have to add this to the iOS mounting layer to be able reasonably easy implement things like:

* MovableNavigationBar: seems, currently we don't handle the situation when the container was mounted first and the nested scroll view second.
* TTI component: It does not have access to telemetry.

The protocol is meant to replace `RCTSurfacePresenterObserver`.

Changelog: [Internal] Fabric-specific change.

Reviewed By: mdvacca

Differential Revision: D16270107

fbshipit-source-id: 2d4bdb7d0092cc214cc433fc633e41e58f6677df
2019-11-01 09:38:25 -07:00
Valentin Shergin c583822504 Fabric: Introducing `RCTComponentViewClassDescriptor`
Summary:
RCTComponentViewClassDescriptor is a pretty much the same as RCTComponentViewDescriptor but for *classes*. RCTComponentViewFactory uses a map of those data structures to create RCTComponentViewDescriptor instances (which reflects the same properties) efficiently.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18217103

fbshipit-source-id: ab7ab6b0712048d0085b61a3604b284b1fb5a68b
2019-11-01 09:38:25 -07:00
Valentin Shergin 93ded152d9 Fabric: Introducing `RCTComponentViewDescriptor`
Summary:
This diff introduces RCTComponentViewDescriptor - the container for a view and associated with this view properties which mounting infra uses for bookkeeping (and recycling) views.
The previous implementation used raw Objective-C pointers to `UIView`s to store and manipulate them. The new way has a bunch of advantages:
* It allows using high-performant C++ data collections for storing views and their properties (in future diffs).
* The new approach allows us to avoid hacks around NSMapTable (such as ` [_registry setObject:componentView forKey:(__bridge id)(void *)tag];`) that were needed because NSMapTable wasn't designed for our use-case.
* Dealing with `RCTComponentViewDescriptor` which stores a pointer to a view sometimes is actually more efficient than dealing with those pointers themselfs because we can deal with `const &` to a descriptor which does not require a ref-counter bump.
* A new approach is much more flexible, it allows us to store additional data alongside view instances which we will use in coming diffs.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18217102

fbshipit-source-id: 063e6c7df794a2e1fd690c194fb31ad6833eaba7
2019-11-01 09:38:24 -07:00
Valentin Shergin 8a1937ace6 Fabric: `RCTComponentViewRegistry::findComponentViewWithTag` was split into two methods
Summary:
In addition to already exiting method `componentViewByTag`, this diff adds a new one `findComponentViewWithTag` which does pretty much the same thing but returns `nil` in a case when it cannot find a view with a given tag. The first method now returns a non-nullable object, whereas the second (new) one return nullable.

We need this to explicitly designate call-sites that are resilient to such kind of errors, where such errors are expected because of still-existing consistency problems (because of some legacy implementation approaches).
At the same time, for the call-sites where a missing view situation is unrecoverable, we should throw early and stop paying for nullability overhead.
In the future diffs, we will change the internal implementation of the registry where the price for dealing with nullability will be actually meaningful.

This is the first diff on the road to an implementation of `RCTMountingTransactionObserving` protocol.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18217099

fbshipit-source-id: dc50033ecadd43c43c5a65fed62649a1a7acf2b5
2019-11-01 09:38:24 -07:00
Valentin Shergin 746e697038 Fabric: Removing `RCTComponentViewRegistry::tagByComponentView`
Summary:
This method has no any usages.

Changelog: [Internal] Fabric-specific, internal change.

Reviewed By: sammy-SC

Differential Revision: D18217100

fbshipit-source-id: 7aabd9e83413c2a1040bdd6c1510d6e4a4c6446a
2019-11-01 09:38:24 -07:00
Tim Yung 548aad4ff1 RN: Delete Apple TV Props
Summary:
With tvOS (Apple TV) now residing in a separately maintained fork, this removes the residual props from React Native. This only includes the JavaScript changes. The Objective-C changes will come later.

Specifically, the following props have been removed:

- `isTVSelectable`
- `tvParallaxProperties`
- `tvParallaxShiftDistanceX`
- `tvParallaxShiftDistanceY`
- `tvParallaxTiltAngle`
- `tvParallaxMagnification`

Note that `hasTVPreferredFocus` is still being used by Android TV, so it remains.

Changelog:
[Removed] Apple TV View Props

Reviewed By: TheSavior

Differential Revision: D18266278

fbshipit-source-id: 9d1448bf2f434a74e6eb23c70d3a37971e406768
2019-11-01 08:49:26 -07:00
Valentin Shergin 1a520e7b5a Fabric: Fixing a typo in RCTSurfacePresenterBridgeAdapter
Summary:
Shameful copy-pasta error.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18220281

fbshipit-source-id: 96a6babc2abb654b0fc8463d151307fe9ef97037
2019-10-31 21:41:11 -07:00
Samuel Susla a82ebeb6f3 Fabric: Use padding instead of size for SafeAreaView
Summary:
Use padding instead of setting size of SafeAreaView, this should make it more consistent with Paper component.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D18225793

fbshipit-source-id: 08dccbdae0e4f7a7847501a06e17d4c26473462a
2019-10-31 21:25:37 -07:00
Samuel Susla cd1abb3bca Fabric: Fix order of arguments in RCTEdgeInsetsFromUIEdgeInsets
Summary:
Order of arguments for `RectangleEdges` was incorrect

changelog: [internal]

Reviewed By: shergin

Differential Revision: D18231825

fbshipit-source-id: 188d7af405ce801437ff67999a8f7dae77ae03c0
2019-10-31 21:25:37 -07:00
Rick Hanlon 6b783b4fb0 LogBox - Don't show native redbox for JS errors
Summary:
This diff switches the exception manager over to the reportException native module function on iOS and adds a new field `extraData.showRedbox` as a temporary hack to control hiding/showing native redboxes for LogBox.

Once LogBox is rolled out we'll remove this field, so we're hacking it into the available unused and untyped extraData bag, which will simplify gutting it in the future.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18212047

fbshipit-source-id: f14e31d90359b7d455a73c2368ce010c28364a5c
2019-10-31 16:26:42 -07:00
Samuel Susla fbfce92e97 Use ReactTag to map events to component view
Summary:
Use `reactTag` instead of address of `UIView` to map events from paper components to Fabric.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D17954974

fbshipit-source-id: 0d8bf748e58f4cb6769e107bc7fd0e66b93d8f12
2019-10-31 14:42:47 -07:00
Samuel Susla 03fd80c937 Refactor RCTLegacyViewInteropComponentView
Summary:
Simplify logic in `RCTLegacyViewManagerInteropComponentView` by caching views that are mounted and unmounted and applying it in finalise.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D17954975

fbshipit-source-id: 11c8ec9e6eabb8a838a83f5fc2428912f4ec9523
2019-10-31 14:42:47 -07:00
Samuel Susla 19f58f4935 Add FBGroupsLandingView to LegacyViewManagerInterop whitelist
Summary:
Allow components outside of React-Native core to be registered with LegacyViewManagerInterop

changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D17912238

fbshipit-source-id: 67a9109c427c5e3efb8ebb6c6f8c13c2931461a3
2019-10-31 14:42:47 -07:00
Peter Argany 2a13f12106 Re-implement reload reason [7/n]
Summary:
This diff adds back RN reload reason, which was removed earlier in the stack. cc/Rick

For callsites which already had a reason, I kept the string exactly the same. For callsites which didn't have a reason, I made up something reasonable.

Changelog: [Internal][Fixed] Re-implemented bridge reload reason text.

Reviewed By: RSNara

Differential Revision: D18074478

fbshipit-source-id: 64a3cd7718674a7ba7228a80e34791ce9f153f9f
2019-10-30 12:23:25 -07:00
Peter Argany 5ca0df64a1 Deprecate RCTBridgeWillReloadNotification [3/n]
Summary:
`RCTBridgeWillReloadNotification` has one job: whenever bridge reloads - trigger a reload in `RCTSurfacePresenter`.

Diff 1/2 deprecated bridge reloading APIs, and replaced them with `RCTReloadCommand`. Use that in `RCTSurfacePresenter` instead .

Changelog: [iOS][Deprecate] Deprecate RCTBridgeWillReloadNotification

Reviewed By: shergin

Differential Revision: D17880926

fbshipit-source-id: 00adc4d56d11d40ab371d81bb17a05609c184769
2019-10-30 12:23:24 -07:00
Peter Argany d98cd7d3a1 Migrate bridge reload to RCTReloadCommand [2/n]
Summary:
Motivation described in diff 1/N.

This diff replaces calls to `[bridge reload]` with calls to `RCTReloadCommand`. This shouldn't have any change in behaviour since RCTBridge listens to RCTReloadCommand and calls `[bridge reload]` [here](https://fburl.com/diffusion/kemzkrei).

It will allow us to customize who listens and reacts to RN lifecycle.

Changelog: [Internal][Changed] - Migrated [bridge reload] calls to RCTReloadCommand

Reviewed By: shergin

Differential Revision: D17880909

fbshipit-source-id: 80b26c6badd4b216656fed6dd04554e9877f4bb7
2019-10-30 12:23:24 -07:00
Peter Argany ffe2306164 Deprecate bridge reload API [1/n]
Summary:
Testing the waters with an idea for unifying RN lifecycle with/without bridge.

### Motivation/Background

RN bridge is being reloaded from [several different places](https://fburl.com/codesearch/ae3zeatt). When this happens, the bridge does a bunch of things:
1. Post `RCTBridgeWillReloadNotification` (RCTSurfacePresenter listens to this and reloads)
2. Invalidate batched bridge, which does:
    a. invalidate display link
    b. post `RCTBridgeWillInvalidateModules/RCTBridgeDidInvalidateModules` (TurboModuleManager listens to this and reloads modules)
    c. clear js thread state
    d. clear some local caches
3. Set up (reload bundle and batched bridge)

In a bridgeless world, there isn't one thing which owns all these peices of infra, and can reload them.

### Plan

Use `RCTReloadCommand` to handle reloads. This light class previously only handled CMD+R. The new workflow looks like this:
1. Anything which cares about reloads can register itself as a listener. (RCTBridge, RCTSurfacePresenter, TurboModuleManager...)
2. Anything that previously called `bridge reload` now calls `RCTTriggerReloadCommandListeners`.
3. Delete old notifications

### Alternate Plan

Use yet another NSNotification. I like `RCTReloadCommand` better.

### Unknowns

Looks like we log the reason for bridge reloading [here](https://fburl.com/diffusion/lc9jj8la), do we want to save this behaviour? Does anyone look at why bridge is being reloaded cc/Rick? If so, I can add back that functionality to `RCTReloadCommand`.

It should be possible to customize the order/priority of what gets reloaded first. There may be some racy behaviour that I haven't thought about yet.

Changelog: [iOS][Deprecated] Deprecate [bridge reload] API - prefer RCTReloadCommand

Reviewed By: shergin

Differential Revision: D17869635

fbshipit-source-id: 81f39eaa2c3ce08ea1bc6f2193684c2630d81a2d
2019-10-30 12:23:24 -07:00
Andrew Monshizadeh 35b8b06db9 Fix unrecognized selector for iOS 9
Summary:
Refresh control is only available in iOS 10+

> https://developer.apple.com/documentation/uikit/uiscrollview/2127691-refreshcontrol?language=objc

changelog: Fix crash in RCTPullToRefreshViewComponentView on iOS 10

Reviewed By: sammy-SC

Differential Revision: D18201528

fbshipit-source-id: 0dd3dad7cabe08589a597039c1dae44da868e1e5
2019-10-30 11:23:58 -07:00
Adam Foxman fe9cba74fa Expose [RCTBundleURLProvider isPackagerRunning] publicly (#27012)
Summary:
The private API isPackagerRunning is useful. Rather than duplicating it, I am exposing it here so that I can make use of it in future PRs, and so others can do the same.

## Changelog

[iOS] [Changed] - Expose the isPackagerRunning methods on RCTBundleURLProvider
Pull Request resolved: https://github.com/facebook/react-native/pull/27012

Test Plan: This change doesn't impact any runtime code, though it does impact build. I used a vanilla test app (react-native init) and built it using xcode as well as react-native run-ios.

Differential Revision: D18174316

Pulled By: cpojer

fbshipit-source-id: 523d134882303f68a1f69521e31f29d7dbfb666c
2019-10-30 08:36:45 -07:00
Victor Fernandez 7468a6c903 Fix Share dialog not resolving promise when dismissed on iOS (#26842)
Summary:
On iOS the promised returned by `Share.share(content, options)` isn't resolved if the user dismisses the dialog by either pressing "Cancel" or pressing outside the shared dialog. This PR fixes this issue.

This fixes https://github.com/facebook/react-native/issues/26809.

## Changelog

[iOS] [Fixed] - Fix promised returned by `Share.share(content, options)` not resolving if share dialog dismissed
Pull Request resolved: https://github.com/facebook/react-native/pull/26842

Test Plan:
1. on iOS, open a share dialog with:

```typescript
const onShare = async () => {
  const result = await Share.share({ message: 'example message' });
}
```

2. Dismiss the opened share dialog and the returned promised should resolve.

Differential Revision: D18189755

Pulled By: cpojer

fbshipit-source-id: 1269932e9549026afefdaa8478ff7d33bbaeb86f
2019-10-28 16:24:16 -07:00
Dratwas 2f8328dbb0 Remove max depth parameter while measuring layout of shadow view (#26986)
Summary:
Searching for the ancestor view while measuring a shadow view layout relative to the ancestor is limited to `30`. I couldn't find the reason nor commit where it was introduced (because I have no access to internal facebook commits).
I think we should keep looking for an ancestor view until the shadow view has the superview property.

## Changelog

[iOS] [Fixed] - Remove maximum searching depth while measuring layout.
Pull Request resolved: https://github.com/facebook/react-native/pull/26986

Test Plan:
- Tested if RNTester works as expected.
- Tested in app with a lot of nested flatlists where sometimes I was facing this redbox because of the max depth limit.
<img width="297" alt="Screenshot 2019-10-24 at 14 40 11" src="https://user-images.githubusercontent.com/16336501/67486474-6309d380-f66c-11e9-9eab-15e8fb8372a5.png">

Differential Revision: D18175568

Pulled By: shergin

fbshipit-source-id: cd59a18032d10bc6dd5707981e69813810f65b5a
2019-10-28 13:17:09 -07:00
Samuel Susla 4c4948b6e8 Fix unrecognised selector crash on iOS 9
Summary:
Refresh control is only available in iOS 10+

> https://developer.apple.com/documentation/uikit/uiscrollview/2127691-refreshcontrol?language=objc

changelog: Fix crash in `RCTPullToRefreshViewComponentView` on iOS 10

Reviewed By: cpojer

Differential Revision: D18161020

fbshipit-source-id: c789433f132e68fc71c875e1da79bfe4fd799a44
2019-10-28 00:07:19 -07:00
Adam Ernst bdaab3c2e5 Run depslint on fb_plugin_apple_library rules
Summary: Changelog: [Internal]

Differential Revision: D18152380

fbshipit-source-id: f33f6cb2f6baeba0719a91c5189357be33a38f59
2019-10-26 13:47:15 -07:00
Valentin Shergin 34816f4d47 Fabric: Suspending all Fabric screens on bridge invalidation
Summary:
Previously, Fabric (RCTSurfacePresenter) was unaware of the bridge being valid or not. That caused the strange situations where the bridge might be already dead is still running.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18050888

fbshipit-source-id: 34e3ec4b6991034410a40c041cfdcca36be8d743
2019-10-24 17:45:41 -07:00
Valentin Shergin 7a20964e9d Introducing `RCTBridgeWillBeInvalidatedNotification`
Summary:
This diff introduces a new broadcasting event for Bridge that communicates that the bridge is being invalidated. This notification can be used by interested parties as a signal to start tearing down all bridge-dependant processes.

The biggest difference between the new event and `RCTBridgeWillInvalidateModulesNotification` is that the latter is being called asynchronously on the JavaScript thread, whereas the new one is being called on whatever thread caused the Bridge invalidation (deallocation) *synchronously*. In most cases that happens on the main thread that allows destroying strictly-main-threaded infra (mostly UI) synchronously and avoids races.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18050889

fbshipit-source-id: 9364c820ea2b0358edf45f0e2b3e16a13d730a9c
2019-10-24 17:45:40 -07:00
Valentin Shergin b3cb27ee9f Fabric: Removing sync block dispatching from `RCTRuntimeExecutorFromBridge`
Summary:
The purpose of RCTRuntimeExecutorFromBridge is to create/implement RuntimeExecutor using some JS queue implemented as part of the Bridge. This diff changes the implementation of this method, specifically:
Removing dispatching a sync block. This causes a deadlock with TM sometimes and should not be generally required.
The implementation does not retain the Bridge anymore.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D17960236

fbshipit-source-id: 0ddea561a6884f066e483d6b0f41ddd1621df73c
2019-10-24 17:45:40 -07:00
Valentin Shergin 32b30074d3 Fabric: Introducing RCTSurfacePresenterBridgeAdapter
Summary:
Yes, this is a pretty big diff; because of the high interconnectedness of the things, I failed to split it apart.

This change does:
Introduces a new class RCTSurfacePresenterBridgeAdapter which decouples all Bridge-related functionality from RCTSurfacePresenter.
The new class allows "replacing" one instance of the bridge with another for a single RCTSurfacePresenter.

This change allows implementing unloading a bridge (e.g. during memory pressure warning) and suspending all RN surfaces with the future possibility of reloading a bridge and resuming surfaces.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D17960239

fbshipit-source-id: 7ae556ed91030f4c5ab187689ce6bd161fabde93
2019-10-24 17:45:40 -07:00
Valentin Shergin 4bdb702b9e Fabric: Generalizing `suspense` and `resume` operations in `RCTSurfacePresenter`
Summary:
We need this for better decoupling RCTSurfacePresenter from Bridge.

Changelog: [Internal] - Changes in RCTSurfacePresenter (Fabric)

Reviewed By: sammy-SC

Differential Revision: D17960237

fbshipit-source-id: e91cd04eab967745c6e5151187eb68ba108f3986
2019-10-24 17:45:39 -07:00
Mehdi Mulani 03acf57b76 Fix use of safeAreaInsets for old versions of iOS
Summary:
This would cause a crash on iOS 9.3 because this method does not exist on UIView on that platform. By wrapping it in an availability check, we provide some safety.

Changelog: [iOS] [Fixed] safeAreaInsets call would crash on older versions of iOS

Reviewed By: fkgozali

Differential Revision: D18118025

fbshipit-source-id: fb7e517b3bcb3e0ba11ae81d8bf8397abc227e04
2019-10-24 10:35:10 -07:00
Kevin Gozali 285d4742a9 iOS: optimize RCTUserInterfaceStyleDidChangeNotification handling
Summary:
* Fabric surface hosting view should emit the same event as RCTRootView
* Before emitting to JS, make sure to check if the color scheme really changed to avoid unnecessary re-render in JS

Changelog: [Internal]

Reviewed By: mdvacca, mmmulani

Differential Revision: D18100700

fbshipit-source-id: 451199beac07cdfb3833131ee429cc151391d8dd
2019-10-23 19:04:36 -07:00
Kevin Gozali 25d94ff34d iOS Allow disabling color scheme preference
Summary:
Some apps may need to disable the automatic dark mode color scheme assignment. This provides such kill switch.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18088313

fbshipit-source-id: 75abf34e92f8a4a637daa26135adf85965cb9df5
2019-10-23 15:52:45 -07:00
Emily Janzer e7f6210d5d Don't attempt to connect to React devtools every 2s
Summary:
When testing out the NetworkOverlay, I noticed that we were creating a lot of WebSocket connections for localhost:8097. Rick found that this is because we're trying to connect to React devtools every 2 seconds: https://github.com/facebook/react/blob/master/packages/react-devtools-core/src/backend.js#L67 and it appears we create a new WebSocket every time.

Dan suggested that we use opening the dev menu as a trigger for attempting to connect to React devtools. This diff uses RCTNativeAppEventEmitter to emit an event from native when the dev menu/dialog is shown, and listening to that event in JS to attempt to connect to devtools.

I'm also making the change of passing in a websocket instead of just passing in the host + port; this way it will only attempt to connect once on each call to `connectToDevTools` (otherwise, we would attempt to reconnect every 2 seconds as soon as the dev menu is opened, and then the next time the menu is opened we'd so start that *again*, and so on - I could have it keep track of whether it's already connecting and avoid doing it again, but this is easier and should be sufficient, I think).

We should probably also update the suggested troubleshooting tips on the devtools page to reflect this change, so that people don't get confused.

Changelog: [General] [Fixed] Fix issue where we attempt to connect to React devtools every 2 seconds

Reviewed By: mmmulani

Differential Revision: D17919808

fbshipit-source-id: 4658d995c274574d22f2f54ea06d7f29ef2f54dc
2019-10-23 10:30:43 -07:00
Joe Loser ba18ee9b87 Replace folly::make_unique with std::make_unique (#26730)
Summary:
There is a mixed usage of `folly::make_unique` and `std::make_unique`. Soon, `folly::make_unique` may be removed (see [this PR](https://github.com/facebook/folly/pull/1150)). Since `react-native` only supports C++14-compilers and later, switch to always using `std::make_unique`.

## Changelog

[Internal] [Removed] - Replace folly::make_unique with std::make_unique
Pull Request resolved: https://github.com/facebook/react-native/pull/26730

Test Plan:
Running the existing test suite. No change in behavior is expected.

Joshua Gross: buck install -r fb4a, make sure MP Home and forced teardown works okay on android

Reviewed By: shergin

Differential Revision: D18062400

Pulled By: JoshuaGross

fbshipit-source-id: 978ca794c7e972db872a8dcc57c31bdec7451481
2019-10-22 12:21:41 -07:00
Moti Zilberman 468d1a2d2e Render collapsed frames in RedBox
Summary:
Renders frames in RedBox in a greyed-out style when their `collapse` field is set to `true`. This avoids outright hiding information in the stack trace while still drawing attention to frames that are likely to be more meaningful.

Changelog: [General] [Changed] - Render collapsed JavaScript frames in RedBox

Reviewed By: rickhanlonii

Differential Revision: D18039438

fbshipit-source-id: 527588f11c0bff495842be7036cd1293bab65eb9
2019-10-22 11:05:36 -07:00
Ramanpreet Nara d8fda74c24 Move RCTImage NativeModules back to RCTImage
Summary:
In D16805827, I moved `RCTImageLoader`, `RCTImageStoreManager`, and `RCTImageEditingManager` to `CoreModules`. This was necessary to turn `RCTImageLoader` into a TurboModule. However, after D17671288 landed, it's no longer necessary to have OSS NativeModules in `CoreModules`. Therefore, I'm moving these NativeModules back to `RCTImage`.

Changelog: [iOS][Fixed] Move RCTImage NativeModules back to RCTImage

Reviewed By: shergin

Differential Revision: D17921612

fbshipit-source-id: 8ae36d2dc8deaf704313cbe2479bfa011ebcbfbc
2019-10-21 17:15:32 -07:00
Ramanpreet Nara 2b5f4de7eb Make RCTTiming TurboModule-compatible
Summary: Changelog: [iOS][Added] Make RCTTiming TurboModule-compatible

Reviewed By: PeteTheHeat

Differential Revision: D17891665

fbshipit-source-id: e0d36ccfb4f3f1d428668836a8b66698d51bdeaf
2019-10-16 19:00:26 -07:00
Emily Janzer f2f4d33a3a Remove unsupported flow types from OSS native module specs
Summary:
Some of our NativeModule type specs aren't compatible with our Android codegen and type safety checks - specifically, we don't support `$ReadOnly` in our type checks, and we don't support map types in the codegen. Removing these from a couple of the OSS type specs so we can enable codegen for these modules (eventually).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D17882093

fbshipit-source-id: 6e8669e4be775347199b2b5346bd8d40d7620886
2019-10-16 11:14:04 -07:00
Andres Suarez aee88b6843 Tidy up license headers [3/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952693

fbshipit-source-id: 8fcb8e58a2e04e7a3169f4d525bffc00835768e6
2019-10-16 10:06:34 -07:00