Skip to content

Commit 04760b3

Browse files
javachefacebook-github-bot
authored andcommitted
Handle textAlignment: start
Summary: > **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'` Differential Revision: D58791937
1 parent 2a6a895 commit 04760b3

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

packages/react-native/ReactCommon/react/renderer/attributedstring/conversions.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ inline void fromRawValue(
413413
react_native_expect(value.hasType<std::string>());
414414
if (value.hasType<std::string>()) {
415415
auto string = (std::string)value;
416-
if (string == "auto") {
416+
if (string == "auto" || string == "start") {
417417
result = TextAlignment::Natural;
418418
} else if (string == "left") {
419419
result = TextAlignment::Left;
@@ -425,7 +425,6 @@ inline void fromRawValue(
425425
result = TextAlignment::Justified;
426426
} else {
427427
LOG(ERROR) << "Unsupported TextAlignment value: " << string;
428-
react_native_expect(false);
429428
// sane default for prod
430429
result = TextAlignment::Natural;
431430
}

packages/react-native/ReactCommon/react/renderer/components/view/conversions.h

+7-13
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,7 @@ inline void fromRawValue(
188188
result = yoga::Direction::RTL;
189189
return;
190190
}
191-
LOG(ERROR) << "Could not parse Direction:" << stringValue;
192-
react_native_expect(false);
191+
LOG(ERROR) << "Could not parse yoga::Direction: " << stringValue;
193192
}
194193

195194
inline void fromRawValue(
@@ -218,8 +217,7 @@ inline void fromRawValue(
218217
result = yoga::FlexDirection::RowReverse;
219218
return;
220219
}
221-
LOG(ERROR) << "Could not parse yoga::FlexDirection:" << stringValue;
222-
react_native_expect(false);
220+
LOG(ERROR) << "Could not parse yoga::FlexDirection: " << stringValue;
223221
}
224222

225223
inline void fromRawValue(
@@ -256,8 +254,7 @@ inline void fromRawValue(
256254
result = yoga::Justify::SpaceEvenly;
257255
return;
258256
}
259-
LOG(ERROR) << "Could not parse yoga::Justify:" << stringValue;
260-
react_native_expect(false);
257+
LOG(ERROR) << "Could not parse yoga::Justify: " << stringValue;
261258
}
262259

263260
inline void fromRawValue(
@@ -306,7 +303,7 @@ inline void fromRawValue(
306303
result = yoga::Align::SpaceEvenly;
307304
return;
308305
}
309-
LOG(ERROR) << "Could not parse yoga::Align:" << stringValue;
306+
LOG(ERROR) << "Could not parse yoga::Align: " << stringValue;
310307
react_native_expect(false);
311308
}
312309

@@ -332,8 +329,7 @@ inline void fromRawValue(
332329
result = yoga::PositionType::Absolute;
333330
return;
334331
}
335-
LOG(ERROR) << "Could not parse yoga::PositionType:" << stringValue;
336-
react_native_expect(false);
332+
LOG(ERROR) << "Could not parse yoga::PositionType: " << stringValue;
337333
}
338334

339335
inline void fromRawValue(
@@ -358,8 +354,7 @@ inline void fromRawValue(
358354
result = yoga::Wrap::WrapReverse;
359355
return;
360356
}
361-
LOG(ERROR) << "Could not parse yoga::Wrap:" << stringValue;
362-
react_native_expect(false);
357+
LOG(ERROR) << "Could not parse yoga::Wrap: " << stringValue;
363358
}
364359

365360
inline void fromRawValue(
@@ -406,8 +401,7 @@ inline void fromRawValue(
406401
result = yoga::Display::None;
407402
return;
408403
}
409-
LOG(ERROR) << "Could not parse yoga::Display:" << stringValue;
410-
react_native_expect(false);
404+
LOG(ERROR) << "Could not parse yoga::Display: " << stringValue;
411405
}
412406

413407
inline void fromRawValue(

0 commit comments

Comments
 (0)