This commit is contained in:
Alexander Sklar 2021-09-30 14:21:00 -07:00
Родитель b279b4d23b
Коммит bf2407ba25
4 изменённых файлов: 3 добавлений и 47 удалений

Просмотреть файл

@ -1,7 +1,7 @@
{
"name": "react-native-xaml",
"title": "React Native Xaml",
"version": "0.0.44",
"version": "0.0.45",
"description": "Allows using XAML directly, inside of a React Native Windows app",
"main": "lib/index.js",
"typings": "lib/index.d.ts",

Просмотреть файл

@ -151,6 +151,7 @@
<ClInclude Include="Codegen\TypeEvents.g.h" />
<ClInclude Include="Codegen\TypeProperties.g.h" />
<ClInclude Include="Crc32Str.h" />
<ClInclude Include="JSValueXaml_local.h" />
<ClInclude Include="ReactPackageProvider.h">
<DependentUpon>ReactPackageProvider.idl</DependentUpon>
</ClInclude>

Просмотреть файл

@ -39,6 +39,7 @@
<ClInclude Include="Codegen\TypeEnums.g.h">
<Filter>Codegen</Filter>
</ClInclude>
<ClInclude Include="JSValueXaml_local.h" />
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />

Просмотреть файл

@ -55,52 +55,6 @@ namespace winrt::Microsoft::ReactNative {
inline void ReadValue(JSValue const& jsValue, Windows::UI::Text::FontWeight& value) noexcept {
value.Weight = jsValue.AsInt16();
}
inline void ReadValue(JSValue const& jsValue, xaml::Thickness& value) noexcept {
if (auto array = jsValue.TryGetArray()) {
if (array->size() == 4) {
value = ThicknessHelper::FromLengths((*array)[0].AsDouble(), (*array)[1].AsDouble(), (*array)[2].AsDouble(), (*array)[3].AsDouble());
return;
}
}
else if (auto number = jsValue.TryGetDouble()) {
value = ThicknessHelper::FromUniformLength(*number);
}
else if (auto numberInt = jsValue.TryGetInt64()) {
const auto valueDbl = static_cast<double>(*numberInt);
value = ThicknessHelper::FromUniformLength(valueDbl);
}
else {
const auto& obj = jsValue.AsObject();
value = ThicknessHelper::FromLengths(obj["left"].AsDouble(), obj["top"].AsDouble(), obj["right"].AsDouble(), obj["bottom"].AsDouble());
return;
}
}
inline void ReadValue(JSValue const& jsValue, xaml::CornerRadius& value) noexcept {
if (auto array = jsValue.TryGetArray()) {
if (array->size() == 4) {
value = CornerRadiusHelper::FromRadii((*array)[0].AsDouble(), (*array)[1].AsDouble(), (*array)[2].AsDouble(), (*array)[3].AsDouble());
return;
}
}
else if (auto number = jsValue.TryGetDouble()) {
value = CornerRadiusHelper::FromUniformRadius(*number);
}
else if (auto numberInt = jsValue.TryGetInt64()) {
const auto valueDbl = static_cast<double>(*numberInt);
value = CornerRadiusHelper::FromUniformRadius(valueDbl);
}
else {
const auto& obj = jsValue.AsObject();
value = CornerRadiusHelper::FromRadii(obj["topLeft"].AsDouble(), obj["topRight"].AsDouble(), obj["bottomRight"].AsDouble(), obj["bottomLeft"].AsDouble());
return;
}
}
inline void ReadValue(JSValue const& jsValue, winrt::Windows::Foundation::Uri& value) noexcept {
value = Uri{ winrt::to_hstring(jsValue.AsString()) };
}
}
enum class XamlPropType {