diff --git a/USAGE.md b/USAGE.md index 86258d3..fbdcc40 100644 --- a/USAGE.md +++ b/USAGE.md @@ -185,6 +185,19 @@ const [showState, setShowState] = useState(ContentDialogState.Hidden); }} /> ``` +## Path & vector graphics + +```jsx + +``` + ## Lightweight styling ```jsx diff --git a/package/Codegen/Util.cs b/package/Codegen/Util.cs index e008960..2617382 100644 --- a/package/Codegen/Util.cs +++ b/package/Codegen/Util.cs @@ -169,6 +169,8 @@ namespace Codegen return ViewManagerPropertyType.String; case $"{XamlNames.XamlNamespace}.Media.FontFamily": return ViewManagerPropertyType.String; + case $"{XamlNames.XamlNamespace}.Media.Geometry": + return ViewManagerPropertyType.String; case "Windows.UI.Text.FontWeight": return ViewManagerPropertyType.Number; case $"{XamlNames.XamlNamespace}.Thickness": @@ -264,6 +266,8 @@ namespace Codegen return "CornerRadius"; case $"{XamlNames.XamlNamespace}.Media.FontFamily": return "string"; + case $"{XamlNames.XamlNamespace}.Media.Geometry": + return "string"; case "System.Object": return "object"; case "Windows.UI.Text.FontWeight": diff --git a/package/package.json b/package/package.json index 06c34c6..b3e0d6d 100644 --- a/package/package.json +++ b/package/package.json @@ -1,7 +1,7 @@ { "name": "react-native-xaml", "title": "React Native Xaml", - "version": "0.0.31", + "version": "0.0.32", "description": "Allows using XAML directly, inside of a React Native Windows app", "main": "lib/index.js", "typings": "lib/index.d.ts", diff --git a/package/src/Props.ts b/package/src/Props.ts index 3dfe610..c273e69 100644 --- a/package/src/Props.ts +++ b/package/src/Props.ts @@ -1241,6 +1241,7 @@ export interface NativePasswordBoxProps extends NativeControlProps { export interface NativePathIconProps extends NativeIconElementProps { type: 'Windows.UI.Xaml.Controls.PathIcon'; + data?: string; } @@ -2199,6 +2200,7 @@ export interface NativeLineProps extends NativeShapeProps { export interface NativePathProps extends NativeShapeProps { type: 'Windows.UI.Xaml.Shapes.Path'; + data?: string; } diff --git a/package/windows/ReactNativeXaml/Codegen/TypeProperties.g.h b/package/windows/ReactNativeXaml/Codegen/TypeProperties.g.h index db7fdf7..e16f1e3 100644 --- a/package/windows/ReactNativeXaml/Codegen/TypeProperties.g.h +++ b/package/windows/ReactNativeXaml/Codegen/TypeProperties.g.h @@ -156,6 +156,8 @@ winrt::Windows::Foundation::IInspectable AsUnwrappedType(const winrt::Windows::F { MAKE_KEY("cornerRadius"), AsType, []() { return winrt::Windows::UI::Xaml::Controls::RelativePanel::CornerRadiusProperty(); }, SetPropValue, ViewManagerPropertyType::Map }, { MAKE_KEY("cornerRadius"), AsType, []() { return winrt::Windows::UI::Xaml::Controls::StackPanel::CornerRadiusProperty(); }, SetPropValue, ViewManagerPropertyType::Map }, { MAKE_KEY("cursor"), AsUnwrappedType, []() { return winrt::Windows::UI::Xaml::Documents::ContentLink::CursorProperty(); }, SetPropValue, ViewManagerPropertyType::Number }, + { MAKE_KEY("data"), AsType, []() { return winrt::Windows::UI::Xaml::Shapes::Path::DataProperty(); }, SetPropValue, ViewManagerPropertyType::String }, + { MAKE_KEY("data"), AsType, []() { return winrt::Windows::UI::Xaml::Controls::PathIcon::DataProperty(); }, SetPropValue, ViewManagerPropertyType::String }, { MAKE_KEY("dataContext"), AsType, []() { return winrt::Windows::UI::Xaml::FrameworkElement::DataContextProperty(); }, SetPropValue, ViewManagerPropertyType::Map }, { MAKE_KEY("dataFetchSize"), AsType, []() { return winrt::Windows::UI::Xaml::Controls::ListViewBase::DataFetchSizeProperty(); }, SetPropValue, ViewManagerPropertyType::Number }, { MAKE_KEY("dateFormat"), AsType, []() { return winrt::Windows::UI::Xaml::Controls::CalendarDatePicker::DateFormatProperty(); }, SetPropValue, ViewManagerPropertyType::String }, @@ -1024,6 +1026,7 @@ void XamlMetadata::PopulateNativeProps(winrt::Windows::Foundation::Collections:: nativeProps.Insert(winrt::to_hstring("contentMargin"), ViewManagerPropertyType::Map); nativeProps.Insert(winrt::to_hstring("cornerRadius"), ViewManagerPropertyType::Map); nativeProps.Insert(winrt::to_hstring("cursor"), ViewManagerPropertyType::Number); + nativeProps.Insert(winrt::to_hstring("data"), ViewManagerPropertyType::String); nativeProps.Insert(winrt::to_hstring("dataContext"), ViewManagerPropertyType::Map); nativeProps.Insert(winrt::to_hstring("dataFetchSize"), ViewManagerPropertyType::Number); nativeProps.Insert(winrt::to_hstring("dateFormat"), ViewManagerPropertyType::String); diff --git a/package/windows/ReactNativeXaml/XamlMetadata.h b/package/windows/ReactNativeXaml/XamlMetadata.h index 24ef7b0..0a36a14 100644 --- a/package/windows/ReactNativeXaml/XamlMetadata.h +++ b/package/windows/ReactNativeXaml/XamlMetadata.h @@ -39,6 +39,11 @@ namespace winrt::Microsoft::ReactNative { } } + inline void ReadValue(JSValue const& jsValue, xaml::Media::Geometry& value) noexcept { + const auto v = winrt::to_hstring(jsValue.AsJSString()); + value = Markup::XamlBindingHelper::ConvertValue(winrt::xaml_typename(), winrt::box_value(v)).as(); + } + inline void ReadValue(JSValue const& jsValue, Windows::UI::Text::FontWeight& value) noexcept { value.Weight = jsValue.AsInt16(); }