Compare commits

...
Author SHA1 Message Date
Blake Friedman bbc48a0fa7 [CI]: verify template is published method
This step called an old reference, this function identifier was updated.

Changelog: [Internal]
2024-10-28 14:06:56 +00:00
Pieter De Baets bd133b5dd5 Add featureflag to not re-order mount items in FabricMountingManager (#46702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46702

In https://github.com/facebook/react-native/pull/44188, we've started combining multiple transactions in a single transaction, to meet React's atomicity requirements, while also dealing with the constraints of Android's Fabric implementation.

This revealed a bug where in some scenarios (especially when using transitions), a node may be deleted and created during the same transaction. The current implementation of FabricMountingManager assumes it can safely reorder some operations, which it does to optimize the size of IntBufferBatch mount items. This is however incorrect and unsafe when multiple transactions are merged.

**Example:**

Differentiator output:

```
# Transaction 1
Remove #100 from #11
Delete #100

# Transaction 2
Create #100
Insert #100 into #11
```
FabricMountingManager output
```
Remove #100 from #11
Insert #100 into #11
Delete #100
```

Note that the create action is also skipped, because we only update `allocatedViewTags` after processing all mutations, leading FabricMountingManager to assume creation is not required.

This leads to an invalid state in SurfaceMountingManager, which will be surfaced as a crash in `getViewState` on the next mutation that interacts with these views.

Changelog: [Android][Fixed] Fix crash in getViewState when using suspense fallbacks.

Reviewed By: sammy-SC

Differential Revision: D63148523

fbshipit-source-id: 07ae26b2f7b7eba1b9784041dd3059b0956c035e
2024-10-28 06:18:43 -07:00
Samuel Susla dd432790b8 Use RuntimeScheduler in EventBeat 2nd try (#47196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47196

changelog: [internal]

EventBeat can use RuntimeScheduler directly, no need to go through RuntimeExecutor.

Reviewed By: christophpurrer

Differential Revision: D64927936

fbshipit-source-id: 9fb317d7c98da588d3438424ab9923dc0c0259c1
2024-10-28 05:50:15 -07:00
zhongwuzw e271b23fad Fixes regression of RCTWindowFrameDidChangeNotification not fired (#47236)
Summary:
Fixes https://github.com/facebook/react-native/issues/47234. regression from https://github.com/facebook/react-native/commit/391680fe844aad887e497912378c699aed13464b#diff-b7fda5d350ac535115fa683faa7317b43aa11f3448f95266ef9ff051c3753a6fL63

bypass-github-export-checks

## Changelog:

[IOS] [FIXED] - Fixes regression of RCTWindowFrameDidChangeNotification not fired

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

Test Plan: Demo in https://github.com/facebook/react-native/issues/47234.

Reviewed By: blakef

Differential Revision: D65058105

Pulled By: cipolleschi

fbshipit-source-id: 0e286182ed93f289cb853710e2e00801ef2d4f73
2024-10-28 05:23:52 -07:00
Riccardo Cipolleschi 4192678bd7 Pin Xcodeproj to < 1.26.0 (#47237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47237

The Xcodeproj gem has been released yesterday to version 1.26.0 and it broke the CI pipeline of react native.

This should fix the issue

## Changelog
[Internal] - Pin Xcodeproj gem to 1.26.0

Reviewed By: blakef

Differential Revision: D65057797

fbshipit-source-id: f4035a1d3c75dd4140eb1646ab2aa0ccb08fb16b
2024-10-28 04:20:31 -07:00
Pieter De Baets dc2000c875 Improve correctness of textTransform: capitalize (#47219)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47219

We received reports that textTransform does not correctly match the web behaviour for capitalize, eg. capitalized characters should not be lowercased when using `capitalize`.

Example input: 'hello WORLD', should become 'Hello WORLD'.

Changelog: [General][Fixed] TextTransform: capitalize better reflects the web behaviour

Reviewed By: NickGerleman

Differential Revision: D65023821

fbshipit-source-id: 8ba5fdbd7afb1460193bf82a2f4021c3aff2110a
2024-10-26 17:57:26 -07:00
Jakub Piasecki 33e1ae13f8 Add tests for LayoutableChildren iterator
Summary:
Adds unit tests that directly cover the order in which `LayoutableChildren` iterator goes over the descendant nodes. The covered cases are as follows (nodes with `display: contents` are marked green):

### Single `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

style B fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, D, E, C`

### Multiple `display: contents` nodes

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

A --> D((D))
A --> E((E))

B --> F((F))
B --> G((G))

C --> H((H))
C --> I((I))

style A fill:https://github.com/facebook/yoga/issues/090
style B fill:https://github.com/facebook/yoga/issues/090
style C fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `D, E, F, G, H, I`

### Nested `display: contents` nodes

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

B --> D((D))
B --> E((E))

E --> F((F))
E --> G((G))

style B fill:https://github.com/facebook/yoga/issues/090
style E fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, D, F, G, C`

### Leaf `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style B fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, C`

### Root `display: contents` node

```mermaid
flowchart TD
R((R)) --> A((A))
R --> B((B))
R --> C((C))

style R fill:https://github.com/facebook/yoga/issues/090
```

Correct order: `A, B, C` - `LayoutableChildren` goes over the children with `display: contents` property, setting it on the root node should have no effect.

Changelog: [Internal]

X-link: https://github.com/facebook/yoga/pull/1731

Reviewed By: joevilches

Differential Revision: D64981779

Pulled By: NickGerleman

fbshipit-source-id: ee39759c663a40f96ad313f1b775d53ab68fb442
2024-10-25 18:01:20 -07:00
Samuel Susla db09e7c2e5 delete shouldYield from commit options (#47191)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47191

changelog: [internal]

not used, let's delete it.

Reviewed By: javache, rubennorte

Differential Revision: D64916432

fbshipit-source-id: 182848c85ca58d4e8fae3c6ab67c781807803dff
2024-10-25 17:41:06 -07:00
Jakub Piasecki a88ddcecc9 Fix for nodes with display: contents not being cleaned in some cases (#47194)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47194

Fixes a case where a node with `display: contents` would not be cleaned up in some cases. This was caused by it being called after some early returns handling different quick paths. This PR moves the call to `cleanupContentsNodesRecursively` earlier so that it's always called.

The problem here wasn't mutating before cloning, but leaving a node marked as dirty after the layout has finished.

The exact case in which I found this was a node with a single `display: contents` child which needs to be a leaf. Then in the parent node [this](https://github.com/facebook/yoga/blob/b0b842d5e75d041e3af7e0ac55abfb8929fbbf21/yoga/algorithm/CalculateLayout.cpp#L1339) condition is true, so `cleanupContentsNodesRecursively` doesn't get called and the child node is never visited and cleaned. I assume the same will happen in the other paths with an early return here.

Changelog:
[General][Fixed] - Fix for nodes with `display: contents` not being cleaned in some cases

X-link: https://github.com/facebook/yoga/pull/1729

Reviewed By: rozele

Differential Revision: D64910099

Pulled By: NickGerleman

fbshipit-source-id: 6d56f8fbf687b7ee5af889c0b868406213c9cee8
2024-10-25 17:34:36 -07:00
Ramanpreet Nara 4f47439a02 cleanup: ExceptionsManager: Delete updateExceptionMessage (#47167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47167

I couldn't find any usages of this method in javascript.

Removing, so that the native code is easier to read.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64606928

fbshipit-source-id: 1d52d58437370ae3d99e9c44500080687f137191
2024-10-25 15:12:40 -07:00
Ramanpreet Nara f8788963b9 cleanup: ExceptionsManager: Delete reportUnhandledException (#47166)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47166

This method wasn't used from javascript.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64607415

fbshipit-source-id: 2fb7eeee9479de85284d05629ed8e1bfb9fa5917
2024-10-25 15:12:40 -07:00
Ramanpreet Nara 0941b51e9d earlyjs: Make ExceptionsManager the js interface for c++ pipeline (#47165)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47165

The c++ pipeline needs a javascript interface.

We could just re-use exceptions manager (for now).

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64779068

fbshipit-source-id: 4e300668a01fa22e194ea9f149ef1d936d5e0834
2024-10-25 15:12:40 -07:00
Ramanpreet Nara 2247e0b983 earlyjs: Make JsErrorHandler work for all js throwables
Summary:
Now, handleError can be called with a JSError that wraps a non-error object!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D64706198

fbshipit-source-id: 562ed7d4e2a13eaef48acfdf3499296462e54166
2024-10-25 15:12:40 -07:00
Samuel Susla 3fff4cf966 delete MountingCoordinator::Shared typealias (#47207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47207

changelog: [internal]

delete typealias `MountingCoordinator::Shared` and use `std::shared_ptr<const MountingCoordinator>` directly.

Reviewed By: christophpurrer

Differential Revision: D64917023

fbshipit-source-id: 586ffcd5d22ea48b22d8a6cf86aa5fdf87fdefd0
2024-10-25 12:51:57 -07:00
David Vacca eddc0a1d49 Delete CoreFeatures class (#45626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45626

I'm deleting CoreFeatures class and all its imports because it was fully replaced by ReactNativeFeatureFlags

Changelog: [Internal][Removed] Delete CoreFeatures class in favor of ReactNativeFeatureFlags

Reviewed By: rubennorte

Differential Revision: D60137380

fbshipit-source-id: 8bf918cdd1ce66e315aa95e1c5a28879445ff9f9
2024-10-25 08:32:20 -07:00
David Vacca a01e2e4165 Delete CoreFeatures::excludeYogaFromRawProps (#45627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45627

I'm deleting CoreFeatures::excludeYogaFromRawProps in favor of ReactNativeFeatureFlags::excludeYogaFromRawProps();

changelog: [internal] internal

Reviewed By: rubennorte

Differential Revision: D60124448

fbshipit-source-id: 1dfec40d638c4051ebfebe712abe0bee6764e584
2024-10-25 08:32:20 -07:00
David Vacca 26278b10b1 Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags (#45602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45602

Migrate enableCppPropsIteratorSetter to ReactNativeFeatureFlags

Changelog: [Internal] internal

Reviewed By: rubennorte

Differential Revision: D60022936

fbshipit-source-id: 88fe6f41af3dea0ac5de4a097901a7e8df39efb2
2024-10-25 08:32:20 -07:00
David Vacca 143b9d172c Expose JSBundleLoader as parameter of DefaultReactHost (#47179)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47179

In this diff I'm exposing the new parameter (JSBundleLoader) as parameter of DefaultReactHost.

changelog: [Android][Breaking] Added JSBundleLoader as parameter of DefaultReactHost

Reviewed By: cortinico

Differential Revision: D64381501

fbshipit-source-id: dd0d56441802f7db53c67c659bbcae63c4b1b613
2024-10-25 02:08:32 -07:00
David Vacca 80f846948a Remove unused dependencies from facebook/react/interfaces (#47115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47115

Remove unused dependencies from facebook/react/interfaces

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D64585748

fbshipit-source-id: fd42b63dd25cb4b6d4d7bb4f05912cff3f167db8
2024-10-25 02:08:32 -07:00
David Vacca 2cb5198f1b Delete CompositeReactPackage from RN (#47128)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47128

Delete CompositeReactPackage from RN, these classes were deprecated for a long time and they can be deleted now, there are no internal usages

changelog: [Android][Breaking] Deleting deprecated CompositeReactPackage

Reviewed By: cortinico

Differential Revision: D64382211

fbshipit-source-id: d4fdfd51177612a64dde918cd68d6e852ef1b0e2
2024-10-25 02:08:32 -07:00
Parsa Nasirimehr 795a21a471 fix(iOS): migrate from depracated websocket method in RCTCxxInspectorWebSocketAdapter (#47197)
Summary:
Saw this while going through the remaining warnings of the project. I double checked, and i can't find any other usages left behind, so this is probably the last one

## Changelog:

[INTERNAL] [FIXED] - Switch to using the new sendString method for Websocket

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

Test Plan:
yarn test:
<img width="933" alt="Screenshot 2024-10-25 at 00 55 58" src="https://github.com/user-attachments/assets/dbfebb90-4957-4fc9-8a90-153c03055ac9">
Running the tests in Xcode with `CMD+U` or the objc-test: I could not get it to pass in either the old code or the modified code. I know the test documentation said it needs a WebSocket, but it was a bit too vague , and even turning metro on did not help, so i have no idea how to test it. If anyone can guide me on that one, please let me know

Reviewed By: blakef

Differential Revision: D64934981

Pulled By: cipolleschi

fbshipit-source-id: c6f13d3da5aafe3eed8b99b98f04904fcdcc4115
2024-10-24 23:49:13 -07:00
Blake Friedman 94fdc38822 fix: mitigate DangerJS transpilation bug (#47192)
Summary:
Danger seems to have a bug where it's not transpiling the import of
rnx-kit/rn-changelog-generator. This mitigates the issue to get our
project back on track.

This can be replicated locally by:

```bash
DEBUG="*" DANGER_GITHUB_API_TOKEN=$GITHUB_TOKEN yarn danger pr https://github.com/facebook/react-native/pull/47182
```
You can see it running correctly here when switching to the branch with the fix.  **I'm a little concerned that this is still failing on the PR**.  Thoughts?

 {F1946190275}

Changelog: [internal]

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

Reviewed By: cortinico

Differential Revision: D64924466

Pulled By: blakef

fbshipit-source-id: 68df0521620809effe3a78ce842e043382ad64a6
2024-10-24 20:07:20 -07:00
Riccardo Cipolleschi e851e73c18 Add yoga to app search paths (#47195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47195

When a user wants to create a Fabric Component i their app (not in a separate library) the app fails to build because:
- The custom component has to inherit from `RCTViewComponentView`
- `RCTViewComponentView` imports `ViewProps.h`
- `ViewProps.h` imports `HostPlatformViewProps.h`
- `HostPlatformViewProps.h` imports `BaseViewProps.h`
- `BaseViewProps.h` imports `YogaStylableProps.h`

which is a Yoga private header and the App has not visibility over it.

It is also not possible to fix this issue with forward declaring the `YogaStylableProps`, because `BaseViewProps` inherit from the yoga's props, so the compiler needs the full declaration of `YogaStylableProps` to work

This needs to be picked in 0.76

## Changelog
[iOS][Fixed] - Give apps access to Yoga headers

Reviewed By: blakef

Differential Revision: D64925222

fbshipit-source-id: e724076bbfb0a678948340dfab2ce609e6509533
2024-10-24 17:16:50 -07:00
Sunny Luo d293fdd27a Add jsBundleFile to DefaultReactNativeHost.kt (#47188)
Summary:
The JsBundleFilePath has been ignored when converting DefaultReactNativeHost to ReactHost

Changelog:
[Internal] [Changed] - Add jsBundleFile to DefaultReactNativeHost.kt

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

Reviewed By: javache

Differential Revision: D64914149

Pulled By: cortinico

fbshipit-source-id: d437ca81df5a170e0c5f01a22ccda83f43a09dd2
2024-10-24 14:59:21 -07:00
109 changed files with 1069 additions and 1308 deletions
+2 -2
View File
@@ -205,9 +205,9 @@ jobs:
with:
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
script: |
const {verifyPublished, isLatest} = require('./.github/workflow-scripts/publishTemplate.js')
const {verifyPublishedTemplate, isLatest} = require('./.github/workflow-scripts/publishTemplate.js')
const version = "${{ github.ref_name }}"
await verifyPublished(version, isLatest());
await verifyPublishedTemplate(version, isLatest());
- name: Update rn-diff-purge to generate upgrade-support diff
run: |
curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \
+1
View File
@@ -5,3 +5,4 @@ ruby ">= 2.6.10"
gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem 'xcodeproj', '< 1.26.0'
+1
View File
@@ -4,3 +4,4 @@ ruby ">= 2.6.10"
gem 'cocoapods', '~> 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
gem 'xcodeproj', '< 1.26.0'
+3 -4
View File
@@ -8,9 +8,6 @@
*/
'use strict';
const {validate: validateChangelog} =
require('@rnx-kit/rn-changelog-generator').default;
const {danger, fail, /*message,*/ warn} = require('danger');
const includes = require('lodash.includes');
@@ -60,7 +57,9 @@ if (!includesTestPlan && !isFromPhabricator) {
// Check if there is a changelog and validate it
if (!isFromPhabricator) {
const status = validateChangelog(danger.github.pr.body);
const status = require('@rnx-kit/rn-changelog-generator').default.validate(
danger.github.pr.body,
);
const changelogInstructions =
'See <a target="_blank" href="https://reactnative.dev/contributing/changelogs-in-pull-requests">Changelog format</a>';
if (status === 'missing') {
@@ -76,6 +76,7 @@
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [self createRootViewController];
[self setRootView:rootView toRootViewController:rootViewController];
_window.windowScene.delegate = self;
_window.rootViewController = rootViewController;
[_window makeKeyAndVisible];
}
@@ -64,7 +64,7 @@ Pod::Spec.new do |s|
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
"DEFINES_MODULE" => "YES"
}
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Private/Yoga\""}
s.dependency "React-Core"
s.dependency "RCT-Folly", folly_version
+21 -18
View File
@@ -141,24 +141,27 @@ let inExceptionHandler = false;
* Logs exceptions to the (native) console and displays them
*/
function handleException(e: mixed, isFatal: boolean) {
let error: Error;
if (e instanceof Error) {
error = e;
} else {
// Workaround for reporting errors caused by `throw 'some string'`
// Unfortunately there is no way to figure out the stacktrace in this
// case, so if you ended up here trying to trace an error, look for
// `throw '<error message>'` somewhere in your codebase.
error = new SyntheticError(e);
}
try {
inExceptionHandler = true;
/* $FlowFixMe[class-object-subtyping] added when improving typing for this
* parameters */
// $FlowFixMe[incompatible-call]
reportException(error, isFatal, /*reportToConsole*/ true);
} finally {
inExceptionHandler = false;
// TODO(T196834299): We should really use a c++ turbomodule for this
if (!global.RN$handleException || !global.RN$handleException(e, isFatal)) {
let error: Error;
if (e instanceof Error) {
error = e;
} else {
// Workaround for reporting errors caused by `throw 'some string'`
// Unfortunately there is no way to figure out the stacktrace in this
// case, so if you ended up here trying to trace an error, look for
// `throw '<error message>'` somewhere in your codebase.
error = new SyntheticError(e);
}
try {
inExceptionHandler = true;
/* $FlowFixMe[class-object-subtyping] added when improving typing for this
* parameters */
// $FlowFixMe[incompatible-call]
reportException(error, isFatal, /*reportToConsole*/ true);
} finally {
inExceptionHandler = false;
}
}
}
@@ -14,7 +14,6 @@ import typeof NativeExceptionsManager from '../NativeExceptionsManager';
export default ({
reportFatalException: jest.fn(),
reportSoftException: jest.fn(),
updateExceptionMessage: jest.fn(),
dismissRedbox: jest.fn(),
reportException: jest.fn(),
}: NativeExceptionsManager);
@@ -67,8 +67,6 @@ function runExceptionsManagerTests() {
return {
default: {
reportException: jest.fn(),
// Used to show symbolicated messages, not part of this test.
updateExceptionMessage: () => {},
},
};
});
+1 -7
View File
@@ -21,13 +21,7 @@ ExceptionsManager.installConsoleErrorReporter();
if (!global.__fbDisableExceptionsManager) {
const handleError = (e: mixed, isFatal: boolean) => {
try {
// TODO(T196834299): We should really use a c++ turbomodule for this
if (
!global.RN$handleException ||
!global.RN$handleException(e, isFatal)
) {
ExceptionsManager.handleException(e, isFatal);
}
ExceptionsManager.handleException(e, isFatal);
} catch (ee) {
console.log('Failed to print error: ', ee.message);
throw e;
@@ -9,8 +9,7 @@
#import <React/RCTDynamicTypeRamp.h>
#import <React/RCTTextDecorationLineType.h>
#import "RCTTextTransform.h"
#import <React/RCTTextTransform.h>
NS_ASSUME_NONNULL_BEGIN
@@ -278,19 +278,15 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
static NSString *capitalizeText(NSString *text)
{
NSArray *words = [text componentsSeparatedByString:@" "];
NSMutableArray *newWords = [NSMutableArray new];
NSNumberFormatter *num = [NSNumberFormatter new];
for (NSString *item in words) {
NSString *word;
if ([item length] > 0 && [num numberFromString:[item substringWithRange:NSMakeRange(0, 1)]] == nil) {
word = [item capitalizedString];
} else {
word = [item lowercaseString];
}
[newWords addObject:word];
}
return [newWords componentsJoinedByString:@" "];
NSMutableString *result = [[NSMutableString alloc] initWithString:text];
[result
enumerateSubstringsInRange:NSMakeRange(0, text.length)
options:NSStringEnumerationByWords
usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
[result replaceCharactersInRange:NSMakeRange(substringRange.location, 1)
withString:[[substring substringToIndex:1] uppercaseString]];
}];
return result;
}
- (NSString *)applyTextAttributesToText:(NSString *)text
@@ -11,7 +11,6 @@
NS_ASSUME_NONNULL_BEGIN
@protocol RCTExceptionsManagerDelegate <NSObject>
- (void)handleSoftJSExceptionWithMessage:(nullable NSString *)message
stack:(nullable NSArray *)stack
exceptionId:(NSNumber *)exceptionId
@@ -20,12 +19,6 @@ NS_ASSUME_NONNULL_BEGIN
stack:(nullable NSArray *)stack
exceptionId:(NSNumber *)exceptionId
extraDataAsJSON:(nullable NSString *)extraDataAsJSON;
@optional
- (void)updateJSExceptionWithMessage:(nullable NSString *)message
stack:(nullable NSArray *)stack
exceptionId:(NSNumber *)exceptionId;
@end
@interface RCTExceptionsManager : NSObject <RCTBridgeModule>
@@ -99,27 +99,6 @@ RCT_EXPORT_METHOD(reportFatalException
[self reportFatal:message stack:stack exceptionId:exceptionId extraDataAsJSON:nil];
}
RCT_EXPORT_METHOD(updateExceptionMessage
: (NSString *)message stack
: (NSArray<NSDictionary *> *)stack exceptionId
: (double)exceptionId)
{
if (RCTRedBoxGetEnabled()) {
RCTRedBox *redbox = [_moduleRegistry moduleForName:"RedBox"];
[redbox updateErrorMessage:message withStack:stack errorCookie:(int)exceptionId];
}
if (_delegate && [_delegate respondsToSelector:@selector(updateJSExceptionWithMessage:stack:exceptionId:)]) {
[_delegate updateJSExceptionWithMessage:message stack:stack exceptionId:[NSNumber numberWithDouble:exceptionId]];
}
}
// Deprecated. Use reportFatalException directly instead.
RCT_EXPORT_METHOD(reportUnhandledException : (NSString *)message stack : (NSArray<NSDictionary *> *)stack)
{
[self reportFatalException:message stack:stack exceptionId:-1];
}
RCT_EXPORT_METHOD(dismissRedbox) {}
RCT_EXPORT_METHOD(reportException : (JS::NativeExceptionsManager::ExceptionData &)data)
@@ -14,8 +14,8 @@ namespace facebook::react {
AppleEventBeat::AppleEventBeat(
std::shared_ptr<OwnerBox> ownerBox,
std::unique_ptr<const RunLoopObserver> uiRunLoopObserver,
RuntimeExecutor runtimeExecutor)
: EventBeat(std::move(ownerBox), std::move(runtimeExecutor)),
RuntimeScheduler& runtimeScheduler)
: EventBeat(std::move(ownerBox), runtimeScheduler),
uiRunLoopObserver_(std::move(uiRunLoopObserver)) {
uiRunLoopObserver_->setDelegate(this);
uiRunLoopObserver_->enable();
@@ -13,6 +13,8 @@
namespace facebook::react {
class RuntimeScheduler;
/*
* Event beat associated with JavaScript runtime.
* The beat is called on `RuntimeExecutor`'s thread induced by the UI thread
@@ -23,7 +25,7 @@ class AppleEventBeat : public EventBeat, public RunLoopObserver::Delegate {
AppleEventBeat(
std::shared_ptr<OwnerBox> ownerBox,
std::unique_ptr<const RunLoopObserver> uiRunLoopObserver,
RuntimeExecutor runtimeExecutor);
RuntimeScheduler& RuntimeScheduler);
#pragma mark - RunLoopObserver::Delegate
@@ -16,7 +16,6 @@
#import <react/renderer/components/image/ImageProps.h>
#import <react/renderer/imagemanager/ImageRequest.h>
#import <react/renderer/imagemanager/RCTImagePrimitivesConversions.h>
#import <react/utils/CoreFeatures.h>
using namespace facebook::react;
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_BEGIN
* Schedule a mounting transaction to be performed on the main thread.
* Can be called from any thread.
*/
- (void)scheduleTransaction:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
- (void)scheduleTransaction:(std::shared_ptr<const facebook::react::MountingCoordinator>)mountingCoordinator;
/**
* Dispatch a command to be performed on the main thread.
@@ -20,7 +20,6 @@
#import <react/renderer/core/LayoutableShadowNode.h>
#import <react/renderer/core/RawProps.h>
#import <react/renderer/mounting/TelemetryController.h>
#import <react/utils/CoreFeatures.h>
#import <React/RCTComponentViewProtocol.h>
#import <React/RCTComponentViewRegistry.h>
@@ -187,7 +186,7 @@ static void RCTPerformMountInstructions(
componentViewDescriptor:rootViewDescriptor];
}
- (void)scheduleTransaction:(MountingCoordinator::Shared)mountingCoordinator
- (void)scheduleTransaction:(std::shared_ptr<const MountingCoordinator>)mountingCoordinator
{
if (RCTIsMainQueue()) {
// Already on the proper thread, so:
@@ -26,9 +26,10 @@ NS_ASSUME_NONNULL_BEGIN
*/
@protocol RCTSchedulerDelegate
- (void)schedulerDidFinishTransaction:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
- (void)schedulerDidFinishTransaction:(std::shared_ptr<const facebook::react::MountingCoordinator>)mountingCoordinator;
- (void)schedulerShouldRenderTransactions:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
- (void)schedulerShouldRenderTransactions:
(std::shared_ptr<const facebook::react::MountingCoordinator>)mountingCoordinator;
- (void)schedulerDidDispatchCommand:(const facebook::react::ShadowView &)shadowView
commandName:(const std::string &)commandName
@@ -26,13 +26,13 @@ class SchedulerDelegateProxy : public SchedulerDelegate {
public:
SchedulerDelegateProxy(void *scheduler) : scheduler_(scheduler) {}
void schedulerDidFinishTransaction(const MountingCoordinator::Shared &mountingCoordinator) override
void schedulerDidFinishTransaction(const std::shared_ptr<const MountingCoordinator> &mountingCoordinator) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
[scheduler.delegate schedulerDidFinishTransaction:mountingCoordinator];
}
void schedulerShouldRenderTransactions(const MountingCoordinator::Shared &mountingCoordinator) override
void schedulerShouldRenderTransactions(const std::shared_ptr<const MountingCoordinator> &mountingCoordinator) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
[scheduler.delegate schedulerShouldRenderTransactions:mountingCoordinator];
@@ -33,7 +33,6 @@
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/scheduler/SchedulerToolbox.h>
#import <react/utils/ContextContainer.h>
#import <react/utils/CoreFeatures.h>
#import <react/utils/ManagedObjectWrapper.h>
#import "AppleEventBeat.h"
@@ -229,10 +228,6 @@ using namespace facebook::react;
{
auto reactNativeConfig = _contextContainer->at<std::shared_ptr<const ReactNativeConfig>>("ReactNativeConfig");
if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_cpp_props_iterator_setter_ios")) {
CoreFeatures::enablePropIteratorSetter = true;
}
auto componentRegistryFactory =
[factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)](
const EventDispatcher::Weak &eventDispatcher, const ContextContainer::Shared &contextContainer) {
@@ -258,10 +253,10 @@ using namespace facebook::react;
toolbox.bridgelessBindingsExecutor = _bridgelessBindingsExecutor;
toolbox.eventBeatFactory =
[runtimeExecutor](std::shared_ptr<EventBeat::OwnerBox> ownerBox) -> std::unique_ptr<EventBeat> {
[runtimeScheduler](std::shared_ptr<EventBeat::OwnerBox> ownerBox) -> std::unique_ptr<EventBeat> {
auto runLoopObserver =
std::make_unique<const MainRunLoopObserver>(RunLoopObserver::Activity::BeforeWaiting, ownerBox->owner);
return std::make_unique<AppleEventBeat>(std::move(ownerBox), std::move(runLoopObserver), runtimeExecutor);
return std::make_unique<AppleEventBeat>(std::move(ownerBox), std::move(runLoopObserver), *runtimeScheduler);
};
RCTScheduler *scheduler = [[RCTScheduler alloc] initWithToolbox:toolbox];
@@ -297,12 +292,12 @@ using namespace facebook::react;
#pragma mark - RCTSchedulerDelegate
- (void)schedulerDidFinishTransaction:(MountingCoordinator::Shared)mountingCoordinator
- (void)schedulerDidFinishTransaction:(std::shared_ptr<const MountingCoordinator>)mountingCoordinator
{
// no-op, we will flush the transaction from schedulerShouldRenderTransactions
}
- (void)schedulerShouldRenderTransactions:(MountingCoordinator::Shared)mountingCoordinator
- (void)schedulerShouldRenderTransactions:(std::shared_ptr<const MountingCoordinator>)mountingCoordinator
{
[_mountingManager scheduleTransaction:mountingCoordinator];
}
@@ -50,7 +50,7 @@ NSString *NSStringFromUTF8StringView(std::string_view view)
dispatch_async(dispatch_get_main_queue(), ^{
RCTCxxInspectorWebSocketAdapter *strongSelf = weakSelf;
if (strongSelf) {
[strongSelf->_webSocket send:messageStr];
[strongSelf->_webSocket sendString:messageStr error:NULL];
}
});
}
@@ -0,0 +1,49 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import <React/RCTTextAttributes.h>
@interface RCTTextAttributesTest : XCTestCase
@end
@implementation RCTTextAttributesTest
- (void)testCapitalize
{
RCTTextAttributes *attrs = [RCTTextAttributes new];
attrs.textTransform = RCTTextTransformCapitalize;
NSString *input = @"hello WORLD from ReAcT nAtIvE 2a !b c";
NSString *output = @"Hello WORLD From ReAcT NAtIvE 2a !B C";
XCTAssertEqualObjects([attrs applyTextAttributesToText:input], output);
}
- (void)testUppercase
{
RCTTextAttributes *attrs = [RCTTextAttributes new];
attrs.textTransform = RCTTextTransformUppercase;
NSString *input = @"hello WORLD from ReAcT nAtIvE 2a !b c";
NSString *output = @"HELLO WORLD FROM REACT NATIVE 2A !B C";
XCTAssertEqualObjects([attrs applyTextAttributesToText:input], output);
}
- (void)testLowercase
{
RCTTextAttributes *attrs = [RCTTextAttributes new];
attrs.textTransform = RCTTextTransformLowercase;
NSString *input = @"hello WORLD from ReAcT nAtIvE 2a !b c";
NSString *output = @"hello world from react native 2a !b c";
XCTAssertEqualObjects([attrs applyTextAttributesToText:input], output);
}
@end
@@ -7,23 +7,6 @@ public abstract class com/facebook/react/BaseReactPackage : com/facebook/react/R
protected fun getViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
}
public class com/facebook/react/CompositeReactPackage : com/facebook/react/ReactPackage, com/facebook/react/ViewManagerOnDemandReactPackage {
public fun <init> (Lcom/facebook/react/ReactPackage;Lcom/facebook/react/ReactPackage;[Lcom/facebook/react/ReactPackage;)V
public fun createNativeModules (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
public fun createViewManager (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager;
public fun createViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
public fun getViewManagerNames (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/Collection;
}
public class com/facebook/react/CompositeReactPackageTurboModuleManagerDelegate : com/facebook/react/ReactPackageTurboModuleManagerDelegate {
protected fun initHybrid ()Lcom/facebook/jni/HybridData;
}
public class com/facebook/react/CompositeReactPackageTurboModuleManagerDelegate$Builder : com/facebook/react/ReactPackageTurboModuleManagerDelegate$Builder {
public fun <init> (Ljava/util/List;)V
protected fun build (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/util/List;)Lcom/facebook/react/ReactPackageTurboModuleManagerDelegate;
}
public class com/facebook/react/CoreModulesPackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider {
public fun <init> ()V
public fun getReactModuleInfos ()Ljava/util/Map;
@@ -2044,7 +2027,6 @@ public final class com/facebook/react/common/network/OkHttpCallUtil {
public class com/facebook/react/config/ReactFeatureFlags {
public static field dispatchPointerEvents Z
public static field enableCppPropsIteratorSetter Z
public fun <init> ()V
}
@@ -2076,8 +2058,8 @@ public class com/facebook/react/defaults/DefaultReactActivityDelegate : com/face
public final class com/facebook/react/defaults/DefaultReactHost {
public static final field INSTANCE Lcom/facebook/react/defaults/DefaultReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Lcom/facebook/react/ReactNativeHost;)Lcom/facebook/react/ReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;)Lcom/facebook/react/ReactHost;
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
public static final fun getDefaultReactHost (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lcom/facebook/react/bridge/JSBundleLoader;)Lcom/facebook/react/ReactHost;
public static synthetic fun getDefaultReactHost$default (Landroid/content/Context;Ljava/util/List;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZLjava/util/List;Lcom/facebook/react/bridge/JSBundleLoader;ILjava/lang/Object;)Lcom/facebook/react/ReactHost;
}
public abstract class com/facebook/react/defaults/DefaultReactNativeHost : com/facebook/react/ReactNativeHost {
@@ -2230,7 +2212,6 @@ public abstract class com/facebook/react/devsupport/DevSupportManagerBase : com/
public fun startInspector ()V
public fun stopInspector ()V
public fun toggleElementInspector ()V
public fun updateJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
}
public abstract interface class com/facebook/react/devsupport/DevSupportManagerBase$CallbackWithBundleLoader {
@@ -2398,7 +2379,6 @@ public class com/facebook/react/devsupport/ReleaseDevSupportManager : com/facebo
public fun startInspector ()V
public fun stopInspector ()V
public fun toggleElementInspector ()V
public fun updateJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
}
public class com/facebook/react/devsupport/StackTraceHelper {
@@ -2534,7 +2514,6 @@ public abstract interface class com/facebook/react/devsupport/interfaces/DevSupp
public abstract fun startInspector ()V
public abstract fun stopInspector ()V
public abstract fun toggleElementInspector ()V
public abstract fun updateJSError (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;I)V
}
public abstract interface class com/facebook/react/devsupport/interfaces/DevSupportManager$PackagerLocationCustomizer {
@@ -3156,7 +3135,6 @@ public class com/facebook/react/modules/core/ExceptionsManagerModule : com/faceb
public fun reportException (Lcom/facebook/react/bridge/ReadableMap;)V
public fun reportFatalException (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V
public fun reportSoftException (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V
public fun updateExceptionMessage (Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;D)V
}
public class com/facebook/react/modules/core/HeadlessJsTaskSupportModule : com/facebook/fbreact/specs/NativeHeadlessJsTaskSupportSpec {
@@ -1,131 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.react.module.model.ReactModuleInfoProvider;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
/**
* {@code CompositeReactPackage} allows to create a single package composed of views and modules
* from several other packages.
*
* @deprecated
*/
@Deprecated(
since = "CompositeReactPackage is deprecated and will be deleted, use ReactPackage instead",
forRemoval = true)
public class CompositeReactPackage implements ViewManagerOnDemandReactPackage, ReactPackage {
private final List<ReactPackage> mChildReactPackages = new ArrayList<>();
/**
* The order in which packages are passed matters. It may happen that a NativeModule or a
* ViewManager exists in two or more ReactPackages. In that case the latter will win i.e. the
* latter will overwrite the former. This re-occurrence is detected by comparing a name of a
* module.
*/
public CompositeReactPackage(ReactPackage arg1, ReactPackage arg2, ReactPackage... args) {
mChildReactPackages.add(arg1);
mChildReactPackages.add(arg2);
Collections.addAll(mChildReactPackages, args);
}
/** {@inheritDoc} */
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
// This is for backward compatibility.
final Map<String, NativeModule> moduleMap = new HashMap<>();
for (ReactPackage reactPackage : mChildReactPackages) {
/**
* For now, we eagerly initialize the NativeModules inside BaseReactPackages. Ultimately, we
* should turn CompositeReactPackage into a BaseReactPackage and remove this eager
* initialization.
*
* <p>TODO: T45627020
*/
if (reactPackage instanceof BaseReactPackage) {
BaseReactPackage baseReactPackage = (BaseReactPackage) reactPackage;
ReactModuleInfoProvider moduleInfoProvider = baseReactPackage.getReactModuleInfoProvider();
Map<String, ReactModuleInfo> moduleInfos = moduleInfoProvider.getReactModuleInfos();
for (final String moduleName : moduleInfos.keySet()) {
moduleMap.put(moduleName, baseReactPackage.getModule(moduleName, reactContext));
}
continue;
}
for (NativeModule nativeModule : reactPackage.createNativeModules(reactContext)) {
moduleMap.put(nativeModule.getName(), nativeModule);
}
}
return new ArrayList<>(moduleMap.values());
}
/** {@inheritDoc} */
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
final Map<String, ViewManager> viewManagerMap = new HashMap<>();
for (ReactPackage reactPackage : mChildReactPackages) {
for (ViewManager viewManager : reactPackage.createViewManagers(reactContext)) {
viewManagerMap.put(viewManager.getName(), viewManager);
}
}
return new ArrayList<>(viewManagerMap.values());
}
/** {@inheritDoc} */
@Override
public Collection<String> getViewManagerNames(ReactApplicationContext reactContext) {
Set<String> uniqueNames = new HashSet<>();
for (ReactPackage reactPackage : mChildReactPackages) {
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
Collection<String> names =
((ViewManagerOnDemandReactPackage) reactPackage).getViewManagerNames(reactContext);
if (names != null) {
uniqueNames.addAll(names);
}
}
}
return uniqueNames;
}
/** {@inheritDoc} */
@Override
public @Nullable ViewManager createViewManager(
ReactApplicationContext reactContext, String viewManagerName) {
ListIterator<ReactPackage> iterator =
mChildReactPackages.listIterator(mChildReactPackages.size());
while (iterator.hasPrevious()) {
ReactPackage reactPackage = iterator.previous();
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
ViewManager viewManager =
((ViewManagerOnDemandReactPackage) reactPackage)
.createViewManager(reactContext, viewManagerName);
if (viewManager != null) {
return viewManager;
}
}
}
return null;
}
}
@@ -1,57 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react;
import androidx.annotation.NonNull;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.internal.turbomodule.core.TurboModuleManagerDelegate;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@Deprecated(
since =
"CompositeReactPackageTurboModuleManagerDelegate is deprecated and will be deleted in the"
+ " future. Please use ReactPackage interface or BaseReactPackage instead.")
@DoNotStrip
public class CompositeReactPackageTurboModuleManagerDelegate
extends ReactPackageTurboModuleManagerDelegate {
protected native HybridData initHybrid();
private CompositeReactPackageTurboModuleManagerDelegate(
ReactApplicationContext context,
List<ReactPackage> packages,
List<TurboModuleManagerDelegate> delegates) {
super(context, packages);
for (TurboModuleManagerDelegate delegate : delegates) {
addTurboModuleManagerDelegate(delegate);
}
}
private native void addTurboModuleManagerDelegate(TurboModuleManagerDelegate delegates);
public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder {
private final List<ReactPackageTurboModuleManagerDelegate.Builder> mDelegatesBuilder;
public Builder(@NonNull List<ReactPackageTurboModuleManagerDelegate.Builder> delegatesBuilder) {
mDelegatesBuilder = delegatesBuilder;
}
protected ReactPackageTurboModuleManagerDelegate build(
ReactApplicationContext context, List<ReactPackage> packages) {
List<TurboModuleManagerDelegate> delegates = new ArrayList<>();
for (ReactPackageTurboModuleManagerDelegate.Builder delegatesBuilder : mDelegatesBuilder) {
delegates.add(delegatesBuilder.build(context, Collections.<ReactPackage>emptyList()));
}
return new CompositeReactPackageTurboModuleManagerDelegate(context, packages, delegates);
}
}
}
@@ -23,9 +23,4 @@ import com.facebook.proguard.annotations.DoNotStripAny;
public class ReactFeatureFlags {
public static boolean dispatchPointerEvents = false;
/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
public static boolean enableCppPropsIteratorSetter = false;
}
@@ -45,6 +45,7 @@ public object DefaultReactHost {
* @param useDevSupport whether to enable dev support, default to ReactBuildConfig.DEBUG.
* @param cxxReactPackageProviders a list of cxxreactpackage providers (to register c++ turbo
* modules)
* @param jsBundleLoader a [JSBundleLoader] to use for creating the [ReactHost]
*
* TODO(T186951312): Should this be @UnstableReactNativeAPI?
*/
@@ -59,25 +60,28 @@ public object DefaultReactHost {
isHermesEnabled: Boolean = true,
useDevSupport: Boolean = ReactBuildConfig.DEBUG,
cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage> = emptyList(),
jsBundleLoader: JSBundleLoader? = null,
): ReactHost {
if (reactHost == null) {
val jsBundleLoader =
if (jsBundleFilePath != null) {
if (jsBundleFilePath.startsWith("assets://")) {
JSBundleLoader.createAssetLoader(context, jsBundleFilePath, true)
} else {
JSBundleLoader.createFileLoader(jsBundleFilePath)
}
} else {
JSBundleLoader.createAssetLoader(context, "assets://$jsBundleAssetPath", true)
}
val bundleLoader =
jsBundleLoader
?: if (jsBundleFilePath != null) {
if (jsBundleFilePath.startsWith("assets://")) {
JSBundleLoader.createAssetLoader(context, jsBundleFilePath, true)
} else {
JSBundleLoader.createFileLoader(jsBundleFilePath)
}
} else {
JSBundleLoader.createAssetLoader(context, "assets://$jsBundleAssetPath", true)
}
val jsRuntimeFactory = if (isHermesEnabled) HermesInstance() else JSCInstance()
val defaultTmmDelegateBuilder = DefaultTurboModuleManagerDelegate.Builder()
cxxReactPackageProviders.forEach { defaultTmmDelegateBuilder.addCxxReactPackage(it) }
val defaultReactHostDelegate =
DefaultReactHostDelegate(
jsMainModulePath = jsMainModulePath,
jsBundleLoader = jsBundleLoader,
jsBundleLoader = bundleLoader,
reactPackages = packageList,
jsRuntimeFactory = jsRuntimeFactory,
turboModuleManagerDelegateBuilder = defaultTmmDelegateBuilder)
@@ -111,7 +111,7 @@ protected constructor(
packages,
jsMainModuleName,
bundleAssetName ?: "index",
null,
jsBundleFile,
isHermesEnabled ?: true,
useDeveloperSupport,
)
@@ -279,26 +279,6 @@ public abstract class DevSupportManagerBase implements DevSupportManager {
return errorInfo;
}
@Override
public void updateJSError(
final String message, final ReadableArray details, final int errorCookie) {
UiThreadUtil.runOnUiThread(
() -> {
// Since we only show the first JS error in a succession of JS errors, make sure we only
// update the error message for that error message. This assumes that updateJSError
// belongs to the most recent showNewJSError
if ((mRedBoxSurfaceDelegate != null && !mRedBoxSurfaceDelegate.isShowing())
|| errorCookie != mLastErrorCookie) {
return;
}
// The RedBox surface delegate will always show the latest error
updateLastErrorInfo(
message, StackTraceHelper.convertJsStackTrace(details), errorCookie, ErrorType.JS);
mRedBoxSurfaceDelegate.show();
});
}
@Override
public void hideRedboxDialog() {
if (mRedBoxSurfaceDelegate == null) {
@@ -53,12 +53,6 @@ public open class ReleaseDevSupportManager : DevSupportManager {
override public fun destroyRootView(rootView: View?): Unit = Unit
override public fun updateJSError(
message: String?,
details: ReadableArray?,
errorCookie: Int
): Unit = Unit
override public fun hideRedboxDialog(): Unit = Unit
override public fun showDevOptionsDialog(): Unit = Unit
@@ -48,8 +48,6 @@ public interface DevSupportManager : JSExceptionHandler {
public fun showNewJSError(message: String?, details: ReadableArray?, errorCookie: Int)
public fun updateJSError(message: String?, details: ReadableArray?, errorCookie: Int)
public fun hideRedboxDialog()
public fun showDevOptionsDialog()
@@ -17,33 +17,33 @@ public interface ReactSurface {
// the API of this interface will be completed as we analyze and refactor API of ReactSurface,
// ReactRootView, etc.
// Returns surface ID of this surface
/** Returns surface ID of this surface */
public val surfaceID: Int
// Returns module name of this surface
/** Returns module name of this surface */
public val moduleName: String
// Returns whether the surface is running or not
/** Returns whether the surface is running or not */
public val isRunning: Boolean
// Returns React root view of this surface
/** Returns React root view of this surface */
public val view: ViewGroup?
// Returns context associated with the surface
/** Returns context associated with the surface */
public val context: Context
// Prerender this surface
/** Prerender this surface */
public fun prerender(): TaskInterface<Void>
// Start running this surface
/** Start running this surface */
public fun start(): TaskInterface<Void>
// Stop running this surface
/** Stop running this surface */
public fun stop(): TaskInterface<Void>
// Clear surface
/** Clear surface */
public fun clear()
// Detach surface from Host
/** Detach surface from Host */
public fun detach()
}
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<6eb9ba14445c1ce6b54a690941171485>>
* @generated SignedSource<<575eeb1e291c1a372eba7aabcdd948e3>>
*/
/**
@@ -52,6 +52,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun disableEventLoopOnBridgeless(): Boolean = accessor.disableEventLoopOnBridgeless()
/**
* Prevent FabricMountingManager from reordering mountitems, which may lead to invalid state on the UI thread
*/
@JvmStatic
public fun disableMountItemReorderingAndroid(): Boolean = accessor.disableMountItemReorderingAndroid()
/**
* Kill-switch to turn off support for aling-items:baseline on Fabric iOS.
*/
@@ -76,6 +82,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableCleanTextInputYogaNode(): Boolean = accessor.enableCleanTextInputYogaNode()
/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
@JvmStatic
public fun enableCppPropsIteratorSetter(): Boolean = accessor.enableCppPropsIteratorSetter()
/**
* Deletes views that were pre-allocated but never mounted on the screen.
*/
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f88e475c51f2595d8ead29ff66e84da1>>
* @generated SignedSource<<f93759a639dbbb95d3307003e4907c86>>
*/
/**
@@ -24,10 +24,12 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var allowRecursiveCommitsWithSynchronousMountOnAndroidCache: Boolean? = null
private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null
private var disableEventLoopOnBridgelessCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableAndroidLineHeightCenteringCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableDeletionOfUnmountedViewsCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableEventEmitterRetentionDuringGesturesOnAndroidCache: Boolean? = null
@@ -103,6 +105,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun disableMountItemReorderingAndroid(): Boolean {
var cached = disableMountItemReorderingAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.disableMountItemReorderingAndroid()
disableMountItemReorderingAndroidCache = cached
}
return cached
}
override fun enableAlignItemsBaselineOnFabricIOS(): Boolean {
var cached = enableAlignItemsBaselineOnFabricIOSCache
if (cached == null) {
@@ -139,6 +150,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableCppPropsIteratorSetter(): Boolean {
var cached = enableCppPropsIteratorSetterCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableCppPropsIteratorSetter()
enableCppPropsIteratorSetterCache = cached
}
return cached
}
override fun enableDeletionOfUnmountedViews(): Boolean {
var cached = enableDeletionOfUnmountedViewsCache
if (cached == null) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<a16a01bbf3c2404ed7c6fa569d68b505>>
* @generated SignedSource<<44d0fe9a36e5e51816e10b8799d451fe>>
*/
/**
@@ -36,6 +36,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun disableEventLoopOnBridgeless(): Boolean
@DoNotStrip @JvmStatic public external fun disableMountItemReorderingAndroid(): Boolean
@DoNotStrip @JvmStatic public external fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@DoNotStrip @JvmStatic public external fun enableAndroidLineHeightCentering(): Boolean
@@ -44,6 +46,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableCleanTextInputYogaNode(): Boolean
@DoNotStrip @JvmStatic public external fun enableCppPropsIteratorSetter(): Boolean
@DoNotStrip @JvmStatic public external fun enableDeletionOfUnmountedViews(): Boolean
@DoNotStrip @JvmStatic public external fun enableEagerRootViewAttachment(): Boolean
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<1ce9496b005924d8a421899ce55f6d81>>
* @generated SignedSource<<917a6effbfd0a476cc05d90abee3c80b>>
*/
/**
@@ -31,6 +31,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun disableEventLoopOnBridgeless(): Boolean = false
override fun disableMountItemReorderingAndroid(): Boolean = false
override fun enableAlignItemsBaselineOnFabricIOS(): Boolean = true
override fun enableAndroidLineHeightCentering(): Boolean = false
@@ -39,6 +41,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableCleanTextInputYogaNode(): Boolean = false
override fun enableCppPropsIteratorSetter(): Boolean = false
override fun enableDeletionOfUnmountedViews(): Boolean = false
override fun enableEagerRootViewAttachment(): Boolean = false
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<b6dd6a5d02c9070c3f35f70d5d1b7e35>>
* @generated SignedSource<<2ad36465b1a411cb55d85416bd8ba823>>
*/
/**
@@ -28,10 +28,12 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var allowRecursiveCommitsWithSynchronousMountOnAndroidCache: Boolean? = null
private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null
private var disableEventLoopOnBridgelessCache: Boolean? = null
private var disableMountItemReorderingAndroidCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableAndroidLineHeightCenteringCache: Boolean? = null
private var enableBridgelessArchitectureCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
private var enableCppPropsIteratorSetterCache: Boolean? = null
private var enableDeletionOfUnmountedViewsCache: Boolean? = null
private var enableEagerRootViewAttachmentCache: Boolean? = null
private var enableEventEmitterRetentionDuringGesturesOnAndroidCache: Boolean? = null
@@ -111,6 +113,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun disableMountItemReorderingAndroid(): Boolean {
var cached = disableMountItemReorderingAndroidCache
if (cached == null) {
cached = currentProvider.disableMountItemReorderingAndroid()
accessedFeatureFlags.add("disableMountItemReorderingAndroid")
disableMountItemReorderingAndroidCache = cached
}
return cached
}
override fun enableAlignItemsBaselineOnFabricIOS(): Boolean {
var cached = enableAlignItemsBaselineOnFabricIOSCache
if (cached == null) {
@@ -151,6 +163,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableCppPropsIteratorSetter(): Boolean {
var cached = enableCppPropsIteratorSetterCache
if (cached == null) {
cached = currentProvider.enableCppPropsIteratorSetter()
accessedFeatureFlags.add("enableCppPropsIteratorSetter")
enableCppPropsIteratorSetterCache = cached
}
return cached
}
override fun enableDeletionOfUnmountedViews(): Boolean {
var cached = enableDeletionOfUnmountedViewsCache
if (cached == null) {
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<12dbd7afae2f6360d17df521ebc53d2f>>
* @generated SignedSource<<9770a9f125b8bcb4b1daef9e3458433f>>
*/
/**
@@ -31,6 +31,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun disableEventLoopOnBridgeless(): Boolean
@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean
@DoNotStrip public fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@DoNotStrip public fun enableAndroidLineHeightCentering(): Boolean
@@ -39,6 +41,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableCleanTextInputYogaNode(): Boolean
@DoNotStrip public fun enableCppPropsIteratorSetter(): Boolean
@DoNotStrip public fun enableDeletionOfUnmountedViews(): Boolean
@DoNotStrip public fun enableEagerRootViewAttachment(): Boolean
@@ -60,17 +60,6 @@ public open class ExceptionsManagerModule(private val devSupportManager: DevSupp
}
}
override fun updateExceptionMessage(
title: String?,
details: ReadableArray?,
exceptionIdDouble: Double
) {
val exceptionId = exceptionIdDouble.toInt()
if (devSupportManager.devSupportEnabled) {
devSupportManager.updateJSError(title, details, exceptionId)
}
}
override fun dismissRedbox() {
if (devSupportManager.devSupportEnabled) {
devSupportManager.hideRedboxDialog()
@@ -48,13 +48,8 @@ public enum TextTransform {
StringBuilder res = new StringBuilder(text.length());
int start = wordIterator.first();
for (int end = wordIterator.next(); end != BreakIterator.DONE; end = wordIterator.next()) {
String word = text.substring(start, end);
if (Character.isLetterOrDigit(word.charAt(0))) {
res.append(Character.toUpperCase(word.charAt(0)));
res.append(word.substring(1).toLowerCase());
} else {
res.append(word);
}
res.append(Character.toUpperCase(text.charAt(start)));
res.append(text.substring(start + 1, end));
start = end;
}
@@ -16,9 +16,9 @@ namespace facebook::react {
AndroidEventBeat::AndroidEventBeat(
std::shared_ptr<OwnerBox> ownerBox,
EventBeatManager* eventBeatManager,
RuntimeExecutor runtimeExecutor,
RuntimeScheduler& runtimeScheduler,
jni::global_ref<jobject> javaUIManager)
: EventBeat(std::move(ownerBox), std::move(runtimeExecutor)),
: EventBeat(std::move(ownerBox), runtimeScheduler),
eventBeatManager_(eventBeatManager),
javaUIManager_(std::move(javaUIManager)) {
eventBeatManager->addObserver(*this);
@@ -19,7 +19,7 @@ class AndroidEventBeat final : public EventBeat,
AndroidEventBeat(
std::shared_ptr<OwnerBox> ownerBox,
EventBeatManager* eventBeatManager,
RuntimeExecutor runtimeExecutor,
RuntimeScheduler& runtimeScheduler,
jni::global_ref<jobject> javaUIManager);
~AndroidEventBeat() override;
@@ -19,7 +19,6 @@
#include <react/renderer/mounting/MountingTransaction.h>
#include <react/renderer/mounting/ShadowView.h>
#include <react/renderer/mounting/ShadowViewMutation.h>
#include <react/utils/CoreFeatures.h>
#include <fbjni/fbjni.h>
#include <glog/logging.h>
@@ -38,7 +37,8 @@ FabricMountingManager::FabricMountingManager(
void FabricMountingManager::onSurfaceStart(SurfaceId surfaceId) {
std::lock_guard lock(allocatedViewsMutex_);
allocatedViewRegistry_.emplace(surfaceId, std::unordered_set<Tag>{});
allocatedViewRegistry_.emplace(
surfaceId, std::unordered_set<Tag>({surfaceId}));
}
void FabricMountingManager::onSurfaceStop(SurfaceId surfaceId) {
@@ -466,6 +466,9 @@ void FabricMountingManager::executeMount(
auto surfaceId = transaction.getSurfaceId();
auto& mutations = transaction.getMutations();
bool maintainMutationOrder =
ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
auto revisionNumber = telemetry.getRevisionNumber();
std::vector<CppMountItem> cppCommonMountItems;
@@ -487,7 +490,7 @@ void FabricMountingManager::executeMount(
// operand is a value type, the compiler will decide the expression to be a
// value type, an unnecessary (sometimes expensive) copy will happen as a
// result.
const auto& allocatedViewTags =
auto& allocatedViewTags =
allocatedViewsIterator != allocatedViewRegistry_.end()
? allocatedViewsIterator->second
: defaultAllocatedViews;
@@ -511,6 +514,7 @@ void FabricMountingManager::executeMount(
if (shouldCreateView) {
cppCommonMountItems.push_back(
CppMountItem::CreateMountItem(newChildShadowView));
allocatedViewTags.insert(newChildShadowView.tag);
}
break;
}
@@ -522,20 +526,32 @@ void FabricMountingManager::executeMount(
break;
}
case ShadowViewMutation::Delete: {
cppDeleteMountItems.push_back(
CppMountItem::DeleteMountItem(oldChildShadowView));
(maintainMutationOrder ? cppCommonMountItems : cppDeleteMountItems)
.push_back(CppMountItem::DeleteMountItem(oldChildShadowView));
if (allocatedViewTags.erase(oldChildShadowView.tag) != 1) {
LOG(ERROR) << "Emitting delete for unallocated view. "
<< oldChildShadowView.tag;
}
break;
}
case ShadowViewMutation::Update: {
if (!isVirtual) {
if (!allocatedViewTags.contains(newChildShadowView.tag)) {
LOG(FATAL) << "Emitting update for unallocated view. "
<< newChildShadowView.tag;
}
if (oldChildShadowView.props != newChildShadowView.props) {
cppUpdatePropsMountItems.push_back(
CppMountItem::UpdatePropsMountItem(
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(CppMountItem::UpdatePropsMountItem(
oldChildShadowView, newChildShadowView));
}
if (oldChildShadowView.state != newChildShadowView.state) {
cppUpdateStateMountItems.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateStateMountItems)
.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
}
// Padding: padding mountItems must be executed before layout props
@@ -544,14 +560,17 @@ void FabricMountingManager::executeMount(
// padding information.
if (oldChildShadowView.layoutMetrics.contentInsets !=
newChildShadowView.layoutMetrics.contentInsets) {
cppUpdatePaddingMountItems.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePaddingMountItems)
.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
}
if (oldChildShadowView.layoutMetrics !=
newChildShadowView.layoutMetrics) {
cppUpdateLayoutMountItems.push_back(
CppMountItem::UpdateLayoutMountItem(
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateLayoutMountItems)
.push_back(CppMountItem::UpdateLayoutMountItem(
mutation.newChildShadowView, parentShadowView));
}
@@ -561,16 +580,18 @@ void FabricMountingManager::executeMount(
// pack too much data there.
if ((oldChildShadowView.layoutMetrics.overflowInset !=
newChildShadowView.layoutMetrics.overflowInset)) {
cppUpdateOverflowInsetMountItems.push_back(
CppMountItem::UpdateOverflowInsetMountItem(
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateOverflowInsetMountItems)
.push_back(CppMountItem::UpdateOverflowInsetMountItem(
newChildShadowView));
}
}
if (oldChildShadowView.eventEmitter !=
newChildShadowView.eventEmitter) {
cppUpdateEventEmitterMountItems.push_back(
CppMountItem::UpdateEventEmitterMountItem(
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(CppMountItem::UpdateEventEmitterMountItem(
mutation.newChildShadowView));
}
break;
@@ -581,19 +602,23 @@ void FabricMountingManager::executeMount(
cppCommonMountItems.push_back(CppMountItem::InsertMountItem(
parentShadowView, newChildShadowView, index));
bool allocationCheck =
allocatedViewTags.find(newChildShadowView.tag) ==
allocatedViewTags.end();
bool shouldCreateView = allocationCheck;
bool shouldCreateView =
!allocatedViewTags.contains(newChildShadowView.tag);
if (shouldCreateView) {
cppUpdatePropsMountItems.push_back(
CppMountItem::UpdatePropsMountItem({}, newChildShadowView));
LOG(ERROR) << "Emitting insert for unallocated view. "
<< newChildShadowView.tag;
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(CppMountItem::UpdatePropsMountItem(
{}, newChildShadowView));
}
// State
if (newChildShadowView.state) {
cppUpdateStateMountItems.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateStateMountItems)
.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
}
// Padding: padding mountItems must be executed before layout props
@@ -602,13 +627,16 @@ void FabricMountingManager::executeMount(
// padding information.
if (newChildShadowView.layoutMetrics.contentInsets !=
EdgeInsets::ZERO) {
cppUpdatePaddingMountItems.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePaddingMountItems)
.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
}
// Layout
cppUpdateLayoutMountItems.push_back(
CppMountItem::UpdateLayoutMountItem(
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateLayoutMountItems)
.push_back(CppMountItem::UpdateLayoutMountItem(
newChildShadowView, parentShadowView));
// OverflowInset: This is the values indicating boundaries including
@@ -617,15 +645,19 @@ void FabricMountingManager::executeMount(
// pack too much data there.
if (newChildShadowView.layoutMetrics.overflowInset !=
EdgeInsets::ZERO) {
cppUpdateOverflowInsetMountItems.push_back(
CppMountItem::UpdateOverflowInsetMountItem(
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateOverflowInsetMountItems)
.push_back(CppMountItem::UpdateOverflowInsetMountItem(
newChildShadowView));
}
}
// EventEmitter
cppUpdateEventEmitterMountItems.push_back(
CppMountItem::UpdateEventEmitterMountItem(
// On insert we always update the event emitter, as we do not pass
// it in when preallocating views
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateEventEmitterMountItems)
.push_back(CppMountItem::UpdateEventEmitterMountItem(
mutation.newChildShadowView));
break;
@@ -635,22 +667,6 @@ void FabricMountingManager::executeMount(
}
}
}
if (allocatedViewsIterator != allocatedViewRegistry_.end()) {
auto& views = allocatedViewsIterator->second;
for (const auto& mutation : mutations) {
switch (mutation.type) {
case ShadowViewMutation::Create:
views.insert(mutation.newChildShadowView.tag);
break;
case ShadowViewMutation::Delete:
views.erase(mutation.oldChildShadowView.tag);
break;
default:
break;
}
}
}
}
// We now have all the information we need, including ordering of mount items,
@@ -729,12 +745,33 @@ void FabricMountingManager::executeMount(
case CppMountItem::Type::Create:
writeCreateMountItem(buffer, mountItem);
break;
case CppMountItem::Type::Delete:
writeDeleteMountItem(buffer, mountItem);
break;
case CppMountItem::Type::Insert:
writeInsertMountItem(buffer, mountItem);
break;
case CppMountItem::Type::Remove:
writeRemoveMountItem(buffer, mountItem);
break;
case CppMountItem::Type::UpdateProps:
writeUpdatePropsMountItem(buffer, mountItem);
break;
case CppMountItem::Type::UpdateState:
writeUpdateStateMountItem(buffer, mountItem);
break;
case CppMountItem::Type::UpdateLayout:
writeUpdateLayoutMountItem(buffer, mountItem);
break;
case CppMountItem::Type::UpdateEventEmitter:
writeUpdateEventEmitterMountItem(buffer, mountItem);
break;
case CppMountItem::Type::UpdatePadding:
writeUpdatePaddingMountItem(buffer, mountItem);
break;
case CppMountItem::Type::UpdateOverflowInset:
writeUpdateOverflowInsetMountItem(buffer, mountItem);
break;
default:
LOG(FATAL) << "Unexpected CppMountItem type: " << mountItemType;
}
@@ -907,11 +944,11 @@ void FabricMountingManager::preallocateShadowView(
if (allocatedViewsIterator == allocatedViewRegistry_.end()) {
return;
}
auto& allocatedViews = allocatedViewsIterator->second;
if (allocatedViews.find(shadowView.tag) != allocatedViews.end()) {
const auto [_, inserted] =
allocatedViewsIterator->second.insert(shadowView.tag);
if (!inserted) {
return;
}
allocatedViews.insert(shadowView.tag);
}
bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics;
@@ -30,7 +30,6 @@
#include <react/renderer/scheduler/SchedulerToolbox.h>
#include <react/renderer/uimanager/primitives.h>
#include <react/utils/ContextContainer.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -73,16 +72,6 @@ FabricUIManagerBinding::getInspectorDataForInstance(
return ReadableNativeMap::newObjectCxxArgs(result);
}
constexpr static auto kReactFeatureFlagsJavaDescriptor =
"com/facebook/react/config/ReactFeatureFlags";
static bool getFeatureFlagValue(const char* name) {
static const auto reactFeatureFlagsClass =
jni::findClassStatic(kReactFeatureFlagsJavaDescriptor);
const auto field = reactFeatureFlagsClass->getStaticField<jboolean>(name);
return reactFeatureFlagsClass->getStaticFieldValue(field) != 0;
}
void FabricUIManagerBinding::setPixelDensity(float pointScaleFactor) {
pointScaleFactor_ = pointScaleFactor;
}
@@ -471,28 +460,25 @@ void FabricUIManagerBinding::installFabricUIManager(
auto runtimeExecutor = runtimeExecutorHolder->cthis()->get();
if (runtimeSchedulerHolder) {
auto runtimeScheduler = runtimeSchedulerHolder->cthis()->get().lock();
if (runtimeScheduler) {
runtimeExecutor =
[runtimeScheduler](
std::function<void(jsi::Runtime & runtime)>&& callback) {
runtimeScheduler->scheduleWork(std::move(callback));
};
contextContainer->insert(
"RuntimeScheduler",
std::weak_ptr<RuntimeScheduler>(runtimeScheduler));
}
auto runtimeScheduler = runtimeSchedulerHolder->cthis()->get().lock();
if (runtimeScheduler) {
runtimeExecutor =
[runtimeScheduler](
std::function<void(jsi::Runtime & runtime)>&& callback) {
runtimeScheduler->scheduleWork(std::move(callback));
};
contextContainer->insert(
"RuntimeScheduler", std::weak_ptr<RuntimeScheduler>(runtimeScheduler));
}
EventBeat::Factory eventBeatFactory =
[eventBeatManager, runtimeExecutor, globalJavaUiManager](
[eventBeatManager, &runtimeScheduler, globalJavaUiManager](
std::shared_ptr<EventBeat::OwnerBox> ownerBox)
-> std::unique_ptr<EventBeat> {
return std::make_unique<AndroidEventBeat>(
std::move(ownerBox),
eventBeatManager,
runtimeExecutor,
*runtimeScheduler,
globalJavaUiManager);
};
@@ -502,11 +488,6 @@ void FabricUIManagerBinding::installFabricUIManager(
// Keep reference to config object and cache some feature flags here
reactNativeConfig_ = config;
CoreFeatures::enablePropIteratorSetter =
getFeatureFlagValue("enableCppPropsIteratorSetter");
CoreFeatures::excludeYogaFromRawProps =
ReactNativeFeatureFlags::excludeYogaFromRawProps();
auto toolbox = SchedulerToolbox{};
toolbox.contextContainer = contextContainer;
toolbox.componentRegistryFactory = componentsRegistry->buildRegistryFunction;
@@ -551,7 +532,7 @@ FabricUIManagerBinding::getMountingManager(const char* locationHint) {
}
void FabricUIManagerBinding::schedulerDidFinishTransaction(
const MountingCoordinator::Shared& mountingCoordinator) {
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator) {
// We shouldn't be pulling the transaction here (which triggers diffing of
// the trees to determine the mutations to run on the host platform),
// but we have to due to current limitations in the Android implementation.
@@ -580,7 +561,8 @@ void FabricUIManagerBinding::schedulerDidFinishTransaction(
}
void FabricUIManagerBinding::schedulerShouldRenderTransactions(
const MountingCoordinator::Shared& /* mountingCoordinator */) {
const std::shared_ptr<
const MountingCoordinator>& /* mountingCoordinator */) {
auto mountingManager =
getMountingManager("schedulerShouldRenderTransactions");
if (!mountingManager) {
@@ -101,10 +101,12 @@ class FabricUIManagerBinding : public jni::HybridClass<FabricUIManagerBinding>,
jni::alias_ref<SurfaceHandlerBinding::jhybridobject> surfaceHandler);
void schedulerDidFinishTransaction(
const MountingCoordinator::Shared& mountingCoordinator) override;
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator)
override;
void schedulerShouldRenderTransactions(
const MountingCoordinator::Shared& mountingCoordinator) override;
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator)
override;
void schedulerDidRequestPreliminaryViewAllocation(
const ShadowNode& shadowNode) override;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<b83cbcc992ef83cbc0a5db25a8ac0987>>
* @generated SignedSource<<aaf6af36813ab1895bf2bf8a6c8bcf1c>>
*/
/**
@@ -63,6 +63,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool disableMountItemReorderingAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("disableMountItemReorderingAndroid");
return method(javaProvider_);
}
bool enableAlignItemsBaselineOnFabricIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAlignItemsBaselineOnFabricIOS");
@@ -87,6 +93,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableCppPropsIteratorSetter() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableCppPropsIteratorSetter");
return method(javaProvider_);
}
bool enableDeletionOfUnmountedViews() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableDeletionOfUnmountedViews");
@@ -339,6 +351,11 @@ bool JReactNativeFeatureFlagsCxxInterop::disableEventLoopOnBridgeless(
return ReactNativeFeatureFlags::disableEventLoopOnBridgeless();
}
bool JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
}
bool JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS();
@@ -359,6 +376,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode(
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
}
bool JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableCppPropsIteratorSetter();
}
bool JReactNativeFeatureFlagsCxxInterop::enableDeletionOfUnmountedViews(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableDeletionOfUnmountedViews();
@@ -592,6 +614,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"disableEventLoopOnBridgeless",
JReactNativeFeatureFlagsCxxInterop::disableEventLoopOnBridgeless),
makeNativeMethod(
"disableMountItemReorderingAndroid",
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
makeNativeMethod(
"enableAlignItemsBaselineOnFabricIOS",
JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS),
@@ -604,6 +629,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableCleanTextInputYogaNode",
JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode),
makeNativeMethod(
"enableCppPropsIteratorSetter",
JReactNativeFeatureFlagsCxxInterop::enableCppPropsIteratorSetter),
makeNativeMethod(
"enableDeletionOfUnmountedViews",
JReactNativeFeatureFlagsCxxInterop::enableDeletionOfUnmountedViews),
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f7d93dbd2b21fc29bfd3c4c231d0fa79>>
* @generated SignedSource<<d4194069e582c0aa5e90938b27067044>>
*/
/**
@@ -42,6 +42,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool disableEventLoopOnBridgeless(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool disableMountItemReorderingAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableAlignItemsBaselineOnFabricIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -54,6 +57,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableCleanTextInputYogaNode(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableCppPropsIteratorSetter(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableDeletionOfUnmountedViews(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -47,7 +47,6 @@ add_library(
turbomodulejsijni
OBJECT
ReactCommon/BindingsInstallerHolder.cpp
ReactCommon/CompositeTurboModuleManagerDelegate.cpp
ReactCommon/OnLoad.cpp
ReactCommon/TurboModuleManager.cpp
$<TARGET_OBJECTS:logger>
@@ -1,58 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "CompositeTurboModuleManagerDelegate.h"
namespace facebook::react {
jni::local_ref<CompositeTurboModuleManagerDelegate::jhybriddata>
CompositeTurboModuleManagerDelegate::initHybrid(jni::alias_ref<jhybridobject>) {
return makeCxxInstance();
}
void CompositeTurboModuleManagerDelegate::registerNatives() {
registerHybrid({
makeNativeMethod(
"initHybrid", CompositeTurboModuleManagerDelegate::initHybrid),
makeNativeMethod(
"addTurboModuleManagerDelegate",
CompositeTurboModuleManagerDelegate::addTurboModuleManagerDelegate),
});
}
std::shared_ptr<TurboModule>
CompositeTurboModuleManagerDelegate::getTurboModule(
const std::string& moduleName,
const std::shared_ptr<CallInvoker>& jsInvoker) {
for (auto delegate : mDelegates_) {
if (auto turboModule =
delegate->cthis()->getTurboModule(moduleName, jsInvoker)) {
return turboModule;
}
}
return nullptr;
}
std::shared_ptr<TurboModule>
CompositeTurboModuleManagerDelegate::getTurboModule(
const std::string& moduleName,
const JavaTurboModule::InitParams& params) {
for (auto delegate : mDelegates_) {
if (auto turboModule =
delegate->cthis()->getTurboModule(moduleName, params)) {
return turboModule;
}
}
return nullptr;
}
void CompositeTurboModuleManagerDelegate::addTurboModuleManagerDelegate(
jni::alias_ref<TurboModuleManagerDelegate::javaobject> delegate) {
mDelegates_.push_back(jni::make_global(delegate));
}
} // namespace facebook::react
@@ -1,48 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <ReactCommon/TurboModuleManagerDelegate.h>
#include <fbjni/fbjni.h>
#include <memory>
#include <string>
#include <vector>
namespace facebook::react {
class CompositeTurboModuleManagerDelegate
: public jni::HybridClass<
CompositeTurboModuleManagerDelegate,
TurboModuleManagerDelegate> {
public:
static auto constexpr kJavaDescriptor =
"Lcom/facebook/react/CompositeReactPackageTurboModuleManagerDelegate;";
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject>);
static void registerNatives();
std::shared_ptr<TurboModule> getTurboModule(
const std::string& moduleName,
const std::shared_ptr<CallInvoker>& jsInvoker) override;
std::shared_ptr<TurboModule> getTurboModule(
const std::string& moduleName,
const JavaTurboModule::InitParams& params) override;
private:
friend HybridBase;
using HybridBase::HybridBase;
std::vector<jni::global_ref<TurboModuleManagerDelegate::javaobject>>
mDelegates_;
void addTurboModuleManagerDelegate(
jni::alias_ref<TurboModuleManagerDelegate::javaobject> delegate);
};
} // namespace facebook::react
@@ -9,7 +9,6 @@
#include <fbjni/fbjni.h>
#include <reactperflogger/JNativeModulePerfLogger.h>
#include "CompositeTurboModuleManagerDelegate.h"
#include "TurboModuleManager.h"
void jniEnableCppLogging(
@@ -26,8 +25,6 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
// "ComponentDescriptorFactory" is defined in Fabric
facebook::react::TurboModuleManager::registerNatives();
facebook::react::CompositeTurboModuleManagerDelegate::registerNatives();
facebook::jni::registerNatives(
"com/facebook/react/internal/turbomodule/core/TurboModulePerfLogger",
{makeNativeMethod("jniEnableCppLogging", jniEnableCppLogging)});
@@ -1,131 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react
import com.facebook.react.bridge.BridgeReactContext
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import org.assertj.core.api.Assertions.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.`when` as whenever
import org.robolectric.RobolectricTestRunner
import org.robolectric.RuntimeEnvironment
@RunWith(RobolectricTestRunner::class)
class CompositeReactPackageTest {
private lateinit var packageNo1: ReactPackage
private lateinit var packageNo2: ReactPackage
private lateinit var packageNo3: ReactPackage
private lateinit var reactContext: ReactApplicationContext
@Before
fun setUp() {
packageNo1 = mock(ReactPackage::class.java)
packageNo2 = mock(ReactPackage::class.java)
packageNo3 = mock(ReactPackage::class.java)
reactContext = BridgeReactContext(RuntimeEnvironment.getApplication())
}
@Test
@Suppress("DEPRECATION")
fun testThatCreateNativeModulesIsCalledOnAllPackages() {
// Given
val composite = CompositeReactPackage(packageNo1, packageNo2, packageNo3)
// When
composite.createNativeModules(reactContext)
// Then
verify(packageNo1).createNativeModules(reactContext)
verify(packageNo2).createNativeModules(reactContext)
verify(packageNo3).createNativeModules(reactContext)
}
@Test
@Suppress("DEPRECATION")
fun testThatCreateViewManagersIsCalledOnAllPackages() {
// Given
val composite = CompositeReactPackage(packageNo1, packageNo2, packageNo3)
// When
composite.createViewManagers(reactContext)
// Then
verify(packageNo1).createViewManagers(reactContext)
verify(packageNo2).createViewManagers(reactContext)
verify(packageNo3).createViewManagers(reactContext)
}
@Test
@Suppress("DEPRECATION")
fun testThatCompositeReturnsASumOfNativeModules() {
// Given
val composite = CompositeReactPackage(packageNo1, packageNo2)
val moduleNo1 = mock(NativeModule::class.java)
whenever(moduleNo1.name).thenReturn("ModuleNo1")
// module2 and module3 will share same name, composite should return only the latter one
val sameModuleName = "SameModuleName"
val moduleNo2 = mock(NativeModule::class.java)
whenever(moduleNo2.name).thenReturn(sameModuleName)
val moduleNo3 = mock(NativeModule::class.java)
whenever(moduleNo3.name).thenReturn(sameModuleName)
val moduleNo4 = mock(NativeModule::class.java)
whenever(moduleNo4.name).thenReturn("ModuleNo4")
whenever(packageNo1.createNativeModules(reactContext)).thenReturn(listOf(moduleNo1, moduleNo2))
whenever(packageNo2.createNativeModules(reactContext)).thenReturn(listOf(moduleNo3, moduleNo4))
// When
val compositeModules = composite.createNativeModules(reactContext)
// Then
// Wrapping lists into sets to be order-independent.
// Note that there should be no module2 returned.
val expected: Set<NativeModule> = setOf(moduleNo1, moduleNo3, moduleNo4)
val actual: Set<NativeModule> = compositeModules.toSet()
assertThat(actual).isEqualTo(expected)
}
@Test
@Suppress("DEPRECATION")
fun testThatCompositeReturnsASumOfViewManagers() {
// Given
val composite = CompositeReactPackage(packageNo1, packageNo2)
val managerNo1 = mock(ViewManager::class.java)
whenever(managerNo1.name).thenReturn("ManagerNo1")
// managerNo2 and managerNo3 will share same name, composite should return only the latter
// one
val sameModuleName = "SameModuleName"
val managerNo2 = mock(ViewManager::class.java)
whenever(managerNo2.name).thenReturn(sameModuleName)
val managerNo3 = mock(ViewManager::class.java)
whenever(managerNo3.name).thenReturn(sameModuleName)
val managerNo4 = mock(ViewManager::class.java)
whenever(managerNo4.name).thenReturn("ManagerNo4")
whenever(packageNo1.createViewManagers(reactContext)).thenReturn(listOf(managerNo1, managerNo2))
whenever(packageNo2.createViewManagers(reactContext)).thenReturn(listOf(managerNo3, managerNo4))
// When
val compositeModules = composite.createViewManagers(reactContext)
// Then
// Wrapping lists into sets to be order-independent.
// Note that there should be no managerNo2 returned.
val expected: Set<ViewManager<*, *>> = setOf(managerNo1, managerNo3, managerNo4)
val actual: Set<ViewManager<*, *>> = compositeModules.toSet()
assertThat(actual).isEqualTo(expected)
}
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.views.text
import org.assertj.core.api.Assertions.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class TextTransformTest {
@Test
fun textTransformCapitalize() {
val input = "hello WORLD from ReAcT nAtIvE 2a !b c"
val output = "Hello WORLD From ReAcT NAtIvE 2a !B C"
assertThat(TextTransform.apply(input, TextTransform.CAPITALIZE)).isEqualTo(output)
}
@Test
fun textTransformUppercase() {
val input = "hello WORLD from ReAcT nAtIvE 2a !b c"
val output = "HELLO WORLD FROM REACT NATIVE 2A !B C"
assertThat(TextTransform.apply(input, TextTransform.UPPERCASE)).isEqualTo(output)
}
@Test
fun textTransformLowercase() {
val input = "hello WORLD from ReAcT nAtIvE 2a !b c"
val output = "hello world from react native 2a !b c"
assertThat(TextTransform.apply(input, TextTransform.LOWERCASE)).isEqualTo(output)
}
}
@@ -78,6 +78,7 @@ Pod::Spec.new do |s|
s.dependency "DoubleConversion"
s.dependency "fast_float", "6.1.4"
s.dependency "fmt", "11.0.2"
s.dependency "React-featureflags"
s.dependency "React-ImageManager"
s.dependency "React-utils"
s.dependency "Yoga"
@@ -50,6 +50,18 @@ void objectAssign(
auto assign = Object.getPropertyAsFunction(runtime, "assign");
assign.callWithThis(runtime, Object, target, value);
}
jsi::Object wrapInErrorIfNecessary(
jsi::Runtime& runtime,
const jsi::Value& value) {
auto Error = runtime.global().getPropertyAsFunction(runtime, "Error");
auto isError =
value.isObject() && value.asObject(runtime).instanceOf(runtime, Error);
auto error = isError
? value.getObject(runtime)
: Error.callAsConstructor(runtime, value).getObject(runtime);
return error;
}
} // namespace
namespace facebook::react {
@@ -187,7 +199,7 @@ void JsErrorHandler::emitError(
jsi::JSError& error,
bool isFatal) {
auto message = error.getMessage();
auto errorObj = error.value().getObject(runtime);
auto errorObj = wrapInErrorIfNecessary(runtime, error.value());
auto componentStackValue = errorObj.getProperty(runtime, "componentStack");
if (!isLooselyNull(componentStackValue)) {
message += "\n" + stringifyToCpp(runtime, componentStackValue);
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<2797dcc4840b0f60670760231f51d459>>
* @generated SignedSource<<abba7ef1f3108b195eef7bfc0a9a26db>>
*/
/**
@@ -42,6 +42,10 @@ bool ReactNativeFeatureFlags::disableEventLoopOnBridgeless() {
return getAccessor().disableEventLoopOnBridgeless();
}
bool ReactNativeFeatureFlags::disableMountItemReorderingAndroid() {
return getAccessor().disableMountItemReorderingAndroid();
}
bool ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS() {
return getAccessor().enableAlignItemsBaselineOnFabricIOS();
}
@@ -58,6 +62,10 @@ bool ReactNativeFeatureFlags::enableCleanTextInputYogaNode() {
return getAccessor().enableCleanTextInputYogaNode();
}
bool ReactNativeFeatureFlags::enableCppPropsIteratorSetter() {
return getAccessor().enableCppPropsIteratorSetter();
}
bool ReactNativeFeatureFlags::enableDeletionOfUnmountedViews() {
return getAccessor().enableDeletionOfUnmountedViews();
}
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<64ea086a7c847e822595983867cdf776>>
* @generated SignedSource<<c6419e8e932f65c7be43425e01776dc9>>
*/
/**
@@ -59,6 +59,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool disableEventLoopOnBridgeless();
/**
* Prevent FabricMountingManager from reordering mountitems, which may lead to invalid state on the UI thread
*/
RN_EXPORT static bool disableMountItemReorderingAndroid();
/**
* Kill-switch to turn off support for aling-items:baseline on Fabric iOS.
*/
@@ -79,6 +84,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableCleanTextInputYogaNode();
/**
* Enable prop iterator setter-style construction of Props in C++ (this flag is not used in Java).
*/
RN_EXPORT static bool enableCppPropsIteratorSetter();
/**
* Deletes views that were pre-allocated but never mounted on the screen.
*/
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<309c5668b6fea35c89764f496d58e803>>
* @generated SignedSource<<fe44d2dba1abe83205db630abe1c2e9a>>
*/
/**
@@ -101,6 +101,24 @@ bool ReactNativeFeatureFlagsAccessor::disableEventLoopOnBridgeless() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::disableMountItemReorderingAndroid() {
auto flagValue = disableMountItemReorderingAndroid_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "disableMountItemReorderingAndroid");
flagValue = currentProvider_->disableMountItemReorderingAndroid();
disableMountItemReorderingAndroid_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableAlignItemsBaselineOnFabricIOS() {
auto flagValue = enableAlignItemsBaselineOnFabricIOS_.load();
@@ -110,7 +128,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAlignItemsBaselineOnFabricIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "enableAlignItemsBaselineOnFabricIOS");
markFlagAsAccessed(5, "enableAlignItemsBaselineOnFabricIOS");
flagValue = currentProvider_->enableAlignItemsBaselineOnFabricIOS();
enableAlignItemsBaselineOnFabricIOS_ = flagValue;
@@ -128,7 +146,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAndroidLineHeightCentering() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(5, "enableAndroidLineHeightCentering");
markFlagAsAccessed(6, "enableAndroidLineHeightCentering");
flagValue = currentProvider_->enableAndroidLineHeightCentering();
enableAndroidLineHeightCentering_ = flagValue;
@@ -146,7 +164,7 @@ bool ReactNativeFeatureFlagsAccessor::enableBridgelessArchitecture() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(6, "enableBridgelessArchitecture");
markFlagAsAccessed(7, "enableBridgelessArchitecture");
flagValue = currentProvider_->enableBridgelessArchitecture();
enableBridgelessArchitecture_ = flagValue;
@@ -164,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(7, "enableCleanTextInputYogaNode");
markFlagAsAccessed(8, "enableCleanTextInputYogaNode");
flagValue = currentProvider_->enableCleanTextInputYogaNode();
enableCleanTextInputYogaNode_ = flagValue;
@@ -173,6 +191,24 @@ bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableCppPropsIteratorSetter() {
auto flagValue = enableCppPropsIteratorSetter_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
// If multiple threads try to initialize the feature flag, we would only
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "enableCppPropsIteratorSetter");
flagValue = currentProvider_->enableCppPropsIteratorSetter();
enableCppPropsIteratorSetter_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableDeletionOfUnmountedViews() {
auto flagValue = enableDeletionOfUnmountedViews_.load();
@@ -182,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::enableDeletionOfUnmountedViews() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(8, "enableDeletionOfUnmountedViews");
markFlagAsAccessed(10, "enableDeletionOfUnmountedViews");
flagValue = currentProvider_->enableDeletionOfUnmountedViews();
enableDeletionOfUnmountedViews_ = flagValue;
@@ -200,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEagerRootViewAttachment() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "enableEagerRootViewAttachment");
markFlagAsAccessed(11, "enableEagerRootViewAttachment");
flagValue = currentProvider_->enableEagerRootViewAttachment();
enableEagerRootViewAttachment_ = flagValue;
@@ -218,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEventEmitterRetentionDuringGesturesO
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(10, "enableEventEmitterRetentionDuringGesturesOnAndroid");
markFlagAsAccessed(12, "enableEventEmitterRetentionDuringGesturesOnAndroid");
flagValue = currentProvider_->enableEventEmitterRetentionDuringGesturesOnAndroid();
enableEventEmitterRetentionDuringGesturesOnAndroid_ = flagValue;
@@ -236,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricLogs() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(11, "enableFabricLogs");
markFlagAsAccessed(13, "enableFabricLogs");
flagValue = currentProvider_->enableFabricLogs();
enableFabricLogs_ = flagValue;
@@ -254,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricRenderer() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(12, "enableFabricRenderer");
markFlagAsAccessed(14, "enableFabricRenderer");
flagValue = currentProvider_->enableFabricRenderer();
enableFabricRenderer_ = flagValue;
@@ -272,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricRendererExclusively() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(13, "enableFabricRendererExclusively");
markFlagAsAccessed(15, "enableFabricRendererExclusively");
flagValue = currentProvider_->enableFabricRendererExclusively();
enableFabricRendererExclusively_ = flagValue;
@@ -290,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::enableGranularShadowTreeStateReconciliatio
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(14, "enableGranularShadowTreeStateReconciliation");
markFlagAsAccessed(16, "enableGranularShadowTreeStateReconciliation");
flagValue = currentProvider_->enableGranularShadowTreeStateReconciliation();
enableGranularShadowTreeStateReconciliation_ = flagValue;
@@ -308,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSViewClipToPaddingBox() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(15, "enableIOSViewClipToPaddingBox");
markFlagAsAccessed(17, "enableIOSViewClipToPaddingBox");
flagValue = currentProvider_->enableIOSViewClipToPaddingBox();
enableIOSViewClipToPaddingBox_ = flagValue;
@@ -326,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(16, "enableLayoutAnimationsOnAndroid");
markFlagAsAccessed(18, "enableLayoutAnimationsOnAndroid");
flagValue = currentProvider_->enableLayoutAnimationsOnAndroid();
enableLayoutAnimationsOnAndroid_ = flagValue;
@@ -344,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(17, "enableLayoutAnimationsOnIOS");
markFlagAsAccessed(19, "enableLayoutAnimationsOnIOS");
flagValue = currentProvider_->enableLayoutAnimationsOnIOS();
enableLayoutAnimationsOnIOS_ = flagValue;
@@ -362,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLongTaskAPI() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(18, "enableLongTaskAPI");
markFlagAsAccessed(20, "enableLongTaskAPI");
flagValue = currentProvider_->enableLongTaskAPI();
enableLongTaskAPI_ = flagValue;
@@ -380,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNewBackgroundAndBorderDrawables() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(19, "enableNewBackgroundAndBorderDrawables");
markFlagAsAccessed(21, "enableNewBackgroundAndBorderDrawables");
flagValue = currentProvider_->enableNewBackgroundAndBorderDrawables();
enableNewBackgroundAndBorderDrawables_ = flagValue;
@@ -398,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePreciseSchedulingForPremountItemsOnA
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(20, "enablePreciseSchedulingForPremountItemsOnAndroid");
markFlagAsAccessed(22, "enablePreciseSchedulingForPremountItemsOnAndroid");
flagValue = currentProvider_->enablePreciseSchedulingForPremountItemsOnAndroid();
enablePreciseSchedulingForPremountItemsOnAndroid_ = flagValue;
@@ -416,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(21, "enablePropsUpdateReconciliationAndroid");
markFlagAsAccessed(23, "enablePropsUpdateReconciliationAndroid");
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
enablePropsUpdateReconciliationAndroid_ = flagValue;
@@ -434,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::enableReportEventPaintTime() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(22, "enableReportEventPaintTime");
markFlagAsAccessed(24, "enableReportEventPaintTime");
flagValue = currentProvider_->enableReportEventPaintTime();
enableReportEventPaintTime_ = flagValue;
@@ -452,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(23, "enableSynchronousStateUpdates");
markFlagAsAccessed(25, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -470,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::enableTextPreallocationOptimisation() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(24, "enableTextPreallocationOptimisation");
markFlagAsAccessed(26, "enableTextPreallocationOptimisation");
flagValue = currentProvider_->enableTextPreallocationOptimisation();
enableTextPreallocationOptimisation_ = flagValue;
@@ -488,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(25, "enableUIConsistency");
markFlagAsAccessed(27, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -506,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecycling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(26, "enableViewRecycling");
markFlagAsAccessed(28, "enableViewRecycling");
flagValue = currentProvider_->enableViewRecycling();
enableViewRecycling_ = flagValue;
@@ -524,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(27, "excludeYogaFromRawProps");
markFlagAsAccessed(29, "excludeYogaFromRawProps");
flagValue = currentProvider_->excludeYogaFromRawProps();
excludeYogaFromRawProps_ = flagValue;
@@ -542,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(28, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(30, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -560,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMountingCoordinatorReportedPendingTrans
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
markFlagAsAccessed(31, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
flagValue = currentProvider_->fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
fixMountingCoordinatorReportedPendingTransactionsOnAndroid_ = flagValue;
@@ -578,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(30, "forceBatchingMountItemsOnAndroid");
markFlagAsAccessed(32, "forceBatchingMountItemsOnAndroid");
flagValue = currentProvider_->forceBatchingMountItemsOnAndroid();
forceBatchingMountItemsOnAndroid_ = flagValue;
@@ -596,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(31, "fuseboxEnabledDebug");
markFlagAsAccessed(33, "fuseboxEnabledDebug");
flagValue = currentProvider_->fuseboxEnabledDebug();
fuseboxEnabledDebug_ = flagValue;
@@ -614,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(32, "fuseboxEnabledRelease");
markFlagAsAccessed(34, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -632,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(33, "initEagerTurboModulesOnNativeModulesQueueAndroid");
markFlagAsAccessed(35, "initEagerTurboModulesOnNativeModulesQueueAndroid");
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
@@ -650,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(34, "lazyAnimationCallbacks");
markFlagAsAccessed(36, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -668,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(35, "loadVectorDrawablesOnImages");
markFlagAsAccessed(37, "loadVectorDrawablesOnImages");
flagValue = currentProvider_->loadVectorDrawablesOnImages();
loadVectorDrawablesOnImages_ = flagValue;
@@ -686,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(36, "setAndroidLayoutDirection");
markFlagAsAccessed(38, "setAndroidLayoutDirection");
flagValue = currentProvider_->setAndroidLayoutDirection();
setAndroidLayoutDirection_ = flagValue;
@@ -704,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(37, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(39, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -722,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(38, "useFabricInterop");
markFlagAsAccessed(40, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -740,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless()
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(39, "useImmediateExecutorInAndroidBridgeless");
markFlagAsAccessed(41, "useImmediateExecutorInAndroidBridgeless");
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
useImmediateExecutorInAndroidBridgeless_ = flagValue;
@@ -758,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(40, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(42, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -776,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(41, "useOptimisedViewPreallocationOnAndroid");
markFlagAsAccessed(43, "useOptimisedViewPreallocationOnAndroid");
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
useOptimisedViewPreallocationOnAndroid_ = flagValue;
@@ -794,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(42, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(44, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -812,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(43, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(45, "useRuntimeShadowNodeReferenceUpdate");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
@@ -830,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(44, "useTurboModuleInterop");
markFlagAsAccessed(46, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -848,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(45, "useTurboModules");
markFlagAsAccessed(47, "useTurboModules");
flagValue = currentProvider_->useTurboModules();
useTurboModules_ = flagValue;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<e6092a90044213cc3b88f995a301aeb6>>
* @generated SignedSource<<afdb4fb4d8419dca361ca8bf7dbc4fb3>>
*/
/**
@@ -36,10 +36,12 @@ class ReactNativeFeatureFlagsAccessor {
bool allowRecursiveCommitsWithSynchronousMountOnAndroid();
bool completeReactInstanceCreationOnBgThreadOnAndroid();
bool disableEventLoopOnBridgeless();
bool disableMountItemReorderingAndroid();
bool enableAlignItemsBaselineOnFabricIOS();
bool enableAndroidLineHeightCentering();
bool enableBridgelessArchitecture();
bool enableCleanTextInputYogaNode();
bool enableCppPropsIteratorSetter();
bool enableDeletionOfUnmountedViews();
bool enableEagerRootViewAttachment();
bool enableEventEmitterRetentionDuringGesturesOnAndroid();
@@ -89,16 +91,18 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 46> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 48> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> allowRecursiveCommitsWithSynchronousMountOnAndroid_;
std::atomic<std::optional<bool>> completeReactInstanceCreationOnBgThreadOnAndroid_;
std::atomic<std::optional<bool>> disableEventLoopOnBridgeless_;
std::atomic<std::optional<bool>> disableMountItemReorderingAndroid_;
std::atomic<std::optional<bool>> enableAlignItemsBaselineOnFabricIOS_;
std::atomic<std::optional<bool>> enableAndroidLineHeightCentering_;
std::atomic<std::optional<bool>> enableBridgelessArchitecture_;
std::atomic<std::optional<bool>> enableCleanTextInputYogaNode_;
std::atomic<std::optional<bool>> enableCppPropsIteratorSetter_;
std::atomic<std::optional<bool>> enableDeletionOfUnmountedViews_;
std::atomic<std::optional<bool>> enableEagerRootViewAttachment_;
std::atomic<std::optional<bool>> enableEventEmitterRetentionDuringGesturesOnAndroid_;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c624d0aed510abd12f9b808324dc2da8>>
* @generated SignedSource<<631c825e33e07674e19a084a33637a50>>
*/
/**
@@ -43,6 +43,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool disableMountItemReorderingAndroid() override {
return false;
}
bool enableAlignItemsBaselineOnFabricIOS() override {
return true;
}
@@ -59,6 +63,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool enableCppPropsIteratorSetter() override {
return false;
}
bool enableDeletionOfUnmountedViews() override {
return false;
}
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<35bffd8482840e9a7d0255098e78450a>>
* @generated SignedSource<<18597e1e2a88be3d80b8747f72576d5f>>
*/
/**
@@ -29,10 +29,12 @@ class ReactNativeFeatureFlagsProvider {
virtual bool allowRecursiveCommitsWithSynchronousMountOnAndroid() = 0;
virtual bool completeReactInstanceCreationOnBgThreadOnAndroid() = 0;
virtual bool disableEventLoopOnBridgeless() = 0;
virtual bool disableMountItemReorderingAndroid() = 0;
virtual bool enableAlignItemsBaselineOnFabricIOS() = 0;
virtual bool enableAndroidLineHeightCentering() = 0;
virtual bool enableBridgelessArchitecture() = 0;
virtual bool enableCleanTextInputYogaNode() = 0;
virtual bool enableCppPropsIteratorSetter() = 0;
virtual bool enableDeletionOfUnmountedViews() = 0;
virtual bool enableEagerRootViewAttachment() = 0;
virtual bool enableEventEmitterRetentionDuringGesturesOnAndroid() = 0;
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<12ecbb280bde10b2d74376a2a890cf97>>
* @generated SignedSource<<43e3b8b18dec356b5121b581ab8ffa02>>
*/
/**
@@ -71,6 +71,11 @@ bool NativeReactNativeFeatureFlags::disableEventLoopOnBridgeless(
return ReactNativeFeatureFlags::disableEventLoopOnBridgeless();
}
bool NativeReactNativeFeatureFlags::disableMountItemReorderingAndroid(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
}
bool NativeReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS();
@@ -91,6 +96,11 @@ bool NativeReactNativeFeatureFlags::enableCleanTextInputYogaNode(
return ReactNativeFeatureFlags::enableCleanTextInputYogaNode();
}
bool NativeReactNativeFeatureFlags::enableCppPropsIteratorSetter(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableCppPropsIteratorSetter();
}
bool NativeReactNativeFeatureFlags::enableDeletionOfUnmountedViews(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableDeletionOfUnmountedViews();
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<00421354f8b4b982f5eac771592d418f>>
* @generated SignedSource<<f6fb3afe84c464ac7ae60b34181c182b>>
*/
/**
@@ -47,6 +47,8 @@ class NativeReactNativeFeatureFlags
bool disableEventLoopOnBridgeless(jsi::Runtime& runtime);
bool disableMountItemReorderingAndroid(jsi::Runtime& runtime);
bool enableAlignItemsBaselineOnFabricIOS(jsi::Runtime& runtime);
bool enableAndroidLineHeightCentering(jsi::Runtime& runtime);
@@ -55,6 +57,8 @@ class NativeReactNativeFeatureFlags
bool enableCleanTextInputYogaNode(jsi::Runtime& runtime);
bool enableCppPropsIteratorSetter(jsi::Runtime& runtime);
bool enableDeletionOfUnmountedViews(jsi::Runtime& runtime);
bool enableEagerRootViewAttachment(jsi::Runtime& runtime);
@@ -5,10 +5,10 @@
* LICENSE file in the root directory of this source tree.
*/
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/image/ImageProps.h>
#include <react/renderer/components/image/conversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -18,15 +18,16 @@ ImageProps::ImageProps(
const RawProps& rawProps)
: ViewProps(context, sourceProps, rawProps),
sources(
CoreFeatures::enablePropIteratorSetter ? sourceProps.sources
: convertRawProp(
context,
rawProps,
"source",
sourceProps.sources,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.sources
: convertRawProp(
context,
rawProps,
"source",
sourceProps.sources,
{})),
defaultSources(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.defaultSources
: convertRawProp(
context,
@@ -35,7 +36,7 @@ ImageProps::ImageProps(
sourceProps.defaultSources,
{})),
resizeMode(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.resizeMode
: convertRawProp(
context,
@@ -44,31 +45,34 @@ ImageProps::ImageProps(
sourceProps.resizeMode,
ImageResizeMode::Stretch)),
blurRadius(
CoreFeatures::enablePropIteratorSetter ? sourceProps.blurRadius
: convertRawProp(
context,
rawProps,
"blurRadius",
sourceProps.blurRadius,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.blurRadius
: convertRawProp(
context,
rawProps,
"blurRadius",
sourceProps.blurRadius,
{})),
capInsets(
CoreFeatures::enablePropIteratorSetter ? sourceProps.capInsets
: convertRawProp(
context,
rawProps,
"capInsets",
sourceProps.capInsets,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.capInsets
: convertRawProp(
context,
rawProps,
"capInsets",
sourceProps.capInsets,
{})),
tintColor(
CoreFeatures::enablePropIteratorSetter ? sourceProps.tintColor
: convertRawProp(
context,
rawProps,
"tintColor",
sourceProps.tintColor,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.tintColor
: convertRawProp(
context,
rawProps,
"tintColor",
sourceProps.tintColor,
{})),
internal_analyticTag(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.internal_analyticTag
: convertRawProp(
context,
@@ -7,10 +7,10 @@
#include "ScrollViewProps.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/scrollview/conversions.h>
#include <react/renderer/core/graphicsConversions.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <react/utils/CoreFeatures.h>
#include <react/renderer/core/propsConversions.h>
@@ -22,7 +22,7 @@ ScrollViewProps::ScrollViewProps(
const RawProps& rawProps)
: ViewProps(context, sourceProps, rawProps),
alwaysBounceHorizontal(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.alwaysBounceHorizontal
: convertRawProp(
context,
@@ -31,7 +31,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.alwaysBounceHorizontal,
{})),
alwaysBounceVertical(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.alwaysBounceVertical
: convertRawProp(
context,
@@ -40,23 +40,25 @@ ScrollViewProps::ScrollViewProps(
sourceProps.alwaysBounceVertical,
{})),
bounces(
CoreFeatures::enablePropIteratorSetter ? sourceProps.bounces
: convertRawProp(
context,
rawProps,
"bounces",
sourceProps.bounces,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.bounces
: convertRawProp(
context,
rawProps,
"bounces",
sourceProps.bounces,
true)),
bouncesZoom(
CoreFeatures::enablePropIteratorSetter ? sourceProps.bouncesZoom
: convertRawProp(
context,
rawProps,
"bouncesZoom",
sourceProps.bouncesZoom,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.bouncesZoom
: convertRawProp(
context,
rawProps,
"bouncesZoom",
sourceProps.bouncesZoom,
true)),
canCancelContentTouches(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.canCancelContentTouches
: convertRawProp(
context,
@@ -65,7 +67,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.canCancelContentTouches,
true)),
centerContent(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.centerContent
: convertRawProp(
context,
@@ -74,7 +76,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.centerContent,
{})),
automaticallyAdjustContentInsets(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.automaticallyAdjustContentInsets
: convertRawProp(
context,
@@ -83,7 +85,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.automaticallyAdjustContentInsets,
{})),
automaticallyAdjustsScrollIndicatorInsets(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.automaticallyAdjustsScrollIndicatorInsets
: convertRawProp(
context,
@@ -92,7 +94,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.automaticallyAdjustsScrollIndicatorInsets,
true)),
automaticallyAdjustKeyboardInsets(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.automaticallyAdjustKeyboardInsets
: convertRawProp(
context,
@@ -101,7 +103,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.automaticallyAdjustKeyboardInsets,
false)),
decelerationRate(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.decelerationRate
: convertRawProp(
context,
@@ -110,7 +112,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.decelerationRate,
(Float)0.998)),
endDraggingSensitivityMultiplier(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.endDraggingSensitivityMultiplier
: convertRawProp(
context,
@@ -119,7 +121,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.endDraggingSensitivityMultiplier,
(Float)1)),
enableSyncOnScroll(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.enableSyncOnScroll
: convertRawProp(
context,
@@ -128,7 +130,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.enableSyncOnScroll,
false)),
directionalLockEnabled(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.directionalLockEnabled
: convertRawProp(
context,
@@ -137,7 +139,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.directionalLockEnabled,
{})),
indicatorStyle(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.indicatorStyle
: convertRawProp(
context,
@@ -146,7 +148,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.indicatorStyle,
{})),
keyboardDismissMode(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.keyboardDismissMode
: convertRawProp(
context,
@@ -155,7 +157,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.keyboardDismissMode,
{})),
maintainVisibleContentPosition(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.maintainVisibleContentPosition
: convertRawProp(
context,
@@ -164,7 +166,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.maintainVisibleContentPosition,
{})),
maximumZoomScale(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.maximumZoomScale
: convertRawProp(
context,
@@ -173,7 +175,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.maximumZoomScale,
(Float)1.0)),
minimumZoomScale(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.minimumZoomScale
: convertRawProp(
context,
@@ -182,7 +184,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.minimumZoomScale,
(Float)1.0)),
scrollEnabled(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.scrollEnabled
: convertRawProp(
context,
@@ -191,7 +193,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollEnabled,
true)),
pagingEnabled(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.pagingEnabled
: convertRawProp(
context,
@@ -200,7 +202,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.pagingEnabled,
{})),
pinchGestureEnabled(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.pinchGestureEnabled
: convertRawProp(
context,
@@ -209,15 +211,16 @@ ScrollViewProps::ScrollViewProps(
sourceProps.pinchGestureEnabled,
true)),
scrollsToTop(
CoreFeatures::enablePropIteratorSetter ? sourceProps.scrollsToTop
: convertRawProp(
context,
rawProps,
"scrollsToTop",
sourceProps.scrollsToTop,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.scrollsToTop
: convertRawProp(
context,
rawProps,
"scrollsToTop",
sourceProps.scrollsToTop,
true)),
showsHorizontalScrollIndicator(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.showsHorizontalScrollIndicator
: convertRawProp(
context,
@@ -226,7 +229,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.showsHorizontalScrollIndicator,
true)),
showsVerticalScrollIndicator(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.showsVerticalScrollIndicator
: convertRawProp(
context,
@@ -235,7 +238,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.showsVerticalScrollIndicator,
true)),
persistentScrollbar(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.persistentScrollbar
: convertRawProp(
context,
@@ -244,15 +247,16 @@ ScrollViewProps::ScrollViewProps(
sourceProps.persistentScrollbar,
true)),
horizontal(
CoreFeatures::enablePropIteratorSetter ? sourceProps.horizontal
: convertRawProp(
context,
rawProps,
"horizontal",
sourceProps.horizontal,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.horizontal
: convertRawProp(
context,
rawProps,
"horizontal",
sourceProps.horizontal,
true)),
scrollEventThrottle(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.scrollEventThrottle
: convertRawProp(
context,
@@ -261,23 +265,25 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollEventThrottle,
{})),
zoomScale(
CoreFeatures::enablePropIteratorSetter ? sourceProps.zoomScale
: convertRawProp(
context,
rawProps,
"zoomScale",
sourceProps.zoomScale,
(Float)1.0)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.zoomScale
: convertRawProp(
context,
rawProps,
"zoomScale",
sourceProps.zoomScale,
(Float)1.0)),
contentInset(
CoreFeatures::enablePropIteratorSetter ? sourceProps.contentInset
: convertRawProp(
context,
rawProps,
"contentInset",
sourceProps.contentInset,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.contentInset
: convertRawProp(
context,
rawProps,
"contentInset",
sourceProps.contentInset,
{})),
contentOffset(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.contentOffset
: convertRawProp(
context,
@@ -286,7 +292,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.contentOffset,
{})),
scrollIndicatorInsets(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.scrollIndicatorInsets
: convertRawProp(
context,
@@ -295,7 +301,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollIndicatorInsets,
{})),
snapToInterval(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToInterval
: convertRawProp(
context,
@@ -304,7 +310,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.snapToInterval,
{})),
snapToAlignment(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToAlignment
: convertRawProp(
context,
@@ -313,7 +319,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.snapToAlignment,
{})),
disableIntervalMomentum(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.disableIntervalMomentum
: convertRawProp(
context,
@@ -322,7 +328,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.disableIntervalMomentum,
{})),
snapToOffsets(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToOffsets
: convertRawProp(
context,
@@ -331,23 +337,25 @@ ScrollViewProps::ScrollViewProps(
sourceProps.snapToOffsets,
{})),
snapToStart(
CoreFeatures::enablePropIteratorSetter ? sourceProps.snapToStart
: convertRawProp(
context,
rawProps,
"snapToStart",
sourceProps.snapToStart,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToStart
: convertRawProp(
context,
rawProps,
"snapToStart",
sourceProps.snapToStart,
true)),
snapToEnd(
CoreFeatures::enablePropIteratorSetter ? sourceProps.snapToEnd
: convertRawProp(
context,
rawProps,
"snapToEnd",
sourceProps.snapToEnd,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToEnd
: convertRawProp(
context,
rawProps,
"snapToEnd",
sourceProps.snapToEnd,
true)),
contentInsetAdjustmentBehavior(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.contentInsetAdjustmentBehavior
: convertRawProp(
context,
@@ -356,7 +364,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.contentInsetAdjustmentBehavior,
{ContentInsetAdjustmentBehavior::Never})),
scrollToOverflowEnabled(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.scrollToOverflowEnabled
: convertRawProp(
context,
@@ -365,7 +373,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollToOverflowEnabled,
{})),
isInvertedVirtualizedList(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.isInvertedVirtualizedList
: convertRawProp(
context,
@@ -7,11 +7,11 @@
#include "BaseTextProps.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/attributedstring/conversions.h>
#include <react/renderer/core/graphicsConversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/debug/DebugStringConvertibleItem.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -230,7 +230,7 @@ BaseTextProps::BaseTextProps(
const BaseTextProps& sourceProps,
const RawProps& rawProps)
: textAttributes(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.textAttributes
: convertRawProp(
context,
@@ -7,11 +7,11 @@
#include "ParagraphProps.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/attributedstring/conversions.h>
#include <react/renderer/attributedstring/primitives.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <react/utils/CoreFeatures.h>
#include <glog/logging.h>
@@ -24,7 +24,7 @@ ParagraphProps::ParagraphProps(
: ViewProps(context, sourceProps, rawProps),
BaseTextProps(context, sourceProps, rawProps),
paragraphAttributes(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.paragraphAttributes
: convertRawProp(
context,
@@ -32,21 +32,23 @@ ParagraphProps::ParagraphProps(
sourceProps.paragraphAttributes,
{})),
isSelectable(
CoreFeatures::enablePropIteratorSetter ? sourceProps.isSelectable
: convertRawProp(
context,
rawProps,
"selectable",
sourceProps.isSelectable,
false)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.isSelectable
: convertRawProp(
context,
rawProps,
"selectable",
sourceProps.isSelectable,
false)),
onTextLayout(
CoreFeatures::enablePropIteratorSetter ? sourceProps.onTextLayout
: convertRawProp(
context,
rawProps,
"onTextLayout",
sourceProps.onTextLayout,
{})) {
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onTextLayout
: convertRawProp(
context,
rawProps,
"onTextLayout",
sourceProps.onTextLayout,
{})) {
/*
* These props are applied to `View`, therefore they must not be a part of
* base text attributes.
@@ -21,7 +21,6 @@
#include <react/renderer/core/graphicsConversions.h>
#include <react/renderer/graphics/Color.h>
#include <react/renderer/imagemanager/primitives.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -6,10 +6,10 @@
*/
#include "AndroidTextInputProps.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/image/conversions.h>
#include <react/renderer/core/graphicsConversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -37,162 +37,162 @@ AndroidTextInputProps::AndroidTextInputProps(
const AndroidTextInputProps &sourceProps,
const RawProps &rawProps)
: BaseTextInputProps(context, sourceProps, rawProps),
autoComplete(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp(
autoComplete(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoComplete : convertRawProp(
context,
rawProps,
"autoComplete",
sourceProps.autoComplete,
{})),
returnKeyLabel(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp(context, rawProps,
returnKeyLabel(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoComplete : convertRawProp(context, rawProps,
"returnKeyLabel",
sourceProps.returnKeyLabel,
{})),
numberOfLines(CoreFeatures::enablePropIteratorSetter? sourceProps.numberOfLines : convertRawProp(context, rawProps,
numberOfLines(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.numberOfLines : convertRawProp(context, rawProps,
"numberOfLines",
sourceProps.numberOfLines,
{0})),
disableFullscreenUI(CoreFeatures::enablePropIteratorSetter? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps,
disableFullscreenUI(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps,
"disableFullscreenUI",
sourceProps.disableFullscreenUI,
{false})),
textBreakStrategy(CoreFeatures::enablePropIteratorSetter? sourceProps.textBreakStrategy : convertRawProp(context, rawProps,
textBreakStrategy(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textBreakStrategy : convertRawProp(context, rawProps,
"textBreakStrategy",
sourceProps.textBreakStrategy,
{})),
inlineImageLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImageLeft : convertRawProp(context, rawProps,
inlineImageLeft(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.inlineImageLeft : convertRawProp(context, rawProps,
"inlineImageLeft",
sourceProps.inlineImageLeft,
{})),
inlineImagePadding(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImagePadding : convertRawProp(context, rawProps,
inlineImagePadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.inlineImagePadding : convertRawProp(context, rawProps,
"inlineImagePadding",
sourceProps.inlineImagePadding,
{0})),
importantForAutofill(CoreFeatures::enablePropIteratorSetter? sourceProps.importantForAutofill : convertRawProp(context, rawProps,
importantForAutofill(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.importantForAutofill : convertRawProp(context, rawProps,
"importantForAutofill",
sourceProps.importantForAutofill,
{})),
showSoftInputOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps,
showSoftInputOnFocus(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps,
"showSoftInputOnFocus",
sourceProps.showSoftInputOnFocus,
{false})),
autoCorrect(CoreFeatures::enablePropIteratorSetter? sourceProps.autoCorrect : convertRawProp(context, rawProps,
autoCorrect(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoCorrect : convertRawProp(context, rawProps,
"autoCorrect",
sourceProps.autoCorrect,
{false})),
allowFontScaling(CoreFeatures::enablePropIteratorSetter? sourceProps.allowFontScaling : convertRawProp(context, rawProps,
allowFontScaling(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.allowFontScaling : convertRawProp(context, rawProps,
"allowFontScaling",
sourceProps.allowFontScaling,
{false})),
maxFontSizeMultiplier(CoreFeatures::enablePropIteratorSetter? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps,
maxFontSizeMultiplier(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps,
"maxFontSizeMultiplier",
sourceProps.maxFontSizeMultiplier,
{0.0})),
keyboardType(CoreFeatures::enablePropIteratorSetter? sourceProps.keyboardType : convertRawProp(context, rawProps,
keyboardType(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.keyboardType : convertRawProp(context, rawProps,
"keyboardType",
sourceProps.keyboardType,
{})),
returnKeyType(CoreFeatures::enablePropIteratorSetter? sourceProps.returnKeyType : convertRawProp(context, rawProps,
returnKeyType(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.returnKeyType : convertRawProp(context, rawProps,
"returnKeyType",
sourceProps.returnKeyType,
{})),
multiline(CoreFeatures::enablePropIteratorSetter? sourceProps.multiline : convertRawProp(context, rawProps,
multiline(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.multiline : convertRawProp(context, rawProps,
"multiline",
sourceProps.multiline,
{false})),
secureTextEntry(CoreFeatures::enablePropIteratorSetter? sourceProps.secureTextEntry : convertRawProp(context, rawProps,
secureTextEntry(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.secureTextEntry : convertRawProp(context, rawProps,
"secureTextEntry",
sourceProps.secureTextEntry,
{false})),
value(CoreFeatures::enablePropIteratorSetter? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})),
selectTextOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps,
value(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})),
selectTextOnFocus(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps,
"selectTextOnFocus",
sourceProps.selectTextOnFocus,
{false})),
submitBehavior(CoreFeatures::enablePropIteratorSetter? sourceProps.submitBehavior : convertRawProp(context, rawProps,
submitBehavior(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.submitBehavior : convertRawProp(context, rawProps,
"submitBehavior",
sourceProps.submitBehavior,
{})),
caretHidden(CoreFeatures::enablePropIteratorSetter? sourceProps.caretHidden : convertRawProp(context, rawProps,
caretHidden(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.caretHidden : convertRawProp(context, rawProps,
"caretHidden",
sourceProps.caretHidden,
{false})),
contextMenuHidden(CoreFeatures::enablePropIteratorSetter? sourceProps.contextMenuHidden : convertRawProp(context, rawProps,
contextMenuHidden(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.contextMenuHidden : convertRawProp(context, rawProps,
"contextMenuHidden",
sourceProps.contextMenuHidden,
{false})),
textShadowColor(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowColor : convertRawProp(context, rawProps,
textShadowColor(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowColor : convertRawProp(context, rawProps,
"textShadowColor",
sourceProps.textShadowColor,
{})),
textShadowRadius(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowRadius : convertRawProp(context, rawProps,
textShadowRadius(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowRadius : convertRawProp(context, rawProps,
"textShadowRadius",
sourceProps.textShadowRadius,
{0.0})),
textDecorationLine(CoreFeatures::enablePropIteratorSetter? sourceProps.textDecorationLine : convertRawProp(context, rawProps,
textDecorationLine(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textDecorationLine : convertRawProp(context, rawProps,
"textDecorationLine",
sourceProps.textDecorationLine,
{})),
fontStyle(CoreFeatures::enablePropIteratorSetter? sourceProps.fontStyle :
fontStyle(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontStyle :
convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {})),
textShadowOffset(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowOffset : convertRawProp(context, rawProps,
textShadowOffset(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowOffset : convertRawProp(context, rawProps,
"textShadowOffset",
sourceProps.textShadowOffset,
{})),
lineHeight(CoreFeatures::enablePropIteratorSetter? sourceProps.lineHeight : convertRawProp(context, rawProps,
lineHeight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.lineHeight : convertRawProp(context, rawProps,
"lineHeight",
sourceProps.lineHeight,
{0.0})),
textTransform(CoreFeatures::enablePropIteratorSetter? sourceProps.textTransform : convertRawProp(context, rawProps,
textTransform(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textTransform : convertRawProp(context, rawProps,
"textTransform",
sourceProps.textTransform,
{})),
color(0 /*convertRawProp(context, rawProps, "color", sourceProps.color, {0})*/),
letterSpacing(CoreFeatures::enablePropIteratorSetter? sourceProps.letterSpacing : convertRawProp(context, rawProps,
letterSpacing(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.letterSpacing : convertRawProp(context, rawProps,
"letterSpacing",
sourceProps.letterSpacing,
{0.0})),
fontSize(CoreFeatures::enablePropIteratorSetter? sourceProps.fontSize :
fontSize(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontSize :
convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})),
textAlign(CoreFeatures::enablePropIteratorSetter? sourceProps.textAlign :
textAlign(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textAlign :
convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {})),
includeFontPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.includeFontPadding : convertRawProp(context, rawProps,
includeFontPadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.includeFontPadding : convertRawProp(context, rawProps,
"includeFontPadding",
sourceProps.includeFontPadding,
{false})),
fontWeight(CoreFeatures::enablePropIteratorSetter? sourceProps.fontWeight :
fontWeight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontWeight :
convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})),
fontFamily(CoreFeatures::enablePropIteratorSetter? sourceProps.fontFamily :
fontFamily(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontFamily :
convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})),
// See AndroidTextInputComponentDescriptor for usage
// TODO T63008435: can these, and this feature, be removed entirely?
hasPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "padding")),
hasPaddingHorizontal(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingHorizontal : hasValue(
hasPadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "padding")),
hasPaddingHorizontal(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingHorizontal : hasValue(
rawProps,
sourceProps.hasPaddingHorizontal,
"paddingHorizontal")),
hasPaddingVertical(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingVertical : hasValue(
hasPaddingVertical(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingVertical : hasValue(
rawProps,
sourceProps.hasPaddingVertical,
"paddingVertical")),
hasPaddingLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingLeft : hasValue(
hasPaddingLeft(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingLeft : hasValue(
rawProps,
sourceProps.hasPaddingLeft,
"paddingLeft")),
hasPaddingTop(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingTop :
hasPaddingTop(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingTop :
hasValue(rawProps, sourceProps.hasPaddingTop, "paddingTop")),
hasPaddingRight(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingRight : hasValue(
hasPaddingRight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingRight : hasValue(
rawProps,
sourceProps.hasPaddingRight,
"paddingRight")),
hasPaddingBottom(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingBottom : hasValue(
hasPaddingBottom(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingBottom : hasValue(
rawProps,
sourceProps.hasPaddingBottom,
"paddingBottom")),
hasPaddingStart(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingStart : hasValue(
hasPaddingStart(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingStart : hasValue(
rawProps,
sourceProps.hasPaddingStart,
"paddingStart")),
hasPaddingEnd(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingEnd :
hasPaddingEnd(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingEnd :
hasValue(rawProps, sourceProps.hasPaddingEnd, "paddingEnd")) {
}
@@ -7,11 +7,11 @@
#include "AccessibilityProps.h"
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/view/accessibilityPropsConversions.h>
#include <react/renderer/components/view/propsConversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -20,15 +20,16 @@ AccessibilityProps::AccessibilityProps(
const AccessibilityProps& sourceProps,
const RawProps& rawProps)
: accessible(
CoreFeatures::enablePropIteratorSetter ? sourceProps.accessible
: convertRawProp(
context,
rawProps,
"accessible",
sourceProps.accessible,
false)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessible
: convertRawProp(
context,
rawProps,
"accessible",
sourceProps.accessible,
false)),
accessibilityState(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityState
: convertRawProp(
context,
@@ -37,7 +38,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityState,
{})),
accessibilityLabel(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityLabel
: convertRawProp(
context,
@@ -46,7 +47,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLabel,
"")),
accessibilityLabelledBy(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityLabelledBy
: convertRawProp(
context,
@@ -55,7 +56,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLabelledBy,
{})),
accessibilityLiveRegion(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityLiveRegion
: convertRawProp(
context,
@@ -64,7 +65,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLiveRegion,
AccessibilityLiveRegion::None)),
accessibilityHint(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityHint
: convertRawProp(
context,
@@ -73,7 +74,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityHint,
"")),
accessibilityLanguage(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityLanguage
: convertRawProp(
context,
@@ -82,7 +83,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLanguage,
"")),
accessibilityLargeContentTitle(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityLargeContentTitle
: convertRawProp(
context,
@@ -91,7 +92,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLargeContentTitle,
"")),
accessibilityValue(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityValue
: convertRawProp(
context,
@@ -100,7 +101,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityValue,
{})),
accessibilityActions(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityActions
: convertRawProp(
context,
@@ -109,7 +110,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityActions,
{})),
accessibilityShowsLargeContentViewer(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityShowsLargeContentViewer
: convertRawProp(
context,
@@ -118,7 +119,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityShowsLargeContentViewer,
false)),
accessibilityViewIsModal(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityViewIsModal
: convertRawProp(
context,
@@ -127,7 +128,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityViewIsModal,
false)),
accessibilityElementsHidden(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityElementsHidden
: convertRawProp(
context,
@@ -136,7 +137,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityElementsHidden,
false)),
accessibilityIgnoresInvertColors(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessibilityIgnoresInvertColors
: convertRawProp(
context,
@@ -145,7 +146,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityIgnoresInvertColors,
false)),
onAccessibilityTap(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onAccessibilityTap
: convertRawProp(
context,
@@ -154,7 +155,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityTap,
{})),
onAccessibilityMagicTap(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onAccessibilityMagicTap
: convertRawProp(
context,
@@ -163,7 +164,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityMagicTap,
{})),
onAccessibilityEscape(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onAccessibilityEscape
: convertRawProp(
context,
@@ -172,7 +173,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityEscape,
{})),
onAccessibilityAction(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onAccessibilityAction
: convertRawProp(
context,
@@ -181,7 +182,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityAction,
{})),
importantForAccessibility(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.importantForAccessibility
: convertRawProp(
context,
@@ -190,13 +191,14 @@ AccessibilityProps::AccessibilityProps(
sourceProps.importantForAccessibility,
ImportantForAccessibility::Auto)),
testId(
CoreFeatures::enablePropIteratorSetter ? sourceProps.testId
: convertRawProp(
context,
rawProps,
"testID",
sourceProps.testId,
"")) {
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.testId
: convertRawProp(
context,
rawProps,
"testID",
sourceProps.testId,
"")) {
// It is a (severe!) perf deoptimization to request props out-of-order.
// Thus, since we need to request the same prop twice here
// (accessibilityRole) we "must" do them subsequently here to prevent
@@ -204,7 +206,7 @@ AccessibilityProps::AccessibilityProps(
// it probably can, but this is a fairly rare edge-case that (1) is easy-ish
// to work around here, and (2) would require very careful work to address
// this case and not regress the more common cases.
if (!CoreFeatures::enablePropIteratorSetter) {
if (!ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
auto* accessibilityRoleValue =
rawProps.at("accessibilityRole", nullptr, nullptr);
auto* roleValue = rawProps.at("role", nullptr, nullptr);
@@ -9,6 +9,7 @@
#include <algorithm>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/view/conversions.h>
#include <react/renderer/components/view/primitives.h>
#include <react/renderer/components/view/propsConversions.h>
@@ -16,7 +17,6 @@
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <react/renderer/graphics/ValueUnit.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -57,15 +57,16 @@ BaseViewProps::BaseViewProps(
: YogaStylableProps(context, sourceProps, rawProps),
AccessibilityProps(context, sourceProps, rawProps),
opacity(
CoreFeatures::enablePropIteratorSetter ? sourceProps.opacity
: convertRawProp(
context,
rawProps,
"opacity",
sourceProps.opacity,
(Float)1.0)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.opacity
: convertRawProp(
context,
rawProps,
"opacity",
sourceProps.opacity,
(Float)1.0)),
backgroundColor(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.backgroundColor
: convertRawProp(
context,
@@ -74,51 +75,56 @@ BaseViewProps::BaseViewProps(
sourceProps.backgroundColor,
{})),
borderRadii(
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderRadii
: convertRawProp(
context,
rawProps,
"border",
"Radius",
sourceProps.borderRadii,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderRadii
: convertRawProp(
context,
rawProps,
"border",
"Radius",
sourceProps.borderRadii,
{})),
borderColors(
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderColors
: convertRawProp(
context,
rawProps,
"border",
"Color",
sourceProps.borderColors,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderColors
: convertRawProp(
context,
rawProps,
"border",
"Color",
sourceProps.borderColors,
{})),
borderCurves(
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderCurves
: convertRawProp(
context,
rawProps,
"border",
"Curve",
sourceProps.borderCurves,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderCurves
: convertRawProp(
context,
rawProps,
"border",
"Curve",
sourceProps.borderCurves,
{})),
borderStyles(
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderStyles
: convertRawProp(
context,
rawProps,
"border",
"Style",
sourceProps.borderStyles,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderStyles
: convertRawProp(
context,
rawProps,
"border",
"Style",
sourceProps.borderStyles,
{})),
outlineColor(
CoreFeatures::enablePropIteratorSetter ? sourceProps.outlineColor
: convertRawProp(
context,
rawProps,
"outlineColor",
sourceProps.outlineColor,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineColor
: convertRawProp(
context,
rawProps,
"outlineColor",
sourceProps.outlineColor,
{})),
outlineOffset(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineOffset
: convertRawProp(
context,
@@ -127,39 +133,43 @@ BaseViewProps::BaseViewProps(
sourceProps.outlineOffset,
{})),
outlineStyle(
CoreFeatures::enablePropIteratorSetter ? sourceProps.outlineStyle
: convertRawProp(
context,
rawProps,
"outlineStyle",
sourceProps.outlineStyle,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineStyle
: convertRawProp(
context,
rawProps,
"outlineStyle",
sourceProps.outlineStyle,
{})),
outlineWidth(
CoreFeatures::enablePropIteratorSetter ? sourceProps.outlineWidth
: convertRawProp(
context,
rawProps,
"outlineWidth",
sourceProps.outlineWidth,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineWidth
: convertRawProp(
context,
rawProps,
"outlineWidth",
sourceProps.outlineWidth,
{})),
shadowColor(
CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowColor
: convertRawProp(
context,
rawProps,
"shadowColor",
sourceProps.shadowColor,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowColor
: convertRawProp(
context,
rawProps,
"shadowColor",
sourceProps.shadowColor,
{})),
shadowOffset(
CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowOffset
: convertRawProp(
context,
rawProps,
"shadowOffset",
sourceProps.shadowOffset,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowOffset
: convertRawProp(
context,
rawProps,
"shadowOffset",
sourceProps.shadowOffset,
{})),
shadowOpacity(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowOpacity
: convertRawProp(
context,
@@ -168,39 +178,43 @@ BaseViewProps::BaseViewProps(
sourceProps.shadowOpacity,
{})),
shadowRadius(
CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowRadius
: convertRawProp(
context,
rawProps,
"shadowRadius",
sourceProps.shadowRadius,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowRadius
: convertRawProp(
context,
rawProps,
"shadowRadius",
sourceProps.shadowRadius,
{})),
cursor(
CoreFeatures::enablePropIteratorSetter ? sourceProps.cursor
: convertRawProp(
context,
rawProps,
"cursor",
sourceProps.cursor,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.cursor
: convertRawProp(
context,
rawProps,
"cursor",
sourceProps.cursor,
{})),
boxShadow(
CoreFeatures::enablePropIteratorSetter ? sourceProps.boxShadow
: convertRawProp(
context,
rawProps,
"boxShadow",
sourceProps.boxShadow,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.boxShadow
: convertRawProp(
context,
rawProps,
"boxShadow",
sourceProps.boxShadow,
{})),
filter(
CoreFeatures::enablePropIteratorSetter ? sourceProps.filter
: convertRawProp(
context,
rawProps,
"filter",
sourceProps.filter,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.filter
: convertRawProp(
context,
rawProps,
"filter",
sourceProps.filter,
{})),
backgroundImage(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.backgroundImage
: convertRawProp(
context,
@@ -209,31 +223,34 @@ BaseViewProps::BaseViewProps(
sourceProps.backgroundImage,
{})),
mixBlendMode(
CoreFeatures::enablePropIteratorSetter ? sourceProps.mixBlendMode
: convertRawProp(
context,
rawProps,
"mixBlendMode",
sourceProps.mixBlendMode,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.mixBlendMode
: convertRawProp(
context,
rawProps,
"mixBlendMode",
sourceProps.mixBlendMode,
{})),
isolation(
CoreFeatures::enablePropIteratorSetter ? sourceProps.isolation
: convertRawProp(
context,
rawProps,
"isolation",
sourceProps.isolation,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.isolation
: convertRawProp(
context,
rawProps,
"isolation",
sourceProps.isolation,
{})),
transform(
CoreFeatures::enablePropIteratorSetter ? sourceProps.transform
: convertRawProp(
context,
rawProps,
"transform",
sourceProps.transform,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.transform
: convertRawProp(
context,
rawProps,
"transform",
sourceProps.transform,
{})),
transformOrigin(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.transformOrigin
: convertRawProp(
context,
@@ -242,7 +259,7 @@ BaseViewProps::BaseViewProps(
sourceProps.transformOrigin,
{})),
backfaceVisibility(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.backfaceVisibility
: convertRawProp(
context,
@@ -251,7 +268,7 @@ BaseViewProps::BaseViewProps(
sourceProps.backfaceVisibility,
{})),
shouldRasterize(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shouldRasterize
: convertRawProp(
context,
@@ -260,15 +277,16 @@ BaseViewProps::BaseViewProps(
sourceProps.shouldRasterize,
{})),
zIndex(
CoreFeatures::enablePropIteratorSetter ? sourceProps.zIndex
: convertRawProp(
context,
rawProps,
"zIndex",
sourceProps.zIndex,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.zIndex
: convertRawProp(
context,
rawProps,
"zIndex",
sourceProps.zIndex,
{})),
pointerEvents(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.pointerEvents
: convertRawProp(
context,
@@ -277,35 +295,38 @@ BaseViewProps::BaseViewProps(
sourceProps.pointerEvents,
{})),
hitSlop(
CoreFeatures::enablePropIteratorSetter ? sourceProps.hitSlop
: convertRawProp(
context,
rawProps,
"hitSlop",
sourceProps.hitSlop,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.hitSlop
: convertRawProp(
context,
rawProps,
"hitSlop",
sourceProps.hitSlop,
{})),
onLayout(
CoreFeatures::enablePropIteratorSetter ? sourceProps.onLayout
: convertRawProp(
context,
rawProps,
"onLayout",
sourceProps.onLayout,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onLayout
: convertRawProp(
context,
rawProps,
"onLayout",
sourceProps.onLayout,
{})),
events(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.events
: convertRawProp(context, rawProps, sourceProps.events, {})),
collapsable(
CoreFeatures::enablePropIteratorSetter ? sourceProps.collapsable
: convertRawProp(
context,
rawProps,
"collapsable",
sourceProps.collapsable,
true)),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.collapsable
: convertRawProp(
context,
rawProps,
"collapsable",
sourceProps.collapsable,
true)),
collapsableChildren(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.collapsableChildren
: convertRawProp(
context,
@@ -314,7 +335,7 @@ BaseViewProps::BaseViewProps(
sourceProps.collapsableChildren,
true)),
removeClippedSubviews(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.removeClippedSubviews
: convertRawProp(
context,
@@ -323,7 +344,7 @@ BaseViewProps::BaseViewProps(
sourceProps.removeClippedSubviews,
false)),
experimental_layoutConformance(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.experimental_layoutConformance
: convertRawProp(
context,
@@ -9,7 +9,6 @@
#include <react/config/ReactNativeConfig.h>
#include <react/renderer/components/view/HostPlatformViewTraitsInitializer.h>
#include <react/renderer/components/view/primitives.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -17,7 +17,6 @@
#include <react/renderer/core/LayoutConstraints.h>
#include <react/renderer/core/LayoutContext.h>
#include <react/renderer/debug/DebugStringConvertibleItem.h>
#include <react/utils/CoreFeatures.h>
#include <yoga/Yoga.h>
#include <algorithm>
#include <limits>
@@ -786,7 +785,7 @@ Rect YogaLayoutableShadowNode::getContentBounds() const {
}
/*static*/ void YogaLayoutableShadowNode::filterRawProps(RawProps& rawProps) {
if (CoreFeatures::excludeYogaFromRawProps) {
if (ReactNativeFeatureFlags::excludeYogaFromRawProps()) {
// TODO: this shouldn't live in RawProps
rawProps.filterYogaStylePropsInDynamicConversion();
}
@@ -11,7 +11,6 @@
#include <react/renderer/components/view/propsConversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/renderer/debug/debugStringConvertibleUtils.h>
#include <react/utils/CoreFeatures.h>
#include <yoga/Yoga.h>
namespace facebook::react {
@@ -9,11 +9,11 @@
#include <algorithm>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/components/view/conversions.h>
#include <react/renderer/components/view/propsConversions.h>
#include <react/renderer/core/graphicsConversions.h>
#include <react/renderer/core/propsConversions.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -23,15 +23,16 @@ HostPlatformViewProps::HostPlatformViewProps(
const RawProps& rawProps)
: BaseViewProps(context, sourceProps, rawProps),
elevation(
CoreFeatures::enablePropIteratorSetter ? sourceProps.elevation
: convertRawProp(
context,
rawProps,
"elevation",
sourceProps.elevation,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.elevation
: convertRawProp(
context,
rawProps,
"elevation",
sourceProps.elevation,
{})),
nativeBackground(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.nativeBackground
: convertRawProp(
context,
@@ -40,7 +41,7 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.nativeBackground,
{})),
nativeForeground(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.nativeForeground
: convertRawProp(
context,
@@ -49,15 +50,16 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.nativeForeground,
{})),
focusable(
CoreFeatures::enablePropIteratorSetter ? sourceProps.focusable
: convertRawProp(
context,
rawProps,
"focusable",
sourceProps.focusable,
{})),
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.focusable
: convertRawProp(
context,
rawProps,
"focusable",
sourceProps.focusable,
{})),
hasTVPreferredFocus(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.hasTVPreferredFocus
: convertRawProp(
context,
@@ -66,7 +68,7 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.hasTVPreferredFocus,
{})),
needsOffscreenAlphaCompositing(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.needsOffscreenAlphaCompositing
: convertRawProp(
context,
@@ -75,7 +77,7 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.needsOffscreenAlphaCompositing,
{})),
renderToHardwareTextureAndroid(
CoreFeatures::enablePropIteratorSetter
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.renderToHardwareTextureAndroid
: convertRawProp(
context,
@@ -11,6 +11,7 @@
#include <vector>
#include <react/debug/react_native_assert.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/renderer/core/ComponentDescriptor.h>
#include <react/renderer/core/EventDispatcher.h>
#include <react/renderer/core/Props.h>
@@ -19,7 +20,6 @@
#include <react/renderer/core/ShadowNodeFragment.h>
#include <react/renderer/core/State.h>
#include <react/renderer/graphics/Float.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -115,7 +115,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor {
// Use the new-style iterator
// Note that we just check if `Props` has this flag set, no matter
// the type of ShadowNode; it acts as the single global flag.
if (CoreFeatures::enablePropIteratorSetter) {
if (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
auto shadowNodeProps = ShadowNodeT::Props(context, rawProps, props);
#ifdef ANDROID
const auto& dynamic = shadowNodeProps->rawProps;
@@ -7,15 +7,15 @@
#include "EventBeat.h"
#include <react/renderer/runtimescheduler/RuntimeScheduler.h>
#include <utility>
namespace facebook::react {
EventBeat::EventBeat(
std::shared_ptr<OwnerBox> ownerBox,
RuntimeExecutor runtimeExecutor)
: ownerBox_(std::move(ownerBox)),
runtimeExecutor_(std::move(runtimeExecutor)) {}
RuntimeScheduler& runtimeScheduler)
: ownerBox_(std::move(ownerBox)), runtimeScheduler_(runtimeScheduler) {}
void EventBeat::request() const {
isRequested_ = true;
@@ -33,17 +33,18 @@ void EventBeat::induce() const {
isRequested_ = false;
isBeatCallbackScheduled_ = true;
runtimeExecutor_([this, ownerBox = ownerBox_](jsi::Runtime& runtime) {
auto owner = ownerBox->owner.lock();
if (!owner) {
return;
}
runtimeScheduler_.scheduleWork(
[this, ownerBox = ownerBox_](jsi::Runtime& runtime) {
auto owner = ownerBox->owner.lock();
if (!owner) {
return;
}
isBeatCallbackScheduled_ = false;
if (beatCallback_) {
beatCallback_(runtime);
}
});
isBeatCallbackScheduled_ = false;
if (beatCallback_) {
beatCallback_(runtime);
}
});
}
} // namespace facebook::react
@@ -7,11 +7,14 @@
#pragma once
#include <ReactCommon/RuntimeExecutor.h>
#include <atomic>
#include <functional>
#include <memory>
namespace facebook::react {
class RuntimeScheduler;
}
namespace facebook::jsi {
class Runtime;
}
@@ -56,7 +59,7 @@ class EventBeat {
explicit EventBeat(
std::shared_ptr<OwnerBox> ownerBox,
RuntimeExecutor runtimeExecutor);
RuntimeScheduler& runtimeScheduler);
virtual ~EventBeat() = default;
@@ -88,7 +91,7 @@ class EventBeat {
mutable std::atomic<bool> isRequested_{false};
private:
RuntimeExecutor runtimeExecutor_;
RuntimeScheduler& runtimeScheduler_;
mutable std::atomic<bool> isBeatCallbackScheduled_{false};
};
@@ -9,7 +9,8 @@
#include <folly/dynamic.h>
#include <react/renderer/core/propsConversions.h>
#include <react/utils/CoreFeatures.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
namespace facebook::react {
@@ -24,7 +25,7 @@ void Props::initialize(
const PropsParserContext& context,
const Props& sourceProps,
const RawProps& rawProps) {
nativeId = CoreFeatures::enablePropIteratorSetter
nativeId = ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.nativeId
: convertRawProp(context, rawProps, "nativeID", sourceProps.nativeId, {});
#ifdef ANDROID
@@ -33,8 +33,6 @@ namespace facebook::react {
*/
class MountingCoordinator final {
public:
using Shared = std::shared_ptr<const MountingCoordinator>;
/*
* The constructor is meant to be used only inside `ShadowTree`, and it's
* `public` only to enable using with `std::make_shared<>`.
@@ -231,7 +231,8 @@ CommitMode ShadowTree::getCommitMode() const {
return commitMode_;
}
MountingCoordinator::Shared ShadowTree::getMountingCoordinator() const {
std::shared_ptr<const MountingCoordinator> ShadowTree::getMountingCoordinator()
const {
return mountingCoordinator_;
}
@@ -278,8 +279,7 @@ CommitStatus ShadowTree::tryCommit(
const auto& oldRootShadowNode = oldRevision.rootShadowNode;
auto newRootShadowNode = transaction(*oldRevision.rootShadowNode);
if (!newRootShadowNode ||
(commitOptions.shouldYield && commitOptions.shouldYield())) {
if (!newRootShadowNode) {
return CommitStatus::Cancelled;
}
@@ -296,8 +296,7 @@ CommitStatus ShadowTree::tryCommit(
newRootShadowNode = delegate_.shadowTreeWillCommit(
*this, oldRootShadowNode, newRootShadowNode);
if (!newRootShadowNode ||
(commitOptions.shouldYield && commitOptions.shouldYield())) {
if (!newRootShadowNode) {
return CommitStatus::Cancelled;
}
@@ -315,10 +314,6 @@ CommitStatus ShadowTree::tryCommit(
// Updating `currentRevision_` in unique manner if it hasn't changed.
std::unique_lock lock(commitMutex_);
if (commitOptions.shouldYield && commitOptions.shouldYield()) {
return CommitStatus::Cancelled;
}
if (ReactNativeFeatureFlags::
enableGranularShadowTreeStateReconciliation()) {
auto lastRevisionNumberWithNewStateChanged =
@@ -66,10 +66,6 @@ class ShadowTree final {
// will then let React run layout effects and apply updates before paint.
// For all other commits, should be true.
bool mountSynchronously{true};
// Called during `tryCommit` phase. Returning true indicates current commit
// should yield to the next commit.
std::function<bool()> shouldYield;
};
/*
@@ -130,7 +126,7 @@ class ShadowTree final {
*/
void notifyDelegatesOfUpdates() const;
MountingCoordinator::Shared getMountingCoordinator() const;
std::shared_ptr<const MountingCoordinator> getMountingCoordinator() const;
private:
constexpr static ShadowTreeRevision::Number INITIAL_REVISION{0};
@@ -148,7 +144,7 @@ class ShadowTree final {
mutable ShadowTreeRevision currentRevision_; // Protected by `commitMutex_`.
mutable ShadowTreeRevision::Number
lastRevisionNumberWithNewState_; // Protected by `commitMutex_`.
MountingCoordinator::Shared mountingCoordinator_;
std::shared_ptr<const MountingCoordinator> mountingCoordinator_;
};
} // namespace facebook::react
@@ -33,7 +33,7 @@ class ShadowTreeDelegate {
* Called right after Shadow Tree commit a new state of the tree.
*/
virtual void shadowTreeDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) const = 0;
virtual ~ShadowTreeDelegate() noexcept = default;
@@ -34,7 +34,7 @@ class DummyShadowTreeDelegate : public ShadowTreeDelegate {
};
void shadowTreeDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) const override {};
};
@@ -9,7 +9,6 @@
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/timing/primitives.h>
#include <react/utils/CoreFeatures.h>
#include <unordered_map>
namespace facebook::react {
@@ -43,7 +43,7 @@ void IntersectionObserverManager::observe(
// (like on the Web) and we'd send the initial notification there, but as
// we don't have it we have to run this check once and manually dispatch.
auto& shadowTreeRegistry = uiManager.getShadowTreeRegistry();
MountingCoordinator::Shared mountingCoordinator = nullptr;
std::shared_ptr<const MountingCoordinator> mountingCoordinator = nullptr;
RootShadowNode::Shared rootShadowNode = nullptr;
shadowTreeRegistry.visit(surfaceId, [&](const ShadowTree& shadowTree) {
mountingCoordinator = shadowTree.getMountingCoordinator();
@@ -9,7 +9,6 @@
#include <jsi/jsi.h>
#include <react/renderer/runtimescheduler/Task.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -284,7 +284,7 @@ void Scheduler::animationTick() const {
#pragma mark - UIManagerDelegate
void Scheduler::uiManagerDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) {
SystraceSection s("Scheduler::uiManagerDidFinishTransaction");
@@ -85,7 +85,7 @@ class Scheduler final : public UIManagerDelegate {
#pragma mark - UIManagerDelegate
void uiManagerDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) override;
void uiManagerDidCreateShadowNode(const ShadowNode& shadowNode) override;
void uiManagerDidDispatchCommand(
@@ -26,7 +26,8 @@ class SchedulerDelegate {
* to construct a new one.
*/
virtual void schedulerDidFinishTransaction(
const MountingCoordinator::Shared& mountingCoordinator) = 0;
const std::shared_ptr<const MountingCoordinator>&
mountingCoordinator) = 0;
/*
* Called when the runtime scheduler decides that one-or-more previously
@@ -37,7 +38,8 @@ class SchedulerDelegate {
* correctly apply changes, due to changes in Props representation.
*/
virtual void schedulerShouldRenderTransactions(
const MountingCoordinator::Shared& mountingCoordinator) = 0;
const std::shared_ptr<const MountingCoordinator>&
mountingCoordinator) = 0;
/*
* Called right after a new ShadowNode was created.
@@ -64,9 +64,9 @@ Size SurfaceManager::measureSurface(
return size;
}
MountingCoordinator::Shared SurfaceManager::findMountingCoordinator(
SurfaceId surfaceId) const noexcept {
auto mountingCoordinator = MountingCoordinator::Shared{};
std::shared_ptr<const MountingCoordinator>
SurfaceManager::findMountingCoordinator(SurfaceId surfaceId) const noexcept {
auto mountingCoordinator = std::shared_ptr<const MountingCoordinator>{};
visit(surfaceId, [&](const SurfaceHandler& surfaceHandler) {
mountingCoordinator = surfaceHandler.getMountingCoordinator();
@@ -49,7 +49,7 @@ class SurfaceManager final {
const LayoutConstraints& layoutConstraints,
const LayoutContext& layoutContext) const noexcept;
MountingCoordinator::Shared findMountingCoordinator(
std::shared_ptr<const MountingCoordinator> findMountingCoordinator(
SurfaceId surfaceId) const noexcept;
private:
@@ -607,7 +607,7 @@ RootShadowNode::Unshared UIManager::shadowTreeWillCommit(
}
void UIManager::shadowTreeDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) const {
SystraceSection s("UIManager::shadowTreeDidFinishTransaction");
@@ -119,7 +119,7 @@ class UIManager final : public ShadowTreeDelegate {
#pragma mark - ShadowTreeDelegate
void shadowTreeDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) const override;
RootShadowNode::Unshared shadowTreeWillCommit(
@@ -483,9 +483,7 @@ jsi::Value UIManagerBinding::get(
uiManager->completeSurface(
surfaceId,
shadowNodeList,
{.enableStateReconciliation = true,
.mountSynchronously = false,
.shouldYield = nullptr});
{.enableStateReconciliation = true, .mountSynchronously = false});
return jsi::Value::undefined();
});
@@ -23,7 +23,7 @@ class UIManagerDelegate {
* For this moment the tree is already laid out and sealed.
*/
virtual void uiManagerDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) = 0;
/*
@@ -24,7 +24,7 @@ class FakeShadowTreeDelegate : public ShadowTreeDelegate {
};
void shadowTreeDidFinishTransaction(
MountingCoordinator::Shared mountingCoordinator,
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
bool mountSynchronously) const override {};
};
@@ -391,17 +391,6 @@ bool isTruthy(jsi::Runtime& runtime, const jsi::Value& value) {
return Boolean.call(runtime, value).getBool();
}
jsi::Value wrapInErrorIfNecessary(
jsi::Runtime& runtime,
const jsi::Value& value) {
auto Error = runtime.global().getPropertyAsFunction(runtime, "Error");
auto isError =
value.isObject() && value.asObject(runtime).instanceOf(runtime, Error);
auto error = isError ? value.getObject(runtime)
: Error.callAsConstructor(runtime, value);
return jsi::Value(runtime, error);
}
} // namespace
void ReactInstance::initializeRuntime(
@@ -448,8 +437,8 @@ void ReactInstance::initializeRuntime(
return jsi::Value(false);
}
auto jsError = jsi::JSError(
runtime, wrapInErrorIfNecessary(runtime, args[0]));
auto jsError =
jsi::JSError(runtime, jsi::Value(runtime, args[0]));
jsErrorHandler->handleError(runtime, jsError, isFatal);
return jsi::Value(true);

Some files were not shown because too many files have changed in this diff Show More