diff --git a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp index 9ed341c9f9f..4824f3d43b0 100644 --- a/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp +++ b/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/HermesExecutorFactory.cpp @@ -197,9 +197,7 @@ std::unique_ptr HermesExecutorFactory::createJSExecutor( makeHermesRuntimeSystraced(runtimeConfig_); HermesRuntime &hermesRuntimeRef = *hermesRuntime; auto decoratedRuntime = std::make_shared( - std::move(hermesRuntime), - hermesRuntimeRef, - jsQueue); + std::move(hermesRuntime), hermesRuntimeRef, jsQueue); // So what do we have now? // DecoratedRuntime -> HermesRuntime diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 28a622d27e7..c40737e19b4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -256,7 +256,7 @@ void Binding::installFabricUIManager( "react_fabric:enabled_collapse_delete_create_mounting_instructions"); disableVirtualNodePreallocation_ = reactNativeConfig_->getBool( - "react_fabric:disable_virtual_node_preallocation"); + "react_fabric:disable_virtual_node_preallocation"); disablePreallocateViews_ = reactNativeConfig_->getBool( "react_fabric:disabled_view_preallocation_android"); diff --git a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp index 0f86ccd5324..0f7159f31ee 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp @@ -8,8 +8,8 @@ #include "JReactMarker.h" #include #include -#include #include +#include namespace facebook { namespace react { @@ -49,7 +49,8 @@ void JReactMarker::logPerfMarker( JReactMarker::logMarker("RUN_JS_BUNDLE_END", tag); break; case ReactMarker::CREATE_REACT_CONTEXT_STOP: - LOG(ERROR) << "logMarker CREATE_REACT_CONTEXT_END"; // TODO T62192299: delete + LOG(ERROR) + << "logMarker CREATE_REACT_CONTEXT_END"; // TODO T62192299: delete JReactMarker::logMarker("CREATE_REACT_CONTEXT_END"); break; case ReactMarker::JS_BUNDLE_STRING_CONVERT_START: diff --git a/ReactCommon/fabric/attributedstring/conversions.h b/ReactCommon/fabric/attributedstring/conversions.h index e52517bbbdf..70ddd41d392 100644 --- a/ReactCommon/fabric/attributedstring/conversions.h +++ b/ReactCommon/fabric/attributedstring/conversions.h @@ -582,8 +582,10 @@ inline folly::dynamic toDynamic(const AttributedString &attributedString) { } if (fragment.isAttachment()) { dynamicFragment["isAttachment"] = true; - dynamicFragment["width"] = (int) fragment.parentShadowView.layoutMetrics.frame.size.width; - dynamicFragment["height"] = (int) fragment.parentShadowView.layoutMetrics.frame.size.height; + dynamicFragment["width"] = + (int)fragment.parentShadowView.layoutMetrics.frame.size.width; + dynamicFragment["height"] = + (int)fragment.parentShadowView.layoutMetrics.frame.size.height; } dynamicFragment["textAttributes"] = toDynamic(fragment.textAttributes); fragments.push_back(dynamicFragment); diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h index 1d482590e4c..318955cb1eb 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h +++ b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputComponentDescriptor.h @@ -10,9 +10,9 @@ #include #include "AndroidTextInputShadowNode.h" +#include #include #include -#include namespace facebook { namespace react { @@ -32,8 +32,8 @@ class AndroidTextInputComponentDescriptor final } virtual State::Shared createInitialState( - ShadowNodeFragment const &fragment, - ShadowNodeFamily::Shared const &family) const override { + ShadowNodeFragment const &fragment, + ShadowNodeFamily::Shared const &family) const override { int surfaceId = family->getSurfaceId(); float defaultThemePaddingStart = NAN; @@ -41,7 +41,8 @@ class AndroidTextInputComponentDescriptor final float defaultThemePaddingTop = NAN; float defaultThemePaddingBottom = NAN; - if (surfaceIdToThemePaddingMap_.find(surfaceId) != surfaceIdToThemePaddingMap_.end()) { + if (surfaceIdToThemePaddingMap_.find(surfaceId) != + surfaceIdToThemePaddingMap_.end()) { YGStyle::Edges theme = surfaceIdToThemePaddingMap_[surfaceId]; defaultThemePaddingStart = ((YGValue)theme[YGEdgeStart]).value; defaultThemePaddingEnd = ((YGValue)theme[YGEdgeEnd]).value; @@ -50,13 +51,22 @@ class AndroidTextInputComponentDescriptor final } return std::make_shared( - std::make_shared(AndroidTextInputState( - 0, {}, {}, {}, {}, {}, textLayoutManager_, defaultThemePaddingStart, defaultThemePaddingEnd, defaultThemePaddingTop, defaultThemePaddingBottom)), - family); + std::make_shared(AndroidTextInputState( + 0, + {}, + {}, + {}, + {}, + {}, + textLayoutManager_, + defaultThemePaddingStart, + defaultThemePaddingEnd, + defaultThemePaddingTop, + defaultThemePaddingBottom)), + family); } -protected: - + protected: void adopt(UnsharedShadowNode shadowNode) const override { assert(std::dynamic_pointer_cast(shadowNode)); auto textInputShadowNode = @@ -70,29 +80,36 @@ protected: const_cast(getContextContainer().get())); // Get theme padding from cache, or set it from State. - // In theory, the Java ViewManager for TextInput should need to set state *exactly once* - // per surface to communicate the correct default padding, which will be cached here in C++. + // In theory, the Java ViewManager for TextInput should need to set state + // *exactly once* per surface to communicate the correct default padding, + // which will be cached here in C++. // TODO T63008435: can this feature be removed entirely? // TODO: figure out RTL/start/end/left/right stuff here int surfaceId = textInputShadowNode->getSurfaceId(); const AndroidTextInputState &state = textInputShadowNode->getStateData(); - if (surfaceIdToThemePaddingMap_.find(surfaceId) == surfaceIdToThemePaddingMap_.end() && !isnan(state.defaultThemePaddingStart)) { + if (surfaceIdToThemePaddingMap_.find(surfaceId) == + surfaceIdToThemePaddingMap_.end() && + !isnan(state.defaultThemePaddingStart)) { YGStyle::Edges result; - result[YGEdgeStart] = (YGValue){state.defaultThemePaddingStart, YGUnitPoint}; + result[YGEdgeStart] = + (YGValue){state.defaultThemePaddingStart, YGUnitPoint}; result[YGEdgeEnd] = (YGValue){state.defaultThemePaddingEnd, YGUnitPoint}; result[YGEdgeTop] = (YGValue){state.defaultThemePaddingTop, YGUnitPoint}; - result[YGEdgeBottom] = (YGValue){state.defaultThemePaddingBottom, YGUnitPoint}; + result[YGEdgeBottom] = + (YGValue){state.defaultThemePaddingBottom, YGUnitPoint}; surfaceIdToThemePaddingMap_.emplace(std::make_pair(surfaceId, result)); } - if (surfaceIdToThemePaddingMap_.find(surfaceId) != surfaceIdToThemePaddingMap_.end()) { + if (surfaceIdToThemePaddingMap_.find(surfaceId) != + surfaceIdToThemePaddingMap_.end()) { YGStyle::Edges theme = surfaceIdToThemePaddingMap_[surfaceId]; // Override padding // Node is still unsealed during adoption, before layout is complete - // TODO: T62959168 account for RTL and paddingLeft when setting default paddingStart, and - // vice-versa with paddingRight/paddingEnd - YGStyle::Edges result = textInputShadowNode->getConcreteProps().yogaStyle.padding(); + // TODO: T62959168 account for RTL and paddingLeft when setting default + // paddingStart, and vice-versa with paddingRight/paddingEnd + YGStyle::Edges result = + textInputShadowNode->getConcreteProps().yogaStyle.padding(); bool changedPadding = false; if (!textInputShadowNode->getConcreteProps().hasPaddingStart) { changedPadding = true; @@ -111,12 +128,14 @@ protected: result[YGEdgeBottom] = theme[YGEdgeBottom]; } - // Note that this is expensive: on every adopt, we need to set the Yoga props again, which - // normally only happens during prop parsing. Every commit, state update, etc, will incur this - // cost. + // Note that this is expensive: on every adopt, we need to set the Yoga + // props again, which normally only happens during prop parsing. Every + // commit, state update, etc, will incur this cost. if (changedPadding) { // Set new props on node - const_cast(textInputShadowNode->getConcreteProps()).yogaStyle.padding() = result; + const_cast( + textInputShadowNode->getConcreteProps()) + .yogaStyle.padding() = result; // Communicate new props to Yoga part of the node textInputShadowNode->updateYogaProps(); } diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp index f22aa5b6f42..e5cc3005bb5 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp +++ b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputProps.cpp @@ -225,13 +225,24 @@ AndroidTextInputProps::AndroidTextInputProps( convertRawProp(rawProps, sourceProps.paragraphAttributes, {})), // See AndroidTextInputComponentDescriptor for usage // TODO T63008435: can these, and this feature, be removed entirely? - hasPaddingLeft(rawProps.at("", "padding", "") != nullptr || rawProps.at("Left", "padding", "") != nullptr), - hasPaddingTop(rawProps.at("", "padding", "") != nullptr || rawProps.at("Top", "padding", "") != nullptr), - hasPaddingRight(rawProps.at("", "padding", "") != nullptr || rawProps.at("Right", "padding", "") != nullptr), - hasPaddingBottom(rawProps.at("", "padding", "") != nullptr || rawProps.at("Bottom", "padding", "") != nullptr), - hasPaddingStart(rawProps.at("", "padding", "") != nullptr || rawProps.at("Start", "padding", "") != nullptr), - hasPaddingEnd(rawProps.at("", "padding", "") != nullptr || rawProps.at("End", "padding", "") != nullptr) - { } + hasPaddingLeft( + rawProps.at("", "padding", "") != nullptr || + rawProps.at("Left", "padding", "") != nullptr), + hasPaddingTop( + rawProps.at("", "padding", "") != nullptr || + rawProps.at("Top", "padding", "") != nullptr), + hasPaddingRight( + rawProps.at("", "padding", "") != nullptr || + rawProps.at("Right", "padding", "") != nullptr), + hasPaddingBottom( + rawProps.at("", "padding", "") != nullptr || + rawProps.at("Bottom", "padding", "") != nullptr), + hasPaddingStart( + rawProps.at("", "padding", "") != nullptr || + rawProps.at("Start", "padding", "") != nullptr), + hasPaddingEnd( + rawProps.at("", "padding", "") != nullptr || + rawProps.at("End", "padding", "") != nullptr) {} // TODO T53300085: support this in codegen; this was hand-written folly::dynamic AndroidTextInputProps::getDynamic() const { diff --git a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h index 635eb395f4b..d9505729de8 100644 --- a/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h +++ b/ReactCommon/fabric/components/textinput/androidtextinput/AndroidTextInputState.h @@ -68,7 +68,8 @@ class AndroidTextInputState final { SharedTextLayoutManager layoutManager{}; /** - * Communicates Android theme padding back to the ShadowNode / Component Descriptor for layout. + * Communicates Android theme padding back to the ShadowNode / Component + * Descriptor for layout. */ float defaultThemePaddingStart{NAN}; float defaultThemePaddingEnd{NAN}; @@ -145,7 +146,10 @@ class AndroidTextInputState final { AndroidTextInputState( AndroidTextInputState const &previousState, folly::dynamic const &data) - : mostRecentEventCount(data.getDefault("mostRecentEventCount", previousState.mostRecentEventCount).getInt()), + : mostRecentEventCount(data.getDefault( + "mostRecentEventCount", + previousState.mostRecentEventCount) + .getInt()), attributedString(updateAttributedString( previousState.defaultTextAttributes, previousState.defaultParentShadowView, @@ -156,10 +160,23 @@ class AndroidTextInputState final { defaultTextAttributes(previousState.defaultTextAttributes), defaultParentShadowView(previousState.defaultParentShadowView), layoutManager(previousState.layoutManager), - defaultThemePaddingStart(data.getDefault("themePaddingStart", previousState.defaultThemePaddingStart).getDouble()), - defaultThemePaddingEnd(data.getDefault("themePaddingEnd", previousState.defaultThemePaddingEnd).getDouble()), - defaultThemePaddingTop(data.getDefault("themePaddingTop", previousState.defaultThemePaddingTop).getDouble()), - defaultThemePaddingBottom(data.getDefault("themePaddingBottom", previousState.defaultThemePaddingBottom).getDouble()) {}; + defaultThemePaddingStart(data.getDefault( + "themePaddingStart", + previousState.defaultThemePaddingStart) + .getDouble()), + defaultThemePaddingEnd(data.getDefault( + "themePaddingEnd", + previousState.defaultThemePaddingEnd) + .getDouble()), + defaultThemePaddingTop(data.getDefault( + "themePaddingTop", + previousState.defaultThemePaddingTop) + .getDouble()), + defaultThemePaddingBottom( + data.getDefault( + "themePaddingBottom", + previousState.defaultThemePaddingBottom) + .getDouble()){}; folly::dynamic getDynamic() const; #endif }; diff --git a/ReactCommon/fabric/components/view/ViewShadowNode.cpp b/ReactCommon/fabric/components/view/ViewShadowNode.cpp index f0d5fe92160..3dd1cb622da 100644 --- a/ReactCommon/fabric/components/view/ViewShadowNode.cpp +++ b/ReactCommon/fabric/components/view/ViewShadowNode.cpp @@ -22,7 +22,8 @@ bool ViewShadowNode::isLayoutOnly() const { // Accessibility Props !viewProps.accessible && // Pointer events Props - (viewProps.pointerEvents == PointerEventsMode::Auto || viewProps.pointerEvents == PointerEventsMode::BoxNone) && + (viewProps.pointerEvents == PointerEventsMode::Auto || + viewProps.pointerEvents == PointerEventsMode::BoxNone) && // Style Props viewProps.opacity == 1.0 && !viewProps.backgroundColor && !viewProps.foregroundColor && !viewProps.shadowColor && diff --git a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h b/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h index 1f22c47d7b9..37b36da5e51 100644 --- a/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h +++ b/ReactCommon/fabric/core/componentdescriptor/ConcreteComponentDescriptor.h @@ -143,7 +143,8 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { assert(data && "Provided `data` is nullptr."); return std::make_shared( - std::static_pointer_cast(data), *family->getMostRecentState()); + std::static_pointer_cast(data), + *family->getMostRecentState()); } virtual ShadowNodeFamily::Shared createFamily( diff --git a/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp b/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp index 9f3388d882c..02662038f9e 100644 --- a/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp +++ b/ReactCommon/fabric/core/tests/LayoutableShadowNodeTest.cpp @@ -15,7 +15,6 @@ class LayoutableShadowNodeTest : public ::testing::Test { LayoutableShadowNodeTest() : eventDispatcher_(std::shared_ptr()), componentDescriptor_(TestComponentDescriptor({eventDispatcher_})) { - auto traits = TestShadowNode::BaseTraits(); auto familyA = std::make_shared(