Fix Type Casting Warnings in ReactCommon

Summary:
Casting warnings are treated as errors in React Native Windows. Adjusting casting to fix warnings.

## Changelog:
[GENERAL] [FIXED] - Fixes type casting warnings that are treated as errors downstream in React Native Windows.

X-link: https://github.com/facebook/react-native/pull/39818

Reviewed By: rshest

Differential Revision: D49940422

Pulled By: NickGerleman

fbshipit-source-id: e4d44326806a2b1974c7e50770e61807a007e39f
This commit is contained in:
Chiara Mooney
2023-10-09 11:07:46 -07:00
committed by Facebook GitHub Bot
parent 7fe6e345a7
commit 81de77af8d

View File

@@ -277,19 +277,22 @@ void Node::setLayoutDirection(Direction direction) {
void Node::setLayoutMargin(float margin, YGEdge edge) { void Node::setLayoutMargin(float margin, YGEdge edge) {
assertFatal( assertFatal(
edge < layout_.margin.size(), "Edge must be top/left/bottom/right"); edge < static_cast<int>(layout_.margin.size()),
"Edge must be top/left/bottom/right");
layout_.margin[edge] = margin; layout_.margin[edge] = margin;
} }
void Node::setLayoutBorder(float border, YGEdge edge) { void Node::setLayoutBorder(float border, YGEdge edge) {
assertFatal( assertFatal(
edge < layout_.border.size(), "Edge must be top/left/bottom/right"); edge < static_cast<int>(layout_.border.size()),
"Edge must be top/left/bottom/right");
layout_.border[edge] = border; layout_.border[edge] = border;
} }
void Node::setLayoutPadding(float padding, YGEdge edge) { void Node::setLayoutPadding(float padding, YGEdge edge) {
assertFatal( assertFatal(
edge < layout_.padding.size(), "Edge must be top/left/bottom/right"); edge < static_cast<int>(layout_.padding.size()),
"Edge must be top/left/bottom/right");
layout_.padding[edge] = padding; layout_.padding[edge] = padding;
} }
@@ -303,7 +306,8 @@ void Node::setLayoutComputedFlexBasis(const FloatOptional computedFlexBasis) {
void Node::setLayoutPosition(float position, YGEdge edge) { void Node::setLayoutPosition(float position, YGEdge edge) {
assertFatal( assertFatal(
edge < layout_.position.size(), "Edge must be top/left/bottom/right"); edge < static_cast<int>(layout_.position.size()),
"Edge must be top/left/bottom/right");
layout_.position[edge] = position; layout_.position[edge] = position;
} }