Skip to content

First parameter must be of type ... for prop setter ... #6

@aike19115

Description

@aike19115

Output of react-native info:

Environment:
  OS: Windows 10
  Node: 10.13.0
  Yarn: 1.12.3
  npm: 6.4.1
  Watchman: Not Found
  Xcode: N/A
  Android Studio: Not Found

Packages: (wanted => installed)
  react: 16.3.1 => 16.3.1
  react-native: 0.55.4 => 0.55.4

After installing the plugin and using it as follows:

import WindowsSvg from 'react-native-windows-svg';
<WindowsSvg.Svg height={200} width={200}>
    <WindowsSvg.Path stroke="black" strokeWidth={1} />
</WindowsSvg.Svg>

The following error appears:
aa

Changing in the file ShapeViewManager.cs:

        public void SetStroke(Shape view, uint? iColor)
        {
            ShapeViewModel viewModel = (ShapeViewModel)view.DataContext;
            viewModel.SetValue(ShapeViewModel.StrokeProperty, iColor);
            UpdateShape(view, viewModel, "stroke");
        }

to

        public void SetStroke(Rectangle view, uint? iColor)
        {
            ShapeViewModel viewModel = (ShapeViewModel)view.DataContext;
            viewModel.SetValue(ShapeViewModel.StrokeProperty, iColor);
            UpdateShape(view, viewModel, "stroke");
        }

Gives the error:
bb

Which indicates that Rectangle should be Line:

        public void SetStroke(Line view, uint? iColor)
        {
            ShapeViewModel viewModel = (ShapeViewModel)view.DataContext;
            viewModel.SetValue(ShapeViewModel.StrokeProperty, iColor);
            UpdateShape(view, viewModel, "stroke");
        }

But that gives the original error:
aa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions