mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix cxx codegen handling of optional return types (#36581)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36581 Found that the current codegen did not properly handle a return type of `?bool` because the branch of `constexpr (is_optional_v<T>)` assumed that T was always a JSI value that needed conversion, and `supportsToJs<bool, bool>` is false. Changelog: [General][Fixed] Issue with TurboModule C++ codegen with optional return types Reviewed By: christophpurrer Differential Revision: D44302352 fbshipit-source-id: 0863de06da4e5e3c18f8a1ced7179d76d8e87b99
This commit is contained in:
committed by
Facebook GitHub Bot
parent
da027dd2fd
commit
dd6d57eea1
@@ -117,10 +117,10 @@ AsyncPromise<std::string> NativeCxxModuleExample::getValueWithPromise(
|
||||
return promise;
|
||||
}
|
||||
|
||||
bool NativeCxxModuleExample::getWithWithOptionalArgs(
|
||||
std::optional<bool> NativeCxxModuleExample::getWithWithOptionalArgs(
|
||||
jsi::Runtime &rt,
|
||||
std::optional<bool> optionalArg) {
|
||||
return optionalArg.value_or(false);
|
||||
return optionalArg;
|
||||
}
|
||||
|
||||
void NativeCxxModuleExample::voidFunc(jsi::Runtime &rt) {
|
||||
|
||||
Reference in New Issue
Block a user