mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix compilation warnings related to YogaShadowNode (#38781)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38781 ## Changelog: [Internal] - These pop up when compiling with `/Wall`, fixes two legitimate warnings around using YogaShadowNode/Props in RN. The `suggestedIndex` in `ShadowNode::replaceChild` (and the overriden one in `YogaLayoutableShadowNode`) is used in a way around the code that suggests that it **is** expected to be negative (checking for non-negativity, assigning -1 as default etc), so having it as a `size_t` type argument both makes things confusing and generates the warning. I believe it's a good idea to be consistent and use the same type for the index throughout. In majority of the cases it's `int32_t` as of now. Reviewed By: rozele Differential Revision: D48059620 fbshipit-source-id: c4bab91f5c66c62d00947f96cb48906a8499f282
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a30f3938a5
commit
70365f2d04
+1
-1
@@ -251,7 +251,7 @@ void YogaLayoutableShadowNode::appendChild(
|
||||
void YogaLayoutableShadowNode::replaceChild(
|
||||
ShadowNode const &oldChild,
|
||||
ShadowNode::Shared const &newChild,
|
||||
size_t suggestedIndex) {
|
||||
int32_t suggestedIndex) {
|
||||
LayoutableShadowNode::replaceChild(oldChild, newChild, suggestedIndex);
|
||||
|
||||
ensureUnsealed();
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode {
|
||||
void replaceChild(
|
||||
ShadowNode const &oldChild,
|
||||
ShadowNode::Shared const &newChild,
|
||||
size_t suggestedIndex = -1) override;
|
||||
int32_t suggestedIndex = -1) override;
|
||||
|
||||
void updateYogaChildren();
|
||||
|
||||
|
||||
+1
-2
@@ -105,6 +105,7 @@ void YogaStylableProps::setProp(
|
||||
const char *propName,
|
||||
RawValue const &value) {
|
||||
static const auto ygDefaults = YGStyle{};
|
||||
static const auto defaults = YogaStylableProps{};
|
||||
|
||||
Props::setProp(context, hash, propName, value);
|
||||
|
||||
@@ -133,8 +134,6 @@ void YogaStylableProps::setProp(
|
||||
REBUILD_FIELD_YG_EDGES(padding, "padding", "");
|
||||
REBUILD_FIELD_YG_EDGES(border, "border", "Width");
|
||||
|
||||
static const auto defaults = YogaStylableProps{};
|
||||
|
||||
// Aliases
|
||||
RAW_SET_PROP_SWITCH_CASE(inset, "inset");
|
||||
RAW_SET_PROP_SWITCH_CASE(insetBlock, "insetBlock");
|
||||
|
||||
@@ -236,7 +236,7 @@ void ShadowNode::appendChild(const ShadowNode::Shared &child) {
|
||||
void ShadowNode::replaceChild(
|
||||
ShadowNode const &oldChild,
|
||||
ShadowNode::Shared const &newChild,
|
||||
size_t suggestedIndex) {
|
||||
int32_t suggestedIndex) {
|
||||
ensureUnsealed();
|
||||
|
||||
cloneChildrenIfShared();
|
||||
|
||||
@@ -168,7 +168,7 @@ class ShadowNode : public Sealable,
|
||||
virtual void replaceChild(
|
||||
ShadowNode const &oldChild,
|
||||
Shared const &newChild,
|
||||
size_t suggestedIndex = -1);
|
||||
int32_t suggestedIndex = -1);
|
||||
|
||||
/*
|
||||
* Performs all side effects associated with mounting/unmounting in one place.
|
||||
|
||||
Reference in New Issue
Block a user