Skip to content
Merged
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
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "TurboModule spec checking should accept hstring for string arguments",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
20 changes: 20 additions & 0 deletions vnext/Microsoft.ReactNative.Cxx/NativeModules.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,26 @@ constexpr bool MatchInputArg<std::string, std::wstring>() noexcept {
return true;
}

template <>
constexpr bool MatchInputArg<std::string, winrt::hstring>() noexcept {
return true;
}

template <>
constexpr bool MatchInputArg<winrt::hstring, std::string>() noexcept {
return true;
}

template <>
constexpr bool MatchInputArg<std::wstring, winrt::hstring>() noexcept {
return true;
}

template <>
constexpr bool MatchInputArg<winrt::hstring, std::wstring>() noexcept {
return true;
}

template <class TResult, class TInputArgs, class TOutputCallbacks, class TOutputPromises>
struct MethodSignature {
using Result = TResult;
Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/Modules/ClipboardModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void Clipboard::getString(React::ReactPromise<std::string> result) noexcept {
);
}

void Clipboard::setString(std::wstring content) noexcept {
void Clipboard::setString(winrt::hstring content) noexcept {
m_reactContext.UIDispatcher().Post([=] {
DataTransfer::DataPackage data;
data.SetText(content);
Expand Down
2 changes: 1 addition & 1 deletion vnext/Microsoft.ReactNative/Modules/ClipboardModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct Clipboard {
void getString(winrt::Microsoft::ReactNative::ReactPromise<std::string> result) noexcept;

REACT_METHOD(setString)
void setString(std::wstring content) noexcept;
void setString(winrt::hstring content) noexcept;

winrt::Microsoft::ReactNative::ReactContext m_reactContext;
};
Expand Down