Commit Graph

1024 Commits

Author SHA1 Message Date
Christoph Purrer 7c82a3fa11 Add enum example to Android/iOS rn-tester TurboModule (#35133)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35133

Add enum example to Android/iOS rn-tester TurboModule

Changelog:
[General][Added] - Add enum example to Android/iOS rn-tester TurboModule

Reviewed By: javache, cipolleschi

Differential Revision: D40711269

fbshipit-source-id: c8ad6fb7dee40b45b696660cc4d78921edafd8a1
2023-02-08 22:49:30 -08:00
Samuel Susla 2e3f55aced Pass MountingCoordinator by value instead of reference
Summary:
changelog: [internal]

Passing MountingCoordinator argument by value instead of reference. Using reference does not make sense since we eventually take ownership of shared_ptr anyway. This better communicates the intent.

Reviewed By: christophpurrer

Differential Revision: D43082955

fbshipit-source-id: 29e20abb9824c10a5f0d5e0ba1049ff6d67cee98
2023-02-08 15:48:17 -08:00
Samuel Susla 56cb19f419 Remove default arguments from ShadowTree::commit and ShadowTree::tryCommit
Summary:
Changelog: [Internal]

Caller needs to explicitly set commit options. This is for readability and making sure caller is aware of what are the options of the commit. This will be important in subsequent diff where we will add another commit option.

Reviewed By: christophpurrer

Differential Revision: D43082837

fbshipit-source-id: 1417205299c19430f902453c2b6d9bb9ca31707d
2023-02-08 06:58:33 -08:00
Deepak Jacob 9d98e2cb07 Revert D41273822: Add fabric support for maintainVisibleContentPosition on iOS
Differential Revision:
D41273822 (https://github.com/facebook/react-native/commit/ecf967a51d358f3759acbf7795675f52d7190280)

Original commit changeset: 7900898f2828

Original Phabricator Diff: D41273822 (https://github.com/facebook/react-native/commit/ecf967a51d358f3759acbf7795675f52d7190280)

fbshipit-source-id: 0f4b9695c805407b9a41b0fec63784bd0e84be43
2023-02-07 13:06:38 -08:00
Janic Duplessis ecf967a51d Add fabric support for maintainVisibleContentPosition on iOS (#35319)
Summary:
This adds support for the `maintainVisibleContentPosition` in iOS fabric. This was previously only implemented in the old renderer. The implementation is very similar to what we currently have.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[iOS] [Added] - Add fabric support for maintainVisibleContentPosition on iOS

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

Test Plan:
Test in RN tester example.

https://user-images.githubusercontent.com/2677334/201484543-f7944e34-6cb7-48d6-aa28-e2a7ccdfa666.mov

Reviewed By: sammy-SC

Differential Revision: D41273822

Pulled By: jacdebug

fbshipit-source-id: 7900898f28280ff01619a4af609d2a37437c7240
2023-02-07 02:54:06 -08:00
Ruslan Shestopalyuk 82a7968d09 Remove duplication of default field values in iterator-based prop parsing (#36051)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36051

[Changelog][Internal]

This has been on my backlog for some time, submitting the diff to get it out of the way.

It makes the macro-based code in the "iterator-based property parsing" branch somewhat less horrible and less error prone (by removing duplication vs the default values in the class declaration).

Reviewed By: sammy-SC

Differential Revision: D42990595

fbshipit-source-id: e4b91160c6e09d3d1eab2ba70a58d390243bb335
2023-02-03 05:54:47 -08:00
Nicola Corti 147a1f6619 Add macro to detect circular dependencies on Cmake
Summary:
This is a prototype to add circular dependencies detection on CMake for ReactCommon and ReactAndroid.
It can be enabled per module and works as follows:

```
set(ALLOWED_HEADER_IMPORT_PATHS
        react/renderer/graphics
        react/debug)
check_for_circular_dependencies("${ALLOWED_HEADER_IMPORT_PATHS}")
```

The allowed header import path must be manually specified as libraries are exposing wrong header search paths (so can't be reused).
The CI will be red till the circular dependency on `graphics` is resolved.

Changelog:
[Internal] [Changed] - Add macro to detect circular dependencies on Cmake

Reviewed By: cipolleschi

Differential Revision: D42927036

fbshipit-source-id: b1393dfd43fd042e2ebf1d5b46b24bd9f5e20d58
2023-02-02 09:23:55 -08:00
gabrieldonadel 597a1ff60b feat: Add logical border block color properties (#35999)
Summary:
This PR implements logical border block color properties as requested on https://github.com/facebook/react-native/issues/34425. This implementation includes the addition of the following style properties

- `borderBlockColor`, equivalent to `borderTopColor` and `borderBottomColor`.
- `borderBlockEndColor`, equivalent to `borderBottomColor`.
- `borderBlockStartColor`, equivalent to `borderTopColor`.

## Changelog

[GENERAL] [ADDED] - Add logical border block color properties

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

Test Plan:
1. Open the RNTester app and navigate to the `View` page
2. Test the new style properties through the `Logical Border Color` section

<table>
<tr>
    <td>Android</td>
    <td>iOS</td>
</tr>
  <tr>
    <td><video src="https://user-images.githubusercontent.com/11707729/215384882-5b96518e-ad70-4157-a7f3-130f488cc41c.mov"  alt="1" width="360px"   />
    </td>
<td>
<video src="https://user-images.githubusercontent.com/11707729/215392728-cfc6a097-26c1-4ffe-ab0e-f0a5a71a902d.mov"2" width="360px"  />
</td>
   </tr>
</table>

Reviewed By: cipolleschi

Differential Revision: D42849911

Pulled By: jacdebug

fbshipit-source-id: 822cff5264689c42031d496105537032b5cd31ef
2023-01-31 10:58:24 -08:00
Genki Kondo d3cc48d9a6 Add codegen support for DimensionValue for components (#35953)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35953

DimensionValue is a reserved prop type that can be a number or string (such as '50%'). On Java, it will get converted to a YogaValue (converter added to this diff); on C++ it will get converted to a YGValue (converter already exists as it's used in Fabric).

Changelog:
[Internal][Added] - Add codegen support for DimensionValue for components

Reviewed By: cipolleschi

Differential Revision: D42650799

fbshipit-source-id: 1d2bc30bbd93837dedbbb4c74f814963c8140957
2023-01-26 18:52:10 -08:00
Samuel Susla 6f7428e27b Delete feature flag enable_simulate_image_props_memory_access
Summary:
changelog: [internal]

Clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709723

fbshipit-source-id: 289697dfb0c0378ff0369e1474150f7be68c8635
2023-01-25 05:43:38 -08:00
Samuel Susla 8863be41b1 Delete feature flag enable_crash_on_missing_component_descriptor
Summary:
changelog: [internal]

Clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709724

fbshipit-source-id: a124015783983dea28db31a4431183f5c30a30e7
2023-01-25 05:43:38 -08:00
Samuel Susla 51c03a0880 Delete feature flag react_fabric:enabled_skip_invalidated_key_frames_ios
Summary:
changelog: [internal]

clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709640

fbshipit-source-id: f64bb0eac67744dec321160c1cbe945e2dd74068
2023-01-25 05:43:38 -08:00
Samuel Susla 0a30aa3612 Enable layout animations on iOS in OSS
Summary:
changelog: Enable Layout Animations on iOS

[LayoutAnimations](https://reactnative.dev/docs/next/layoutanimation) in New Architecture have been disabled in OSS on iOS because of unresolved crash. This crash only happens rarely. Turning on LayoutAnimations in OSS should be safe and brings New Architecture to parity with old.

Reviewed By: fkgozali

Differential Revision: D42708774

fbshipit-source-id: b0f7febee3aa4f0ddac25556644198ebe79378c1
2023-01-25 05:43:38 -08:00
Ruslan Lesiutin 465e937533 internalize Slider module (#35825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35825

Changelog:
[iOS][Removed] - removed Slider module
[Android][Removed] - removed Slider module

Reviewed By: cortinico

Differential Revision: D42394124

fbshipit-source-id: 92ba3bc50d16996a597148fa2f8178e6bd6d8eb7
2023-01-16 02:42:18 -08:00
Wojciech Lewicki 97c7c6a4b6 fix: dispatch ContentSizeChange event on Fabric on iOS (#35816)
Summary:
On Fabric, `onContentSizeChange` of `TextInput` component was never fired on `iOS`, since the logic dispatching it was implemented in `RCTBaseTextInputShadowView` on Paper: https://github.com/facebook/react-native/blob/0f8dc067ac079f7b14696cfcafa37e3ec19a0409/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m#L105. This class is not used on Fabric, therefore the event was never dispatched. On Paper, it was dispatched in `dirtyLayout` method,  so I added dispatching of this event based on the change of content size in `layoutSubviews` method, since this method seems the closest one on Fabric. I am not sure if it is the best place for it though.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [ADDED] - dispatch `onContentSizeChange` event on Fabric.

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

Test Plan:
Try to use `onContentSizeChange` callback in `TextInput` component:
```tsx
import React from 'react';
import {TextInput, SafeAreaView} from 'react-native';

const App = () => {
  return (
    <SafeAreaView style={{flex: 1, backgroundColor: 'red'}}>
      <TextInput
        multiline={true}
        placeholder="type here"
        onContentSizeChange={e => console.log(e)}
      />
    </SafeAreaView>
  );
};

export default App;

```

Reviewed By: christophpurrer

Differential Revision: D42499974

Pulled By: sammy-SC

fbshipit-source-id: 3e010ff096cf91cb3e7b87ed2753e9d0e7be9650
2023-01-13 09:34:03 -08:00
Ruslan Lesiutin ac66512eb3 Revert D41069547: Multisect successfully blamed D40984397 for test or build failures (#35789)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35789

Changelog: [Internal]

This diff is reverting D41069547 (https://github.com/facebook/react-native/commit/fee9510b2d8ff73be632dbe6f07003f001104836) D41062668 (https://github.com/facebook/react-native/commit/4c40014d43abe88b17db75aca9de9cca349ecbcc) D40984397 (https://github.com/facebook/react-native/commit/05968d16e1c4714a7ebfb08fff60ec7d5c914de1)
D40984397 (https://github.com/facebook/react-native/commit/05968d16e1c4714a7ebfb08fff60ec7d5c914de1) has been identified to be causing the following test or build failures:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

allow-large-files

Differential Revision: D42371475

fbshipit-source-id: daa01c9215811c397f5cef958fd4620f36295b60
2023-01-06 13:06:17 -08:00
Nishan 5a912ccc09 fix: margin auto conversion in fabric (#35635)
Summary:
Auto margin is not working as expected in fabric views. Below snippet results in different outputs in fabric and non-fabric runtime.

```jsx
<View style={{ backgroundColor: "black", width: "100%", height: "100%" }}>
  <View style={{ marginLeft: "auto", width: 100, height: 100, backgroundColor: "pink" }} />
</View>
```
### Current Result | Expected Result

<div style="display: flex;">
<img width="100" alt="Screenshot 2022-12-14 at 11 00 22 AM" src="https://user-images.githubusercontent.com/23293248/207513912-633910e2-cf92-4f50-b839-c5abfa8041fb.png">

<img width="100" alt="Screenshot 2022-12-14 at 10 55 31 AM" src="https://user-images.githubusercontent.com/23293248/207513196-94650c60-ffe5-4475-9a95-2a59f8f0e9d9.png">
</div>

## Issue

This issue doesn't happen on non-fabric as it uses [YGNodeStyleSetMarginAuto](https://github.com/facebook/react-native/blob/9f9111bd7b75fb5f60b74b127b417512e29afb67/ReactCommon/yoga/yoga/Yoga.cpp#L749) to set the auto margins. In fabric, it uses the [convert function](https://github.com/intergalacticspacehighway/react-native/blob/2a15f9190266d90abbe3fc7e5437ea77e99e4290/ReactCommon/react/renderer/components/view/conversions.h#L375). The change in this PR can affect some other styles e.g. padding, borders. We could also create a different setter just for margins.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[GENERAL] [FIXED] - margin auto style conversion in fabric

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

Test Plan:
- Test above snippet in fabric and non fabric runtime.

- I think we should have test cases for RN + layouts. Maybe we can use something like https://github.com/FormidableLabs/react-native-owl

Reviewed By: sammy-SC

Differential Revision: D42080908

Pulled By: NickGerleman

fbshipit-source-id: 6715c292fc40d82c425d79867099d8a6a3663dba
2023-01-06 10:13:00 -08:00
Gabriel Donadel Dall'Agnol 4ae4984094 feat: Add logical border radius implementation (#35572)
Summary:
This PR implements logical border-radius as requested on https://github.com/facebook/react-native/issues/34425. This implementation includes the addition of the following style properties

- `borderEndEndRadius`, equivalent to `borderBottomEndRadius`.
- `borderEndStartRadius`, equivalent to `borderBottomStartRadius`.
- `borderStartEndRadius`, equivalent to `borderTopEndRadius`.
- `borderStartStartRadius`, equivalent to `borderTopStartRadius`.

## Changelog

[GENERAL] [ADDED] - Add logical border-radius implementation

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

Test Plan:
1. Open the RNTester app and navigate to the `RTLExample` page
2. Test the new style properties through the `Logical Border Radii Start/End` section

https://user-images.githubusercontent.com/11707729/206623732-6d542347-93f9-40da-be97-f7dcd5f66ca9.mov

Reviewed By: necolas

Differential Revision: D42002043

Pulled By: NickGerleman

fbshipit-source-id: a0aa9783c280398b437aeb7a00c6eb3f767657a5
2023-01-06 06:00:03 -08:00
Ruslan Shestopalyuk 7252c66292 Optimize size of an ViewProps instance by reducing enum storage sizes
Summary:
[Changelog][Internal]

The diff changes underlying storage types used by different enums that are used in ViewProps data structure, together with some eventual field rearranging to reduce padding overhead.

This **shaves off 128 bytes** from each `ViewProps` instance, which is **a ~10% improvement**.

Given that an average RN app may have thousands of shadow tree nodes, and correspondingly `ViewProps` instances in flight (e.g. Oculus Store has 2-3K of them nominally), the overall memory win is about **300K+** for this change only. Plus slightly better cache locality, which never a bad thing either.

Reviewed By: mdvacca

Differential Revision: D42372127

fbshipit-source-id: d3a832af2b2e89f50a5b8e04d24d0df92869ea4d
2023-01-05 23:35:56 -08:00
Moti Zilberman 5009ad33a6 Make MapBuffer movable
Summary:
Changelog: [Internal]

`MapBuffer` already has a move constructor but did not have a move assignment operator prior to this diff. Changing this requires removing the `const` qualifier from `bytes_`, but this seems OK in practice as it will still be treated as `const` by all the `const` accessors on `MapBuffer`.

Reviewed By: RSNara

Differential Revision: D42369493

fbshipit-source-id: f0fcce533d8e0883dcf85d7262620ea77f377644
2023-01-05 12:38:41 -08:00
fabriziobertoglio1987 dcc5dbe562 adding togglebutton to attributedstring conversions (#35632)
Summary:
fixes runtime error `E/ReactNativeJNI(24576): Unsupported AccessibilityRole value: togglebutton` when using togglebutton accessibilityRole with Text. Related https://github.com/fabriziobertoglio1987/react-native/commit/da899c0cc4372830e5ca053a096b74fff2a19cb8

## Changelog

[GENERAL] [FIXED] - Fixes crash when using togglebutton accessibilityRole with Text

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

Reviewed By: lunaleaps

Differential Revision: D42360628

Pulled By: rshest

fbshipit-source-id: afca8f540d972e1df0c390b3dff8875f07804e97
2023-01-05 12:11:46 -08:00
Ruslan Lesiutin 4c40014d43 refactor(ReactNative/Slider): moved android sources to internal
Summary:
# Changelog:
[Android][Removed] - removed android sources of Slider module

Reviewed By: NickGerleman

Differential Revision: D41062668

fbshipit-source-id: fe628527f757d4fefa8ecf2c0c952aaf8d4acec2
2023-01-05 06:12:47 -08:00
Ruslan Shestopalyuk 55db1b23ff Better event mapping handling in prop setter (#35775)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35775

[Changelog][Internal]

Follow-up to D42344715 (https://github.com/facebook/react-native/commit/f70a2f6e3857f9e9d1f2ab9b6847fe318e67bd78).

I realized that the problem that was fixed there could have been avoided, to begin with, by crafting the corresponding macro more carefully.

This gives both more readable and less fragile code.

Reviewed By: mdvacca

Differential Revision: D42345323

fbshipit-source-id: d4b6d5a95aab360ef0aac3ecb0f157d5325271b6
2023-01-05 02:59:37 -08:00
Ruslan Shestopalyuk f70a2f6e38 Fix mapping of the "onResponderMove" event via props parsing (#35772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35772

[Changelog][Internal]

Noticed when looking into the events handling code - this looks like a copy/paste error, presumably introduced in D37050215 (https://github.com/facebook/react-native/commit/47280de85e62f33f0b97bc1ed7c83bc6ca0dc7d4).

The correct event name is `onResponderMove`, as evident from all other places in code and the documentation.

Reviewed By: sammy-SC

Differential Revision: D42344715

fbshipit-source-id: fbf1648efaee696edcc7c945ebc0e8423246138b
2023-01-04 14:09:44 -08:00
Ruslan Shestopalyuk 09ad0cc0c6 Implement reporting of events from native side to WebPerformance API (#35768)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35768

Changelog: [Internal]

This implements native side mechanics for reporting user events timing to JS  (PerformanceObserver API).

See the standard for more details: https://www.w3.org/TR/event-timing/

The events are only logged when there are any active subscriptions (via `PerformanceObserver.observe`), also we only log "discrete events" (i.e. no likes of mouse move), so the overhead is non-existing.

There are two main metrics of interest for an event lifecycle:
* Time the event is spent in the queue, i.e. the time between it's created and dispatched
* Time that is spend in the event handler on the JS side (event dispatch), or processing time

Both of these are measured, and the corresponding fields are populated.

Reviewed By: sammy-SC

Differential Revision: D42294947

fbshipit-source-id: 4fd7938c04b942400befa4057d4929fb2763cee1
2023-01-03 11:11:37 -08:00
Tomek Zawadzki 292268ea3f Eliminate double call of shadowNodeFromValue in dispatchCommand (#35695)
Summary:
This PR slightly improves the implementation of `dispatchCommand` method of `UIManagerBinding` to use existing variable `shadowNode` instead of calling `shadowNodeFromValue` again.

## Changelog

[INTERNAL] [CHANGED] - Eliminated double call of `shadowNodeFromValue` in `dispatchCommand`

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

Test Plan: Launch RNTester with Fabric enabled and check if `scrollTo` or some other command works properly.

Reviewed By: christophpurrer

Differential Revision: D42233216

Pulled By: robhogan

fbshipit-source-id: db152206060ff599962f47c43fda8ea797f2a8cb
2023-01-03 03:07:13 -08:00
Ruslan Shestopalyuk 673d7e81a2 Avoid using shared_ptr when forwarding arguments in AsyncCallback (#35731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35731

[Changelog][Internal]

The initial intent was to try and use `unique_ptr` instead of `shared_ptr`, however turns out it complicates code more than it's worth it, so I ended up just factoring the repeated complex parts of the corresponding code to make it easier to reason about.

Reviewed By: christophpurrer

Differential Revision: D42265274

fbshipit-source-id: 105f57b449934c2e3227e592a76036ca7f61bc35
2022-12-28 10:29:23 -08:00
Samuel Susla 874881e73e Bring setNativeProps to Fabric
Summary:
changelog: [internal]

This is experimental implementation of `setNativeProps` in Fabric.

This diff brings `setNativeProps` to Fabric to make migration easier. I tried to stay as close as possible to Paper's behaviour, with all of its flaws (ready CAUTION section on https://reactnative.dev/docs/direct-manipulation)

State can't be stored in views because on iOS, eventually on Android, views are not the source of truth, shadow tree is. Fabric's implementation keeps state from setNativeProps in shadow node family in very inefficient data structure folly::dynamic. It is always reconciled with new prop updates. The performance cost is only paid in case node has used `setNativeProps` before.

Reviewed By: mdvacca

Differential Revision: D41875413

fbshipit-source-id: 453a5f7612a6f86a4cece269b13bd2ffd0c0e2d1
2022-12-24 06:40:42 -08:00
Gabriel Donadel Dall'Agnol 9669c10afc feat: Add Fabric implementation of inset logical properties (#35692)
Summary:
This PR implements `inset` logical properties as requested on https://github.com/facebook/react-native/issues/34425. This implementation includes the addition of the following style properties

- `inset`, equivalent to `top`, `bottom`, `right` and `left`.
- `insetBlock`, equivalent to `top` and `bottom`.
- `insetBlockEnd`, equivalent to `bottom`.
- `insetBlockStart`, equivalent to `top`.
- `insetInline`, equivalent to `right` and `left`.
- `insetInlineEnd`, equivalent to `right` or `left`.
- `insetInlineStart`, equivalent to `right` or `left`.

## Changelog

[GENERAL] [ADDED] - Add Fabric implementation of inset logical properties

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

Test Plan:
1. Open the RNTester app and navigate to the `View` page
2. Test the new style properties through the `Insets` section

<table>
<tr>
    <td>Android</td>
    <td>iOS</td>
</tr>
  <tr>
    <td><img src="https://user-images.githubusercontent.com/11707729/208821212-fbbac6ed-09a4-43f4-ba98-dfd2cbabf044.png"  alt="1" width="360px"   />
    </td>
<td>
<img src="https://user-images.githubusercontent.com/11707729/208816997-ef044140-8824-4b1b-a77b-085f18ea9e0e.png" alt="2" width="360px"  />
</td>
   </tr>
</table>

Reviewed By: NickGerleman

Differential Revision: D42193661

Pulled By: ryancat

fbshipit-source-id: 3db8bcd2c4db0ef4886b9ec49a46424d57362620
2022-12-21 20:07:35 -08:00
Ruslan Shestopalyuk 33324b8d91 Add uint32_t as accepted data type for bridging communication
Summary:
Add `uint32_t` as a valid type for communication between C++ and JS via bridging.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D42008412

fbshipit-source-id: 2c038e37745782b677d28bcbe4cc030683b74286
2022-12-14 09:02:55 -08:00
Xin Chen cf9c7d51ef Fix edge case when delete is queued with conflict layout animation
Summary:
This is a two step (1/2) fix to a race that could caused a `DELETE`...`CREATE` mutations being sent over to the fabric mounting layer. Such combination was assumed not possible from the differ, yet it happened at least in the existence of layout animation and when certain commits happen while animation is active.

This race condition could cause a view to get deleted at the end of one UI frame, yet the mount instructions generated from animation in the next frame still need to access the deleted view and caused crashes like T112157805. Note that even though such crash is recorded as `RetryableMountingLayerException` and is a soft crash (which only gets logged but not crash in production), the out-of-order mount instructions could lead to illegal view state and make the surface unusable, like what's shown here:

{F820669000}

The diff fixes this issue by removing the `DELETE` [conflict animation](https://fburl.com/code/5ctckvz3) keyframe, as well as the `CREATE` [immediate mutations](https://fburl.com/code/txyomytd) from the layout animation. The Fabric mounting layer assumes no combination of `DELETE...CREATE` in the same frame from differ + [layout animation overrides](https://fburl.com/code/zn17uqch).

Reviewed By: sammy-SC

Differential Revision: D41895427

fbshipit-source-id: d6df02663ba707af6db4a63a325ac776ca54d18e
2022-12-13 01:17:37 -08:00
Samuel Susla 1d3fa40c59 Add setNativeProps to Fabric
Summary:
changelog: Introduce setNativeProps to Fabric

Add support for `setNativeProps` in Fabric for backwards compatibility. It is still recommended to move away from `setNativeProps` because the API will not work with future features.

We can make step [Migrating off setNativeProps](https://reactnative.dev/docs/new-architecture-library-intro#migrating-off-setnativeprops) in migration guide optional.

Reviewed By: yungsters, mdvacca

Differential Revision: D41521523

fbshipit-source-id: 4d9bbd6304b8c5ee24a36b33039ed33ae1fc21f8
2022-12-06 04:47:51 -08:00
Samuel Susla 86786f1d22 Introduce FabricUIManager.findShadowNodeByTag_DEPRECATED
Summary:
changelog: [internal]

Add findShadowNodeByTag_DEPRECATED` to Fabric's UIManager.
This API makes it possible to get ShadowNode reference for given native tag.
We will leverage this API to make UIManager.measure* calls backwards compatible in the new architecture.

Reviewed By: yungsters

Differential Revision: D41550734

fbshipit-source-id: a45b6a76634d034eac70603bad8ac60f9135ff24
2022-12-06 04:43:18 -08:00
Ruslan Shestopalyuk e2c4941c80 Add ability to schedule JS functions as tasks from turbo modules (#35525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35525

[Changelog][Internal]

Adds ability to invoke an async JS callback from a C++ native module, as a task with priority.

This will allow native modules to schedule less important calls to JS thread with lower priority. One example use case is feeding collected perf metrics back to JS.

Reviewed By: javache

Differential Revision: D41492849

fbshipit-source-id: 12f738557972dc23398d9bb9a7a01125c79da070
2022-12-01 09:49:44 -08:00
TatianaKapos 879d303fc7 Fix windows build of RectangleEdges (#35516)
Summary:
[PR: Avoid emitting mountitems for default values](https://github.com/facebook/react-native/commit/56e9aa369f5c13af38cf80ba47e9eb29d835ec89) used a constexpr in a template, which windows is unable to compile since type at this point is incomplete. Once removed, windows is able to build again. Let me know if there's a better way to fix this!

See [10072](https://github.com/microsoft/react-native-windows/issues/10072) for windows error messages

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[General] [Fixed] - Remove constexpr from RectangleEdges.h

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

Test Plan: Windows has forked this file and had the change for ~5 month, all tests pass on Windows side

Reviewed By: javache

Differential Revision: D41639514

Pulled By: rshest

fbshipit-source-id: fbe595f71a7ab0accb7a76edf58ffb6aeef1ae96
2022-12-01 07:43:59 -08:00
Riccardo Cipolleschi c5de1eb1ba Fix imports in React Bridging for Old Arch and frameworks
Summary:
In 0.71.0-RC.2, we had a regression in `use_frameworks!`.

The `use_frameworks! :linkage => :static` use to work fine with the Old Architecture.
We modified how the `React-bridging` pod is configured and, now those are broken.

This change make sure to use the right imports for React-bridging.

## Changelog
[iOS][Changed] - Fix imports in React Bridging for Old Arch and frameworks

Reviewed By: christophpurrer, cortinico

Differential Revision: D41551103

fbshipit-source-id: 4416fde92fef11eb801daf2302a57fe52732e4ef
2022-11-29 08:53:50 -08:00
Pieter De Baets 70bb6444aa Remove iOS TurboModuleManager experiment with shared mutex
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D41551085

fbshipit-source-id: f4d1d8126529d5f384ada941f6fb140abcfd9716
2022-11-29 08:29:05 -08:00
Pieter De Baets 229a1ded15 Remove ObjCTurboModule experiments with retaining JS callbacks in custom scopes
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D41551086

fbshipit-source-id: b70965bcf2af6ebac921cc627c196ec108f73944
2022-11-29 08:29:05 -08:00
Pieter De Baets cadf850ac1 Remove JavaTurboModule experiments with retaining JS callbacks in custom scopes
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D41551087

fbshipit-source-id: 5bdcd5f8c9bac99603f6187a9bc387827f5321c7
2022-11-29 08:29:05 -08:00
Christoph Purrer 022e22cbd4 Replace folly::Optional with std::optional (#35436)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35436

Using std::optional as react-native has been using C++17 for quite some time

changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D41415031

fbshipit-source-id: d786647f64b4f90cf75409109830ae0885460c17
2022-11-28 02:08:12 -08:00
Phillip Pan e6cba99744 rename Geometry.h -> Vector.h
Summary:
Geometry only contains the Vector struct now, renaming it for accuracy

Changelog: [Internal]

Reviewed By: stephinphection

Differential Revision: D41453351

fbshipit-source-id: 973b4a03208f4eeb0e209ea0aa58f5beca17c483
2022-11-23 16:16:38 -08:00
Phillip Pan c5a8425fad more Geometry.h cleanup
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D41452147

fbshipit-source-id: f427b8d95572c4b602b96962be187b62b801d62b
2022-11-23 01:41:23 -08:00
Christoph Purrer 6c315de226 Add butter/function.h (#35385)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35385

In OpenSource builds folly:: types are not always easy to consume.

With butter:: we actually allow consumers to opt-into other/non folly:: types (by providing a custom butter:: implementation).

This change adds a butter::function for that purpose.

It is especially useful for react-native-windows which prefers Mso::Functor over folly::Function.

You can use it by setting those compiler flags:
-DBUTTER_FUNCTION_OVERRIDE_INCLUDE=<functional/functor.h>
-DBUTTER_FUNCTION_OVERRIDE=Mso::Functor

std::function is no option as it is not move-only and we can't wait till 2025 > https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p0288r9.html

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D41388193

fbshipit-source-id: 56f58b9ddc602aa4b13000031d50de5228b4a16b
2022-11-21 11:17:01 -08:00
Phillip Pan ad0c8551c2 remove all unnecessary imports to Geometry.h
Summary: Changelog: [Internal]

Reviewed By: stephinphection

Differential Revision: D41366189

fbshipit-source-id: ea4ed1f0c759b5a05012425684bfb835dbe90904
2022-11-18 11:51:39 -08:00
Christoph Purrer 1ec1785e32 Unify SystraceSection.h implementation (#35353)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35353

Unfortunately we have 2 different definitions of SystraceSection.h
- xplat/js/react-native-github/ReactCommon/cxxreact/SystraceSection.h
- xplat/js/react-native-github/ReactCommon/react/renderer/debug/SystraceSection.h

The first one is the Old Arch one and the second one is the New Arch one.

As we first step, we unify the implementation

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D41307049

fbshipit-source-id: a9eb854dfcf49f87ad81fd9cc8dbe51648ecd209
2022-11-16 12:58:42 -08:00
Nick Gerleman 67b8e182fa Add Fabric implementation of flow-relative padding and margin (#35342)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35342

This is a native implementation of the JS shimmed layout-specific properties in https://github.com/facebook/react-native/pull/35316.

There is an experiment splitting the prop splitting codepath in Fabric, so this change effectively has two implementations depending on whether `enablePropIteratorSetter` is enabled.

None of these changes make sense to propagate Yoga. `inlineEnd`, etc are already mapped to `YGEdgeStart` and `YGEdgeEnd`, but RN's mapping used a different name. Then `blockStart`, `blockEnd`, map directly to existing edges in all cases since we don't support a writing mode.

On web, the last value in the style which computes the given dimension is given precedence. E.g. if "left" comes after "start" it will be chosen. Yoga stylesheets are unordered, and precedence for edges is given based on specificity (left > start > horizontal > all).

We give precedence to new renamings (e.g. start to inlineStart), but to preserve consistent behavior, we give precedence to specific edges before overwriting them with flow relative ones (e.g. marginTop has precedence over marginBlockStar).

Changelog:
[General][Added] - Add Fabric implementation of flow-relative padding and margin

Reviewed By: javache

Differential Revision: D41267765

fbshipit-source-id: 896e2ed71fe8bf83aef00b0a9d70fd20b2ce47a7
2022-11-16 12:31:33 -08:00
Adam Gleitman 11c8bf3137 Add Dynamic Type support for iOS (Paper and Fabric) (#35017)
Summary:
This adds Dynamic Type support in iOS as described [here](https://github.com/react-native-community/discussions-and-proposals/issues/519).

`Text` elements have a new prop, `dynamicTypeRamp`, that allows users to specify which font ramp a particular `Text` element should take on as the OS's accessibility setting for text size. The different types line up with different values of `UIFontTextStyle`. If not specified, we default to the current behavior.

~~For the moment, this change is only for Paper. I tried applying a corresponding change to Fabric by adding an additional field to [`facebook::react::TextAttributes`](https://github.com/facebook/react-native/blob/main/ReactCommon/react/renderer/attributedstring/TextAttributes.h) and changing [`RCTEffectiveFontSizeMultiplierFromTextAttributes`](https://github.com/facebook/react-native/blob/afb124dcf0cdf0db525acc7cfd2cea2742c64068/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm#L79-L84) to use that new field, but in the process I discovered that this function doesn't seem to ever get called, hence [this bug](https://github.com/facebook/react-native/issues/34990).~~

## Changelog

[iOS] [Added] - Dynamic Type support

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

Test Plan:
Validated with a test page in RNTester. Screenshots follow:

A) Default text size
B) Largest non-accessibility text size
C) Largest accessibility text size, split across two screenshots due to size

| A | B | C |
|-|-|-|
| ![Simulator Screen Shot - iPad (9th generation) - 2022-10-18 at 16 17 08](https://user-images.githubusercontent.com/717674/196562746-c8bbf53d-3c70-4e55-8600-0cfed8aacf5d.png) | ![Simulator Screen Shot - iPad (9th generation) - 2022-10-18 at 16 17 55](https://user-images.githubusercontent.com/717674/196563051-68bb0e34-c573-47ed-8c19-58ae45a7ce2b.png) | ![Simulator Screen Shot - iPad (9th generation) - 2022-10-18 at 16 18 33](https://user-images.githubusercontent.com/717674/196563185-61ede5ee-e79e-4af5-84a7-8f1e230a25f8.png) |
||| ![Simulator Screen Shot - iPad (9th generation) - 2022-10-18 at 16 18 42](https://user-images.githubusercontent.com/717674/196563208-2242efa2-5f24-466d-80f5-eb57a7678a67.png) |

Reviewed By: sammy-SC

Differential Revision: D40779346

Pulled By: NickGerleman

fbshipit-source-id: efc7a8e9810a93afc82c5def97af15a2e8453d90
2022-11-15 19:03:37 -08:00
David Vacca 9ca30adff8 Exclude mapbuffer files from Mac/iOS builds
Summary:
In this diff I'm excluding mapbuffer files from Mac/iOS builds

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D41309209

fbshipit-source-id: d92ae685ac05592e326ec3e046106f9a884271d6
2022-11-15 12:17:18 -08:00
Phillip Pan 9138712934 decouple various files from Geometry.h
Summary:
a lot of files were depending on Geometry even though they didn't use Vector, this will help with future modularity

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D41127194

fbshipit-source-id: 024519c638a1f0df3fdbfbdd937eac84b9adee6e
2022-11-15 08:06:45 -08:00
Christoph Purrer 19d65a2baf Update .podspec license information (#35245)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35245

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D41084913

fbshipit-source-id: a4ba31a19ffe515aa4e7c5a6e273a8cc4b6bc42d
2022-11-07 09:52:52 -08:00