mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
# Fixed Type Conversion Error in DynamicEventPayload (#52525)
Summary: Resolves https://github.com/microsoft/react-native-windows/issues/14797 We were facing a type conversion error in the DynamicEventPayload::extractValue() method. The function signature declares a return type of std::optional<double>, but when handling INT64 values, but when handling `INT64` values, the code was directly returning `dynamic.asInt()` without proper type conversion We faced the issue while integrating https://github.com/microsoft/react-native-windows/pull/14791 ## Changelog: [General][Fixed] Pull Request resolved: https://github.com/facebook/react-native/pull/52525 Test Plan: The fix involved wrapping the dynamic.asInt() call with static_cast<double>(), creating the corrected line: return static_cast<double>(dynamic.asInt()) Tested E2E in RNW Reviewed By: andrewdacenko Differential Revision: D78083842 Pulled By: rshest fbshipit-source-id: 8dbedd67fa7c21e89b863d8b1bc7b9e0d7978b9f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
7bbb13c9be
commit
ff38d59cff
@@ -36,7 +36,7 @@ std::optional<double> DynamicEventPayload::extractValue(
|
||||
if (dynamic.type() == folly::dynamic::Type::DOUBLE) {
|
||||
return dynamic.asDouble();
|
||||
} else if (dynamic.type() == folly::dynamic::Type::INT64) {
|
||||
return dynamic.asInt();
|
||||
return static_cast<double>(dynamic.asInt());
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user