Skip to content

Commit

Permalink
Handle textAlignment: start and make logs consistent (#45076)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #45076

> **start**: The same as left if direction is left-to-right and right if direction is right-to-left.

This is equivalent to `auto`, which is not actually a valid CSS value.

Changelog: [General][Added] Add support for `texAlignment: 'start'`

Reviewed By: sammy-SC

Differential Revision: D58791937

fbshipit-source-id: 09622d814212a7055f94b1f091c71edae5db117c
  • Loading branch information
javache authored and facebook-github-bot committed Jun 20, 2024
1 parent a297b30 commit a2cb343
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ inline void fromRawValue(
react_native_expect(value.hasType<std::string>());
if (value.hasType<std::string>()) {
auto string = (std::string)value;
if (string == "auto") {
if (string == "auto" || string == "start") {
result = TextAlignment::Natural;
} else if (string == "left") {
result = TextAlignment::Left;
Expand All @@ -425,7 +425,6 @@ inline void fromRawValue(
result = TextAlignment::Justified;
} else {
LOG(ERROR) << "Unsupported TextAlignment value: " << string;
react_native_expect(false);
// sane default for prod
result = TextAlignment::Natural;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ inline void fromRawValue(
result = yoga::Direction::RTL;
return;
}
LOG(ERROR) << "Could not parse Direction:" << stringValue;
react_native_expect(false);
LOG(ERROR) << "Could not parse yoga::Direction: " << stringValue;
}

inline void fromRawValue(
Expand Down Expand Up @@ -218,8 +217,7 @@ inline void fromRawValue(
result = yoga::FlexDirection::RowReverse;
return;
}
LOG(ERROR) << "Could not parse yoga::FlexDirection:" << stringValue;
react_native_expect(false);
LOG(ERROR) << "Could not parse yoga::FlexDirection: " << stringValue;
}

inline void fromRawValue(
Expand Down Expand Up @@ -256,8 +254,7 @@ inline void fromRawValue(
result = yoga::Justify::SpaceEvenly;
return;
}
LOG(ERROR) << "Could not parse yoga::Justify:" << stringValue;
react_native_expect(false);
LOG(ERROR) << "Could not parse yoga::Justify: " << stringValue;
}

inline void fromRawValue(
Expand Down Expand Up @@ -306,7 +303,7 @@ inline void fromRawValue(
result = yoga::Align::SpaceEvenly;
return;
}
LOG(ERROR) << "Could not parse yoga::Align:" << stringValue;
LOG(ERROR) << "Could not parse yoga::Align: " << stringValue;
react_native_expect(false);
}

Expand All @@ -332,8 +329,7 @@ inline void fromRawValue(
result = yoga::PositionType::Absolute;
return;
}
LOG(ERROR) << "Could not parse yoga::PositionType:" << stringValue;
react_native_expect(false);
LOG(ERROR) << "Could not parse yoga::PositionType: " << stringValue;
}

inline void fromRawValue(
Expand All @@ -358,8 +354,7 @@ inline void fromRawValue(
result = yoga::Wrap::WrapReverse;
return;
}
LOG(ERROR) << "Could not parse yoga::Wrap:" << stringValue;
react_native_expect(false);
LOG(ERROR) << "Could not parse yoga::Wrap: " << stringValue;
}

inline void fromRawValue(
Expand Down Expand Up @@ -406,8 +401,7 @@ inline void fromRawValue(
result = yoga::Display::None;
return;
}
LOG(ERROR) << "Could not parse yoga::Display:" << stringValue;
react_native_expect(false);
LOG(ERROR) << "Could not parse yoga::Display: " << stringValue;
}

inline void fromRawValue(
Expand Down

0 comments on commit a2cb343

Please sign in to comment.