Compare commits

..
Author SHA1 Message Date
Blake Friedman 6291332455 fix: mitigate DangerJS transpilation bug
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.

Changelog: [internal]
2024-10-24 13:43:43 -07:00
109 changed files with 1305 additions and 1069 deletions
+2 -2
View File
@@ -205,9 +205,9 @@ jobs:
with:
github-token: ${{ secrets.REACT_NATIVE_BOT_GITHUB_TOKEN }}
script: |
const {verifyPublishedTemplate, isLatest} = require('./.github/workflow-scripts/publishTemplate.js')
const {verifyPublished, isLatest} = require('./.github/workflow-scripts/publishTemplate.js')
const version = "${{ github.ref_name }}"
await verifyPublishedTemplate(version, isLatest());
await verifyPublished(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,4 +5,3 @@ 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,4 +4,3 @@ 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 -3
View File
@@ -57,9 +57,7 @@ if (!includesTestPlan && !isFromPhabricator) {
// Check if there is a changelog and validate it
if (!isFromPhabricator) {
const status = require('@rnx-kit/rn-changelog-generator').default.validate(
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,7 +76,6 @@
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\" \"$(PODS_ROOT)/Headers/Private/Yoga\""}
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
s.dependency "React-Core"
s.dependency "RCT-Folly", folly_version
+18 -21
View File
@@ -141,27 +141,24 @@ let inExceptionHandler = false;
* Logs exceptions to the (native) console and displays them
*/
function handleException(e: mixed, isFatal: boolean) {
// 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;
}
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,6 +14,7 @@ import typeof NativeExceptionsManager from '../NativeExceptionsManager';
export default ({
reportFatalException: jest.fn(),
reportSoftException: jest.fn(),
updateExceptionMessage: jest.fn(),
dismissRedbox: jest.fn(),
reportException: jest.fn(),
}: NativeExceptionsManager);
@@ -67,6 +67,8 @@ function runExceptionsManagerTests() {
return {
default: {
reportException: jest.fn(),
// Used to show symbolicated messages, not part of this test.
updateExceptionMessage: () => {},
},
};
});
+7 -1
View File
@@ -21,7 +21,13 @@ ExceptionsManager.installConsoleErrorReporter();
if (!global.__fbDisableExceptionsManager) {
const handleError = (e: mixed, isFatal: boolean) => {
try {
ExceptionsManager.handleException(e, isFatal);
// TODO(T196834299): We should really use a c++ turbomodule for this
if (
!global.RN$handleException ||
!global.RN$handleException(e, isFatal)
) {
ExceptionsManager.handleException(e, isFatal);
}
} catch (ee) {
console.log('Failed to print error: ', ee.message);
throw e;
@@ -9,7 +9,8 @@
#import <React/RCTDynamicTypeRamp.h>
#import <React/RCTTextDecorationLineType.h>
#import <React/RCTTextTransform.h>
#import "RCTTextTransform.h"
NS_ASSUME_NONNULL_BEGIN
@@ -278,15 +278,19 @@ NSString *const RCTTextAttributesTagAttributeName = @"RCTTextAttributesTagAttrib
static NSString *capitalizeText(NSString *text)
{
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;
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:@" "];
}
- (NSString *)applyTextAttributesToText:(NSString *)text
@@ -11,6 +11,7 @@
NS_ASSUME_NONNULL_BEGIN
@protocol RCTExceptionsManagerDelegate <NSObject>
- (void)handleSoftJSExceptionWithMessage:(nullable NSString *)message
stack:(nullable NSArray *)stack
exceptionId:(NSNumber *)exceptionId
@@ -19,6 +20,12 @@ 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,6 +99,27 @@ 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,
RuntimeScheduler& runtimeScheduler)
: EventBeat(std::move(ownerBox), runtimeScheduler),
RuntimeExecutor runtimeExecutor)
: EventBeat(std::move(ownerBox), std::move(runtimeExecutor)),
uiRunLoopObserver_(std::move(uiRunLoopObserver)) {
uiRunLoopObserver_->setDelegate(this);
uiRunLoopObserver_->enable();
@@ -13,8 +13,6 @@
namespace facebook::react {
class RuntimeScheduler;
/*
* Event beat associated with JavaScript runtime.
* The beat is called on `RuntimeExecutor`'s thread induced by the UI thread
@@ -25,7 +23,7 @@ class AppleEventBeat : public EventBeat, public RunLoopObserver::Delegate {
AppleEventBeat(
std::shared_ptr<OwnerBox> ownerBox,
std::unique_ptr<const RunLoopObserver> uiRunLoopObserver,
RuntimeScheduler& RuntimeScheduler);
RuntimeExecutor runtimeExecutor);
#pragma mark - RunLoopObserver::Delegate
@@ -16,6 +16,7 @@
#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:(std::shared_ptr<const facebook::react::MountingCoordinator>)mountingCoordinator;
- (void)scheduleTransaction:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
/**
* Dispatch a command to be performed on the main thread.
@@ -20,6 +20,7 @@
#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>
@@ -186,7 +187,7 @@ static void RCTPerformMountInstructions(
componentViewDescriptor:rootViewDescriptor];
}
- (void)scheduleTransaction:(std::shared_ptr<const MountingCoordinator>)mountingCoordinator
- (void)scheduleTransaction:(MountingCoordinator::Shared)mountingCoordinator
{
if (RCTIsMainQueue()) {
// Already on the proper thread, so:
@@ -26,10 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
*/
@protocol RCTSchedulerDelegate
- (void)schedulerDidFinishTransaction:(std::shared_ptr<const facebook::react::MountingCoordinator>)mountingCoordinator;
- (void)schedulerDidFinishTransaction:(facebook::react::MountingCoordinator::Shared)mountingCoordinator;
- (void)schedulerShouldRenderTransactions:
(std::shared_ptr<const facebook::react::MountingCoordinator>)mountingCoordinator;
- (void)schedulerShouldRenderTransactions:(facebook::react::MountingCoordinator::Shared)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 std::shared_ptr<const MountingCoordinator> &mountingCoordinator) override
void schedulerDidFinishTransaction(const MountingCoordinator::Shared &mountingCoordinator) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
[scheduler.delegate schedulerDidFinishTransaction:mountingCoordinator];
}
void schedulerShouldRenderTransactions(const std::shared_ptr<const MountingCoordinator> &mountingCoordinator) override
void schedulerShouldRenderTransactions(const MountingCoordinator::Shared &mountingCoordinator) override
{
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
[scheduler.delegate schedulerShouldRenderTransactions:mountingCoordinator];
@@ -33,6 +33,7 @@
#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"
@@ -228,6 +229,10 @@ 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) {
@@ -253,10 +258,10 @@ using namespace facebook::react;
toolbox.bridgelessBindingsExecutor = _bridgelessBindingsExecutor;
toolbox.eventBeatFactory =
[runtimeScheduler](std::shared_ptr<EventBeat::OwnerBox> ownerBox) -> std::unique_ptr<EventBeat> {
[runtimeExecutor](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), *runtimeScheduler);
return std::make_unique<AppleEventBeat>(std::move(ownerBox), std::move(runLoopObserver), runtimeExecutor);
};
RCTScheduler *scheduler = [[RCTScheduler alloc] initWithToolbox:toolbox];
@@ -292,12 +297,12 @@ using namespace facebook::react;
#pragma mark - RCTSchedulerDelegate
- (void)schedulerDidFinishTransaction:(std::shared_ptr<const MountingCoordinator>)mountingCoordinator
- (void)schedulerDidFinishTransaction:(MountingCoordinator::Shared)mountingCoordinator
{
// no-op, we will flush the transaction from schedulerShouldRenderTransactions
}
- (void)schedulerShouldRenderTransactions:(std::shared_ptr<const MountingCoordinator>)mountingCoordinator
- (void)schedulerShouldRenderTransactions:(MountingCoordinator::Shared)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 sendString:messageStr error:NULL];
[strongSelf->_webSocket send:messageStr];
}
});
}
@@ -1,49 +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.
*/
#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,6 +7,23 @@ 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;
@@ -2027,6 +2044,7 @@ 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
}
@@ -2058,8 +2076,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/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 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 abstract class com/facebook/react/defaults/DefaultReactNativeHost : com/facebook/react/ReactNativeHost {
@@ -2212,6 +2230,7 @@ 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 {
@@ -2379,6 +2398,7 @@ 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 {
@@ -2514,6 +2534,7 @@ 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 {
@@ -3135,6 +3156,7 @@ 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 {
@@ -0,0 +1,131 @@
/*
* 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;
}
}
@@ -0,0 +1,57 @@
/*
* 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,4 +23,9 @@ 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,7 +45,6 @@ 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?
*/
@@ -60,28 +59,25 @@ public object DefaultReactHost {
isHermesEnabled: Boolean = true,
useDevSupport: Boolean = ReactBuildConfig.DEBUG,
cxxReactPackageProviders: List<(ReactContext) -> CxxReactPackage> = emptyList(),
jsBundleLoader: JSBundleLoader? = null,
): ReactHost {
if (reactHost == null) {
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 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 = bundleLoader,
jsBundleLoader = jsBundleLoader,
reactPackages = packageList,
jsRuntimeFactory = jsRuntimeFactory,
turboModuleManagerDelegateBuilder = defaultTmmDelegateBuilder)
@@ -111,7 +111,7 @@ protected constructor(
packages,
jsMainModuleName,
bundleAssetName ?: "index",
jsBundleFile,
null,
isHermesEnabled ?: true,
useDeveloperSupport,
)
@@ -279,6 +279,26 @@ 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,6 +53,12 @@ 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,6 +48,8 @@ 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<<575eeb1e291c1a372eba7aabcdd948e3>>
* @generated SignedSource<<6eb9ba14445c1ce6b54a690941171485>>
*/
/**
@@ -52,12 +52,6 @@ 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.
*/
@@ -82,12 +76,6 @@ 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<<f93759a639dbbb95d3307003e4907c86>>
* @generated SignedSource<<f88e475c51f2595d8ead29ff66e84da1>>
*/
/**
@@ -24,12 +24,10 @@ 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
@@ -105,15 +103,6 @@ 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) {
@@ -150,15 +139,6 @@ 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<<44d0fe9a36e5e51816e10b8799d451fe>>
* @generated SignedSource<<a16a01bbf3c2404ed7c6fa569d68b505>>
*/
/**
@@ -36,8 +36,6 @@ 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
@@ -46,8 +44,6 @@ 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<<917a6effbfd0a476cc05d90abee3c80b>>
* @generated SignedSource<<1ce9496b005924d8a421899ce55f6d81>>
*/
/**
@@ -31,8 +31,6 @@ 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
@@ -41,8 +39,6 @@ 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<<2ad36465b1a411cb55d85416bd8ba823>>
* @generated SignedSource<<b6dd6a5d02c9070c3f35f70d5d1b7e35>>
*/
/**
@@ -28,12 +28,10 @@ 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
@@ -113,16 +111,6 @@ 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) {
@@ -163,16 +151,6 @@ 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<<9770a9f125b8bcb4b1daef9e3458433f>>
* @generated SignedSource<<12dbd7afae2f6360d17df521ebc53d2f>>
*/
/**
@@ -31,8 +31,6 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun disableEventLoopOnBridgeless(): Boolean
@DoNotStrip public fun disableMountItemReorderingAndroid(): Boolean
@DoNotStrip public fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@DoNotStrip public fun enableAndroidLineHeightCentering(): Boolean
@@ -41,8 +39,6 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableCleanTextInputYogaNode(): Boolean
@DoNotStrip public fun enableCppPropsIteratorSetter(): Boolean
@DoNotStrip public fun enableDeletionOfUnmountedViews(): Boolean
@DoNotStrip public fun enableEagerRootViewAttachment(): Boolean
@@ -60,6 +60,17 @@ 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,8 +48,13 @@ public enum TextTransform {
StringBuilder res = new StringBuilder(text.length());
int start = wordIterator.first();
for (int end = wordIterator.next(); end != BreakIterator.DONE; end = wordIterator.next()) {
res.append(Character.toUpperCase(text.charAt(start)));
res.append(text.substring(start + 1, end));
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);
}
start = end;
}
@@ -16,9 +16,9 @@ namespace facebook::react {
AndroidEventBeat::AndroidEventBeat(
std::shared_ptr<OwnerBox> ownerBox,
EventBeatManager* eventBeatManager,
RuntimeScheduler& runtimeScheduler,
RuntimeExecutor runtimeExecutor,
jni::global_ref<jobject> javaUIManager)
: EventBeat(std::move(ownerBox), runtimeScheduler),
: EventBeat(std::move(ownerBox), std::move(runtimeExecutor)),
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,
RuntimeScheduler& runtimeScheduler,
RuntimeExecutor runtimeExecutor,
jni::global_ref<jobject> javaUIManager);
~AndroidEventBeat() override;
@@ -19,6 +19,7 @@
#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>
@@ -37,8 +38,7 @@ FabricMountingManager::FabricMountingManager(
void FabricMountingManager::onSurfaceStart(SurfaceId surfaceId) {
std::lock_guard lock(allocatedViewsMutex_);
allocatedViewRegistry_.emplace(
surfaceId, std::unordered_set<Tag>({surfaceId}));
allocatedViewRegistry_.emplace(surfaceId, std::unordered_set<Tag>{});
}
void FabricMountingManager::onSurfaceStop(SurfaceId surfaceId) {
@@ -466,9 +466,6 @@ void FabricMountingManager::executeMount(
auto surfaceId = transaction.getSurfaceId();
auto& mutations = transaction.getMutations();
bool maintainMutationOrder =
ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
auto revisionNumber = telemetry.getRevisionNumber();
std::vector<CppMountItem> cppCommonMountItems;
@@ -490,7 +487,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.
auto& allocatedViewTags =
const auto& allocatedViewTags =
allocatedViewsIterator != allocatedViewRegistry_.end()
? allocatedViewsIterator->second
: defaultAllocatedViews;
@@ -514,7 +511,6 @@ void FabricMountingManager::executeMount(
if (shouldCreateView) {
cppCommonMountItems.push_back(
CppMountItem::CreateMountItem(newChildShadowView));
allocatedViewTags.insert(newChildShadowView.tag);
}
break;
}
@@ -526,32 +522,20 @@ void FabricMountingManager::executeMount(
break;
}
case ShadowViewMutation::Delete: {
(maintainMutationOrder ? cppCommonMountItems : cppDeleteMountItems)
.push_back(CppMountItem::DeleteMountItem(oldChildShadowView));
if (allocatedViewTags.erase(oldChildShadowView.tag) != 1) {
LOG(ERROR) << "Emitting delete for unallocated view. "
<< oldChildShadowView.tag;
}
cppDeleteMountItems.push_back(
CppMountItem::DeleteMountItem(oldChildShadowView));
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) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(CppMountItem::UpdatePropsMountItem(
cppUpdatePropsMountItems.push_back(
CppMountItem::UpdatePropsMountItem(
oldChildShadowView, newChildShadowView));
}
if (oldChildShadowView.state != newChildShadowView.state) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateStateMountItems)
.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
cppUpdateStateMountItems.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
}
// Padding: padding mountItems must be executed before layout props
@@ -560,17 +544,14 @@ void FabricMountingManager::executeMount(
// padding information.
if (oldChildShadowView.layoutMetrics.contentInsets !=
newChildShadowView.layoutMetrics.contentInsets) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePaddingMountItems)
.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
cppUpdatePaddingMountItems.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
}
if (oldChildShadowView.layoutMetrics !=
newChildShadowView.layoutMetrics) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateLayoutMountItems)
.push_back(CppMountItem::UpdateLayoutMountItem(
cppUpdateLayoutMountItems.push_back(
CppMountItem::UpdateLayoutMountItem(
mutation.newChildShadowView, parentShadowView));
}
@@ -580,18 +561,16 @@ void FabricMountingManager::executeMount(
// pack too much data there.
if ((oldChildShadowView.layoutMetrics.overflowInset !=
newChildShadowView.layoutMetrics.overflowInset)) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateOverflowInsetMountItems)
.push_back(CppMountItem::UpdateOverflowInsetMountItem(
cppUpdateOverflowInsetMountItems.push_back(
CppMountItem::UpdateOverflowInsetMountItem(
newChildShadowView));
}
}
if (oldChildShadowView.eventEmitter !=
newChildShadowView.eventEmitter) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(CppMountItem::UpdateEventEmitterMountItem(
cppUpdateEventEmitterMountItems.push_back(
CppMountItem::UpdateEventEmitterMountItem(
mutation.newChildShadowView));
}
break;
@@ -602,23 +581,19 @@ void FabricMountingManager::executeMount(
cppCommonMountItems.push_back(CppMountItem::InsertMountItem(
parentShadowView, newChildShadowView, index));
bool shouldCreateView =
!allocatedViewTags.contains(newChildShadowView.tag);
bool allocationCheck =
allocatedViewTags.find(newChildShadowView.tag) ==
allocatedViewTags.end();
bool shouldCreateView = allocationCheck;
if (shouldCreateView) {
LOG(ERROR) << "Emitting insert for unallocated view. "
<< newChildShadowView.tag;
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePropsMountItems)
.push_back(CppMountItem::UpdatePropsMountItem(
{}, newChildShadowView));
cppUpdatePropsMountItems.push_back(
CppMountItem::UpdatePropsMountItem({}, newChildShadowView));
}
// State
if (newChildShadowView.state) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateStateMountItems)
.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
cppUpdateStateMountItems.push_back(
CppMountItem::UpdateStateMountItem(newChildShadowView));
}
// Padding: padding mountItems must be executed before layout props
@@ -627,16 +602,13 @@ void FabricMountingManager::executeMount(
// padding information.
if (newChildShadowView.layoutMetrics.contentInsets !=
EdgeInsets::ZERO) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdatePaddingMountItems)
.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
cppUpdatePaddingMountItems.push_back(
CppMountItem::UpdatePaddingMountItem(newChildShadowView));
}
// Layout
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateLayoutMountItems)
.push_back(CppMountItem::UpdateLayoutMountItem(
cppUpdateLayoutMountItems.push_back(
CppMountItem::UpdateLayoutMountItem(
newChildShadowView, parentShadowView));
// OverflowInset: This is the values indicating boundaries including
@@ -645,19 +617,15 @@ void FabricMountingManager::executeMount(
// pack too much data there.
if (newChildShadowView.layoutMetrics.overflowInset !=
EdgeInsets::ZERO) {
(maintainMutationOrder ? cppCommonMountItems
: cppUpdateOverflowInsetMountItems)
.push_back(CppMountItem::UpdateOverflowInsetMountItem(
cppUpdateOverflowInsetMountItems.push_back(
CppMountItem::UpdateOverflowInsetMountItem(
newChildShadowView));
}
}
// EventEmitter
// 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(
cppUpdateEventEmitterMountItems.push_back(
CppMountItem::UpdateEventEmitterMountItem(
mutation.newChildShadowView));
break;
@@ -667,6 +635,22 @@ 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,
@@ -745,33 +729,12 @@ 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;
}
@@ -944,11 +907,11 @@ void FabricMountingManager::preallocateShadowView(
if (allocatedViewsIterator == allocatedViewRegistry_.end()) {
return;
}
const auto [_, inserted] =
allocatedViewsIterator->second.insert(shadowView.tag);
if (!inserted) {
auto& allocatedViews = allocatedViewsIterator->second;
if (allocatedViews.find(shadowView.tag) != allocatedViews.end()) {
return;
}
allocatedViews.insert(shadowView.tag);
}
bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics;
@@ -30,6 +30,7 @@
#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 {
@@ -72,6 +73,16 @@ 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;
}
@@ -460,25 +471,28 @@ void FabricUIManagerBinding::installFabricUIManager(
auto runtimeExecutor = runtimeExecutorHolder->cthis()->get();
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));
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));
}
}
EventBeat::Factory eventBeatFactory =
[eventBeatManager, &runtimeScheduler, globalJavaUiManager](
[eventBeatManager, runtimeExecutor, globalJavaUiManager](
std::shared_ptr<EventBeat::OwnerBox> ownerBox)
-> std::unique_ptr<EventBeat> {
return std::make_unique<AndroidEventBeat>(
std::move(ownerBox),
eventBeatManager,
*runtimeScheduler,
runtimeExecutor,
globalJavaUiManager);
};
@@ -488,6 +502,11 @@ 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;
@@ -532,7 +551,7 @@ FabricUIManagerBinding::getMountingManager(const char* locationHint) {
}
void FabricUIManagerBinding::schedulerDidFinishTransaction(
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator) {
const MountingCoordinator::Shared& 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.
@@ -561,8 +580,7 @@ void FabricUIManagerBinding::schedulerDidFinishTransaction(
}
void FabricUIManagerBinding::schedulerShouldRenderTransactions(
const std::shared_ptr<
const MountingCoordinator>& /* mountingCoordinator */) {
const MountingCoordinator::Shared& /* mountingCoordinator */) {
auto mountingManager =
getMountingManager("schedulerShouldRenderTransactions");
if (!mountingManager) {
@@ -101,12 +101,10 @@ class FabricUIManagerBinding : public jni::HybridClass<FabricUIManagerBinding>,
jni::alias_ref<SurfaceHandlerBinding::jhybridobject> surfaceHandler);
void schedulerDidFinishTransaction(
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator)
override;
const MountingCoordinator::Shared& mountingCoordinator) override;
void schedulerShouldRenderTransactions(
const std::shared_ptr<const MountingCoordinator>& mountingCoordinator)
override;
const MountingCoordinator::Shared& 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<<aaf6af36813ab1895bf2bf8a6c8bcf1c>>
* @generated SignedSource<<b83cbcc992ef83cbc0a5db25a8ac0987>>
*/
/**
@@ -63,12 +63,6 @@ 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");
@@ -93,12 +87,6 @@ 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");
@@ -351,11 +339,6 @@ 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();
@@ -376,11 +359,6 @@ 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();
@@ -614,9 +592,6 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"disableEventLoopOnBridgeless",
JReactNativeFeatureFlagsCxxInterop::disableEventLoopOnBridgeless),
makeNativeMethod(
"disableMountItemReorderingAndroid",
JReactNativeFeatureFlagsCxxInterop::disableMountItemReorderingAndroid),
makeNativeMethod(
"enableAlignItemsBaselineOnFabricIOS",
JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS),
@@ -629,9 +604,6 @@ 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<<d4194069e582c0aa5e90938b27067044>>
* @generated SignedSource<<f7d93dbd2b21fc29bfd3c4c231d0fa79>>
*/
/**
@@ -42,9 +42,6 @@ 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>);
@@ -57,9 +54,6 @@ 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,6 +47,7 @@ add_library(
turbomodulejsijni
OBJECT
ReactCommon/BindingsInstallerHolder.cpp
ReactCommon/CompositeTurboModuleManagerDelegate.cpp
ReactCommon/OnLoad.cpp
ReactCommon/TurboModuleManager.cpp
$<TARGET_OBJECTS:logger>
@@ -0,0 +1,58 @@
/*
* 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
@@ -0,0 +1,48 @@
/*
* 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,6 +9,7 @@
#include <fbjni/fbjni.h>
#include <reactperflogger/JNativeModulePerfLogger.h>
#include "CompositeTurboModuleManagerDelegate.h"
#include "TurboModuleManager.h"
void jniEnableCppLogging(
@@ -25,6 +26,8 @@ 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)});
@@ -0,0 +1,131 @@
/*
* 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)
}
}
@@ -1,37 +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.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,7 +78,6 @@ 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,18 +50,6 @@ 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 {
@@ -199,7 +187,7 @@ void JsErrorHandler::emitError(
jsi::JSError& error,
bool isFatal) {
auto message = error.getMessage();
auto errorObj = wrapInErrorIfNecessary(runtime, error.value());
auto errorObj = error.value().getObject(runtime);
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<<abba7ef1f3108b195eef7bfc0a9a26db>>
* @generated SignedSource<<2797dcc4840b0f60670760231f51d459>>
*/
/**
@@ -42,10 +42,6 @@ bool ReactNativeFeatureFlags::disableEventLoopOnBridgeless() {
return getAccessor().disableEventLoopOnBridgeless();
}
bool ReactNativeFeatureFlags::disableMountItemReorderingAndroid() {
return getAccessor().disableMountItemReorderingAndroid();
}
bool ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS() {
return getAccessor().enableAlignItemsBaselineOnFabricIOS();
}
@@ -62,10 +58,6 @@ 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<<c6419e8e932f65c7be43425e01776dc9>>
* @generated SignedSource<<64ea086a7c847e822595983867cdf776>>
*/
/**
@@ -59,11 +59,6 @@ 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.
*/
@@ -84,11 +79,6 @@ 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<<fe44d2dba1abe83205db630abe1c2e9a>>
* @generated SignedSource<<309c5668b6fea35c89764f496d58e803>>
*/
/**
@@ -101,24 +101,6 @@ 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();
@@ -128,7 +110,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(5, "enableAlignItemsBaselineOnFabricIOS");
markFlagAsAccessed(4, "enableAlignItemsBaselineOnFabricIOS");
flagValue = currentProvider_->enableAlignItemsBaselineOnFabricIOS();
enableAlignItemsBaselineOnFabricIOS_ = flagValue;
@@ -146,7 +128,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(6, "enableAndroidLineHeightCentering");
markFlagAsAccessed(5, "enableAndroidLineHeightCentering");
flagValue = currentProvider_->enableAndroidLineHeightCentering();
enableAndroidLineHeightCentering_ = flagValue;
@@ -164,7 +146,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(7, "enableBridgelessArchitecture");
markFlagAsAccessed(6, "enableBridgelessArchitecture");
flagValue = currentProvider_->enableBridgelessArchitecture();
enableBridgelessArchitecture_ = flagValue;
@@ -182,7 +164,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(8, "enableCleanTextInputYogaNode");
markFlagAsAccessed(7, "enableCleanTextInputYogaNode");
flagValue = currentProvider_->enableCleanTextInputYogaNode();
enableCleanTextInputYogaNode_ = flagValue;
@@ -191,24 +173,6 @@ 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();
@@ -218,7 +182,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(10, "enableDeletionOfUnmountedViews");
markFlagAsAccessed(8, "enableDeletionOfUnmountedViews");
flagValue = currentProvider_->enableDeletionOfUnmountedViews();
enableDeletionOfUnmountedViews_ = flagValue;
@@ -236,7 +200,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(11, "enableEagerRootViewAttachment");
markFlagAsAccessed(9, "enableEagerRootViewAttachment");
flagValue = currentProvider_->enableEagerRootViewAttachment();
enableEagerRootViewAttachment_ = flagValue;
@@ -254,7 +218,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(12, "enableEventEmitterRetentionDuringGesturesOnAndroid");
markFlagAsAccessed(10, "enableEventEmitterRetentionDuringGesturesOnAndroid");
flagValue = currentProvider_->enableEventEmitterRetentionDuringGesturesOnAndroid();
enableEventEmitterRetentionDuringGesturesOnAndroid_ = flagValue;
@@ -272,7 +236,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(13, "enableFabricLogs");
markFlagAsAccessed(11, "enableFabricLogs");
flagValue = currentProvider_->enableFabricLogs();
enableFabricLogs_ = flagValue;
@@ -290,7 +254,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(14, "enableFabricRenderer");
markFlagAsAccessed(12, "enableFabricRenderer");
flagValue = currentProvider_->enableFabricRenderer();
enableFabricRenderer_ = flagValue;
@@ -308,7 +272,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(15, "enableFabricRendererExclusively");
markFlagAsAccessed(13, "enableFabricRendererExclusively");
flagValue = currentProvider_->enableFabricRendererExclusively();
enableFabricRendererExclusively_ = flagValue;
@@ -326,7 +290,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(16, "enableGranularShadowTreeStateReconciliation");
markFlagAsAccessed(14, "enableGranularShadowTreeStateReconciliation");
flagValue = currentProvider_->enableGranularShadowTreeStateReconciliation();
enableGranularShadowTreeStateReconciliation_ = flagValue;
@@ -344,7 +308,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(17, "enableIOSViewClipToPaddingBox");
markFlagAsAccessed(15, "enableIOSViewClipToPaddingBox");
flagValue = currentProvider_->enableIOSViewClipToPaddingBox();
enableIOSViewClipToPaddingBox_ = flagValue;
@@ -362,7 +326,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(18, "enableLayoutAnimationsOnAndroid");
markFlagAsAccessed(16, "enableLayoutAnimationsOnAndroid");
flagValue = currentProvider_->enableLayoutAnimationsOnAndroid();
enableLayoutAnimationsOnAndroid_ = flagValue;
@@ -380,7 +344,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(19, "enableLayoutAnimationsOnIOS");
markFlagAsAccessed(17, "enableLayoutAnimationsOnIOS");
flagValue = currentProvider_->enableLayoutAnimationsOnIOS();
enableLayoutAnimationsOnIOS_ = flagValue;
@@ -398,7 +362,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(20, "enableLongTaskAPI");
markFlagAsAccessed(18, "enableLongTaskAPI");
flagValue = currentProvider_->enableLongTaskAPI();
enableLongTaskAPI_ = flagValue;
@@ -416,7 +380,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(21, "enableNewBackgroundAndBorderDrawables");
markFlagAsAccessed(19, "enableNewBackgroundAndBorderDrawables");
flagValue = currentProvider_->enableNewBackgroundAndBorderDrawables();
enableNewBackgroundAndBorderDrawables_ = flagValue;
@@ -434,7 +398,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(22, "enablePreciseSchedulingForPremountItemsOnAndroid");
markFlagAsAccessed(20, "enablePreciseSchedulingForPremountItemsOnAndroid");
flagValue = currentProvider_->enablePreciseSchedulingForPremountItemsOnAndroid();
enablePreciseSchedulingForPremountItemsOnAndroid_ = flagValue;
@@ -452,7 +416,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(23, "enablePropsUpdateReconciliationAndroid");
markFlagAsAccessed(21, "enablePropsUpdateReconciliationAndroid");
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
enablePropsUpdateReconciliationAndroid_ = flagValue;
@@ -470,7 +434,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(24, "enableReportEventPaintTime");
markFlagAsAccessed(22, "enableReportEventPaintTime");
flagValue = currentProvider_->enableReportEventPaintTime();
enableReportEventPaintTime_ = flagValue;
@@ -488,7 +452,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(25, "enableSynchronousStateUpdates");
markFlagAsAccessed(23, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -506,7 +470,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(26, "enableTextPreallocationOptimisation");
markFlagAsAccessed(24, "enableTextPreallocationOptimisation");
flagValue = currentProvider_->enableTextPreallocationOptimisation();
enableTextPreallocationOptimisation_ = flagValue;
@@ -524,7 +488,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(27, "enableUIConsistency");
markFlagAsAccessed(25, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -542,7 +506,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(28, "enableViewRecycling");
markFlagAsAccessed(26, "enableViewRecycling");
flagValue = currentProvider_->enableViewRecycling();
enableViewRecycling_ = flagValue;
@@ -560,7 +524,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(29, "excludeYogaFromRawProps");
markFlagAsAccessed(27, "excludeYogaFromRawProps");
flagValue = currentProvider_->excludeYogaFromRawProps();
excludeYogaFromRawProps_ = flagValue;
@@ -578,7 +542,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(30, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(28, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -596,7 +560,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(31, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
markFlagAsAccessed(29, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
flagValue = currentProvider_->fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
fixMountingCoordinatorReportedPendingTransactionsOnAndroid_ = flagValue;
@@ -614,7 +578,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(32, "forceBatchingMountItemsOnAndroid");
markFlagAsAccessed(30, "forceBatchingMountItemsOnAndroid");
flagValue = currentProvider_->forceBatchingMountItemsOnAndroid();
forceBatchingMountItemsOnAndroid_ = flagValue;
@@ -632,7 +596,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(33, "fuseboxEnabledDebug");
markFlagAsAccessed(31, "fuseboxEnabledDebug");
flagValue = currentProvider_->fuseboxEnabledDebug();
fuseboxEnabledDebug_ = flagValue;
@@ -650,7 +614,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(34, "fuseboxEnabledRelease");
markFlagAsAccessed(32, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -668,7 +632,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(35, "initEagerTurboModulesOnNativeModulesQueueAndroid");
markFlagAsAccessed(33, "initEagerTurboModulesOnNativeModulesQueueAndroid");
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
@@ -686,7 +650,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(36, "lazyAnimationCallbacks");
markFlagAsAccessed(34, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -704,7 +668,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(37, "loadVectorDrawablesOnImages");
markFlagAsAccessed(35, "loadVectorDrawablesOnImages");
flagValue = currentProvider_->loadVectorDrawablesOnImages();
loadVectorDrawablesOnImages_ = flagValue;
@@ -722,7 +686,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(38, "setAndroidLayoutDirection");
markFlagAsAccessed(36, "setAndroidLayoutDirection");
flagValue = currentProvider_->setAndroidLayoutDirection();
setAndroidLayoutDirection_ = flagValue;
@@ -740,7 +704,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(39, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(37, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -758,7 +722,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(40, "useFabricInterop");
markFlagAsAccessed(38, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -776,7 +740,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(41, "useImmediateExecutorInAndroidBridgeless");
markFlagAsAccessed(39, "useImmediateExecutorInAndroidBridgeless");
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
useImmediateExecutorInAndroidBridgeless_ = flagValue;
@@ -794,7 +758,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(42, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(40, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -812,7 +776,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(43, "useOptimisedViewPreallocationOnAndroid");
markFlagAsAccessed(41, "useOptimisedViewPreallocationOnAndroid");
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
useOptimisedViewPreallocationOnAndroid_ = flagValue;
@@ -830,7 +794,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(44, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(42, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -848,7 +812,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(45, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(43, "useRuntimeShadowNodeReferenceUpdate");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
@@ -866,7 +830,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(46, "useTurboModuleInterop");
markFlagAsAccessed(44, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -884,7 +848,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(47, "useTurboModules");
markFlagAsAccessed(45, "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<<afdb4fb4d8419dca361ca8bf7dbc4fb3>>
* @generated SignedSource<<e6092a90044213cc3b88f995a301aeb6>>
*/
/**
@@ -36,12 +36,10 @@ 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();
@@ -91,18 +89,16 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 48> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 46> 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<<631c825e33e07674e19a084a33637a50>>
* @generated SignedSource<<c624d0aed510abd12f9b808324dc2da8>>
*/
/**
@@ -43,10 +43,6 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool disableMountItemReorderingAndroid() override {
return false;
}
bool enableAlignItemsBaselineOnFabricIOS() override {
return true;
}
@@ -63,10 +59,6 @@ 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<<18597e1e2a88be3d80b8747f72576d5f>>
* @generated SignedSource<<35bffd8482840e9a7d0255098e78450a>>
*/
/**
@@ -29,12 +29,10 @@ 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<<43e3b8b18dec356b5121b581ab8ffa02>>
* @generated SignedSource<<12ecbb280bde10b2d74376a2a890cf97>>
*/
/**
@@ -71,11 +71,6 @@ bool NativeReactNativeFeatureFlags::disableEventLoopOnBridgeless(
return ReactNativeFeatureFlags::disableEventLoopOnBridgeless();
}
bool NativeReactNativeFeatureFlags::disableMountItemReorderingAndroid(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::disableMountItemReorderingAndroid();
}
bool NativeReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS();
@@ -96,11 +91,6 @@ 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<<f6fb3afe84c464ac7ae60b34181c182b>>
* @generated SignedSource<<00421354f8b4b982f5eac771592d418f>>
*/
/**
@@ -47,8 +47,6 @@ class NativeReactNativeFeatureFlags
bool disableEventLoopOnBridgeless(jsi::Runtime& runtime);
bool disableMountItemReorderingAndroid(jsi::Runtime& runtime);
bool enableAlignItemsBaselineOnFabricIOS(jsi::Runtime& runtime);
bool enableAndroidLineHeightCentering(jsi::Runtime& runtime);
@@ -57,8 +55,6 @@ 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,16 +18,15 @@ ImageProps::ImageProps(
const RawProps& rawProps)
: ViewProps(context, sourceProps, rawProps),
sources(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.sources
: convertRawProp(
context,
rawProps,
"source",
sourceProps.sources,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.sources
: convertRawProp(
context,
rawProps,
"source",
sourceProps.sources,
{})),
defaultSources(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.defaultSources
: convertRawProp(
context,
@@ -36,7 +35,7 @@ ImageProps::ImageProps(
sourceProps.defaultSources,
{})),
resizeMode(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.resizeMode
: convertRawProp(
context,
@@ -45,34 +44,31 @@ ImageProps::ImageProps(
sourceProps.resizeMode,
ImageResizeMode::Stretch)),
blurRadius(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.blurRadius
: convertRawProp(
context,
rawProps,
"blurRadius",
sourceProps.blurRadius,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.blurRadius
: convertRawProp(
context,
rawProps,
"blurRadius",
sourceProps.blurRadius,
{})),
capInsets(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.capInsets
: convertRawProp(
context,
rawProps,
"capInsets",
sourceProps.capInsets,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.capInsets
: convertRawProp(
context,
rawProps,
"capInsets",
sourceProps.capInsets,
{})),
tintColor(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.tintColor
: convertRawProp(
context,
rawProps,
"tintColor",
sourceProps.tintColor,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.tintColor
: convertRawProp(
context,
rawProps,
"tintColor",
sourceProps.tintColor,
{})),
internal_analyticTag(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? 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(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.alwaysBounceHorizontal
: convertRawProp(
context,
@@ -31,7 +31,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.alwaysBounceHorizontal,
{})),
alwaysBounceVertical(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.alwaysBounceVertical
: convertRawProp(
context,
@@ -40,25 +40,23 @@ ScrollViewProps::ScrollViewProps(
sourceProps.alwaysBounceVertical,
{})),
bounces(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.bounces
: convertRawProp(
context,
rawProps,
"bounces",
sourceProps.bounces,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.bounces
: convertRawProp(
context,
rawProps,
"bounces",
sourceProps.bounces,
true)),
bouncesZoom(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.bouncesZoom
: convertRawProp(
context,
rawProps,
"bouncesZoom",
sourceProps.bouncesZoom,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.bouncesZoom
: convertRawProp(
context,
rawProps,
"bouncesZoom",
sourceProps.bouncesZoom,
true)),
canCancelContentTouches(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.canCancelContentTouches
: convertRawProp(
context,
@@ -67,7 +65,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.canCancelContentTouches,
true)),
centerContent(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.centerContent
: convertRawProp(
context,
@@ -76,7 +74,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.centerContent,
{})),
automaticallyAdjustContentInsets(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.automaticallyAdjustContentInsets
: convertRawProp(
context,
@@ -85,7 +83,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.automaticallyAdjustContentInsets,
{})),
automaticallyAdjustsScrollIndicatorInsets(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.automaticallyAdjustsScrollIndicatorInsets
: convertRawProp(
context,
@@ -94,7 +92,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.automaticallyAdjustsScrollIndicatorInsets,
true)),
automaticallyAdjustKeyboardInsets(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.automaticallyAdjustKeyboardInsets
: convertRawProp(
context,
@@ -103,7 +101,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.automaticallyAdjustKeyboardInsets,
false)),
decelerationRate(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.decelerationRate
: convertRawProp(
context,
@@ -112,7 +110,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.decelerationRate,
(Float)0.998)),
endDraggingSensitivityMultiplier(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.endDraggingSensitivityMultiplier
: convertRawProp(
context,
@@ -121,7 +119,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.endDraggingSensitivityMultiplier,
(Float)1)),
enableSyncOnScroll(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.enableSyncOnScroll
: convertRawProp(
context,
@@ -130,7 +128,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.enableSyncOnScroll,
false)),
directionalLockEnabled(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.directionalLockEnabled
: convertRawProp(
context,
@@ -139,7 +137,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.directionalLockEnabled,
{})),
indicatorStyle(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.indicatorStyle
: convertRawProp(
context,
@@ -148,7 +146,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.indicatorStyle,
{})),
keyboardDismissMode(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.keyboardDismissMode
: convertRawProp(
context,
@@ -157,7 +155,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.keyboardDismissMode,
{})),
maintainVisibleContentPosition(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.maintainVisibleContentPosition
: convertRawProp(
context,
@@ -166,7 +164,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.maintainVisibleContentPosition,
{})),
maximumZoomScale(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.maximumZoomScale
: convertRawProp(
context,
@@ -175,7 +173,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.maximumZoomScale,
(Float)1.0)),
minimumZoomScale(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.minimumZoomScale
: convertRawProp(
context,
@@ -184,7 +182,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.minimumZoomScale,
(Float)1.0)),
scrollEnabled(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.scrollEnabled
: convertRawProp(
context,
@@ -193,7 +191,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollEnabled,
true)),
pagingEnabled(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.pagingEnabled
: convertRawProp(
context,
@@ -202,7 +200,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.pagingEnabled,
{})),
pinchGestureEnabled(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.pinchGestureEnabled
: convertRawProp(
context,
@@ -211,16 +209,15 @@ ScrollViewProps::ScrollViewProps(
sourceProps.pinchGestureEnabled,
true)),
scrollsToTop(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.scrollsToTop
: convertRawProp(
context,
rawProps,
"scrollsToTop",
sourceProps.scrollsToTop,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.scrollsToTop
: convertRawProp(
context,
rawProps,
"scrollsToTop",
sourceProps.scrollsToTop,
true)),
showsHorizontalScrollIndicator(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.showsHorizontalScrollIndicator
: convertRawProp(
context,
@@ -229,7 +226,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.showsHorizontalScrollIndicator,
true)),
showsVerticalScrollIndicator(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.showsVerticalScrollIndicator
: convertRawProp(
context,
@@ -238,7 +235,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.showsVerticalScrollIndicator,
true)),
persistentScrollbar(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.persistentScrollbar
: convertRawProp(
context,
@@ -247,16 +244,15 @@ ScrollViewProps::ScrollViewProps(
sourceProps.persistentScrollbar,
true)),
horizontal(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.horizontal
: convertRawProp(
context,
rawProps,
"horizontal",
sourceProps.horizontal,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.horizontal
: convertRawProp(
context,
rawProps,
"horizontal",
sourceProps.horizontal,
true)),
scrollEventThrottle(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.scrollEventThrottle
: convertRawProp(
context,
@@ -265,25 +261,23 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollEventThrottle,
{})),
zoomScale(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.zoomScale
: convertRawProp(
context,
rawProps,
"zoomScale",
sourceProps.zoomScale,
(Float)1.0)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.zoomScale
: convertRawProp(
context,
rawProps,
"zoomScale",
sourceProps.zoomScale,
(Float)1.0)),
contentInset(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.contentInset
: convertRawProp(
context,
rawProps,
"contentInset",
sourceProps.contentInset,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.contentInset
: convertRawProp(
context,
rawProps,
"contentInset",
sourceProps.contentInset,
{})),
contentOffset(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.contentOffset
: convertRawProp(
context,
@@ -292,7 +286,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.contentOffset,
{})),
scrollIndicatorInsets(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.scrollIndicatorInsets
: convertRawProp(
context,
@@ -301,7 +295,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollIndicatorInsets,
{})),
snapToInterval(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.snapToInterval
: convertRawProp(
context,
@@ -310,7 +304,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.snapToInterval,
{})),
snapToAlignment(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.snapToAlignment
: convertRawProp(
context,
@@ -319,7 +313,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.snapToAlignment,
{})),
disableIntervalMomentum(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.disableIntervalMomentum
: convertRawProp(
context,
@@ -328,7 +322,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.disableIntervalMomentum,
{})),
snapToOffsets(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.snapToOffsets
: convertRawProp(
context,
@@ -337,25 +331,23 @@ ScrollViewProps::ScrollViewProps(
sourceProps.snapToOffsets,
{})),
snapToStart(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToStart
: convertRawProp(
context,
rawProps,
"snapToStart",
sourceProps.snapToStart,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.snapToStart
: convertRawProp(
context,
rawProps,
"snapToStart",
sourceProps.snapToStart,
true)),
snapToEnd(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.snapToEnd
: convertRawProp(
context,
rawProps,
"snapToEnd",
sourceProps.snapToEnd,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.snapToEnd
: convertRawProp(
context,
rawProps,
"snapToEnd",
sourceProps.snapToEnd,
true)),
contentInsetAdjustmentBehavior(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.contentInsetAdjustmentBehavior
: convertRawProp(
context,
@@ -364,7 +356,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.contentInsetAdjustmentBehavior,
{ContentInsetAdjustmentBehavior::Never})),
scrollToOverflowEnabled(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.scrollToOverflowEnabled
: convertRawProp(
context,
@@ -373,7 +365,7 @@ ScrollViewProps::ScrollViewProps(
sourceProps.scrollToOverflowEnabled,
{})),
isInvertedVirtualizedList(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? 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(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? 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(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.paragraphAttributes
: convertRawProp(
context,
@@ -32,23 +32,21 @@ ParagraphProps::ParagraphProps(
sourceProps.paragraphAttributes,
{})),
isSelectable(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.isSelectable
: convertRawProp(
context,
rawProps,
"selectable",
sourceProps.isSelectable,
false)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.isSelectable
: convertRawProp(
context,
rawProps,
"selectable",
sourceProps.isSelectable,
false)),
onTextLayout(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onTextLayout
: convertRawProp(
context,
rawProps,
"onTextLayout",
sourceProps.onTextLayout,
{})) {
CoreFeatures::enablePropIteratorSetter ? 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,6 +21,7 @@
#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(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoComplete : convertRawProp(
autoComplete(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp(
context,
rawProps,
"autoComplete",
sourceProps.autoComplete,
{})),
returnKeyLabel(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoComplete : convertRawProp(context, rawProps,
returnKeyLabel(CoreFeatures::enablePropIteratorSetter? sourceProps.autoComplete : convertRawProp(context, rawProps,
"returnKeyLabel",
sourceProps.returnKeyLabel,
{})),
numberOfLines(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.numberOfLines : convertRawProp(context, rawProps,
numberOfLines(CoreFeatures::enablePropIteratorSetter? sourceProps.numberOfLines : convertRawProp(context, rawProps,
"numberOfLines",
sourceProps.numberOfLines,
{0})),
disableFullscreenUI(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps,
disableFullscreenUI(CoreFeatures::enablePropIteratorSetter? sourceProps.disableFullscreenUI : convertRawProp(context, rawProps,
"disableFullscreenUI",
sourceProps.disableFullscreenUI,
{false})),
textBreakStrategy(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textBreakStrategy : convertRawProp(context, rawProps,
textBreakStrategy(CoreFeatures::enablePropIteratorSetter? sourceProps.textBreakStrategy : convertRawProp(context, rawProps,
"textBreakStrategy",
sourceProps.textBreakStrategy,
{})),
inlineImageLeft(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.inlineImageLeft : convertRawProp(context, rawProps,
inlineImageLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImageLeft : convertRawProp(context, rawProps,
"inlineImageLeft",
sourceProps.inlineImageLeft,
{})),
inlineImagePadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.inlineImagePadding : convertRawProp(context, rawProps,
inlineImagePadding(CoreFeatures::enablePropIteratorSetter? sourceProps.inlineImagePadding : convertRawProp(context, rawProps,
"inlineImagePadding",
sourceProps.inlineImagePadding,
{0})),
importantForAutofill(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.importantForAutofill : convertRawProp(context, rawProps,
importantForAutofill(CoreFeatures::enablePropIteratorSetter? sourceProps.importantForAutofill : convertRawProp(context, rawProps,
"importantForAutofill",
sourceProps.importantForAutofill,
{})),
showSoftInputOnFocus(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps,
showSoftInputOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.showSoftInputOnFocus : convertRawProp(context, rawProps,
"showSoftInputOnFocus",
sourceProps.showSoftInputOnFocus,
{false})),
autoCorrect(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.autoCorrect : convertRawProp(context, rawProps,
autoCorrect(CoreFeatures::enablePropIteratorSetter? sourceProps.autoCorrect : convertRawProp(context, rawProps,
"autoCorrect",
sourceProps.autoCorrect,
{false})),
allowFontScaling(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.allowFontScaling : convertRawProp(context, rawProps,
allowFontScaling(CoreFeatures::enablePropIteratorSetter? sourceProps.allowFontScaling : convertRawProp(context, rawProps,
"allowFontScaling",
sourceProps.allowFontScaling,
{false})),
maxFontSizeMultiplier(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps,
maxFontSizeMultiplier(CoreFeatures::enablePropIteratorSetter? sourceProps.maxFontSizeMultiplier : convertRawProp(context, rawProps,
"maxFontSizeMultiplier",
sourceProps.maxFontSizeMultiplier,
{0.0})),
keyboardType(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.keyboardType : convertRawProp(context, rawProps,
keyboardType(CoreFeatures::enablePropIteratorSetter? sourceProps.keyboardType : convertRawProp(context, rawProps,
"keyboardType",
sourceProps.keyboardType,
{})),
returnKeyType(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.returnKeyType : convertRawProp(context, rawProps,
returnKeyType(CoreFeatures::enablePropIteratorSetter? sourceProps.returnKeyType : convertRawProp(context, rawProps,
"returnKeyType",
sourceProps.returnKeyType,
{})),
multiline(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.multiline : convertRawProp(context, rawProps,
multiline(CoreFeatures::enablePropIteratorSetter? sourceProps.multiline : convertRawProp(context, rawProps,
"multiline",
sourceProps.multiline,
{false})),
secureTextEntry(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.secureTextEntry : convertRawProp(context, rawProps,
secureTextEntry(CoreFeatures::enablePropIteratorSetter? sourceProps.secureTextEntry : convertRawProp(context, rawProps,
"secureTextEntry",
sourceProps.secureTextEntry,
{false})),
value(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})),
selectTextOnFocus(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps,
value(CoreFeatures::enablePropIteratorSetter? sourceProps.value : convertRawProp(context, rawProps, "value", sourceProps.value, {})),
selectTextOnFocus(CoreFeatures::enablePropIteratorSetter? sourceProps.selectTextOnFocus : convertRawProp(context, rawProps,
"selectTextOnFocus",
sourceProps.selectTextOnFocus,
{false})),
submitBehavior(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.submitBehavior : convertRawProp(context, rawProps,
submitBehavior(CoreFeatures::enablePropIteratorSetter? sourceProps.submitBehavior : convertRawProp(context, rawProps,
"submitBehavior",
sourceProps.submitBehavior,
{})),
caretHidden(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.caretHidden : convertRawProp(context, rawProps,
caretHidden(CoreFeatures::enablePropIteratorSetter? sourceProps.caretHidden : convertRawProp(context, rawProps,
"caretHidden",
sourceProps.caretHidden,
{false})),
contextMenuHidden(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.contextMenuHidden : convertRawProp(context, rawProps,
contextMenuHidden(CoreFeatures::enablePropIteratorSetter? sourceProps.contextMenuHidden : convertRawProp(context, rawProps,
"contextMenuHidden",
sourceProps.contextMenuHidden,
{false})),
textShadowColor(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowColor : convertRawProp(context, rawProps,
textShadowColor(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowColor : convertRawProp(context, rawProps,
"textShadowColor",
sourceProps.textShadowColor,
{})),
textShadowRadius(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowRadius : convertRawProp(context, rawProps,
textShadowRadius(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowRadius : convertRawProp(context, rawProps,
"textShadowRadius",
sourceProps.textShadowRadius,
{0.0})),
textDecorationLine(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textDecorationLine : convertRawProp(context, rawProps,
textDecorationLine(CoreFeatures::enablePropIteratorSetter? sourceProps.textDecorationLine : convertRawProp(context, rawProps,
"textDecorationLine",
sourceProps.textDecorationLine,
{})),
fontStyle(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontStyle :
fontStyle(CoreFeatures::enablePropIteratorSetter? sourceProps.fontStyle :
convertRawProp(context, rawProps, "fontStyle", sourceProps.fontStyle, {})),
textShadowOffset(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textShadowOffset : convertRawProp(context, rawProps,
textShadowOffset(CoreFeatures::enablePropIteratorSetter? sourceProps.textShadowOffset : convertRawProp(context, rawProps,
"textShadowOffset",
sourceProps.textShadowOffset,
{})),
lineHeight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.lineHeight : convertRawProp(context, rawProps,
lineHeight(CoreFeatures::enablePropIteratorSetter? sourceProps.lineHeight : convertRawProp(context, rawProps,
"lineHeight",
sourceProps.lineHeight,
{0.0})),
textTransform(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textTransform : convertRawProp(context, rawProps,
textTransform(CoreFeatures::enablePropIteratorSetter? sourceProps.textTransform : convertRawProp(context, rawProps,
"textTransform",
sourceProps.textTransform,
{})),
color(0 /*convertRawProp(context, rawProps, "color", sourceProps.color, {0})*/),
letterSpacing(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.letterSpacing : convertRawProp(context, rawProps,
letterSpacing(CoreFeatures::enablePropIteratorSetter? sourceProps.letterSpacing : convertRawProp(context, rawProps,
"letterSpacing",
sourceProps.letterSpacing,
{0.0})),
fontSize(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontSize :
fontSize(CoreFeatures::enablePropIteratorSetter? sourceProps.fontSize :
convertRawProp(context, rawProps, "fontSize", sourceProps.fontSize, {0.0})),
textAlign(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.textAlign :
textAlign(CoreFeatures::enablePropIteratorSetter? sourceProps.textAlign :
convertRawProp(context, rawProps, "textAlign", sourceProps.textAlign, {})),
includeFontPadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.includeFontPadding : convertRawProp(context, rawProps,
includeFontPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.includeFontPadding : convertRawProp(context, rawProps,
"includeFontPadding",
sourceProps.includeFontPadding,
{false})),
fontWeight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontWeight :
fontWeight(CoreFeatures::enablePropIteratorSetter? sourceProps.fontWeight :
convertRawProp(context, rawProps, "fontWeight", sourceProps.fontWeight, {})),
fontFamily(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.fontFamily :
fontFamily(CoreFeatures::enablePropIteratorSetter? sourceProps.fontFamily :
convertRawProp(context, rawProps, "fontFamily", sourceProps.fontFamily, {})),
// See AndroidTextInputComponentDescriptor for usage
// TODO T63008435: can these, and this feature, be removed entirely?
hasPadding(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "padding")),
hasPaddingHorizontal(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingHorizontal : hasValue(
hasPadding(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPadding : hasValue(rawProps, sourceProps.hasPadding, "padding")),
hasPaddingHorizontal(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingHorizontal : hasValue(
rawProps,
sourceProps.hasPaddingHorizontal,
"paddingHorizontal")),
hasPaddingVertical(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingVertical : hasValue(
hasPaddingVertical(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingVertical : hasValue(
rawProps,
sourceProps.hasPaddingVertical,
"paddingVertical")),
hasPaddingLeft(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingLeft : hasValue(
hasPaddingLeft(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingLeft : hasValue(
rawProps,
sourceProps.hasPaddingLeft,
"paddingLeft")),
hasPaddingTop(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingTop :
hasPaddingTop(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingTop :
hasValue(rawProps, sourceProps.hasPaddingTop, "paddingTop")),
hasPaddingRight(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingRight : hasValue(
hasPaddingRight(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingRight : hasValue(
rawProps,
sourceProps.hasPaddingRight,
"paddingRight")),
hasPaddingBottom(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingBottom : hasValue(
hasPaddingBottom(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingBottom : hasValue(
rawProps,
sourceProps.hasPaddingBottom,
"paddingBottom")),
hasPaddingStart(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingStart : hasValue(
hasPaddingStart(CoreFeatures::enablePropIteratorSetter? sourceProps.hasPaddingStart : hasValue(
rawProps,
sourceProps.hasPaddingStart,
"paddingStart")),
hasPaddingEnd(ReactNativeFeatureFlags::enableCppPropsIteratorSetter()? sourceProps.hasPaddingEnd :
hasPaddingEnd(CoreFeatures::enablePropIteratorSetter? 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,16 +20,15 @@ AccessibilityProps::AccessibilityProps(
const AccessibilityProps& sourceProps,
const RawProps& rawProps)
: accessible(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.accessible
: convertRawProp(
context,
rawProps,
"accessible",
sourceProps.accessible,
false)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.accessible
: convertRawProp(
context,
rawProps,
"accessible",
sourceProps.accessible,
false)),
accessibilityState(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityState
: convertRawProp(
context,
@@ -38,7 +37,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityState,
{})),
accessibilityLabel(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityLabel
: convertRawProp(
context,
@@ -47,7 +46,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLabel,
"")),
accessibilityLabelledBy(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityLabelledBy
: convertRawProp(
context,
@@ -56,7 +55,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLabelledBy,
{})),
accessibilityLiveRegion(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityLiveRegion
: convertRawProp(
context,
@@ -65,7 +64,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLiveRegion,
AccessibilityLiveRegion::None)),
accessibilityHint(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityHint
: convertRawProp(
context,
@@ -74,7 +73,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityHint,
"")),
accessibilityLanguage(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityLanguage
: convertRawProp(
context,
@@ -83,7 +82,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLanguage,
"")),
accessibilityLargeContentTitle(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityLargeContentTitle
: convertRawProp(
context,
@@ -92,7 +91,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityLargeContentTitle,
"")),
accessibilityValue(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityValue
: convertRawProp(
context,
@@ -101,7 +100,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityValue,
{})),
accessibilityActions(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityActions
: convertRawProp(
context,
@@ -110,7 +109,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityActions,
{})),
accessibilityShowsLargeContentViewer(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityShowsLargeContentViewer
: convertRawProp(
context,
@@ -119,7 +118,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityShowsLargeContentViewer,
false)),
accessibilityViewIsModal(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityViewIsModal
: convertRawProp(
context,
@@ -128,7 +127,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityViewIsModal,
false)),
accessibilityElementsHidden(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityElementsHidden
: convertRawProp(
context,
@@ -137,7 +136,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityElementsHidden,
false)),
accessibilityIgnoresInvertColors(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.accessibilityIgnoresInvertColors
: convertRawProp(
context,
@@ -146,7 +145,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.accessibilityIgnoresInvertColors,
false)),
onAccessibilityTap(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.onAccessibilityTap
: convertRawProp(
context,
@@ -155,7 +154,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityTap,
{})),
onAccessibilityMagicTap(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.onAccessibilityMagicTap
: convertRawProp(
context,
@@ -164,7 +163,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityMagicTap,
{})),
onAccessibilityEscape(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.onAccessibilityEscape
: convertRawProp(
context,
@@ -173,7 +172,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityEscape,
{})),
onAccessibilityAction(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.onAccessibilityAction
: convertRawProp(
context,
@@ -182,7 +181,7 @@ AccessibilityProps::AccessibilityProps(
sourceProps.onAccessibilityAction,
{})),
importantForAccessibility(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.importantForAccessibility
: convertRawProp(
context,
@@ -191,14 +190,13 @@ AccessibilityProps::AccessibilityProps(
sourceProps.importantForAccessibility,
ImportantForAccessibility::Auto)),
testId(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.testId
: convertRawProp(
context,
rawProps,
"testID",
sourceProps.testId,
"")) {
CoreFeatures::enablePropIteratorSetter ? 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
@@ -206,7 +204,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 (!ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
if (!CoreFeatures::enablePropIteratorSetter) {
auto* accessibilityRoleValue =
rawProps.at("accessibilityRole", nullptr, nullptr);
auto* roleValue = rawProps.at("role", nullptr, nullptr);
@@ -9,7 +9,6 @@
#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>
@@ -17,6 +16,7 @@
#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,16 +57,15 @@ BaseViewProps::BaseViewProps(
: YogaStylableProps(context, sourceProps, rawProps),
AccessibilityProps(context, sourceProps, rawProps),
opacity(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.opacity
: convertRawProp(
context,
rawProps,
"opacity",
sourceProps.opacity,
(Float)1.0)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.opacity
: convertRawProp(
context,
rawProps,
"opacity",
sourceProps.opacity,
(Float)1.0)),
backgroundColor(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.backgroundColor
: convertRawProp(
context,
@@ -75,56 +74,51 @@ BaseViewProps::BaseViewProps(
sourceProps.backgroundColor,
{})),
borderRadii(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderRadii
: convertRawProp(
context,
rawProps,
"border",
"Radius",
sourceProps.borderRadii,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderRadii
: convertRawProp(
context,
rawProps,
"border",
"Radius",
sourceProps.borderRadii,
{})),
borderColors(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderColors
: convertRawProp(
context,
rawProps,
"border",
"Color",
sourceProps.borderColors,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderColors
: convertRawProp(
context,
rawProps,
"border",
"Color",
sourceProps.borderColors,
{})),
borderCurves(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderCurves
: convertRawProp(
context,
rawProps,
"border",
"Curve",
sourceProps.borderCurves,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderCurves
: convertRawProp(
context,
rawProps,
"border",
"Curve",
sourceProps.borderCurves,
{})),
borderStyles(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.borderStyles
: convertRawProp(
context,
rawProps,
"border",
"Style",
sourceProps.borderStyles,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderStyles
: convertRawProp(
context,
rawProps,
"border",
"Style",
sourceProps.borderStyles,
{})),
outlineColor(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineColor
: convertRawProp(
context,
rawProps,
"outlineColor",
sourceProps.outlineColor,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.outlineColor
: convertRawProp(
context,
rawProps,
"outlineColor",
sourceProps.outlineColor,
{})),
outlineOffset(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.outlineOffset
: convertRawProp(
context,
@@ -133,43 +127,39 @@ BaseViewProps::BaseViewProps(
sourceProps.outlineOffset,
{})),
outlineStyle(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineStyle
: convertRawProp(
context,
rawProps,
"outlineStyle",
sourceProps.outlineStyle,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.outlineStyle
: convertRawProp(
context,
rawProps,
"outlineStyle",
sourceProps.outlineStyle,
{})),
outlineWidth(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.outlineWidth
: convertRawProp(
context,
rawProps,
"outlineWidth",
sourceProps.outlineWidth,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.outlineWidth
: convertRawProp(
context,
rawProps,
"outlineWidth",
sourceProps.outlineWidth,
{})),
shadowColor(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowColor
: convertRawProp(
context,
rawProps,
"shadowColor",
sourceProps.shadowColor,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowColor
: convertRawProp(
context,
rawProps,
"shadowColor",
sourceProps.shadowColor,
{})),
shadowOffset(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowOffset
: convertRawProp(
context,
rawProps,
"shadowOffset",
sourceProps.shadowOffset,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowOffset
: convertRawProp(
context,
rawProps,
"shadowOffset",
sourceProps.shadowOffset,
{})),
shadowOpacity(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.shadowOpacity
: convertRawProp(
context,
@@ -178,43 +168,39 @@ BaseViewProps::BaseViewProps(
sourceProps.shadowOpacity,
{})),
shadowRadius(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.shadowRadius
: convertRawProp(
context,
rawProps,
"shadowRadius",
sourceProps.shadowRadius,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.shadowRadius
: convertRawProp(
context,
rawProps,
"shadowRadius",
sourceProps.shadowRadius,
{})),
cursor(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.cursor
: convertRawProp(
context,
rawProps,
"cursor",
sourceProps.cursor,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.cursor
: convertRawProp(
context,
rawProps,
"cursor",
sourceProps.cursor,
{})),
boxShadow(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.boxShadow
: convertRawProp(
context,
rawProps,
"boxShadow",
sourceProps.boxShadow,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.boxShadow
: convertRawProp(
context,
rawProps,
"boxShadow",
sourceProps.boxShadow,
{})),
filter(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.filter
: convertRawProp(
context,
rawProps,
"filter",
sourceProps.filter,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.filter
: convertRawProp(
context,
rawProps,
"filter",
sourceProps.filter,
{})),
backgroundImage(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.backgroundImage
: convertRawProp(
context,
@@ -223,34 +209,31 @@ BaseViewProps::BaseViewProps(
sourceProps.backgroundImage,
{})),
mixBlendMode(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.mixBlendMode
: convertRawProp(
context,
rawProps,
"mixBlendMode",
sourceProps.mixBlendMode,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.mixBlendMode
: convertRawProp(
context,
rawProps,
"mixBlendMode",
sourceProps.mixBlendMode,
{})),
isolation(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.isolation
: convertRawProp(
context,
rawProps,
"isolation",
sourceProps.isolation,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.isolation
: convertRawProp(
context,
rawProps,
"isolation",
sourceProps.isolation,
{})),
transform(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.transform
: convertRawProp(
context,
rawProps,
"transform",
sourceProps.transform,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.transform
: convertRawProp(
context,
rawProps,
"transform",
sourceProps.transform,
{})),
transformOrigin(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.transformOrigin
: convertRawProp(
context,
@@ -259,7 +242,7 @@ BaseViewProps::BaseViewProps(
sourceProps.transformOrigin,
{})),
backfaceVisibility(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.backfaceVisibility
: convertRawProp(
context,
@@ -268,7 +251,7 @@ BaseViewProps::BaseViewProps(
sourceProps.backfaceVisibility,
{})),
shouldRasterize(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.shouldRasterize
: convertRawProp(
context,
@@ -277,16 +260,15 @@ BaseViewProps::BaseViewProps(
sourceProps.shouldRasterize,
{})),
zIndex(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.zIndex
: convertRawProp(
context,
rawProps,
"zIndex",
sourceProps.zIndex,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.zIndex
: convertRawProp(
context,
rawProps,
"zIndex",
sourceProps.zIndex,
{})),
pointerEvents(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.pointerEvents
: convertRawProp(
context,
@@ -295,38 +277,35 @@ BaseViewProps::BaseViewProps(
sourceProps.pointerEvents,
{})),
hitSlop(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.hitSlop
: convertRawProp(
context,
rawProps,
"hitSlop",
sourceProps.hitSlop,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.hitSlop
: convertRawProp(
context,
rawProps,
"hitSlop",
sourceProps.hitSlop,
{})),
onLayout(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.onLayout
: convertRawProp(
context,
rawProps,
"onLayout",
sourceProps.onLayout,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.onLayout
: convertRawProp(
context,
rawProps,
"onLayout",
sourceProps.onLayout,
{})),
events(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.events
: convertRawProp(context, rawProps, sourceProps.events, {})),
collapsable(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.collapsable
: convertRawProp(
context,
rawProps,
"collapsable",
sourceProps.collapsable,
true)),
CoreFeatures::enablePropIteratorSetter ? sourceProps.collapsable
: convertRawProp(
context,
rawProps,
"collapsable",
sourceProps.collapsable,
true)),
collapsableChildren(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.collapsableChildren
: convertRawProp(
context,
@@ -335,7 +314,7 @@ BaseViewProps::BaseViewProps(
sourceProps.collapsableChildren,
true)),
removeClippedSubviews(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.removeClippedSubviews
: convertRawProp(
context,
@@ -344,7 +323,7 @@ BaseViewProps::BaseViewProps(
sourceProps.removeClippedSubviews,
false)),
experimental_layoutConformance(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.experimental_layoutConformance
: convertRawProp(
context,
@@ -9,6 +9,7 @@
#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,6 +17,7 @@
#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>
@@ -785,7 +786,7 @@ Rect YogaLayoutableShadowNode::getContentBounds() const {
}
/*static*/ void YogaLayoutableShadowNode::filterRawProps(RawProps& rawProps) {
if (ReactNativeFeatureFlags::excludeYogaFromRawProps()) {
if (CoreFeatures::excludeYogaFromRawProps) {
// TODO: this shouldn't live in RawProps
rawProps.filterYogaStylePropsInDynamicConversion();
}
@@ -11,6 +11,7 @@
#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,16 +23,15 @@ HostPlatformViewProps::HostPlatformViewProps(
const RawProps& rawProps)
: BaseViewProps(context, sourceProps, rawProps),
elevation(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.elevation
: convertRawProp(
context,
rawProps,
"elevation",
sourceProps.elevation,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.elevation
: convertRawProp(
context,
rawProps,
"elevation",
sourceProps.elevation,
{})),
nativeBackground(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.nativeBackground
: convertRawProp(
context,
@@ -41,7 +40,7 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.nativeBackground,
{})),
nativeForeground(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.nativeForeground
: convertRawProp(
context,
@@ -50,16 +49,15 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.nativeForeground,
{})),
focusable(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
? sourceProps.focusable
: convertRawProp(
context,
rawProps,
"focusable",
sourceProps.focusable,
{})),
CoreFeatures::enablePropIteratorSetter ? sourceProps.focusable
: convertRawProp(
context,
rawProps,
"focusable",
sourceProps.focusable,
{})),
hasTVPreferredFocus(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.hasTVPreferredFocus
: convertRawProp(
context,
@@ -68,7 +66,7 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.hasTVPreferredFocus,
{})),
needsOffscreenAlphaCompositing(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.needsOffscreenAlphaCompositing
: convertRawProp(
context,
@@ -77,7 +75,7 @@ HostPlatformViewProps::HostPlatformViewProps(
sourceProps.needsOffscreenAlphaCompositing,
{})),
renderToHardwareTextureAndroid(
ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
CoreFeatures::enablePropIteratorSetter
? sourceProps.renderToHardwareTextureAndroid
: convertRawProp(
context,
@@ -11,7 +11,6 @@
#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>
@@ -20,6 +19,7 @@
#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 (ReactNativeFeatureFlags::enableCppPropsIteratorSetter()) {
if (CoreFeatures::enablePropIteratorSetter) {
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,
RuntimeScheduler& runtimeScheduler)
: ownerBox_(std::move(ownerBox)), runtimeScheduler_(runtimeScheduler) {}
RuntimeExecutor runtimeExecutor)
: ownerBox_(std::move(ownerBox)),
runtimeExecutor_(std::move(runtimeExecutor)) {}
void EventBeat::request() const {
isRequested_ = true;
@@ -33,18 +33,17 @@ void EventBeat::induce() const {
isRequested_ = false;
isBeatCallbackScheduled_ = true;
runtimeScheduler_.scheduleWork(
[this, ownerBox = ownerBox_](jsi::Runtime& runtime) {
auto owner = ownerBox->owner.lock();
if (!owner) {
return;
}
runtimeExecutor_([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,14 +7,11 @@
#pragma once
#include <ReactCommon/RuntimeExecutor.h>
#include <atomic>
#include <functional>
#include <memory>
namespace facebook::react {
class RuntimeScheduler;
}
namespace facebook::jsi {
class Runtime;
}
@@ -59,7 +56,7 @@ class EventBeat {
explicit EventBeat(
std::shared_ptr<OwnerBox> ownerBox,
RuntimeScheduler& runtimeScheduler);
RuntimeExecutor runtimeExecutor);
virtual ~EventBeat() = default;
@@ -91,7 +88,7 @@ class EventBeat {
mutable std::atomic<bool> isRequested_{false};
private:
RuntimeScheduler& runtimeScheduler_;
RuntimeExecutor runtimeExecutor_;
mutable std::atomic<bool> isBeatCallbackScheduled_{false};
};
@@ -9,8 +9,7 @@
#include <folly/dynamic.h>
#include <react/renderer/core/propsConversions.h>
#include <react/featureflags/ReactNativeFeatureFlags.h>
#include <react/utils/CoreFeatures.h>
namespace facebook::react {
@@ -25,7 +24,7 @@ void Props::initialize(
const PropsParserContext& context,
const Props& sourceProps,
const RawProps& rawProps) {
nativeId = ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
nativeId = CoreFeatures::enablePropIteratorSetter
? sourceProps.nativeId
: convertRawProp(context, rawProps, "nativeID", sourceProps.nativeId, {});
#ifdef ANDROID
@@ -33,6 +33,8 @@ 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,8 +231,7 @@ CommitMode ShadowTree::getCommitMode() const {
return commitMode_;
}
std::shared_ptr<const MountingCoordinator> ShadowTree::getMountingCoordinator()
const {
MountingCoordinator::Shared ShadowTree::getMountingCoordinator() const {
return mountingCoordinator_;
}
@@ -279,7 +278,8 @@ CommitStatus ShadowTree::tryCommit(
const auto& oldRootShadowNode = oldRevision.rootShadowNode;
auto newRootShadowNode = transaction(*oldRevision.rootShadowNode);
if (!newRootShadowNode) {
if (!newRootShadowNode ||
(commitOptions.shouldYield && commitOptions.shouldYield())) {
return CommitStatus::Cancelled;
}
@@ -296,7 +296,8 @@ CommitStatus ShadowTree::tryCommit(
newRootShadowNode = delegate_.shadowTreeWillCommit(
*this, oldRootShadowNode, newRootShadowNode);
if (!newRootShadowNode) {
if (!newRootShadowNode ||
(commitOptions.shouldYield && commitOptions.shouldYield())) {
return CommitStatus::Cancelled;
}
@@ -314,6 +315,10 @@ 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,6 +66,10 @@ 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;
};
/*
@@ -126,7 +130,7 @@ class ShadowTree final {
*/
void notifyDelegatesOfUpdates() const;
std::shared_ptr<const MountingCoordinator> getMountingCoordinator() const;
MountingCoordinator::Shared getMountingCoordinator() const;
private:
constexpr static ShadowTreeRevision::Number INITIAL_REVISION{0};
@@ -144,7 +148,7 @@ class ShadowTree final {
mutable ShadowTreeRevision currentRevision_; // Protected by `commitMutex_`.
mutable ShadowTreeRevision::Number
lastRevisionNumberWithNewState_; // Protected by `commitMutex_`.
std::shared_ptr<const MountingCoordinator> mountingCoordinator_;
MountingCoordinator::Shared 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(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) const = 0;
virtual ~ShadowTreeDelegate() noexcept = default;
@@ -34,7 +34,7 @@ class DummyShadowTreeDelegate : public ShadowTreeDelegate {
};
void shadowTreeDidFinishTransaction(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) const override {};
};
@@ -9,6 +9,7 @@
#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();
std::shared_ptr<const MountingCoordinator> mountingCoordinator = nullptr;
MountingCoordinator::Shared mountingCoordinator = nullptr;
RootShadowNode::Shared rootShadowNode = nullptr;
shadowTreeRegistry.visit(surfaceId, [&](const ShadowTree& shadowTree) {
mountingCoordinator = shadowTree.getMountingCoordinator();
@@ -9,6 +9,7 @@
#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(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) {
SystraceSection s("Scheduler::uiManagerDidFinishTransaction");
@@ -85,7 +85,7 @@ class Scheduler final : public UIManagerDelegate {
#pragma mark - UIManagerDelegate
void uiManagerDidFinishTransaction(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) override;
void uiManagerDidCreateShadowNode(const ShadowNode& shadowNode) override;
void uiManagerDidDispatchCommand(
@@ -26,8 +26,7 @@ class SchedulerDelegate {
* to construct a new one.
*/
virtual void schedulerDidFinishTransaction(
const std::shared_ptr<const MountingCoordinator>&
mountingCoordinator) = 0;
const MountingCoordinator::Shared& mountingCoordinator) = 0;
/*
* Called when the runtime scheduler decides that one-or-more previously
@@ -38,8 +37,7 @@ class SchedulerDelegate {
* correctly apply changes, due to changes in Props representation.
*/
virtual void schedulerShouldRenderTransactions(
const std::shared_ptr<const MountingCoordinator>&
mountingCoordinator) = 0;
const MountingCoordinator::Shared& mountingCoordinator) = 0;
/*
* Called right after a new ShadowNode was created.
@@ -64,9 +64,9 @@ Size SurfaceManager::measureSurface(
return size;
}
std::shared_ptr<const MountingCoordinator>
SurfaceManager::findMountingCoordinator(SurfaceId surfaceId) const noexcept {
auto mountingCoordinator = std::shared_ptr<const MountingCoordinator>{};
MountingCoordinator::Shared SurfaceManager::findMountingCoordinator(
SurfaceId surfaceId) const noexcept {
auto mountingCoordinator = MountingCoordinator::Shared{};
visit(surfaceId, [&](const SurfaceHandler& surfaceHandler) {
mountingCoordinator = surfaceHandler.getMountingCoordinator();
@@ -49,7 +49,7 @@ class SurfaceManager final {
const LayoutConstraints& layoutConstraints,
const LayoutContext& layoutContext) const noexcept;
std::shared_ptr<const MountingCoordinator> findMountingCoordinator(
MountingCoordinator::Shared findMountingCoordinator(
SurfaceId surfaceId) const noexcept;
private:
@@ -607,7 +607,7 @@ RootShadowNode::Unshared UIManager::shadowTreeWillCommit(
}
void UIManager::shadowTreeDidFinishTransaction(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) const {
SystraceSection s("UIManager::shadowTreeDidFinishTransaction");
@@ -119,7 +119,7 @@ class UIManager final : public ShadowTreeDelegate {
#pragma mark - ShadowTreeDelegate
void shadowTreeDidFinishTransaction(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) const override;
RootShadowNode::Unshared shadowTreeWillCommit(
@@ -483,7 +483,9 @@ jsi::Value UIManagerBinding::get(
uiManager->completeSurface(
surfaceId,
shadowNodeList,
{.enableStateReconciliation = true, .mountSynchronously = false});
{.enableStateReconciliation = true,
.mountSynchronously = false,
.shouldYield = nullptr});
return jsi::Value::undefined();
});
@@ -23,7 +23,7 @@ class UIManagerDelegate {
* For this moment the tree is already laid out and sealed.
*/
virtual void uiManagerDidFinishTransaction(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) = 0;
/*
@@ -24,7 +24,7 @@ class FakeShadowTreeDelegate : public ShadowTreeDelegate {
};
void shadowTreeDidFinishTransaction(
std::shared_ptr<const MountingCoordinator> mountingCoordinator,
MountingCoordinator::Shared mountingCoordinator,
bool mountSynchronously) const override {};
};
@@ -391,6 +391,17 @@ 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(
@@ -437,8 +448,8 @@ void ReactInstance::initializeRuntime(
return jsi::Value(false);
}
auto jsError =
jsi::JSError(runtime, jsi::Value(runtime, args[0]));
auto jsError = jsi::JSError(
runtime, wrapInErrorIfNecessary(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