Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ inline std::string toString(const ImportantForAccessibility &importantForAccessi
return "no";
case ImportantForAccessibility::NoHideDescendants:
return "no-hide-descendants";
default:
LOG(ERROR) << "Unsupported ImportantForAccessibility value: " << static_cast<int>(importantForAccessibility);
react_native_expect(false);
return "auto";
}
}

Expand Down Expand Up @@ -372,12 +376,12 @@ inline std::string toString(const AccessibilityRole &accessibilityRole)
return "slidingdrawer";
case AccessibilityRole::Iconmenu:
return "iconmenu";
default:
LOG(ERROR) << "Unsupported AccessibilityRole value: " << static_cast<int>(accessibilityRole);
react_native_expect(false);
// sane default for prod
return "none";
}

LOG(ERROR) << "Unsupported AccessibilityRole value";
react_native_expect(false);
// sane default for prod
return "none";
}

inline void fromRawValue(const PropsParserContext &context, const RawValue &value, AccessibilityRole &result)
Expand Down Expand Up @@ -613,12 +617,12 @@ inline std::string toString(const Role &role)
return "treegrid";
case Role::Treeitem:
return "treeitem";
default:
LOG(ERROR) << "Unsupported Role value: " << static_cast<int>(role);
react_native_expect(false);
// sane default for prod
return "none";
}

LOG(ERROR) << "Unsupported Role value";
react_native_expect(false);
// sane default for prod
return "none";
}

inline void fromRawValue(const PropsParserContext &context, const RawValue &value, Role &result)
Expand Down Expand Up @@ -780,6 +784,10 @@ inline std::string toString(AccessibilityLiveRegion accessibilityLiveRegion)
return "polite";
case AccessibilityLiveRegion::Assertive:
return "assertive";
default:
LOG(ERROR) << "Unsupported AccessibilityLiveRegion value: " << static_cast<int>(accessibilityLiveRegion);
react_native_expect(false);
return "none";
}
}

Expand All @@ -795,6 +803,10 @@ inline std::string toString(AccessibilityState::CheckedState state)
return "Mixed";
case AccessibilityState::None:
return "None";
default:
LOG(ERROR) << "Unsupported AccessibilityState::CheckedState value: " << static_cast<int>(state);
react_native_expect(false);
return "None";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ static inline PositionType positionTypeFromYogaPositionType(yoga::PositionType p
return PositionType::Relative;
case yoga::PositionType::Absolute:
return PositionType::Absolute;
default:
LOG(ERROR) << "Unexpected yoga::PositionType value: " << static_cast<int>(positionType);
react_native_expect(false);
return PositionType::Relative;
}
}

Expand All @@ -138,6 +142,10 @@ inline DisplayType displayTypeFromYGDisplay(YGDisplay display)
return DisplayType::Flex;
case YGDisplayGrid:
return DisplayType::Grid;
default:
LOG(ERROR) << "Unexpected YGDisplay value: " << static_cast<int>(display);
react_native_expect(false);
return DisplayType::Flex;
}
}

Expand Down Expand Up @@ -185,6 +193,10 @@ inline YGDirection yogaDirectionFromLayoutDirection(LayoutDirection direction)
return YGDirectionLTR;
case LayoutDirection::RightToLeft:
return YGDirectionRTL;
default:
LOG(ERROR) << "Unexpected LayoutDirection value: " << static_cast<int>(direction);
react_native_expect(false);
return YGDirectionInherit;
}
}

Expand Down Expand Up @@ -1113,6 +1125,10 @@ inline std::string toString(PointerEventsMode value)
return "box-none";
case PointerEventsMode::BoxOnly:
return "box-only";
default:
LOG(ERROR) << "Unsupported PointerEventsMode value: " << static_cast<int>(value);
react_native_expect(false);
return "auto";
}
}

Expand Down Expand Up @@ -1695,6 +1711,10 @@ inline std::string toString(const LayoutConformance &value)
return "strict";
case LayoutConformance::Compatibility:
return "compatibility";
default:
LOG(ERROR) << "Unsupported LayoutConformance value: " << static_cast<int>(value);
react_native_expect(false);
return "strict";
}
}

Expand Down Expand Up @@ -1774,6 +1794,10 @@ inline std::string toString(const Transform &transform)
result += "{\"identity\": true}";
break;
}
default:
LOG(ERROR) << "Unsupported TransformOperationType value: " << static_cast<int>(operation.type);
react_native_expect(false);
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ template <>
struct CSSDataTypeParser<CSSLength> {
static constexpr auto consumePreservedToken(const CSSPreservedToken &token) -> std::optional<CSSLength>
{
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
switch (token.type()) {
#ifdef __clang__
#pragma clang diagnostic pop
#endif
case CSSTokenType::Dimension:
if (auto unit = parseCSSLengthUnit(token.unit())) {
return CSSLength{.value = token.numericValue(), .unit = *unit};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ struct CSSDataTypeParser<CSSTransformOrigin> {
return CSSPercentage{100.0f};
case CSSTransformOriginKeyword::Bottom:
return CSSPercentage{100.0f};
default:
return {};
}

return {};
}
};

Expand Down
Loading