Fabric: Making `YogaStylableProps.yogaStyle` protected
Summary: `YogaStylableProps.yogaStyle` is designed to be consumed by Yoga only. Making it `protected` allows us to avoid confusion and misuse of this props. Reviewed By: JoshuaGross Differential Revision: D15296474 fbshipit-source-id: cf9e416afee99fb426d72765557b34d303a63dbe
This commit is contained in:
Родитель
16499c1086
Коммит
184073813e
|
@ -185,8 +185,8 @@ using namespace facebook::react;
|
|||
}
|
||||
|
||||
// `overflow`
|
||||
if (oldViewProps.yogaStyle.overflow() != newViewProps.yogaStyle.overflow()) {
|
||||
self.clipsToBounds = newViewProps.yogaStyle.overflow() != YGOverflowVisible;
|
||||
if (oldViewProps.getClipsContentToBounds() != newViewProps.getClipsContentToBounds()) {
|
||||
self.clipsToBounds = newViewProps.getClipsContentToBounds();
|
||||
needsInvalidateLayer = YES;
|
||||
}
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ local_ref<JString> getPlatformComponentName(const ShadowView& shadowView) {
|
|||
std::dynamic_pointer_cast<const ScrollViewProps>(shadowView.props);
|
||||
|
||||
if (newViewProps &&
|
||||
newViewProps->yogaStyle.flexDirection() == YGFlexDirectionRow) {
|
||||
newViewProps->getProbablyMoreHorizontalThanVertical_DEPRECATED()) {
|
||||
componentName = make_jstring("AndroidHorizontalScrollView");
|
||||
} else {
|
||||
componentName = make_jstring(shadowView.componentName);
|
||||
|
|
|
@ -146,6 +146,16 @@ BorderMetrics ViewProps::resolveBorderMetrics(
|
|||
};
|
||||
}
|
||||
|
||||
bool ViewProps::getClipsContentToBounds() const {
|
||||
return yogaStyle.overflow() != YGOverflowVisible;
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
bool ViewProps::getProbablyMoreHorizontalThanVertical_DEPRECATED() const {
|
||||
return yogaStyle.flexDirection() == YGFlexDirectionRow;
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
|
|
|
@ -65,6 +65,11 @@ class ViewProps : public Props,
|
|||
#pragma mark - Convenience Methods
|
||||
|
||||
BorderMetrics resolveBorderMetrics(LayoutMetrics const &layoutMetrics) const;
|
||||
bool getClipsContentToBounds() const;
|
||||
|
||||
#ifdef ANDROID
|
||||
bool getProbablyMoreHorizontalThanVertical_DEPRECATED() const;
|
||||
#endif
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
|
|
|
@ -21,10 +21,10 @@ bool ViewShadowNode::isLayoutOnly() const {
|
|||
// Accessibility Props
|
||||
!viewProps.accessible &&
|
||||
// Style Props
|
||||
viewProps.yogaStyle.overflow() == YGOverflowVisible &&
|
||||
viewProps.opacity == 1.0 && !viewProps.backgroundColor &&
|
||||
!viewProps.foregroundColor && !viewProps.shadowColor &&
|
||||
viewProps.transform == Transform{} && viewProps.zIndex == 0 &&
|
||||
!viewProps.getClipsContentToBounds() &&
|
||||
// Layout Metrics
|
||||
getLayoutMetrics().borderWidth == EdgeInsets{};
|
||||
}
|
||||
|
|
|
@ -29,12 +29,17 @@ class YogaStylableProps {
|
|||
|
||||
#pragma mark - Props
|
||||
|
||||
protected:
|
||||
friend class YogaLayoutableShadowNode;
|
||||
const YGStyle yogaStyle{};
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
|
||||
#pragma mark - DebugStringConvertible (Partial)
|
||||
|
||||
#if RN_DEBUG_STRING_CONVERTIBLE
|
||||
public:
|
||||
SharedDebugStringConvertibleList getDebugProps() const;
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче