Skip to content

Commit ff38d59

Browse files
Harini Malothufacebook-github-bot
authored andcommitted
# Fixed Type Conversion Error in DynamicEventPayload (#52525)
Summary: Resolves microsoft/react-native-windows#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 microsoft/react-native-windows#14791 ## Changelog: [General][Fixed] Pull Request resolved: #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
1 parent 7bbb13c commit ff38d59

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/react-native/ReactCommon/react/renderer/core/DynamicEventPayload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ std::optional<double> DynamicEventPayload::extractValue(
3636
if (dynamic.type() == folly::dynamic::Type::DOUBLE) {
3737
return dynamic.asDouble();
3838
} else if (dynamic.type() == folly::dynamic::Type::INT64) {
39-
return dynamic.asInt();
39+
return static_cast<double>(dynamic.asInt());
4040
}
4141
return std::nullopt;
4242
}

0 commit comments

Comments
 (0)