Files
yoga/yoga/algorithm/Align.h
Nick Gerleman 5bf81b1ef8 C++ style enums 11/N: Align (#1395)
Summary:
X-link: https://github.com/facebook/react-native/pull/39497

Pull Request resolved: https://github.com/facebook/yoga/pull/1395

Moves internal usages of YGAlign to Align

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49337511

fbshipit-source-id: bb9906fcd22780d2cfd8d1360ef69f66b9701bb6
2023-09-19 16:30:02 -07:00

30 lines
729 B
C++

/*
* 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 <yoga/Yoga.h>
#include <yoga/algorithm/FlexDirection.h>
#include <yoga/node/Node.h>
namespace facebook::yoga {
inline Align resolveChildAlignment(
const yoga::Node* node,
const yoga::Node* child) {
const Align align = child->getStyle().alignSelf() == Align::Auto
? node->getStyle().alignItems()
: child->getStyle().alignSelf();
if (align == Align::Baseline && isColumn(node->getStyle().flexDirection())) {
return Align::FlexStart;
}
return align;
}
} // namespace facebook::yoga