diff --git a/packages/react-native/ReactCommon/react/bridging/Base.h b/packages/react-native/ReactCommon/react/bridging/Base.h index 2858ea7833bf65..2c67d46f2ff830 100644 --- a/packages/react-native/ReactCommon/react/bridging/Base.h +++ b/packages/react-native/ReactCommon/react/bridging/Base.h @@ -63,8 +63,8 @@ using bridging_t = typename detail::bridging_wrapper::type; template , int> = 0> auto fromJs(jsi::Runtime& rt, T&& value, const std::shared_ptr&) - -> decltype(static_cast(convert(rt, std::forward(value)))) { - return convert(rt, std::forward(value)); + -> decltype(static_cast(std::move(convert(rt, std::forward(value))))) { + return static_cast(std::move(convert(rt, std::forward(value)))); } template @@ -121,7 +121,7 @@ auto toJs( template inline constexpr bool supportsFromJs = false; -template +template inline constexpr bool supportsFromJs< T, Arg, @@ -130,10 +130,19 @@ inline constexpr bool supportsFromJs< std::declval(), nullptr))>> = true; +template +inline constexpr bool supportsFromJs< + T, + jsi::Value, + std::void_t( + std::declval(), + std::declval(), + nullptr))>> = true; + template inline constexpr bool supportsToJs = false; -template +template inline constexpr bool supportsToJs< T, Ret, @@ -148,5 +157,20 @@ inline constexpr bool supportsToJs< nullptr)), Ret>; +template +inline constexpr bool supportsToJs< + T, + jsi::Value, + std::void_t(), + std::declval(), + nullptr))>> = + std::is_convertible_v< + decltype(toJs( + std::declval(), + std::declval(), + nullptr)), + jsi::Value>; + } // namespace bridging } // namespace facebook::react