Commit Graph

489 Commits

Author SHA1 Message Date
David Vacca b67dc01d1d Replace int -> int32_t
Summary:
This diff replaces all usages of int by int32_t. This is to ensure we always use a fixed size for int that matches what's expected on Java.

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27915608

fbshipit-source-id: 634c45796dda1d4434c3ad6ff3e199931c22940b
2021-04-22 09:50:23 -07:00
David Vacca 091197be5e Fix MapBufferBuilder::ensureDynamicDataSpace
Summary:
There was a subtle bug in MapBufferBuilder::ensureDynamicDataSpace where in some situations allowed MapBufferBuilder to use unowned memory.

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D27904642

fbshipit-source-id: de447633349094b0e8c5cb5e377dd31f5bfd1471
2021-04-21 10:27:57 -07:00
David Vacca b614afc613 Refactor MapBufferBuilder to use int to store size of Mapbuffer data
Summary:
Refactor MapBufferBuilder to use int to store size of Mapbuffer data

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D27904646

fbshipit-source-id: 6b8b96fdd30184b6d35c1d612743eae653854d6d
2021-04-21 10:27:57 -07:00
David Vacca 668d71aa0b Refactor dataSize to use int instead of short
Summary:
DynamicData can contain a big amount of data, refactoring type to use int instead of short

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27904643

fbshipit-source-id: 157064b280e27a9c7c4a4f55af310392b178feda
2021-04-21 10:27:57 -07:00
David Vacca f946001c4e Change type of MapBufferBuilder.dynamicDataSize variable
Summary:
Dynamicdata can contain long datastructures, increasing type of MapBufferBuilder.dynamicDataSize to int

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27904647

fbshipit-source-id: ccbccf9328a6aa301aa3f9bf5c1b3c20f56e2a19
2021-04-21 10:27:57 -07:00
David Vacca 8cdba40987 Fix MapBuffer.getString() method
Summary:
found a bug in MapBuffer.getString() method, this diff is fixing it

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27904644

fbshipit-source-id: 746812235539ff75c5ce53c6f872ede9779fa1fa
2021-04-21 10:27:57 -07:00
David Vacca c9a69de962 Add TODOs and Tasks into TODOs
Summary:
Add TODOs and Tasks into TODOs

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27865470

fbshipit-source-id: fcc7f86b0e6b290bf9f691a2dafea18d8addf782
2021-04-20 12:13:48 -07:00
David Vacca a32a636909 Fix assert in mapbufferBuilder
Summary:
This diff fixes an assert in mapbufferBuilder

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27864306

fbshipit-source-id: fbeb812906441c50bf51ca71566fcd6f6e494322
2021-04-20 12:13:48 -07:00
David Vacca 0bb05789b2 Add assert in constructor of MapBuffer
Summary:
This diff adds an assert in the constructor of MapBuffer to ensure that we always access valid memory

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27864310

fbshipit-source-id: bd3870b6df1dbc5181fc5d852eb0ccbc32a8a951
2021-04-20 12:13:48 -07:00
David Vacca 7d326a98f6 Refactor MapBuffer::getCount
Summary:
EZ refactor of MapBuffer::getCount and removal of TODO

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27864307

fbshipit-source-id: 14138090b3f2b45de8e0a3941abec990edb427ed
2021-04-20 12:13:48 -07:00
David Vacca e2b9c61998 Add assertion when building MapBuffer
Summary:
This diff adds an assertion when trying to build a MapBuffer with invalid data

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27864309

fbshipit-source-id: 6601388e56be18ded0675f92cce009a577828c16
2021-04-20 12:13:47 -07:00
David Vacca 4d9973fa59 Use explicit initial values for internal data of MapBufferBuilder
Summary:
Use explicit initial values for internal data of MapBufferBuilder

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27864311

fbshipit-source-id: 1e861d90da5ba52dfe560630b50aa4e1e741f66c
2021-04-20 12:13:47 -07:00
David Vacca 8b5ad95a30 Use explicit initial values for internal data of MapBuffer
Summary:
Use explicit initial values for internal data of MapBuffer

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D27864308

fbshipit-source-id: f90fb34735ba190b9ca96da245f3c478640eb537
2021-04-20 12:13:47 -07:00
Samuel Susla e9016f8b73 Handle $$typeof call in RuntimeSchedulerBinding
Summary:
Changelog: [internal]

Explicitly return undefined for `$$typeof` inside RuntimeSchedulerBinding.

React calls `$$typeof` on RuntimeScheduler. To make sure assert only triggers if unsupported value is requested, it needs to be explicitly handled

Reviewed By: mdvacca

Differential Revision: D27854472

fbshipit-source-id: 515c68d92b291cc274f5370c45e49302534e6f9c
2021-04-20 09:22:23 -07:00
Samuel Susla 090ab0a08d Fix typo in runtime scheduler mobile config
Summary:
Changelog: [internal]

Fix typo in runtime scheduler mobile config.

Reviewed By: mdvacca

Differential Revision: D27841843

fbshipit-source-id: fa76d5f49b37fa62a4b69e8e50a883aa98864e94
2021-04-20 09:22:23 -07:00
Samuel Susla a8d0dd6646 Implement task continuation
Summary:
Changelog: [internal]

Scheduler's callback have option to add more work inside callback. This work stays on top of the priority queue and gives React ability to flush all work synchronously if need.

This diff adds use of `shouldYield_` to the workLoop. For now, it always evaluates to false. In the future when we allow access to the scheduler to native, it will allow yielding.

Relevant code in JavaScript:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L190

Reviewed By: mdvacca

Differential Revision: D27823528

fbshipit-source-id: 016101e41eb7c41c2ac5abb55f803814867b8517
2021-04-20 09:22:23 -07:00
Samuel Susla ed76719f24 Pass hardcoded false argument to scheduled callbacks
Summary:
changelog: [internal]

Callback function in React is expecting a boolean parameter indicating whether the callback timed out. React team is removing it, that's why we only pass in hardcoded false.

Reviewed By: mdvacca

Differential Revision: D27794562

fbshipit-source-id: b96a7b31560524b8f38ad3bb0dbdb3b3b32ac97b
2021-04-20 09:22:23 -07:00
Samuel Susla 318e9f283e Execute multiple tasks within single dispatch
Summary:
Changelog: [internal]

This brings native scheduler close to React's scheduler. React's scheduler executes all tasks in the queue within a single dispatch (they use setTimeout(0) for dispatch) and makes sure to not schedule two dispatches.

Relevant JS code:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L359

Reviewed By: JoshuaGross

Differential Revision: D27793200

fbshipit-source-id: 4af13d95cfe4d33d0945f25929ccbea5f9ce5710
2021-04-16 08:16:41 -07:00
Héctor Ramos ae07c53d0b Resolve "fatal: not a git repository" error outside of git repositories
Summary:
CocoaPods will display a "fatal: not a git repository" when these podspecs are consumed within Facebook's internal Mercurial repository due to the reliance on `git` to obtain the current commit hash.

In these cases, the podspec is being consumed locally and the commit hash is unnecessary.

The error is removed by avoiding the use of `git` if the current working directory is not a git repository (or any of the parent directories).

Changelog:
[Internal] [iOS] - Remove CocoaPods error within Facebook's repository

Reviewed By: fkgozali

Differential Revision: D27750974

fbshipit-source-id: 99159611c580baf5526f116948c5ff60e1c02e5c
2021-04-15 13:30:31 -07:00
Joshua Gross bd1d4e9f4f StubViewTree: reenable asserts in Delete mutation path
Summary:
I had intended to make this change as part of the stack I landed earlier, but I had some poorly resolved merge conflicts that left this path disabled.

I verified that T76057501 no longer repros and ran unit tests.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27788467

fbshipit-source-id: 42148b887c6b3c0e815f1805e6bfb3ee58503e48
2021-04-15 11:22:19 -07:00
CodemodService FBSourceClangFormatLinterBot e6dc3717e9 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D27789747

fbshipit-source-id: ef4882e92d7755669083573c43ae6c5088bf01ab
2021-04-15 04:27:14 -07:00
Samuel Susla 8f3ffcf0bb Add unit tests for RuntimeScheduler::cancelTask
Summary:
Changelog: [internal]

Add unit tests for RuntimeScheduler::cancelTask

Reviewed By: JoshuaGross

Differential Revision: D27764482

fbshipit-source-id: 3833e49dd49865be4126bc5c3eb95a40d04bba99
2021-04-15 02:44:13 -07:00
Samuel Susla 4c1fd979a0 Add tests for RuntimeScheduler::scheduletTask and RuntimeScheduler::getShouldYield
Summary:
Changelog: [internal]

Add tests for `RuntimeScheduler::scheduleTask` and `RuntimeScheduler::getShouldYield`

Reviewed By: JoshuaGross

Differential Revision: D27764464

fbshipit-source-id: 8f95dfd9ec1ddf9a0ee17d489961b19e4ceaa9de
2021-04-15 02:44:13 -07:00
Samuel Susla e3a4de8b55 Add unit tests for RuntimeScheduler::now
Summary:
changelog: [internal]

Add unit tests for `RuntimeScheduler::now`

Reviewed By: JoshuaGross

Differential Revision: D27763852

fbshipit-source-id: 1edec8e8338e9d9798b95c55d07114be05f555b8
2021-04-15 02:44:13 -07:00
Samuel Susla eb49f95048 Bootstrap unit tests for RuntimeScheduler module
Summary:
changelog: [internal]

Create module for tests.

Reviewed By: JoshuaGross

Differential Revision: D27764408

fbshipit-source-id: 22681c99d64666bb3a04e961ceeba470062abc51
2021-04-15 02:44:12 -07:00
Joshua Gross dc80b2dcb5 Add mounting layer test that stress-tests differ on (un)flattening
Summary:
Add mounting layer test that stress-tests differ on (un)flattening.

This fails before D27759380 and D27730952, and passes after.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27767219

fbshipit-source-id: a7e186e510f95792da6f98f80fcae5ff8ac74775
2021-04-14 19:50:10 -07:00
Joshua Gross d1b1e8b80d Differ: ensure all ShadowViews generated by differ have correct LayoutMetrics
Summary:
While I think this was a very marginal bug with no known issues in the wild, incorrect layout values were sometimes being propagated to certain nodes. This would only occur during complex nested (un)flattening operations and may only impact node consistency, specifically with setting the "previous" ShadowView of mutation instructions, specifically REMOVE and DELETE. Even in rigorous testing I had trouble hitting this case and it didn't seem to impact the "next" values in CREATE, INSERT, or UPDATE.

The issue: previously `sliceChildShadowNodeViewPairsV2` assumed that the node it's operating on is a child of a non-flattened view, and the baseline origin is `{0,0}`. You can see when `sliceChildShadowNodeViewPairsRecursivelyV2` is called, a `layoutOffset` is passed in. If we ever got a list of a node that was in a flattened parent by calling `sliceChildShadowNodeViewPairsV2`, we would incorrectly assume that baseline layoutOffset for the node is `0,0`.

Now, we store the layoutOffset in the ShadowViewNodePair and can retrieve it when getting child pairs of a node.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D27759380

fbshipit-source-id: a89756190a1cb377bcc55ff31799c2afbaecdaa9
2021-04-14 19:50:10 -07:00
Joshua Gross c22b874fd6 Differ: ensure ownership of all ShadowView/ShadowNode pairs, ensure consistency of nodes
Summary:
Previously, `ShadowViewNodePair::List` owned each `ShadowViewNodePair` but whenever we put `ShadowViewNodePair` into a TinyMap, those were unowned pointer references. This worked... 99% of the time. But in some marginal cases, it would cause dangling pointers, leading to difficult-to-track-down issues. So, I'm moving both of these to be unowned pointers and keeping a `std::deque` that owns all `ShadowViewNodePair`s and is itself owned by the main differ function. See comments for more implementation details. I'm moderately concerned about memory usage regressions, but practically speaking this will contain many items when a tree is created for the first time, and then very few items after that (space complexity should be similar to `O(n)` where `n` is the number of changed nodes after the last diff).

See comments as to why I believe `std::deque` is the right choice. Long-term there might be data-structures that are even more optimal, but std::deque has the right tradeoffs compared to other built-in STL structures like std::list and std::vector, and is probably better than std::forward_list too. Long-term we may want a custom data-structure that fits our needs exactly, but std::deque comes close and is possibly optimal.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27730952

fbshipit-source-id: 2194b535439bd309803a221188da5db75242005a
2021-04-14 19:50:10 -07:00
Joshua Gross b9828a8afa Differ: fix edge-case where we "REMOVE" an older version of a ShadowNode
Summary:
I am fixing an extremely marginal case that probably impacts nothing in production, but in theory, could - see next diff in stack for the assert that is being hit.

TL;DR in marginal, complex cases with a lot of un/flattening, we can generate the following sequence of mutations:

```
UPDATE node V1 -> V2
REMOVE node V1
```

That is incorrect, and what we actually want is:

```
UPDATE node V1 -> V2
REMOVE node V2
```

While this, again, impacts /nothing/ in prod that we know of, it would be good to get this correct so that we can enable stricter asserts (see next diff).

This will also help with debugging LayoutAnimations.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27697788

fbshipit-source-id: 47f34fe3e8107167b3df4db841d2cc14c58cb31d
2021-04-14 19:50:09 -07:00
Joshua Gross 39b8233c93 Copy Differ implementation to new file, feature-flag-gate new differ
Summary:
Changes in following diffs will be gated by this feature flag.

The differ in the new file is copied from the current stable implementation and will not be modified until it's deleted.

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D27775698

fbshipit-source-id: 03d9518ffd2b1f25712386c56a38bd2b4d839fc2
2021-04-14 19:50:09 -07:00
Joshua Gross 5eba5c11b0 Differ: improvements to logging
Summary:
First, I make the breadcrumbs mechanism (landed just this week) more readable - I forgot to add separators between the breadcrumbs.

Second, there is a path that I am 99% sure we never hit. I've had comments to that effect for a ~year, but now I'm adding a falsey assert. If we don't hit it in prod after a few months I'll be more comfortable just deleting the branch entirely (while probably keeping the assert).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27697786

fbshipit-source-id: 6d74d1703b2212d069fbed510f2655ec17294458
2021-04-14 19:50:09 -07:00
Joshua Gross c83562eb1c StubViewTree: move assert to get better debug logging
Summary:
Move this assert so the debug logging executes first; in the case where this assert fires, we'll get a little more information (for Android, where attaching a Cxx debugger is a bit harder vs iOS).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27585132

fbshipit-source-id: e3f4cc3d78587744b9e73db685eda1fd6c36ca9d
2021-04-14 19:50:09 -07:00
Joshua Gross 2d7560d7b9 StubViewTree: enable stricter REMOVE asserts
Summary:
With all known remaining issues (outside of LayoutAnimations, potentially) resolved, enable this assert.

Note for future readers: this is the first time this particular assert has EVER been enabled widely, so if we hit this assert in dev, it's great signal for debugging BUT does not necessarily indicate any wide-spread problems in prod, or with any subsystems. This will simply help us become "more correct" over time.

It is possible, but not extremely likely, that cleaning up things that cause this assert will improve stability/crashes.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27697787

fbshipit-source-id: 28fa34eba70548f5001bbd47f41dbe3c6ff3b4c1
2021-04-14 19:50:09 -07:00
Peter Argany 9729d4dfeb Revert a small change to UIManagerBinding
Summary:
Changelog: [Internal]

This reverts a small change from D26885562 (https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624). I'm not sure if this change was made intentionally (feel free to reject this diff if it was luluwu).

Before D26885562 (https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624), if `RN$Bridgeless` was truthy and `RN$stopSurface` was falsey, then the function returned. After D26885562 (https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624), it ran the else clause (which shouldn't be run in bridgeless mode IIUC).

Reviewed By: mdvacca

Differential Revision: D27751583

fbshipit-source-id: daaf5c72fec11f4b2e21d1d2926a5026b984461f
2021-04-14 10:37:50 -07:00
Joshua Gross 88c3090066 Correct LayoutMetrics comparison and make debuggable
Summary:
Allow conversion of LayoutMetrics to DebuggableString.

We also skipped a field in comparison. It probably isn't impactful in terms of production issues, but still wasn't correct.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27709451

fbshipit-source-id: 987fc2de0a4562a295d6cbeffdd922cbf056b811
2021-04-14 09:41:41 -07:00
Samuel Susla 06753d431a Add expiration date to Task and use it to determine priority
Summary:
Changelog: [internal]

To prevent starvation, this diff implements expiration time as a way to order tasks in priority queue. This stops higher priority tasks from preventing lower priority tasks from running. The same mechanism is implemented in [JavaScript's scheduler](https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js).

Reviewed By: mdvacca

Differential Revision: D27707887

fbshipit-source-id: 3dc734c856a166ef5c17c5045ebd429565ba79f0
2021-04-14 02:53:24 -07:00
Samuel Susla 240588b6d4 Implement RuntimeScheduler::now
Summary:
Changelog: [internal]

Implement RuntimeScheduler::now and exposite it to JavaScript. JavaScripts expects miliseconds and is using `performance.now()` call to get this value.

More about `performance.now()`: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
JavaScript implementation in Scheduler: https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L71-L82

Reviewed By: JoshuaGross

Differential Revision: D27675512

fbshipit-source-id: bce5ac700e71b1722cd280dfbdd15e141783a3a5
2021-04-14 02:53:24 -07:00
Samuel Susla 52f1d54509 Add implementation for requestPaint
Summary:
Changelog: [internal]

requestPaint is unimplemented on JavaScript scheduler:

https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L445

Reviewed By: mdvacca

Differential Revision: D27651947

fbshipit-source-id: 1e3cece8cbcd330f2408887ceb283ca61374f5bd
2021-04-14 02:53:23 -07:00
Samuel Susla cc3e87c45b Implement RuntimeScheduler::getShouldYield
Summary:
Changelog: [internal]

Implement RuntimeScheduler::getShouldYield and expose it through JSI.
For now we are only returning `false`. The value is backed by atomic_bool and in the future we will be able to indicate that React should yield to native.

JavaScript implementation:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L439-L441

Reviewed By: JoshuaGross

Differential Revision: D27648579

fbshipit-source-id: b9313e2efbd9daae8975357df9de803f24a35e89
2021-04-14 02:53:23 -07:00
David Vacca aee07e1203 Integrate react_native_asserts into mapbuffer
Summary:
Integrate react_native_asserts into mapbuffer

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D27753092

fbshipit-source-id: dbeb7f140f3096c8153e2f6bced4e4d9d88b48b8
2021-04-13 21:32:17 -07:00
Samuel Susla 08ef1df1ba Implement RuntimeScheduler::cancelTask
Summary:
Changelog: [internal]

Implement RuntimeScheduler::cancelTask and expose it through JSI.

JavaScript implementation:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L384-L397

Reviewed By: mdvacca

Differential Revision: D27648071

fbshipit-source-id: 91ae92b336017596fb658831824e971c7e047cd2
2021-04-13 01:55:04 -07:00
Samuel Susla 3c14c196ca Add return value to RuntimeScheduler unstable_scheduleCallback
Summary:
Changelog: [internal]

unstable_scheduleCallback needs to return reference to the created task so it can be cancelled later.

Reviewed By: mdvacca

Differential Revision: D27622779

fbshipit-source-id: 54160015c7f98e123d08c2e13efac4f498d3ba5e
2021-04-13 01:55:04 -07:00
Samuel Susla 2779129434 Add minimal implementation of RuntimeScheduler::scheduleTask
Summary:
Changelog: [internal]

Add minimal implementation of schedule task. More features and proper scheduling will be added later.

Reviewed By: mdvacca

Differential Revision: D27622138

fbshipit-source-id: b2e4623d38e7217290a6a3c59ccc10a1c13e3a4f
2021-04-13 01:55:04 -07:00
Samuel Susla 71b5178230 Make glog exported depencency of debug module
Summary:
Changelog: [internal]

`glog` needs to be exported dependency because it is used in public headers.

Reviewed By: mdvacca

Differential Revision: D27617632

fbshipit-source-id: 91aa27b641286002a80a8cd5ef2e6fe6c266b452
2021-04-13 01:55:03 -07:00
Samuel Susla 8d5c22edfd Add runtime scheduler priorities
Summary:
Changelog: [internal]

Add runtime scheduler priorities

Reviewed By: JoshuaGross

Differential Revision: D27618305

fbshipit-source-id: 95e4e02f3473acb41bca0c22df7b271a8d710f34
2021-04-13 01:55:03 -07:00
Andrei Shikov a17e3cf893 Avoid mounting tree on mode change if it wasn't commited
Summary:
Changelog: [Internal]

Calls to `surfaceHandler.start()` and `setDisplayMode(DisplayMode::Visible)` in quick succession on different threads can cause a race condition between mount and commit operations.

The mountingCoordinator will try to mount an empty revision without any commits causing it to fail with:
```
TransactionTelemetry.cpp:108: function getCommitStartTime: assertion failed (commitStartTime_ != kTelemetryUndefinedTimePoint)
```
which is called from [Binding.cpp](https://www.internalfb.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp?lines=791-791&blame=1).

This change avoids this initial commit by verifying we had at least 1 revision commited before mounting it.

Reviewed By: sammy-SC

Differential Revision: D27430174

fbshipit-source-id: d208d55f02cd218a316d6fea62d0106c2bcb4be8
2021-04-12 13:17:52 -07:00
David Vacca b28ddede7b Transfer 'DisplayMode' value from Native -> JS
Summary:
This diff adds a new variable called "DisplayMode" into SurfaceHandler.cpp and FacebookAppRouteHandler.js. The purpose of DisplayMode is for the native pre-render system to notify React that the a surface is either being "pre-rendered" or "rendered"

When the surface is being "pre-rendered" (displayMode == "SUSPENDED"), react will create and commit React Trees, but it will not execute use-effect callbacks

When the surface is being "rendered" (displayMode == "VISIBLE"), react will create and commit React Trees and it will not execute all use-effect callbacks that weren't executed during "pre-rendering"

By default surfaces are going to be rendered with displayMode == "VISIBLE".

This diff should not create any change of behavior for now, this is the infra required to integrate the new offScreen API the react team is working on for pre-rendering system

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D27614664

fbshipit-source-id: f1f42fdf174c2ffa74174feb1873f1d5d46e7a95
2021-04-12 00:05:43 -07:00
David Vacca bdb9a1e094 Add displayMode parameter into startSurface and setSurfaceProps methods
Summary:
This diff extends startSurface and setSurfaceProps methods with the new parameter called displayMode

changelog: [internal] internal

Reviewed By: yungsters

Differential Revision: D27669847

fbshipit-source-id: c2ddb690ca897e46e00f07b491b91bb2bc8e847d
2021-04-12 00:05:43 -07:00
David Vacca 2793bba278 Move DisplayMode out of SurfaceHandler
Summary:
This diff moves DisplayMode out of SurfaceHandler, this is necessary in order to use it from react/uimanager package

changelog: [internal] internal

Reviewed By: ShikaSD

Differential Revision: D27669846

fbshipit-source-id: 274869d8f2907b1b159f51240440acece09a746f
2021-04-12 00:05:43 -07:00
David Vacca e7b52d7b0b Update initial props when DisplayMode changes in Fabric
Summary:
This diff updates initial props when DisplayMode changes in Fabric. This method will be called during pre-rendering.

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D27607586

fbshipit-source-id: 7625943d57a786d6dfe30dd893e27704f51826d2
2021-04-12 00:05:43 -07:00