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

18783 Коммитов

Автор SHA1 Сообщение Дата
Eli White e483bd4d49 Add Jest snapshot tests to TextInput
Summary:
$title

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D18536359

fbshipit-source-id: 382c81c094c0ae28ec3e203cb0726bdbccf755dc
2019-11-20 18:09:30 -08:00
Eli White 20a3bb52ce Convert component snapshot tests to a reusable helper
Summary:
These tests need to be consistent with every test so a helper makes more sense.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18500439

fbshipit-source-id: de535156d370102bad88e556ad3d2a0d5443e4e2
2019-11-20 18:09:30 -08:00
Eli White 9b53f52236 Revert D18577288: Don't allow pressing on un-symbolicated stackframes
Differential Revision:
D18577288

Original commit changeset: 6de322b47558

fbshipit-source-id: 095766e07a43008abf5fc6adb0f46bb08fc420a0
2019-11-20 15:51:06 -08:00
Andrey Lunyov d904dc1e95 Update eslint-plugin-relay to 1.4.1
Summary: Changelog: [Internal]

Reviewed By: kassens

Differential Revision: D18602667

fbshipit-source-id: 881a0aa23f10b69a12a6105d6259df79941883a2
2019-11-20 12:56:49 -08:00
Chad Smith ddff713247 upgrade detox to 14.5.1
Summary:
This version of Detox has a fix that is required to be compatible with the current React Native API.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D18495247

fbshipit-source-id: b329975b33835e12b7f5b5d1f1aa3eb4a82c1950
2019-11-20 12:01:19 -08:00
Christoph Nakazawa 1e0e9582ab Improve rendering perf of LogBoxInspectorStackFrame
Summary:
LogBox tends to take a bit of time to open after tapping a log banner. This is very noticeable on Android where it takes multiple seconds.

When looking at React DevTools, the Stack Frame code can be responsible for two thirds of total LogBox rendering time. With this diff, the time is reduced from about 46ms to 25ms, and the total time spent rendering LogBox is reduced by one third.

This diff makes a few micro-optimizations but primarily it gets rid of an unnecessary View and collapses multiple text components into a single one as they are all rendered the same. Note that this also fixes an issue in the case where a line number may be missing but a column was provided. While I can't think of a case where that would actually happen, previously it would print the column (which could be mistaken for the lineNumber in that case) but now it prints the column only if the line Number is also present.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D18613899

fbshipit-source-id: 5c6a3b65b749d5f95058b34ded6cc12531d91c38
2019-11-20 11:24:15 -08:00
Ramanpreet Nara 294e31b7c2 Make RCTDevLoadingView TurboModule-compatible
Summary:
RCTDevLoadingView wasn't hooked up to the codegen. This diff makes RCTDevLoadingView type-safe and also makes it TurboModule-compatible.

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

Reviewed By: PeteTheHeat

Differential Revision: D16969764

fbshipit-source-id: 47e6682eea3fc49d3f0448c636b5f616d5bce220
2019-11-20 11:20:12 -08:00
Rick Hanlon 55cb6ab07c Don't allow pressing on un-symbolicated stackframes
Summary:
This diff makes a few improvements to the call stack / symbolication process:

- Removes button from unsymbolicated stack frames
- Adds a warning message for missing features without symbolication
- Reduces symbolication requests (we were re-requesting stacks when they were pending)
- Speeds up opening unsymbolicated logs (because we were re-requesting them, the components were updating a lot)

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D18577288

fbshipit-source-id: 6de322b4755895e2d1599b06100a61e64f7ec023
2019-11-20 11:05:20 -08:00
Rick Hanlon bdd1a675ba Dismiss all logs on fast refresh
Summary:
Based on feedback we're going to clear all logs on fast refresh 👍

Changelog: [Internal]

Reviewed By: gaearon

Differential Revision: D18614230

fbshipit-source-id: 119a09e8ffea9d86137583d8da435338833f910c
2019-11-20 08:50:49 -08:00
Valentin Shergin 8dea0acc23 Fabric: Using LOG(ERROR) instead of LOG(Fatal) in Scheduler
Summary:
FATAL crashes the app, which was never the intent of that log message.
We need to use ERROR instead.

Changelog: [INTERNAL]

Reviewed By: fkgozali, zackargyle, mdvacca

Differential Revision: D18597249

fbshipit-source-id: 523c96550f97e837e1957c933786acf28033e60a
2019-11-19 17:01:55 -08:00
Stepan Furdei 25a21b8e49 Don't crash when pretty-format is not available
Summary:
pretty-format library is not available on some JSC which causes the app to crash while trying to log a warning. This change defaults to just stringify the error if formatter is not available. The behavior on platforms where it already works fine isn't changed.

Changelog: Don't crash the app while formatting a warning for console if pretty-format is not available.

Reviewed By: PeteTheHeat

Differential Revision: D18403456

fbshipit-source-id: 73226f1a4e3f38c8d7c4e5ace909dd494e1da298
2019-11-19 16:22:29 -08:00
Jordan Brown 48cb80892d Manually fix places the codemod doesnt hit
Summary:
Generating this diff was difficult. We _will_ fix the issues with jscodeshift, but i don't want to block the syntax change on that.

To get this diff, I first codemodded all of xplat to use exact-by-default. Then i turned on implicit-inexact-object:error enforcement to get a list of errors showing places that violated the lint. With that, I used this to generate a list of `sed` commands to add `...`:

```
flow --json | jq '.errors | .[] | .message | .[] | .loc | {source, "line": .end."line", "column": .end."column"} | "\(.column),\(.line),\(.source)"' | sort -n -r | sed 's/"//g' | while read -r line; do echo $line; awk -F',' "{ print \"sed -i '\"\$2\"s/./...&/\"\$1\"' \" \$3 }"; done
```

Then I ran prettier, reverted generated files, and manually fixed up suppressions that got messed up.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D18516431

fbshipit-source-id: 6cf940dce411fb179e7ebaff764bd5113a07989f
2019-11-19 13:38:18 -08:00
Ramanpreet Nara 8ac9b32779 Remove __unused annotation from ConcreteSystraceSection ctor args
Summary:
The constructor arguments to `ConcreteSystraceSection` are actually used. It seems like they were accidentally marked unused in D14181748.

Changelog:
[iOS][Fixed] - Remove __unused annotation from ConcreteSystraceSection ctor args.

Reviewed By: PeteTheHeat

Differential Revision: D18574190

fbshipit-source-id: 38d58da794341d4ecc52f3bc16e05ef2757cca1d
2019-11-19 10:51:59 -08:00
Samuel Susla 1926feea2b Fix missing nullability in PickerManager.setNativeSelectedIndex
Summary:
Changelog: [Internal]

To ensure compatibility with Android, nullability needs to be specified.

Reviewed By: shergin

Differential Revision: D18590634

fbshipit-source-id: 9cd969f4f187e8f1d004f03692dd9b29c4f37f95
2019-11-19 10:22:24 -08:00
Samuel Susla 2d80a248cd Migrate RefreshControl to Native Commands
Summary:
Changelog: [Internal]

Introduce native command `setNativeRefreshing`, it has the word Native in order to avoid name conflict with setRefreshing in Android implementation. Even this component is iOS only, it would make it easier to merge them in the future.

Introduce `RCTRefreshableProtocol` and make `RCTRefreshControl` and `RCTPullToRefreshViewComponentView` to conform to the protocol so view manager can forward command to both, Paper and Fabric component.

Reviewed By: mmmulani

Differential Revision: D18475804

fbshipit-source-id: 4c19225784efc931b7b8f2d2671cc839bce429bf
2019-11-19 10:06:56 -08:00
Valentin Shergin 83f0210cee Fabric: Attempt to fix a crash in RCTMountingTransactionObserverCoordinator
Summary:
We see a quite small but probably dangerous crash in RCTMountingTransactionObserverCoordinator, it's unclear why exactly it happens but seems it's somehow connected with a shape of RCTComponentViewDescriptor struct.
Specifying storage attribute (`__strong`) correctly/explicitly might fix the issue.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18567763

fbshipit-source-id: 57d9f96c4609a38ddf44ce02df53f2d713dfb116
2019-11-19 09:50:52 -08:00
Rick Hanlon 6db52c5fe0 LogBox - Add app version and move meta info
Summary:
This diff adds a new API `setAppInfo` to add app version and engine to LogBox and changes the way they're displayed so that they're more subtle and visible for screenshots.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18592992

fbshipit-source-id: 1c57b21fa9dca93029ffc92acf1287f3ee247f4d
2019-11-19 09:36:28 -08:00
Dan Abramov 1edce56a9d React Native sync for revisions 4eeee35...6cff70a
Summary:
Changelog: [General][Changed] - React sync for revisions 0b61e2698...6cff70a74 (Includes React 16.11.0)

This sync includes the following changes:
- **[6cff70a74](https://github.com/facebook/react/commit/6cff70a74 )**: [react-interactions]
Expost host instance to Scope Query function (#17341) //<Dominic Gannaway>//
- **[b8f825877](https://github.com/facebook/react/commit/b8f825877 )**: Split ReactDOM entry
point (#17331) //<Dan Abramov>//
- **[a7b4d51a2](https://github.com/facebook/react/commit/a7b4d51a2 )**: Warn when doing creat
eRoot twice on the same node (another approach) (#17329) //<Dan Abramov>//
- **[be3bfa6fa](https://github.com/facebook/react/commit/be3bfa6fa )**: [Flight] Basic Integr
ation Test (#17307) //<Dan Abramov>//
- **[6cb6b1d66](https://github.com/facebook/react/commit/6cb6b1d66 )**: Add yarn build --unsa
fe-partial (#17316) //<Dan Abramov>//
- **[38dd17ab9](https://github.com/facebook/react/commit/38dd17ab9 )**: [RN] Hoist static dee
pDiffer options object (#17303) //<Moti Zilberman>//
- **[61d3dd0e0](https://github.com/facebook/react/commit/61d3dd0e0 )**: Update deepDiffer usa
ge in React Native renderer (#17282) //<Moti Zilberman>//
- **[e701632ad](https://github.com/facebook/react/commit/e701632ad )**: [react-interactions] Change unmount blur logic to a dedicated event (#17291) //<Dominic Gannaway>//
- **[ce4b3e998](https://github.com/facebook/react/commit/ce4b3e998 )**: [react-interactions] Add optional searchNodes to Scope.queryAllNodes (#17293) //<Dominic Gannaway>//
- **[dee03049f](https://github.com/facebook/react/commit/dee03049f )**: [Flight] Basic Streaming Suspense Support (#17285) //<Sebastian Markbåge>//
- **[f50f39b55](https://github.com/facebook/react/commit/f50f39b55 )**: [Flight] Better compat with http.createServer (#17289) //<Dan Abramov>//
- **[345270630](https://github.com/facebook/react/commit/345270630 )**: DevTools cleanup (#17283) //<Brian Vaughn>//
- **[cd1bdcd06](https://github.com/facebook/react/commit/cd1bdcd06 )**: [react-interactions] Prevent duplicate onPress firing for keyboard Enter (#17266) //<Dominic Gannaway>//
- **[4f02c93c7](https://github.com/facebook/react/commit/4f02c93c7 )**: Fix devtools displaying Anonymous for memo of ref-forwarding components (#17274) //<Waseem Dahman>//
- **[053cf0fed](https://github.com/facebook/react/commit/053cf0fed )**: Fix react-is memo and lazy type checks (#17278) //<Brian Vaughn>//
- **[0f3838a01](https://github.com/facebook/react/commit/0f3838a01 )**: Remove `debugRenderPhaseSideEffects` flag (#17270) //<Andrew Clark>//
- **[cb09dbe0a](https://github.com/facebook/react/commit/cb09dbe0a )**: [react-interactions] Add handleSimulateChildBlur upon DOM node removal (#17225) //<Dominic Gannaway>//
- **[6095993d4](https://github.com/facebook/react/commit/6095993d4 )**: Types: findHostInstance_DEPRECATED returns React.ElementRef<HostComponent<mixed>> (#17265) //<Eli White>//
- **[62ef25077](https://github.com/facebook/react/commit/62ef25077 )**: Avoid bundling in ponyfill for Object.assign in use-subscription package (#17259) //<Mateusz Burzyński>//
- **[f4148b256](https://github.com/facebook/react/commit/f4148b256 )**: [Flight] Move around the Server side a bit (#17251) //<Sebastian Markbåge>//
- **[fadc97167](https://github.com/facebook/react/commit/fadc97167 )**: [Flight] Add Client Infrastructure (#17234) //<Sebastian Markbåge>//
- **[36fd29f09](https://github.com/facebook/react/commit/36fd29f09 )**: Don't show empty (no work) commits in Profiler (#17253) //<Brian Vaughn>//
- **[a2e05b6c1](https://github.com/facebook/react/commit/a2e05b6c1 )**: [Scheduler] Delete old rAF implementation (#17252) //<Andrew Clark>//
- **[6dc2734b4](https://github.com/facebook/react/commit/6dc2734b4 )**: Codemod tests to `it.experimental` (#17243) //<Andrew Clark>//
- **[273679a78](https://github.com/facebook/react/commit/273679a78 )**: DevTools standalone shell changes: (#17213) //<Brian Vaughn>//
- **[d0fc0ba0a](https://github.com/facebook/react/commit/d0fc0ba0a )**: Revert "Dispatch commands to both UIManagers from both renderers (#17211)" (#17232) //<Eli White>//
- **[bdcdb69a2](https://github.com/facebook/react/commit/bdcdb69a2 )**: Rename findHostInstance_deprecated to findHostInstance_DEPRECATED (#17228) //<Eli White>//
- **[515746c21](https://github.com/facebook/react/commit/515746c21 )**: Add findHostInstance_deprecated to the React Native Renderer (#17224) //<Eli White>//
- **[9a35adc96](https://github.com/facebook/react/commit/9a35adc96 )**: Only call Profiler onRender when a descendant had work (#17223) //<Brian Vaughn>//
- **[8eee0eb01](https://github.com/facebook/react/commit/8eee0eb01 )**: Dispatch commands to both UIManagers from both renderers (#17211) //<Eli White>//
- **[f4e974d26](https://github.com/facebook/react/commit/f4e974d26 )**: Add Experimental Flight Infrastructure (#16398) //<Sebastian Markbåge>//
- **[6cd365cac](https://github.com/facebook/react/commit/6cd365cac )**: Don't treat the last row in hidden as deleted if already mounted (#17206) //<Sebastian Markbåge>//
- **[048879eda](https://github.com/facebook/react/commit/048879eda )**: [react-interactions] Ensure props on scope query function is always object (#17212) //<Dominic Gannaway>//
- **[3497ccc14](https://github.com/facebook/react/commit/3497ccc14 )**: Add guard to handle modified React elements with non-string keys (#17164) //<Brian Vaughn>//
- **[3f9c03675](https://github.com/facebook/react/commit/3f9c03675 )**: Typo fix in comment (#17111) //<Deniz Susman>//
- **[f6b8d31a7](https://github.com/facebook/react/commit/f6b8d31a7 )**: Rename createSyncRoot to createBlockingRoot (#17165) //<Dan Abramov>//
- **[9c02d2654](https://github.com/facebook/react/commit/9c02d2654 )**: docs: Fixed a typo in readme.md (#17119) //<Wilco Fiers>//
- **[8075c8505](https://github.com/facebook/react/commit/8075c8505 )**: Update local package versions for 16.10 release //<Andrew Clark>//
- **[5faf377df](https://github.com/facebook/react/commit/5faf377df )**: Fixed a style bug in props editor (#17162) //<Brian Vaughn>//
- **[f7ec65eeb](https://github.com/facebook/react/commit/f7ec65eeb )**: [react-interactions] Make events non-passive to allow preventDefault (#17136) //<Dominic Gannaway>//
- **[1022ee0ec](https://github.com/facebook/react/commit/1022ee0ec )**: Read current time without marking event start time (#17160) //<Andrew Clark>//
- **[349cf5acc](https://github.com/facebook/react/commit/349cf5acc )**: Experimental test helper: `it.experimental` (#17149) //<Andrew Clark>//
- **[edc234c73](https://github.com/facebook/react/commit/edc234c73 )**: Build script should default to experimental (#17144) //<Andrew Clark>//
- **[3cc564547](https://github.com/facebook/react/commit/3cc564547 )**: SuspenseList support in DevTools (#17145) //<Sebastian Markbåge>//
- **[68fb58029](https://github.com/facebook/react/commit/68fb58029 )**: Remove unstable_ prefix in various internal uses (#17146) //<Sebastian Markbåge>//
- **[7082d5a2d](https://github.com/facebook/react/commit/7082d5a2d )**: Don't build non-experimental www bundles (#17139) //<Andrew Clark>//
- **[c47f59331](https://github.com/facebook/react/commit/c47f59331 )**: Move SuspenseList to experimental package (#17130) //<Andrew Clark>//
- **[685ed561f](https://github.com/facebook/react/commit/685ed561f )**: Migrate useDeferredValue and useTransition (#17058) //<Luna Ruan>//
- **[0b61e2698](https://github.com/facebook/react/commit/0b61e2698 )**: Update RN typings for a shim (#17138) //<Dan Abramov>//

Reviewed By: threepointone

Differential Revision: D18428149

fbshipit-source-id: 28273be4d7a4c7ec0fe0451cea134ee09a3b4d86
2019-11-19 08:52:37 -08:00
Samuel Susla 5a9b7d7adc Make views tappable with screen reader
Summary:
Changelog: [Internal]

In paper implementation:
`accessibilityActivate` returns NO in case `onAccessibilityTap` is nil.

In Fabric we have no option to detect whether `onAccessibilityTap` is nil or isn't but we don't want to prevent VoiceOver from tapping an element. This could potentially trigger action associated with element twice.

Let's say you have `onPress` and `onAccessibilityTap`, it will trigger both if you trigger action through VoiceOver.

Reviewed By: shergin

Differential Revision: D18572432

fbshipit-source-id: c5ac002317c798a10045b6f05738299d0ae27456
2019-11-19 07:54:16 -08:00
Valentin Shergin 3f7e0a2c96 Removing <TextInput>'s `onTextInput` event
Summary:
This is the first diff in the series. It removes Flow types for this feature to verify that we actually do not have any usages. After it lands, we will remove actual support on the native side.

There are several reasons why removing it is a good idea:
* There is no any evidence that this feature is actually useful. That was discussed several times (e.g. see T7936714) during RN lifetime and the overall consensus is: We need something else, something like sync `onChange` event instead of it.
* Supporting the previous point, it's not used (at least inside Facebook). I searched hard and I could find only one place where it's used: in the TextInput Example.
* To deliver more functionality we should lean towards W3C specs, this one is not W3C compliant.
* Supporting this Feature in Fabric is quite challenging, so I want to do it sooner than later.
* This feature was never documented.

Changelog: [Breaking] `<TextInput>::onTextInput` event was removed

Reviewed By: TheSavior

Differential Revision: D18456175

fbshipit-source-id: c7a8ed7a86b33ecc01d45497645fe249556fdf96
2019-11-18 20:53:35 -08:00
Riley Dulin 9f0b80b1cf Fix licenses in the inspector
Summary:
Lint all files in the inspector and apply auto-fixes for licenses.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D18210914

fbshipit-source-id: 91c45d4b02a04e99dd32cf0be8771e327fe03660
2019-11-18 19:34:24 -08:00
Emily Janzer e22a27fb9b Use JS view configs for Image
Summary:
There was already a ImageViewNativeComponent used on Android, so I changed `Image.ios.js` to use it as well, and then switched that component to use `codegenNativeComponent` instead of `requireNativeComponent` so that it gets the view config from JS instead of the UIManager.

I'm gating this change behind `RN$Bridgeless` so this only affects bridgeless mode.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18575533

fbshipit-source-id: aa71beb6be65dbb48ad2e1ca748f2cccd72a0e73
2019-11-18 18:37:37 -08:00
Valentin Shergin e6d566fcb9 Fabric: More asserts in RCTMountingTransactionObserverCoordinator
Summary:
Just asserts to be sure that we don't over-insert or over-erase to/from the collection.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18567732

fbshipit-source-id: 569dbce6e62380ae3a0716448ad10bf418aa4f9c
2019-11-18 18:25:01 -08:00
Valentin Shergin e4a23f72d5 Fabric: Removing some code leftovers from RCTComponentViewRegistry
Summary:
The removed code is fragments of one of failed approches to implement the functionality of RCTMountingTransactionObserverCoordinator.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18567733

fbshipit-source-id: cd7d6abc91394a2755866c35ff43d2c4f0271470
2019-11-18 18:25:01 -08:00
Valentin Shergin ccc05cd054 Fabric: Fixed onLoadEnd event in RCTImageComponentView
Summary:
`onLoadEnd` event should be called when load either succeeds or fails.
Before the fix, we didn't call it on error case.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18566996

fbshipit-source-id: 92727e91be167eb1e8eec4a40e90097972097c05
2019-11-18 18:25:00 -08:00
Emily Janzer 719d52fb6b Remove unused import from ScrollViewViewConfig
Summary:
As titled

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D18575837

fbshipit-source-id: 02e0b126bb783119f78e1eca82ee9fe9980529bc
2019-11-18 18:08:11 -08:00
Peter Argany f38a225e34 Fix Reload stats
Summary: Changelog: [iOS][Internal] Add bundleURL to RCTReloadCommand

Reviewed By: rickhanlonii

Differential Revision: D18576008

fbshipit-source-id: 2b6ef7377d299f3b2daf9adf4b93cd4506a3e080
2019-11-18 16:17:09 -08:00
Mehdi Mulani 3ceb95954a Enable dev loading view in build-on-device
Summary: Changelog: [iOS] [Changed] - Added another build flag for DevLoadingView

Reviewed By: JoshuaGross

Differential Revision: D18579773

fbshipit-source-id: e53733ac96ddcdb45e3d4ef23612f87ecb6dccd3
2019-11-18 15:24:32 -08:00
Valentin Shergin f32aa2a516 Fabric: Moving `MeasureCache` into `TextLayoutManager`
Summary:
We will have several consumers for the measure infra soon (TextInput will use the same TextLayoutManager). It makes sense to move the cache there.
In the future, iOS and Android implementations will probably use a bit different (platform-specific) cache implementations because we will implement the ability to measure "opaque"/platform-specific text containers alongside with normal AttributeStrings.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D18445855

fbshipit-source-id: 7b7a65152ac13c74525da695612ae034904e82bf
2019-11-18 14:28:44 -08:00
Valentin Shergin 5f0435fb85 Fabric: Support for interleaving/followup transactions in RCTMountingManager (iOS)
Summary:
Imagine a case where we initiate a synchronous state update right in the middle of the mount transaction. With the current implementation, the mount transaction caused by the change will be mounted right inside the in-flight transaction, which will probably cause a crash or incorrect mounting side-effects (which will cause a crash later).
Instead of executing all mounting instructions cased by the state change, we actually need to execute them right after the end of the current transaction (synchronously, inside the same main run loop tick).
This diff implements exactly this.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D18444730

fbshipit-source-id: 3e777a7aa70ff28205d40588970c7478869b6899
2019-11-18 14:28:44 -08:00
Valentin Shergin 9349ee26e7 Fabric: Clarifying life-time concerns of `ShadowTree::delegate_`
Summary:
This diff makes it clear from the code that ShadowTree delegate must be around for the whole life-time of a ShadowTree instance and there is no way to revoke/reset the delegate. This makes reasoning about the lifetime much simpler.

We didn't call `setDelegate(nullptr)` before, so nothing really changes here.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D18542502

fbshipit-source-id: f57ee21e0bb533fb82cb6f8ba7723e40ffb25a38
2019-11-18 14:28:43 -08:00
Rick Hanlon b346970016 LogBox - Minor error message formatting fixes
Summary:
Adds better handling of component stacks for warnings and clarifies why we ignore `(ADVICE)` warnings.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D18575693

fbshipit-source-id: f4eacbf74c62cd079f2c441951849fb03e0941dd
2019-11-18 13:47:42 -08:00
Emily Janzer 641e9657dd Make ImageLoaderModule TurboModule-compatible
Summary:
Modifying ImageLoaderModule to be TM-compatible by extending the generated abstract class and fixing the conflicting method signatures (int -> double).

Changelog: [Android] [Changed] Changing method signatures for ImageLoaderModule to accept double for requestId

Reviewed By: mdvacca

Differential Revision: D18435628

fbshipit-source-id: bc2a82bda49e339d1feebfe917b0862a1af15a1f
2019-11-18 12:40:31 -08:00
Ramanpreet Nara 8797a5cfcb Stop using RCTConvert to convert between primitive types
Summary:
RCTTiming was the only NativeModule that relied on converting `double`s to other `double`s via `RCTConvert`. RCTTiming was made into a regular NativeModule in D18410788, so it's safe to strip out this logic.

Hopefully, this reduces the memory consumption enough to reduce the OOMs reported in T45151932.

Changelog:
[iOS][Removed] - Stop using RCTConvert to convert between primitive types

Reviewed By: fkgozali

Differential Revision: D18506069

fbshipit-source-id: 7316ad86bc84d47fb383735126d5b00e5491b371
2019-11-18 10:58:50 -08:00
Moti Zilberman ca3c8b7a7d Treat NSNull like nil in RCTBridgingToOptional{Bool,Double}
Summary:
Currently `RCTBridgingToOptionalBool` and `RCTBridgingToOptionalDouble` will crash if passed an `NSNull` value. This diff changes these functions to instead treat it as equivalent to a missing value.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D18532044

fbshipit-source-id: fa822dcacb49697dd8a4f7b579bcfc029e0cdf41
2019-11-18 07:04:46 -08:00
Samuel Susla d1f0826f2c Lay groundwork for Fabric iOS plugins
Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D18397243

fbshipit-source-id: bae51800e93259e50db51dac2d9d7b4b52d8ef23
2019-11-18 06:59:24 -08:00
Moti Zilberman 75a154b449 Use timer type as Systrace identifier
Summary:
Removes the use of `parseErrorStack` in `_allocateCallback`, which was used to determine which timer API was allocating the callback (for Systrace purposes). Instead, we now use the already-existing `type` argument, which achieves the exact same thing but is much faster than parsing the stack trace.

Changelog: [General] [Fixed] - Reduce overhead of setting up timers in DEV

Reviewed By: yinghuitan

Differential Revision: D18233182

fbshipit-source-id: 190c0ffad8734cd889b790248e5a77cfb147454b
2019-11-18 05:16:49 -08:00
Valentin Shergin db4a7ae9b8 Fabric: Attempt to recover from invariant violation in ~Sheduler
Summary:
We see crashes that happen in the destructor of `EventEmitterWrapper` class which indicates that `EventEmitter`s were not "disabled" before `Runtime` was deallocated. Assuming that `Scheduler` *was* deallocated before the `Runtime` (there is no proof for that), we can suppose that `stopSurface` was not called properly on time. Again, assuming that the moment of Scheduler deallocation is fine, we can try to recover from this situation by forced unmounting of all outstanding `ShadowTree` (that will make future destroying of EventEmitter don't crash).

Why do we believe that `Scheduler` *was* deallocated before `Runtime`?
We are not sure but that's possibly a case or that might be true for some portion of cases.
At least, we will know for sure what exactly went wrong. There is a possibility that all crashes that would happen after will happen exactly here.
And, frankly, from the probability standpoint, earlier we destroy JSI objects, lower chances are that it will be after the death of Runtime.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18465408

fbshipit-source-id: 76338ed6fce0621cf11ce3178b4d1be7e0c73ccf
2019-11-17 13:54:33 -08:00
Valentin Shergin 59e8bd9560 Fabric: ScrollViewComponentView: Calling `onScrollEndDrag` in `scrollViewDidEndDragging:`
Summary:
* Previously we called `onScrollEndDrag` in `scrollViewWillEndDragging` which was not correct.
* Now we also call `_updateStateWithContentOffset` in the method to update the stored in state `contentOffset`. This fixes all `measure*` infra.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18563050

fbshipit-source-id: ade696eda579642c22927c8a56ff122cd61a7534
2019-11-17 10:45:27 -08:00
Kevin Gozali bae5aea074 iOS: Pass image react tag to the image loader for attribution purpose
Summary:
Changelog: [Internal]

For image loading, the loader may need to inspect the imageView itself, so let's pass its reactTag. This only works pre-Fabric.

Reviewed By: sammy-SC

Differential Revision: D18522073

fbshipit-source-id: 400fc7e04b8d7852f6ecef941dd446fbff423c88
2019-11-16 00:13:48 -08:00
Kevin Gozali 446705df33 iOS: attach rootTag to the native component instance for easy access
Summary:
Changelog: [Internal]

The main use-case here is to get the rootTag off RCTImageView, for image loading instrumentation. The fact is, each RCTView subclass already has `reactTag` attached today. We already have the `rootTag` when the view is created by the UIManager, so why not just attach it like reactTag? If we don't, looking up the rootTag from the native component is non-trivial and extremely inefficient (have to jump to shadow queue, back to main queue, etc).

Reviewed By: sammy-SC

Differential Revision: D18497002

fbshipit-source-id: 8409e3a1c95e09accedd959592cbf178fab0b2c3
2019-11-16 00:13:48 -08:00
Kevin Gozali 13a9a03203 Fabric iOS: pass in surfaceId when requesting to download image
Summary:
Changelog: [Internal]

For attribution purpose, pass in the surfaceId and let the app-specific image loader handle it.

Reviewed By: shergin

Differential Revision: D18494106

fbshipit-source-id: e22ca339a2dd12c5bd619b596c7db9c49dc111d0
2019-11-16 00:13:48 -08:00
Kevin Gozali fdcdca4cfa iOS: Introduced RCTImageURLLoaderWithAttribution
Summary:
Changelog: [iOS] [Changed] - New internal image attribution support, but files importing RCTImageLoader.h must be converted to ObjC++

This new interface is the same as RCTImageURLLoader, but with additional support to pass in optional attribution information. The attribution info is not strictly defined (we may do so in the future though), and it's up to the hosting application and RCTImageURLLoader classes to handle it.

Reviewed By: sammy-SC

Differential Revision: D18492882

fbshipit-source-id: c3870c60e6c2e7c65758fc3235ebf5db369e07dc
2019-11-16 00:13:47 -08:00
Valentin Shergin 806a2b8103 Fabric: `ShadowTreeDelegate::shadowTreeDidCommit` was renamed to `shadowTreeDidFinishTransaction`
Summary:
Simple renaming. Now the name is aligned with `SchedulerDelegate::schedulerDidFinishTransaction` and actually expresses the idea that not only commit finished but also a transaction was prepared and layout events were sent.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D18542503

fbshipit-source-id: 54d429ed139383621fe926fa48a4de062f724176
2019-11-15 21:49:44 -08:00
Valentin Shergin 3426f1f537 Fabric: YogaLayoutableShadowNode::isLeaf_ and using that in ParagraphShadowNode
Summary:
As soon as we have traits infra, it's pretty straight-forward to implement this kinda flag. Without the traits, it's challenging to build that in a performant and elegant way. The challenges of the dynamic_cast-involved approach are:
 * How to check for that feature in YogaLayoutableShadowNode?
 * Even if we use `dynamic_cast`, to which class to cast?
 * We also need to do that in constructor... and dynamic_cast-like checks for `this` don't work in constructors (C++ design limitation).
 * How to scale that if we have more classes like Paragraph (and we will have it for sure)?
 * Performance.
 * Relying on RTTI.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18525347

fbshipit-source-id: b1915f43ff3fe4364ab6345fb9d1becc591b5a35
2019-11-15 19:51:22 -08:00
Valentin Shergin 059142935a Fabric: Introducing ShadowNodeTraits
Summary:
Quite often in the Fabric codebase, we need to iterate on a list of shadow nodes and perform some work depending on the exact type (or kind) of shadow node we have. Today, we exclusively use RTTI to test for exact type. The problem here is that RTTI is not only expensive in terms of code size (we are moving towards removing RTTI), it's expensive in terms of CPU cycles. (Don't mistake RTTI/dynamic_cast overhead with dynamic dispatch overhead!)

`dynamic_cast` has it's own advantages, of cource: it's simple and straight-forward and does not require additional configuration. On the other side, it requires knowledge about exact class relationship configuration and knowing the exact name of the class.

ShadowNodeTraits is the generalized solution for storing predefined traits right inside ShadowNode object and check/set/unset them efficiently and in a particular-class-independent manner.

This diff only implements it in general and switching storing an internal flag of ShadowNode inside the trait collection to save some space (and for illustration purposes as well).

In the coming diff, we will see how this approach allows tackling the real, non-trivial problem.

In addition to the concept, this diff implements some convenience infra, such as `ConcreteShadowNode::BaseTraits()` static method that allows designating intrinsic-to-a-class traits declaratively.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D18525348

fbshipit-source-id: 083bb85e0a9dc9d6c69bf395bd338d3c18def688
2019-11-15 19:51:21 -08:00
Ramanpreet Nara 29b99720b2 Make TurboModuleRegistry in CatalystInstanceImpl.java volatile
Summary:
We read from / write to `CatalystInstanceImpl.mTurboModuleRegistry` from multiple threads. To ensure that we directly read/write from memory, and not a stale cache, we should make this variable `volatile`.

Changelog:
[Android][Fixed] Make TurboModuleRegistry in CatalystInstanceImpl.java volatile

Reviewed By: fkgozali

Differential Revision: D18542954

fbshipit-source-id: 0a47f05e0653b4f7f58503c678bdf31c68eab9bf
2019-11-15 17:31:31 -08:00
David Vacca 8accd77c45 Deprecate CallerContext from ReactImageManager
Summary:
This diff deprecates the constructors and getter method exposing CallerContext in ReactImageManager.
This will be replaced by the ReactCallerContextFactory class

Changelog: Deprecation of constructors and methods that expose CallerContext in ReactImageManager class

Reviewed By: JoshuaGross

Differential Revision: D18474012

fbshipit-source-id: d8190f938e00da0499bfef7e81522dc8022a8836
2019-11-15 17:28:12 -08:00
David Vacca 882e4a3f17 Integrate ReactContextContainerFactory as part of ReactImageViewManager
Summary:
This diff exposes the ReactContextContainerFactory class on ReactImageViewManager and it customize ChainContext to improve Fresco logging

Changelog: Expose new ReactContextContainerFactory class as part of ReactImageViewManager

Reviewed By: JoshuaGross

Differential Revision: D18474013

fbshipit-source-id: 143461da22966694e5b1e2c3b5b39e3d6be91fd6
2019-11-15 17:28:12 -08:00
David Vacca f0b6f8441b Expose SurfaceID as part ReactRootView
Summary:
This diff exposes the surfaceID as part of ReactRootView.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D18474014

fbshipit-source-id: 98f651b211d3cc4df88c6b1eb257bc12129eff57
2019-11-15 17:28:12 -08:00