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

20846 Коммитов

Автор SHA1 Сообщение Дата
Samuel Susla db7080ddde Fix default value for TextInput autoCapitalize
Summary:
Changelog: [internal]

According to React Native docs, the default value for `autoCapitalize` is `sentences`.
Fabric's TextInput default value does not align with this.

[Source](https://reactnative.dev/docs/textinput#autocapitalize)

Reviewed By: JoshuaGross

Differential Revision: D23344479

fbshipit-source-id: f9e6f2aa6e1fbba2b08cb4aff23b842e49fa8c21
2020-08-26 14:31:48 -07:00
David Vacca 25e0a15b77 Delete activityindicator module
Summary:
This diff deletes the activityindicator buck module because these files are created by the code gen.

changelog: [internal]

Reviewed By: PeteTheHeat

Differential Revision: D23227860

fbshipit-source-id: 133315a44c9181be3263e0c6227884ed15487c1f
2020-08-26 12:33:31 -07:00
Gant Laborde 959365a902 Change default metro.config.js to utilize inline requires (#29770)
Summary:
This feature has been in [experimental mode since 0.59.0](https://reactnative.dev/blog/2019/03/12/releasing-react-native-059#-faster-app-launches-with-inline-requires).  The feature seems quite beneficial.

Most people won't know to look for the inline requires flag, and it's been existing in React Native as an experiment for months.  This defaults the flag to true as the next step towards utilizing this optimization for React Native devs initiating brand new projects.

## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Breaking] - Enable `inlineRequires` by default. Gives a performance benefit but slightly different JS execution order

Pull Request resolved: https://github.com/facebook/react-native/pull/29770

Reviewed By: cpojer

Differential Revision: D23338113

Pulled By: TheSavior

fbshipit-source-id: 1b8ff41418c81a324335782d4b4109d89594ccbf
2020-08-26 11:30:59 -07:00
Marc Horowitz 525e55f898 Look up HostObject computed properties on the right object in the prototype chain.
Summary:
The change in the hermes repository fixes the security vulnerability
CVE-2020-1911.  This vulnerability only affects applications which
allow evaluation of uncontrolled, untrusted JavaScript code not
shipped with the app, so React Native apps will generally not be affected.

This revision includes a test for the bug.  The test is generic JSI
code, so it is included in the hermes and react-native repositories.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D23322992 (0dee0e6036)

fbshipit-source-id: 4e88c974afe1ad33a263f9cac03e9dc98d33649a
2020-08-26 11:30:34 -07:00
Ankit Tiwari 1270873ed6 RNTester UI Redesign (#29685)
Summary:
This Pull request adds the UI changes to the RNTester app as discussed in the MLH Fellowship.

This list is not exhaustive.

- The initial App screen is redesigned.
  - A bottom Navbar has been added.
   - Filter pills are added.
   - The list card UI is updated.

- The example page UI is updated.

- Recently Viewed Sections are added. It shows the last 5 recently viewed components/APIs.

- Bookmarking functionality is added.

- The documentation URL is added to the example page.

- RNTester doesn't lose its state on a hard refresh (even on iOS).

<img width="373" src="https://user-images.githubusercontent.com/22813027/90530113-20346180-e192-11ea-8ef6-789fa25b402b.png" />
<img width="373" src="https://user-images.githubusercontent.com/22813027/90530112-20346180-e192-11ea-9539-706b540fcc5f.png" />
<img width="373" src="https://user-images.githubusercontent.com/22813027/90530100-1d397100-e192-11ea-8836-b88070643233.png" />
<img width="373" src="https://user-images.githubusercontent.com/22813027/90530110-1f9bcb00-e192-11ea-936b-64ee75fa4289.png" />

Pull Request resolved: https://github.com/facebook/react-native/pull/29685

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

{F302717939}

Note: this failed **before** this diff too:

{F302745716}

Reviewed By: mdvacca, cpojer

Differential Revision: D23240434

fbshipit-source-id: 65e2766a6a097eca0e0d0fda8dadf6871e9276c2

Co-authored-by: agarwalmanya <manya18ag@gmail.com>
Co-authored-by: chirag-singhal <csinghal208@gmail.com>
Co-authored-by: Ansh Godha <ag759@cornell.edu>
Co-authored-by: Yash Kumar Verma <yk.verma2000@gmail.com>
Co-authored-by: Sanskar Jethi <sansyrox@gmail.com>
Co-authored-by: Aniketh Saha <anik220798@gmail.com>
Co-authored-by: Xtremilicious <nilarjundas@outlook.com>
Co-authored-by: Jani Evakallio <jani.evakallio@gmail.com>
2020-08-26 08:45:57 -07:00
Samuel Susla 9b973f32e4 Fix TextInput value not restoring after reuse
Summary:
Changelog: [Internal]

# Problem

The problem was setting `_backedTextInputView.attributedText` to nil inside `[RCTTextInputComponentView prepareForRecycle]`.

Ordinarily this isn't a problem becase `UIManager::updateState` drops the update if the ShadowNode no longer exists. But in certain cases the ShadowNode can exist, empty string being set as its value

# Fix

Fix is trivial, invalidate state before nullifying `_backedTextInputView`. This prevents the state update from being dispatched.

# Discussion

We should go over all other components and make sure state is invalidated as first thing in `[RCTViewComponentView prepareForRecycle]`.

Reviewed By: shergin

Differential Revision: D23324929

fbshipit-source-id: 9568e920d99683ad95f965ef4b63c529f50f3283
2020-08-25 15:43:08 -07:00
Samuel Susla 19cd630f04 Clone node with state in yogaNodeCloneCallbackConnector
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D23317682

fbshipit-source-id: c273804efbe48143dcecd7c62c4edced0a746bc6
2020-08-25 14:48:38 -07:00
Tim Yung 206ea36253 RN: Delete `Animated/polyfills`
Summary:
Deletes `Animated/polyfills` which is no longer necessary (and only creates extra configuration burden).

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22451963

fbshipit-source-id: 7a9a48b96b3783f2f6340226bdafd2eaa43f32e7
2020-08-25 14:15:35 -07:00
Tim Yung 9c9e677918 RN: Remove `react-animated` Legacy Package
Summary:
Removes the legacy `react-animated` package configuration and collapses the `Animated/src/` directory into `Animated/`.

Also, reconfigures all references to `Animated/src/` to just be `Animated/`.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22450848

fbshipit-source-id: 9fd4861e9f357d817d82e9fec71967a2936a3830
2020-08-25 14:15:35 -07:00
Tim Yung 279b8e7678 RN: Remove `fbjs/requestAnimationFrame` Dependency
Summary:
Removes `fbjs/requestAnimationFrame` call sites from React Native. It is already available globally.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D22445947

fbshipit-source-id: d85418ac055eddd15ba7de4a586de1d31445e95c
2020-08-25 14:15:35 -07:00
Tim Yung 982272932c RN: Remove `fbjs/warning` Dependency
Summary:
Replaces `fbjs/warning` call sites in React Native with `console.warn`. A few warnings will now log as warnings without the "Warning:" prefix.

Changelog:
[General][Changed] - Some warnings changed to use `console.warn` without the "Warning:" prefix.

Reviewed By: TheSavior, cpojer

Differential Revision: D22445946

fbshipit-source-id: 96b01e1bdee52b89ff3b808bc9d6cd494f6787f5
2020-08-25 14:15:35 -07:00
Betty Ni 287cf070cb Unbreak the build
Summary:
build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review
Oncall Short Name: fbandroid_sheriff

Differential Revision: D23325277

fbshipit-source-id: 20e4fb649ce8a0c8640a5ff1c5eb0ff310a4cc22
2020-08-25 12:23:17 -07:00
Kevin Gozali 8ce57ec1b5 Codegen: JavaGenerator [7] - produce complete NativeModule spec .java files
Summary:
This implements the full NativeModuleResolvedType for each NativeModule spec, producing .java spec files in the output directory. The output files are now compiled during build time for :ReactAndroid and :packages:rn-tester:android:app.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23312858

fbshipit-source-id: c521b9d6602677fd275891cf44329740c6bd7387
2020-08-25 10:38:14 -07:00
Kevin Gozali 92a3dff58a Codegen: ignore NativeUIManager.js when producing schema given a JavaScript directory
Summary:
When crawling a provided JS directory to find all .js files for NativeModules and native components, ignore `NativeUIManager.js` for now, because it will be replaced with the Fabric UIManager in the future. The existing NativeUIManagerSpec.java won't be produced by the codegen, but stays manually checked in just in case: 0199a0392c/ReactAndroid/src/main/java/com/facebook/fbreact/specs/NativeUIManagerSpec.java

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23312859

fbshipit-source-id: 7d554fefa651732c13e478b8ec94566348ed3142
2020-08-25 10:38:14 -07:00
Kevin Gozali 8fc1646c75 Codegen: JavaGenerator [6] - resolve individual types into their generated code
Summary:
For each resolved type, define how to process its own type and whether it should produce generated code/file, minus the NativeModuleResolvedType (will be in the next commit).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23307961

fbshipit-source-id: 87af09867aace7a5ff060a33a00b141048630eda
2020-08-25 10:38:14 -07:00
Kevin Gozali eda1f8da7b Codegen: JavaGenerator [5] - Introduced ResolvedType structure that knows how to generate code for itself
Summary:
This is the base setup for ResolvedType. Each Type needs to be resolved to its final representation, which knows what Java type it needs, and what standalone Java code (e.g. class) it needs to produce. Individual resolved types are not yet implemented, this commit provides the flow to pass the parsed structure (from schema) to the resolution logic.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23288208

fbshipit-source-id: 18535d5fae8ca15f6d9374bdba38f57dfd4300e8
2020-08-25 10:38:14 -07:00
Kevin Gozali 301e149f97 Codegen: JavaGenerator [4] - collect all parsed types in a flat list of "TypeData"
Summary:
Instead of recreating the schema structure, the generator only needs to collect the list of types that it needs to generate for. So instead, let's just add each parsed type into a map using TypeId as the key. This means every inner types in the schema needs its own unique TypeId. This was a change from the previous commit where we didn't assign unique names to the types. Here's the reasoning:
* In Java, any generated class needs to be in its own file.
* If a NativeModule spec defines a few aliases, and or inner types (function args, return type shape, etc) that needs representation with a dedicated class, we need to track them as well for code generation.
* This means, the schema format is no longer relevant for the code generation step, so let's produce a structure that's more efficient for code generation

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23287818

fbshipit-source-id: 7caf4e95aeafe5c8ba336af290179b85bf87ad6d
2020-08-25 10:38:14 -07:00
Jordan Brown 4aa69e634d 0.132 for xplat
Summary:
Changelog: [Internal]

0.132 for xplat/js

allow-large-files

Reviewed By: mroch

Differential Revision: D23298358

fbshipit-source-id: 0c75746c0cc2895f63ebc034df386217ffb64c61
2020-08-25 07:33:13 -07:00
Samuel Susla b7afbb1fe2 Use window size instead of screensize for maximum size
Summary:
Changelog: [Internal]

This was set to screensize in D13104172 (346c9d5f2c) to work around issues at that time.
The issues might not be around anymore.

Reviewed By: PeteTheHeat

Differential Revision: D23298723

fbshipit-source-id: 4f33a2cc65ae4fe5ba20b0b2b270b135878c339f
2020-08-25 06:50:34 -07:00
Samuel Susla 258387ddaa Use window size instead of screen size in InputAccessoryView
Summary:
Changelog: [internal]

Use window size instead of screen size to layout InputAccessoryView.

Reviewed By: PeteTheHeat

Differential Revision: D23297141

fbshipit-source-id: d6d7223342d17a2e1b9e5fca6f999b7ad365d056
2020-08-25 06:50:34 -07:00
Samuel Susla 9aabc8cdf0 Use window size instead of screen size in BottomSheet
Summary: Changelog: [internal]

Reviewed By: shergin

Differential Revision: D23294566

fbshipit-source-id: 1da67feff377a2f8c843b961ce3b381f6b16828b
2020-08-25 06:50:34 -07:00
generatedunixname89002005287564@sandcastle995.atn2.facebook.com 835f3677c3 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D23315866

fbshipit-source-id: 8f8e71596f483754cc5f5f5c1677dc2e4f7fd72b
2020-08-25 05:16:48 -07:00
Joshua Gross 1afd9f0e31 UpdateState MountItems should *always* update ViewManagers
Summary:
I'm removing an ill-informed "optimization" that resulted in some StateUpdates being dropped. For some components (including TextInput) we rely on State updates to request a layout from the ShadowNode layer.

In the past we were performing an optimization that didn't update the View layer if the data contained in the State container is identical, but in the case of TextInput and other components, we simply pass an opaque
object with no meaningful data to trigger the layouts. In those cases, it could cause a permanent rift between the View layer's StateWrapper and the most recent state object from the C++ perspective.

In the case of TextInput this didn't cause tangible bugs because you can always update state using an out-of-date State object, but it's better this way anyway.

The other issue is that for some components, we want to know when there's a State update from the Cxx layer. This optimization broke certain logic in those components.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23306222

fbshipit-source-id: 8ef83149b814de50776674b5fd22406be1db14ba
2020-08-24 19:39:56 -07:00
Stephy Ma 03d69fce59 Revert D23292369: Remove State Reconciliation flags and dead code
Differential Revision:
D23292369 (3cb78d5189)

Original commit changeset: 6f00070495e9

fbshipit-source-id: 7e41f6fbdbdb1b833b16c5f3f5ece35a5d7adebe
2020-08-24 19:04:09 -07:00
Peter Argany 6d58490187 Fix RCTEventDispatcher Crash
Summary:
This crash was introduced in D22962320 (ffdfbbec08), which landed 8/17 and went into 8/23 cut. I plan to pick this diff into that release.

I can't repro this, but there must be a scenario (in bridged mode), where we try to flush event queue while bridge is tearing down. I plan to consider this scenario going forward.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23306445

fbshipit-source-id: 285d4b94a17423c3b08d83e7041c4ee04b7e6d0c
2020-08-24 17:21:06 -07:00
Peter Argany 75197dbb16 Pass RCTSurfacePresenter into RCTNativeAnimatedNodesManager in bridgeless
Summary:
This diff ties the stack together. It completes the long chain of RCTSurfacePresenter ownership:

`FBReactModule` -> `RCTNativeAnimatedTurboModule` (this diff and D23272746)
`RCTNativeAnimatedTurboModule` -> `RCTNativeAnimatedNodesManager` (this diff)
`RCTNativeAnimatedNodesManager` -> `RCTPropsAnimatedNode` (D23272735)

It completes animations working without the bridge.

Changelog: [Internal]

Differential Revision: D23272755

fbshipit-source-id: 137f7ff89993a2cb644bd67869eb685afcec4068
2020-08-24 16:37:50 -07:00
Peter Argany 700960c9f1 Pass SurfacePresenter directly instead of relying on bridge
Summary:
`RCTPropsAnimatedNode` uses the bridge to access it's current surface presenter to perform animations.

In bridgeless mode, the surface presenter is not owned by the bridge. Instead, pass the surface presenter through the ownership chain:
`RCTNativeAnimated*Module` -> `RCTNativeAnimatedNodesManager` -> `RCTPropsAnimatedNode`

`RCTSurfacePresenter` should not be strongly held by any of these animation internals. If it gets destroyed at a higher level, animations should not be completed.

Changelog: [Internal]

Differential Revision: D23272735

fbshipit-source-id: ce08ee3b59ac2ba70e31cebb7ba8e9f3a644c848
2020-08-24 16:37:49 -07:00
Peter Argany e1d53ce697 Create init method for RCTNativeAnimatedModule and it's TM fork
Summary:
The animated native module relies on `setBridge` to perform generic setup which doesn't rely on the bridge at all. This diff refactors that setup code to an `init` function.

Changelog: [Internal]

Differential Revision: D23272427

fbshipit-source-id: 0c9c5522c9044283f4db25360010465ff42aba25
2020-08-24 16:37:49 -07:00
Samuel Susla 3cb78d5189 Remove State Reconciliation flags and dead code
Summary: Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D23292369

fbshipit-source-id: 6f00070495e9947476f1dbea7776ca85002e078b
2020-08-24 15:33:07 -07:00
Tim Yung 8edd2e3ef6 RN: Extract `ScrollViewContext`
Summary:
Extracts `ScrollViewContext` so that other components can use it without requiring `ScrollView` as a dependency.

Changelog:
[Internal]

Reviewed By: kacieb

Differential Revision: D22670035

fbshipit-source-id: 7f902697ad2a60cd1869438e9a2b77e479a18065
2020-08-24 15:24:49 -07:00
Joshua Gross 059e424628 Classic Differ: don't recurse down subtrees if parents are pointer-identical
Summary:
Fairly self-explanatory. Should make a fairly meaningful perf difference.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D23296681

fbshipit-source-id: 727d0fb619eeef1b4bf8a47457c4746e6b31be80
2020-08-24 13:09:12 -07:00
Joshua Gross 92091b8b31 New Flattening Differ
Summary:
# What is this?

For a very long time, we've discussed the possibility of detecting Node Reparenting in the Fabric Differ. Practically, from the developer perspective, ReactJS and React Native do not allow reparenting: nodes cannot be reparented, only deleted and then recreated with entirely new tags.

However, Fabric introduced the idea of View Flattening where views deemed unnecessary would be removed from the View hierarchy entirely. This is great and improves memory usage, except for one issue: if a View becomes unflattened, or becomes flattened, the entire tree underneath it must be rebuilt.

In a past diff we introduced a mechanism to detect sibling reordering cleverly, and produce a minimal instruction set. This diff is very similar: we know the invariants around flattening and unflattening of views and we take advantage of them to produce an optimal set of instructions efficiently.

# What's different from previous attempts?

No global maps! Those are slow!

This seems to work and (hopefully) might even improve performance, since way less work is being done on the UI thread in cases when views are (un)flattened.

This *only* does extra work when flattening/unflattening happens, which gives product engineers a little more control over perf.

# So, how's it work?

This algorithm is intuitively simple (I think) but tricky to pull off, because there are lots of edge-cases.

In short: In the past, that information was hidden from the Differ: the differ didn't know if views were being reparented, it would see them
as entirely new views or as views being deleted if a View was flattened or unflattened. We very subtly change the information given to the differ:
all nodes are visible to the differ, but marked as Flattened or Unflattened. Thus, when the differ compares two nodes in the "old" and "new" tree,
it can tell not just if there are updates to the node but if it has been unflattened or flattened as well.

For example, take this tree, where * indicates that a View is flattened:

```
         A
         +
    +----+---+
    B*       X
    +        +
    |        |
+---+--+     +
E      F     Y
```

When the Differ asks for the children of A, in the past it would get a list `[E, F, X]`. That is, B* and X are both its children, but since B is flattened, it is omitted entirely from the list and
its children are substituted.

Now, when the Differ asks for the children of A, we give it this list instead: `[B*, E, F, X]`. That is: we give it a list which includes B, but B is marked as flattened.

Another wrinkle: A node `X` could have its children flattened, but still be a concrete view: so flattening/unflattening is a different operation from making a view "concrete" or "unconcrete", which can change independently of flattening.

There is one additional wrinkle: because of zIndex/stacking order, the children of `B` might not actually appear after `B` in the list. Depending on zIndex, a tree that looks like this:

```
          A
          +
   +------+------+
   B*            C*
   +             +
   |             |
+--+--+       +--+--+
D     E       F     G
```

Could actually be linearized as: `[D G B* F C* E]` (as an extreme example; but basically all permutations as possible).

This is the reason, and the *only* reason that the inner Flattener/Unflattener

## The cases we need to handle

There are 7 cases/edge-cases of flattening and unflattening that we need to handle. Practically, all cases of reordering + flattening/unflattening, and taking recursive cases into account:

1. View A and A' (A in the old tree, A' in the new tree) are matched in the differ, and A* has been flattened or unflattened. These two cases are the easiest to handle.
2. View A' has been reordered with its siblings, and has been flattened or unflattened. These cases are slightly trickier to handle.
3. While flattening or unflattening, we encounter a child that has also been unflattened or flattened. So we need to handle four cases here in total: Flatten-Flatten, Flatten-Unflatten, Unflatten-Flatten, and Unflatten-Unflatten.

Other things to think about, also covered above:

1. Ordering. Views can be reordered and flattened/unflattened at the same time.
2. zIndex ordering: children in a certain order from the ShadowNode perspective may be stacked differently from a View perspective. We use the zIndex ordering for everything in the differ, and this prevents us from performing certain optimizations (see above: we cannot assume that children come after their parent in a list; they may come before, may be interwoven with children from other parents, etc).

# Perf Implications?

Practically, there should be very little negative overhead. There is some overhead in actually performing a flattening/unflattening operation, but... not much more than before. We don't use global maps, so the cost of flattening/unflattening is basically `O(number of nodes reparented)` - note that that's direct nodes reparented, *not* descendants.

tl;dr the perf hit should be similar to reordering, which is non-zero, but close to zero, and zero-cost for any diff operations on parts of the tree that don't involve flattening/unflattening. AFAICT this is very close to an ideal solution for that reason (but I wish it was simpler overall).

# In Summary?

I hope this works out and I think it could improve a number of things downstream: perf, LayoutAnimations, Bindings, certain crashes because of platform assumptions about mutations, etc.

Is it worth it? This new implementation is substantially harder to reason about, harder to read, and harder to understand. This is an important consideration. All I can say there is that I trust the test suite I've been using, but
the decreased readability is a big negative. Hopefully we can improve this in the future.

The rest is fiddly implementation details that I sincerely hope can be improved and simplified in the future.

# Followups?

The part that makes this algorithm the most expensive is that because of zIndex ordering, we cannot assume that children are linearized after their parents and so we rely more heavily on maps for the flattening/unflattening. Our TinyMap implementation should make these `find` operations fast enough unless trees' children are constantly being reordered, but it's still worth thinking of ways to make this even faster.

Changelog: [Internal]

Reviewed By: shergin, mdvacca

Differential Revision: D23259341

fbshipit-source-id: 35d9b90caf262d601a31996ea2cb37e329c61ffc
2020-08-24 13:09:12 -07:00
Joshua Gross dd05ec3801 StubViewTree: add additional verbose logging, make slightly more resilient
Summary:
1. When testing major changes to the differ, it can be useful to have more verbose logging.
2. On Android, since asserts don't fire yet, I log which asserts are failing.

Should have no impact on any builds unless you manually set the macro here, and it will have no impact on production builds regardless.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D23257859

fbshipit-source-id: 94a8e74ece8023064de0f2203db6074975f8f1f0
2020-08-24 13:09:12 -07:00
Valentin Shergin f4fa79a2e3 Fabric: Fixed dangling pointer issue in UIManager::getRelativeLayoutMetrics
Summary:
The same as D21464834 (604402678b).
It should help with T71784916.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D23297325

fbshipit-source-id: 6f14f9b1d1e7d251e53819207bac26dde5afe020
2020-08-24 12:41:44 -07:00
Joshua Gross d602c51996 Simplify TextInput measurements
Summary:
Simplify the TextInput measurement mechanism.

Now, data only flows from JS->C++->Java and from Java->JS. C++ passes along AttributedStrings from JS if JS updates, and otherwise Java maintains the only source of truth.

Previously we tried to keep all three in sync. This was complicated, slow, and even lead to some crashes.

This feels a bit hacky but I believe it's the simplest way to achieve this short-term. Ideally, we would use something like `AttributedStringBox` and pass that to State from Java,
but currently everything passed through the State system from Java must be serializable as `folly::dynamic`. So, instead, we just cache one Spannable per TextInput component and
use ReactTag as the cache identifier for lookup.

An interesting side-effect is that `measure` could race with TextInput updates, but the race condition favors measuring the latest text, not outdated values.

Followups:

- Can we do this without copying the EditText Spannable on every keystroke? Maybe this approach is too aggressive, but I don't want a background thread measuring a Spannable as it's being mutated.
- Do we need to support measuring Attachments?
- How can we clean up this API? It should work for now, but feels a little hacky.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23290230

fbshipit-source-id: 832d2f397d30dfb17b77958af970d9c52a37e88b
2020-08-24 11:59:28 -07:00
Samuel Susla 00563575ba Fix native command dispatch from RCTLegacyViewManagerInteropComponentView
Summary:
Changelog: [Internal]

# Problem

In D22274782 (fb2b49d298) I removed integration between Paper and Fabric. However this integration was still used by `RCTLegacyViewManagerInteropComponentView` for view commands dispatch.

Fix is to use `[RCTUIManager viewForReactTag:viewTag]` instead of viewRegistry.

Reviewed By: shergin

Differential Revision: D23291567

fbshipit-source-id: 35c50716fd8b86ae25b1534e4d8aa688c8e6e129
2020-08-24 10:33:56 -07:00
Samuel Susla 1704a725c5 Use ConcreteStateTeller in RCTImageComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23239098

fbshipit-source-id: fa558e705e121f3d3fbded80ae99e5f51c80ae4a
2020-08-24 06:43:18 -07:00
Samuel Susla 0f7a1145ff Use ConcreteStateTeller in RCTInputAccessoryComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23239095

fbshipit-source-id: a3324b5df6e6bd7508d74b66de9235852d828bbd
2020-08-24 06:43:18 -07:00
Samuel Susla 0b532e1be7 Use ConcreteStateTeller in RCTLegacyViewManagerInteropComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23239097

fbshipit-source-id: 4c0d7b24917509d3d9660098349c226ad42e832e
2020-08-24 06:43:18 -07:00
Samuel Susla 9a5807162c Use ConcreteStateTeller in RCTParagraphComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23239100

fbshipit-source-id: 10d10a369cb7ec82d2f6118a21ec70c2cc20abb3
2020-08-24 06:43:18 -07:00
Samuel Susla c2dab01c62 Use ConcreteStateTeller in RCTModalHostViewComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23239096

fbshipit-source-id: b82301e5db48861d6d241abd681df38701e3ac44
2020-08-24 06:43:18 -07:00
Samuel Susla ca091b009a Use ConcreteStateTeller in RCTScrollViewComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23238812

fbshipit-source-id: 8c777ae1264cfade507bfd336eefbe86ffb94b8f
2020-08-24 06:43:18 -07:00
Samuel Susla 724952e5d6 Use ConcreteStateTeller in RCTSafeAreaViewComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23238703

fbshipit-source-id: 67596194b599ce8d39a6e7403bf61dce0fd61434
2020-08-24 06:43:18 -07:00
Samuel Susla e454863bca Use ConcreteStateTeller in RCTTextInputComponentView
Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D23216864

fbshipit-source-id: 2b82e2d43cc694251a1873ad9059eff4abca4e73
2020-08-24 06:43:17 -07:00
Samuel Susla 2bc8ce1549 Introduce ConcreteStateTeller
Summary:
Changelog: [internal]

# What is Teller?
Teller is a bank's employee who deals with the customer on behalf of the bank. In Fabric's scenario it is a class that on behalf of the view deals with State.

# Why do we need it?
Dealing with `ConcreteState` can be complicated and patterns are often repeated among different component views. `ConcreteStateTeller` aims to resolve these issues. Examples:
- You can call teller's methods without checking for nullptr (we have had crashes because of this before).
- Methods are save to be called on any thread.
- Mechanism to retry state update if it fails is built in.

It is designed to be used from ComponentView so views don't have to talk directly to `ConcreteState`.

Reviewed By: JoshuaGross, shergin

Differential Revision: D23216865

fbshipit-source-id: 90a50702e036eac084f89743ebab687a67182dc0
2020-08-24 06:43:17 -07:00
Martin Sherburn 549563e8ab Allow Hermes to be built as a DLL on Windows
Summary:
On windows it is required to explicitly specify what symbols need to be exported from a DLL to make them accessible (using `__declspec(dllexport)`). I have added and expanded on existing macros to do this and added exports that were previously missing.

Changelog:
[Internal][Changed] - Allow Hermes to be compiled to a single DLL on windows

Reviewed By: mhorowitz

Differential Revision: D23084343

fbshipit-source-id: 832cb17b9e637e4c04dad479aae6c1fc190f968e
2020-08-24 06:07:19 -07:00
benjaminhr 464293f64e Update Metro packages to v0.63.0
Summary:
`js1 upgrade metro -v 0.63.0`

Newest Metro release: https://github.com/facebook/metro/releases/tag/v0.63.0

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D23266107

fbshipit-source-id: 1afcb8a1f5bac7f4d489e5af62df7d27e24da8f8
2020-08-24 01:51:45 -07:00
Samuel Susla 6c1ee871c0 Calling `ConcreteShadowNode::setStateData` sets mostReventState
Summary:
Changelog: [Internal]

If `ConcreteShadowNode::setStateData` is called and the node is cloned before it is mounted, the cloned node will have old state before `setStateData` was called.

To solve this, simply call `setMostRecentState` on the family inside `ConcreteShadowNode::setStateData`.

Reviewed By: JoshuaGross

Differential Revision: D23283560

fbshipit-source-id: f9822fb69e4234f776d512fc02fe13ea7de64897
2020-08-24 01:43:29 -07:00
Joshua Gross 19c45ba709 NativeAnimatedModule: allow JS to control queueing of Animated operations (JS Side)
Summary:
This is the JS side of D23010844 (73242b45a9).

In the past I tried a few heuristics to guess when a batch of Animated Operations were ready, and none of these were super reliable. But it turns out we can safely allow JS to manage that explicitly.

Non-Fabric still uses the old behavior which seems fine.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D23010937

fbshipit-source-id: 4a513672c166ceaa8b6daa387e46a2a95b60ce53
2020-08-24 01:20:47 -07:00
Joshua Gross 1d05d46e64 Add square brackets around tags in logs in FabricUIManager
Summary:
See title.

Changelog: [Internal]

Differential Revision: D23257809

fbshipit-source-id: b8e519971603506e8ae2b327582d3e3e7d65fddf
2020-08-22 22:42:12 -07:00