Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,17 @@ static inline float scale(Float value, Float pointScaleFactor) {
jni::local_ref<jobject> FabricMountingManager::getProps(
const ShadowView& oldShadowView,
const ShadowView& newShadowView) {
auto componentName = newShadowView.componentName;
// We calculate the diffing between the props of the last mounted ShadowTree
// and the Props of the latest commited ShadowTree). ONLY for <View>
// components when the "enablePropsUpdateReconciliationAndroid" feature flag
// is enabled.
if (ReactNativeFeatureFlags::enablePropsUpdateReconciliationAndroid() &&
strcmp(componentName, "View") == 0) {
const Props* oldProps = oldShadowView.props.get();
auto diffProps = newShadowView.props->getDiffProps(oldProps);
return ReadableNativeMap::newObjectCxxArgs(diffProps);
}
return ReadableNativeMap::newObjectCxxArgs(newShadowView.props->rawProps);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,8 @@ static BorderRadii radiiPercentToPoint(
};
}

BorderMetrics BaseViewProps::resolveBorderMetrics(
const LayoutMetrics& layoutMetrics) const {
auto isRTL =
bool{layoutMetrics.layoutDirection == LayoutDirection::RightToLeft};

auto borderWidths = CascadedBorderWidths{
CascadedBorderWidths BaseViewProps::getBorderWidths() const {
return CascadedBorderWidths{
/* .left = */ optionalFloatFromYogaValue(
yogaStyle.border(yoga::Edge::Left)),
/* .top = */
Expand All @@ -457,6 +453,14 @@ BorderMetrics BaseViewProps::resolveBorderMetrics(
/* .all = */
optionalFloatFromYogaValue(yogaStyle.border(yoga::Edge::All)),
};
}

BorderMetrics BaseViewProps::resolveBorderMetrics(
const LayoutMetrics& layoutMetrics) const {
auto isRTL =
bool{layoutMetrics.layoutDirection == LayoutDirection::RightToLeft};

auto borderWidths = getBorderWidths();

BorderRadii radii = radiiPercentToPoint(
borderRadii.resolve(isRTL, ValueUnit{0.0f, UnitType::Point}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps {

#pragma mark - Convenience Methods

CascadedBorderWidths getBorderWidths() const;
BorderMetrics resolveBorderMetrics(const LayoutMetrics& layoutMetrics) const;
Transform resolveTransform(const LayoutMetrics& layoutMetrics) const;
bool getClipsContentToBounds() const;
Expand Down
5 changes: 5 additions & 0 deletions packages/react-native/ReactCommon/react/renderer/core/Props.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ class Props : public virtual Sealable, public virtual DebugStringConvertible {

#ifdef ANDROID
folly::dynamic rawProps = folly::dynamic::object();

virtual folly::dynamic getDiffProps(const Props* prevProps) const {
return folly::dynamic::object();
}

#endif

protected:
Expand Down