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

19678 Коммитов

Автор SHA1 Сообщение Дата
Valentin Shergin 8fb0eefb78 Fabric: Using move semantic in Differentiator
Summary:
This diff changes how we pass lists of nodes to `calculateShadowViewMutations`: previously we passed that as `const &` and now we pass them as rvalue references because we will need to mute them in the future diffs.

This diff also adds a `static_assert` to ensure that the lists are movable.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20353754

fbshipit-source-id: 0c3383bff6ded8a49d1ac003fce8919d3906b5bb
2020-03-11 22:45:27 -07:00
generatedunixname89002005287564 1dc82a89d7 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D20383094

fbshipit-source-id: 1dc497a98fd3b5962542735c5243d7ac9cd40da3
2020-03-11 21:41:04 -07:00
Marc Horowitz 409c276474 Remove remaining external references to JSC
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20319757

fbshipit-source-id: 4ac3952175fd1b78957b01de279135af122d5bf1
2020-03-11 21:13:01 -07:00
Tommy Nguyen f332fac163 iOS: Add UIScene support to RCTImageView (#28141)
Summary:
Apps implementing `UISceneDelegate` no longer clear out images when backgrounded because `UIApplicationDidEnterBackgroundNotification` no longer gets fired.

## Changelog

[iOS] [Added] - UIScene support for RCTImageView
Pull Request resolved: https://github.com/facebook/react-native/pull/28141

Test Plan:
1. Create a new iOS app implementing `UISceneDelegate` or modify an existing one
2. Open a React view with some images
3. Switch to another app, or background the current app
4. Observe that `-[RCTImageView clearImageIfDetached]` gets called

Reviewed By: shergin

Differential Revision: D20009200

Pulled By: hramos

fbshipit-source-id: bdbf79d6cf56a295344c036b9225efec672fa780
2020-03-11 18:01:32 -07:00
Samuel Susla 3198009410 Remove redundant queue switch from RCTLocalAssetImageLoader
Summary:
Switching queues in `RCTLocalAssetImageLoader` is unnecessary. We dispatch to main queue before assigning the image to `UIImageView`.

Changelog: Remove redundant queue switch from RCTLocalAssetImageLoader

Reviewed By: PeteTheHeat

Differential Revision: D20347223

fbshipit-source-id: ff6215838f0462356d4a516e6ec31c82a742881a
2020-03-11 14:01:21 -07:00
Joshua Gross f3a53fd338 TextInput: keep less stateful data on the View
Summary:
Allow JS to keep track of mostRecentEventCount and pass it into each event or prop update. We really don't want to separately keep track of that data.

In non-Fabric, the ShadowNode will keep track of the mostRecentEventCount associated to prop updates. In Fabric, that happens on the C++ ShadowNode.

Changelog: [Internal] Simplification to TextInput native state

Reviewed By: mdvacca

Differential Revision: D20374573

fbshipit-source-id: 385fba6ec69a071c78832a686b397699a6c55d67
2020-03-11 12:32:40 -07:00
Miguel Bolivar 686d8a57f8 Update: Fixing typo on Modal comment code � (#28057)
Summary:
This PR only fixes a little typo that I noticed working on the documentation of React Native website taking reference from this source code, and then saw it 😅

## Changelog

[General] [Fixed] - Fixed typo from `inly` to `only` inside `Modal.js` library code.
Pull Request resolved: https://github.com/facebook/react-native/pull/28057

Test Plan: Not needed.

Reviewed By: cpojer

Differential Revision: D20197178

Pulled By: TheSavior

fbshipit-source-id: 372f263a16a2de665ced7c0d3f10e3897777d19f
2020-03-11 10:00:04 -07:00
Joshua Gross 8b61578076 Maintain a separate queue for ViewCommands and execute before everything else
Summary:
ViewCommands are sort of like setNativeProps updates, in that they're direct manipulations of Views on-screen that don't go through the normal
commit/diff process that other UI updates do. This is an MVP that shows how we can do this in non-Fabric RN.

Changelog: [Internal] experiment, allow ViewCommands to be executed before other types of UIOperations

Reviewed By: axe-fb, mdvacca

Differential Revision: D20378633

fbshipit-source-id: 5f3c54d3c84b4e4f7cb060a9505b20b0e5b7afed
2020-03-10 20:26:44 -07:00
Ramanpreet Nara 99ceb6afba Introduce RCTTurboModulePerformanceLogger
Summary:
In production, we'd like to be able to track the performance metrics of TurboModules. So, I'm introducing a new protocol called `RCTTurboModulePerformanceLogger`. It allows the application to be notified at points during stages of TurboModule creation, and TurboModule method invocation.

**Why can't we use `RCTPerformanceLogger`?**

`RCTPerformanceLogger` is meant to be used to profile RN initialization. It supports a fixed list of markers. Each marker has a type, and there can only be one instance of it. This isn't suitable for logging events in the TurboModule system.

Reviewed By: mdvacca

Differential Revision: D20310976

fbshipit-source-id: a49251b325c94f912cd35ab1cd8fc010f2cfc08f
2020-03-10 19:59:34 -07:00
Ramanpreet Nara 1c1fa5b909 Make main queue setup synchronous
Summary:
This can cause a deadlock if the main thread synchronously calls into some JS that creates a TurboModule. However, this is also the behaviour of legacy NativeModules. Furthermore, this also greatly simplifies how we'll fix async method invocation in TurboModules: T55255146.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D20364251

fbshipit-source-id: d0db85665506f08c51c2f33a123e69960923e7f3
2020-03-10 19:59:33 -07:00
Andy Himberger 0c2db3256f timing fix for RCTCxxBridge.executeApplicationScript (#25991)
Summary:
In one of our test apps (actually on Mac not iOS, but same code) we very consistently crash in RCTCxxBridge.executeApplicationScript when js debugging, due to a timing issue where another thread has reset _reactInstance in between the null check on self->_reactInstance and usage of it on these lines:

```
    } else if (self->_reactInstance) {
      self->_reactInstance->loadScriptFromString(std::make_unique<NSDataBigString>(script),

```
The thread doing the reset is doing so switching the executorClass to WebSocketExecutor.
In the scenario we crash, the packager has a bundle ready and quickly returns it, though its a 34MB string being passed to NSDataBigString which must be taking long enough for the other thread to get a chance to reset.

## Changelog

[iOS] [Fixed] - Fix crash in RCTCxxBridge.executeApplicationScript
Pull Request resolved: https://github.com/facebook/react-native/pull/25991

Test Plan: Ran apple code path in normal from bundle file and js debugging scenarios.

Reviewed By: shergin

Differential Revision: D19186065

Pulled By: hramos

fbshipit-source-id: ae1d4b5b50b7fb33b74aba21addc2978e917479f
2020-03-10 18:15:42 -07:00
Luna Wei a3aaa471ec Add JS error to AnimatedValue constructor
Summary:
Changelog: [Internal]
Add one more error around AnimatedValue.js returning an undefined value for "value" property.

Since this error happens in construction of the animated node, it makes sense that the constructor could be passed an undefined value?

Reviewed By: zackargyle

Differential Revision: D20354532

fbshipit-source-id: ba35172cd91977c48c849a2b1e27596c4dd8b4d4
2020-03-10 18:03:22 -07:00
Valentin Shergin 0d6d58656a Fabric: EmptyLayoutMetrics does not contain invalid values anymore
Summary:
Before this change, fields of EmptyLayoutMetrics have some "invalid" values to allow us to compare equal them individually and get `false`. Turned out that having invalid values there might break some serialization layers, which is no good.
This change fixes that and adds explicit check for EmptyLayoutMetrics before running a comparison of individual fields.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20324881

fbshipit-source-id: ab8e2a402f6bdfb393fc9b6789decb526fa94dfa
2020-03-10 17:00:41 -07:00
Michel Weststrate 85a4b0f5bd Bump FlipperKit version on iOS to be compatible with react-native-flipper (#28277)
Summary:
This pull request re-applies https://github.com/facebook/react-native/pull/28225, thereby reverting 4bb17944f1, this time bumping to FlipperKit 0.33.1 which is again compatible with iOS 9 (thanks to https://github.com/facebook/flipper/pull/874)

This is the iOS counterpart of https://github.com/facebook/react-native/pull/28275

## Changelog

[iOS] [Changed] - Upgrade Flipper dependency to 0.33.1
Pull Request resolved: https://github.com/facebook/react-native/pull/28277

Test Plan:
* Bumped the version in our Flipper / RN integration test app first, that runs on 0.62-rc.5, verified everything still works there.
* CI

![Screen Shot 2020-03-10 at 12 12 46](https://user-images.githubusercontent.com/1820292/76311312-94f09f00-62c8-11ea-81db-ced6d16e096b.png)

Reviewed By: mweststrate

Differential Revision: D20369106

Pulled By: TheSavior

fbshipit-source-id: dfeb0446e7f29684a266eca5d0e29ac42cef2ef3
2020-03-10 14:16:55 -07:00
Pavlos Vinieratos 5198978f2a Don't mess with Windows line endings (#28274)
Summary:
During some rc releases we have seen the file `gradlew.bat` get diffs from release to release, and sometimes the diff is nothing, except some script messing with the line endings of that file.

According to [this](https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings#example) and my own experiments using `unix2dos` and `dos2unix` to swap the line endings of that file, this change fixes this problem.
We specify all the `.bat` files should have the Windows line endings.

## Changelog

[General] [Fixed] - Specify line endings of `.bat` files for Windows in `.gitattributes`
Pull Request resolved: https://github.com/facebook/react-native/pull/28274

Test Plan:
To assist with the test, you can use `brew install unix2dos`.

- Init a new project or use an existing one.
- Make sure in your `.gitattributes` of the project and of the user (home dir or `.config/git/attributes` don't have anything about `.bat` files, or `* text=auto`.
- Run `unix2dos ./android/gradlew.bat`.
- Check git status.
- Run `dos2unix ./android/gradlew.bat`.
- Check git status.
- You will notice that the changes when swapping around are the whole file changed.

- Using the changes in this PR, and doing the above, the git status will be no changes, as it should be. The line changes stay Windows-style.

Reviewed By: cpojer

Differential Revision: D20369235

Pulled By: TheSavior

fbshipit-source-id: 4bb6e9f46caecd36211834c7dc3f0e2e64272862
2020-03-10 14:11:23 -07:00
Pascal Hartig db12255645 Upgrade Flipper Android to 0.33.1 (#28275)
Summary:
Upgrades Flipper to 0.33.1 for both the Android template and RNTester.

## Changelog

[Android] [Changed] - Upgrade Flipper dependency to 0.33.1
Pull Request resolved: https://github.com/facebook/react-native/pull/28275

Test Plan: Still trying to figure out how to get my Gradle setup working again. Until then, CI.

Reviewed By: cpojer, mweststrate

Differential Revision: D20369480

Pulled By: TheSavior

fbshipit-source-id: 048c944819168a352214349f6a83407a587479c9
2020-03-10 14:05:33 -07:00
Samuel Susla cd0e4ecd7b Fix scrollView state contentOffset not being in sync with scrollView contentOffset
Summary:
Changelog: [Internal]

# Problem
`scrollView.state.contentOffset` was not in sync with actual `contentOffset` in case `contentOffset` is changed programatically.

# Solution
Add a flag `_isUserTriggeredScrolling` that indicates whether the current scroll is triggered by user or not. In case it isn't, update state.

Reviewed By: shergin

Differential Revision: D20098161

fbshipit-source-id: 021d916e7a45a24095a47bb8f84d1102226b672a
2020-03-10 12:47:20 -07:00
Valentin Shergin 507379f6fa Fabric: Support for Inline Views in Paragraph component
Summary:
Final diff that implements Inline Views in `Paragraph` component.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20268045

fbshipit-source-id: 9a0093eacb9ae34890f6137b308550547a3bcb38
2020-03-10 08:16:40 -07:00
Max Kareta c38318d084 deleting marker cancel 2/N. [DO NOT LAND]
Summary: Added markerDrop API that will replace markerCancel in future.

Reviewed By: furdei

Differential Revision: D20003457

fbshipit-source-id: 38cf68455d9274761a49014d9cbb50d82f4e9437
2020-03-10 07:11:42 -07:00
generatedunixname89002005287564 837c3db49e Daily `arc lint --take GOOGLEJAVAFORMAT`
Reviewed By: zertosh

Differential Revision: D20360867

fbshipit-source-id: 737748733ff6826b2f20760fcb301988ff46e278
2020-03-10 05:41:35 -07:00
Alec Larson 37436752f5 Add RNTester example for multi-line interleaved <View> and <Text> (#28242)
Summary:
Currently, using `alignSelf: "baseline"` on a `<View>` nested in a `<Text>` fails to position the view properly. Using `alignItems: "baseline"` on the parent `<Text>` doesn't work either.

/cc shergin

### Current Result
![rn-baseline-nested-view](https://user-images.githubusercontent.com/1925840/76032574-29918080-5f08-11ea-8ee8-cf3106ef0e06.jpg)

### Expected Result
![rn-baseline-nested-text](https://user-images.githubusercontent.com/1925840/76032575-2a2a1700-5f08-11ea-9efa-4026bc824ed5.jpg)
Pull Request resolved: https://github.com/facebook/react-native/pull/28242

Reviewed By: PeteTheHeat

Differential Revision: D20308202

Pulled By: shergin

fbshipit-source-id: adb75b763db1c3e879cb90d469a80ee8262a3609
2020-03-10 00:02:21 -07:00
David Detlefs 07c4980267 Add unit test for multiple levels of DecoratedHostObject.
Summary:
I was unsure how, or if, DecoratedHostObjects worked.  Marc had created the linked task to make sure that things worked right with multiple levels of decorated host objects.  I decided to do that, thinking it would show a bug; instead it showed me that the pattern did work, and let me figure out how.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D20263797

fbshipit-source-id: 8bbe71cba1b6ef5b2673566759112320dd1894b8
2020-03-09 22:08:00 -07:00
Joshua Gross 2f45961beb Protect against View context not being a ThemedReactContext in AndroidTextInput in Android 4
Summary:
See D19204032. In some cases the View might not have a ThemedReactContext, it may be wrapped, so we use a previously-created helper to get the correct context from the View or we throw a soft exception.

Changelog: [Internal] Fabric change

Reviewed By: mdvacca

Differential Revision: D20355126

fbshipit-source-id: 469a3b7f8f2d3b98236f3170dd62c4a6e7e1e46f
2020-03-09 20:45:01 -07:00
Joshua Gross 3cc69d2e2b Work around crash when default colors are null
Summary:
Work around crash in Android TextInput when default colors are null.

This likely indicates that the Context is corrupted in some way, so this is not a permanent solution.

Changelog: [Internal] Raise soft exception is default platform text color isn't defined

Reviewed By: mdvacca

Differential Revision: D20351080

fbshipit-source-id: d912c9348272c2f3a3b8d571d465d482060efe5a
2020-03-09 20:45:01 -07:00
Spencer Ahrens 08c338eebf update JSTime to last call
Summary: ChangeLog: [General] [Added] - support PerformanceLogger stopTimespan updates

Reviewed By: alexeylang

Differential Revision: D20095949

fbshipit-source-id: 3522a8d16ced44d6b699b294004371e223f9f619
2020-03-09 19:47:36 -07:00
Luna Wei c938c0afbf Adjust Layout Animation with pending deletion set
Summary:
Changelog: [Internal]
This solves the problem of viewToAdd indices being invalid if the deletes are asynchronous within the scope of one `manageChildren` call.

Since deletions are performed first, we keep a set of tags being deleted.
During view insertion, we iterate through and filter those tags out of our count.

Reviewed By: JoshuaGross

Differential Revision: D20324643

fbshipit-source-id: 150230428fcd65b8c43cc1f2331e9ce02d31fff9
2020-03-09 18:33:53 -07:00
Adam Ernst 0c7bd388f0 Rename get_debug_preprocessor_flags
Summary:
The new name is get_preprocessor_flags_for_build_mode.

Changelog: [Internal]

Reviewed By: d16r

Differential Revision: D20351718

fbshipit-source-id: 67628ce81e7244f0f72af2d00d92842a649ff619
2020-03-09 18:28:27 -07:00
Valentin Shergin 02f2c81240 Fabric: Proper way to specity layout constraints for root Yoga node
Summary:
This diff changes how we apply layout constraints to a root node before layout. We previously used two arguments of `YGNodeCalculateLayout` but that's not expressive enough in cases we have min & max sizes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D20268051

fbshipit-source-id: 85aaae65326432993296c3cbc9f7fb8919b07386
2020-03-09 16:36:47 -07:00
Valentin Shergin 0d33cdf146 Fabric: New `LayoutableShadowNode::measure(...)` which measures the node "outside"
Summary:
This diff introduces a new method of `LayoutableShadowNode` called `measure`. The purpose of the method is to measure the node from an "outside" perspective (including paddings and so on). The existing method with the same name (but with slightly different signature) will be renamed to `measureContent` in future diffs.
Hense we will have two `measure*` methods:
 * `measureContent` measures nested content of the node;
 * `measure` measures the node (outside).

This diff also introduces a default implementation of a new measure that uses `layoutTree` under the hood.

Measures the node with given layoutConstraints and layoutContext.
The size of nested content and the padding should be included, the margin should *not* be included.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D20268047

fbshipit-source-id: 29c28cf16c5afe24f1bfb6e76c42816d4583a8fa
2020-03-09 16:36:47 -07:00
Valentin Shergin 90ada5abb1 Fabric: Calculating positions of attachments as part of text measurement
Summary:
This diff changes API we use to measure text. Previously, a platform-specific measure infra returned just the size of the text, now it returns the size and an array of frames that describe where attachments are placed.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268041

fbshipit-source-id: 7c065607b6af18a36318db0aab24dad0f171d33a
2020-03-09 16:36:46 -07:00
Valentin Shergin d1ad29b7db Fabric: Introducing `ParagraphShadowNode::Content`
Summary:
`ParagraphShadowNode::Content` describes all nested content of a `Paragraph` component as a single entity allowing to reason about that as a thing that holds an invariant. Now we can store that as a single thing, copy, pass to functions, build on top of that and etc.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC, mdvacca

Differential Revision: D20268043

fbshipit-source-id: e976588ad76615259c72bc21f9ad8d923f2f3b9f
2020-03-09 16:36:46 -07:00
Valentin Shergin 2508c46a75 Fabric: More `assert`s in YogaLayoutableShadowNode
Summary:
These `assert`s must be satisfied. Having them allows us to fail early in case of bugs.
I spent a log of time debugging an issue and finally found that after adding those `assert`s.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D20268046

fbshipit-source-id: 1d8ddd6de00069bd2a79e74af5e4278aa6c9131b
2020-03-09 16:36:45 -07:00
Valentin Shergin b5aaa25b9e Fabric: De-virtualizing `LayoutableShadowNode::setLayoutMetrics()`
Summary:
Removing `virtual` qualifier for `LayoutableShadowNode::setLayoutMetrics()`. Original design implied that some subclass might override that method to provide additional functionality but we never used that and seems not it does not much the overall design: we store `layoutMetrics` *inside* `LayoutableShadowNode`.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268042

fbshipit-source-id: 2aa9b3da316b97f26493fb04d19ca8290bd5d2a6
2020-03-09 16:36:45 -07:00
Valentin Shergin 2a61c4ec53 Fabric: `roundToPixel<>()` convenience functions
Summary:
A bunch of convenience functions for rounding float values to be aligned to the device pixel grid. We had something like this on iOS, now we need to have that in xplat C++ code.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268044

fbshipit-source-id: 980b61c793eaeafb160e2b3c1d9742402800cd47
2020-03-09 16:36:45 -07:00
Valentin Shergin e1b8841c7a Fabric: non-const `AttributedString::getFragments()`
Summary:
This diff adds a non-const method to AttributedString that allows accessing a list of fragments by reference.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268040

fbshipit-source-id: cd0c8be126607b99686f7f596106b38fbe3da230
2020-03-09 16:36:44 -07:00
Valentin Shergin f18358dda6 Fabric: Introducing `BaseTextShadowNode::getAttributedString()`
Summary:
`BaseTextShadowNode::getAttributedString()` was replaced with simular method `BaseTextShadowNode::buildAttributedString()` which does same work with following differences:
* Besides returning `AttributedString`, it retures an array of `Attachment`s elements of which points to `ShadowNode`s that form attachments;
* Now we use single `AttributedString` to construct result instead of concatenation objects recurvily walking the tree.

We will use the array of attachments later.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20268048

fbshipit-source-id: 371c548826bdfd5c4f4b18915d68977724885ce6
2020-03-09 16:36:44 -07:00
Luna Wei dedf9372ca Track animations and flush them
Summary:
Changelog: [Internal]

Track delete animations and when `manageChildren` is called on a certain view tag, finish all pending deletion animations before manipulating children

Reviewed By: JoshuaGross

Differential Revision: D20319824

fbshipit-source-id: b594d0e6e9b6fecc5eca2938f284be631494e55c
2020-03-09 15:56:38 -07:00
Luna Wei d3b93f7578 Remove all layout index adjustments
Summary:
Changelog: [Internal]

# Context Timeline

* ~March 2019 landed D14529038 (I'll be referring to this as "index adjustment fix")
which attempted to fix a reproducible issue with layout animations: P127130177, see Spencer's diff for more context: D14245985

* May 2019 I realized that "index adjustment fix" has a bug in it and attempted to fix with D15485132, but was eventually reverted because of other crashes

* Just recently have been getting tasks related to crashes that are attempting to either remove or add a view that is out of bounds which is caused by invalid index because of the "index adjustment fix".

# What is this diff doing?
I'm removing the "index adjustment fix" because I found that the original layout animation repro, P127130177, no longer repros on  latest master with the "index adjustment fix" reverted.

Additionally, I've found a consistent crash in (RN bookmark > Sample Integration App > Relay Sample Friends) of a bad view deletion because of the "index adjustment fix"

Removing the index adjustment fix may have effects elsewhere but it seems better to remove this and go back to what layout animations was doing a year ago than to continue on in this half-baked state.

Reviewed By: JoshuaGross

Differential Revision: D20323928

fbshipit-source-id: ba4a222915add00e98a9936ba2a8efc4006fb8e3
2020-03-09 15:56:37 -07:00
Jesse Katsumata 42c1957aff chore: fix typo in comments (#28269)
Summary:
Fixed some typos in the comment.

## Changelog

[Internal] [Fixed] - Fixed typo in the comments
Pull Request resolved: https://github.com/facebook/react-native/pull/28269

Test Plan: Changes are only made in the comments, so test is not necessary.

Reviewed By: cpojer

Differential Revision: D20342637

Pulled By: shergin

fbshipit-source-id: f6e7dd538ee54c43e1570c35e1f8c4502054e328
2020-03-09 15:37:33 -07:00
Chad Smith f0dd701045 upgrade detox to 15.4.4
Summary:
Upgrade detox version to avoid a crash, per https://github.com/wix/Detox/issues/1947#issuecomment-596547229.

Changelog: [Internal] Upgrade Detox to 15.4.4.

Reviewed By: TheSavior

Differential Revision: D20344541

fbshipit-source-id: a7a3d97b858dbbb13a796dbc3c5c0c47f3ffe556
2020-03-09 14:13:28 -07:00
Rick Hanlon 69126069fc LogBox - Handle invalid requires
Summary:
This diff updates the errors thrown by Metro for invalid requires, and fixed a bug in Fast Refresh that was failing to handle errors returned by metro. The net result is that invalid requires are displayed as syntax errors with code frames.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D20107057

fbshipit-source-id: 59f77aa1da620d2c619a7cc45d90f40ef8b54448
2020-03-09 06:02:07 -07:00
Samuel Susla f96dc274d1 FindNodeAtPoint now accounts for scrollView offset
Summary:
Changelog: [internal]
FindNodeAtPoint was not taking transform into account.

Reviewed By: JoshuaGross

Differential Revision: D20288026

fbshipit-source-id: a8ff09bc265de983e42610c5d23837a2000f9dd2
2020-03-09 05:57:20 -07:00
Samuel Susla d6484fa180 Add TextKind trait to ParagraphShadowNode and TextInputShadowNode
Summary:
Adds `TextKind` trait to Paragraph and TextInput shadow nodes.

Later on it could cause confusion why they do not have this trait.

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D20254008

fbshipit-source-id: 56fb264fa4fe38a5f00f080558cdc7992fd51fea
2020-03-09 05:51:27 -07:00
Samuel Susla 138ade0117 Add transform*rect and transform*size operators
Summary:
Adding 2 `transform*rect` and `transform*size` operations.
Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D20304247

fbshipit-source-id: 7bde67c96a21ce15e9da0464bcfccc61ab8fe13d
2020-03-09 04:56:39 -07:00
Valentin Shergin d0871d0a9a Clang format for all React Native files
Summary:
Buckle up, this enables clang-format prettifier for all files in React Native opensource repo.

Changelog: [Internal] Clang-format codemod.

Reviewed By: mdvacca

Differential Revision: D20331210

fbshipit-source-id: 8da0f94700be0c35bfd399e0c48f1706de04f5b1
2020-03-08 23:01:17 -07:00
Valentin Shergin a426c8dc77 Fabric: Using `(un)wrapManagedObject` in TextLayoutManager
Summary:
Investigating a crash, I spend half of an hour staring at `__bridge`, `__bridge_retained`, `CFRelease` and etc trying to understand is there a bug or not. Even if I think there was no bug there, it should not be this way. We have a nice abstraction around that madness we should use to make the code obvious.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20260917

fbshipit-source-id: 2b511ebf46a78950c4720e749099134aed1dd890
2020-03-08 21:31:54 -07:00
Jon Thysell (JAUNTY) 460c698e5f Fix MSVC build break in VS 2019 (#28253)
Summary:
Updating react-native-windows to build with Visual Studio 2019 and the v142 toolset.

## Changelog

[Internal] [Fixed] - Fix MSVC build break in VS 2019
Pull Request resolved: https://github.com/facebook/react-native/pull/28253

Test Plan: No real change, only adding a missing include for `stdexcept`.

Reviewed By: cpojer

Differential Revision: D20321273

Pulled By: shergin

fbshipit-source-id: ffe8b4d3a96ce4ed1db303020d77a806637e88bc
2020-03-08 21:18:48 -07:00
David Vacca c3d0729550 Fix rendering of TextInput in Catalyst App
Summary:
This diff fixes the rendering of the TextInput RNTester examples in catalyst app.
The root cause of the bug is that we were parsing the props of the text using the TextAttributeProps class, this is incorrect because TextAttributeProps is a holder of the C++ TextAttributes and not TextProps, but the name is confusing.
As a consecuence there was some mistmaches of types during parsing and that was throwing an exception in some examples.

I created the task T63643819 to refactor these classes to make this cleaner.
I'll be working on T63643819 next week, now I want to unblock this bug.

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D20320969

fbshipit-source-id: 7b47546ba4f34df2a7fa151ab200823ea2eeb696
2020-03-06 23:07:32 -08:00
Valentin Shergin 6530c90267 Fabric: Fixing a crash in RCTParagraphComponentView
Summary:
We don't know why exactly it happens but (seemingly) sometime Paragraph component receives an empty State object. This causes a crash because of unchecked access to an instance variable.
This diff introduces an assert in DEBUG mode and the check for prod.

Why is this happens? Hard to say, probably `layout()` method (which updates `State`) is not being called on ShadowNode. Why? One explanation can be that Yoga skips some subtree during layout because it starts from "visibility: hidden" component. We need to investigate it more and figure out what exactly going on and what should we need to improve besides the check. That's why we have an assertion.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D20260512

fbshipit-source-id: 4772855f41c6694be2ed6c0a19da40332d2bb8db
2020-03-06 20:06:32 -08:00
Joshua Gross c18cc76e58 Comparison of AttributedString false more often than true in TextInput, resulting in janky editing behavior
Summary:
Instead of comparing the entire AttributedString, compare just the strings and the TextAttributes of Fragments.

Concretely what I'm seeing is that the Frame of the associated parent ShadowViews are changing very frequently, making it impossible to actually modify the TextInput in some cases. However, we shouldn't forcibly reset the content of the TextInput if the frame of the parent is changing and not the actual child contents.

Changelog: [Internal] Fabric TextInput bug fix

Reviewed By: shergin

Differential Revision: D20319359

fbshipit-source-id: 2f51f521ad76fff9da6f6c8b5e795f03c33e496f
2020-03-06 19:37:27 -08:00