Fix handling 'auto' checks in absolute layout (#1689)
Summary: X-link: https://github.com/facebook/react-native/pull/46216 Regarding [issue](https://github.com/facebook/react-native/issues/45817) with incorrect layout when `left` is set to `auto`. This PR introduces handling `auto` whenever inline or flex position is checked to be defined and it fixes above issue. Changelog: [General][Fixed] - Fix handling 'auto' checks in absolute layout ## Tests: I have run the provided unit tests and everything passes. Pull Request resolved: https://github.com/facebook/yoga/pull/1689 Reviewed By: cipolleschi Differential Revision: D61737876 Pulled By: NickGerleman fbshipit-source-id: 531199a91c5e122b930b49725ea567cbb1d592ce
This commit is contained in:
committed by
Facebook GitHub Bot
parent
596f8dff3c
commit
6d6f69bee7
@@ -87,6 +87,10 @@ void Node::setPositionPercent(int edge, double position) {
|
||||
YGNodeStyleSetPositionPercent(m_node, static_cast<YGEdge>(edge), position);
|
||||
}
|
||||
|
||||
void Node::setPositionAuto(int edge) {
|
||||
YGNodeStyleSetPositionAuto(m_node, static_cast<YGEdge>(edge));
|
||||
}
|
||||
|
||||
void Node::setAlignContent(int alignContent) {
|
||||
YGNodeStyleSetAlignContent(m_node, static_cast<YGAlign>(alignContent));
|
||||
}
|
||||
|
@@ -76,6 +76,7 @@ class Node {
|
||||
void setPositionType(int positionType);
|
||||
void setPosition(int edge, double position);
|
||||
void setPositionPercent(int edge, double position);
|
||||
void setPositionAuto(int edge);
|
||||
|
||||
void setAlignContent(int alignContent);
|
||||
void setAlignItems(int alignItems);
|
||||
|
@@ -70,6 +70,7 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setPositionType", &Node::setPositionType)
|
||||
.function("setPosition", &Node::setPosition)
|
||||
.function("setPositionPercent", &Node::setPositionPercent)
|
||||
.function("setPositionAuto", &Node::setPositionAuto)
|
||||
|
||||
.function("setAlignContent", &Node::setAlignContent)
|
||||
.function("setAlignItems", &Node::setAlignItems)
|
||||
|
@@ -168,6 +168,7 @@ export type Node = {
|
||||
setPosition(edge: Edge, position: number | `${number}%` | undefined): void;
|
||||
setPositionPercent(edge: Edge, position: number | undefined): void;
|
||||
setPositionType(positionType: PositionType): void;
|
||||
setPositionAuto(edge: Edge): void;
|
||||
setWidth(width: number | 'auto' | `${number}%` | undefined): void;
|
||||
setWidthAuto(): void;
|
||||
setWidthPercent(width: number | undefined): void;
|
||||
|
Reference in New Issue
Block a user