Как я могу добавить границу к своей форме реактивной конвы? - PullRequest
0 голосов
/ 21 ноября 2019

У меня есть проект React с TypeScript. Я использую пакет Reaction-Konva для рисования фигур. Как я могу добавить к моей форме границу, как в HTML (border: 1px solid black)?

Мой код:

       <Rect
          x={103}
          y={103}
          width={144}
          height={44}
          // here i need a border
          fill="#E2E6EA"
          draggable
          onDragStart={this.handleDragStart}
          onDragEnd={this.handleDragEnd}
        />

1 Ответ

3 голосов
/ 21 ноября 2019

Вы должны установить границу, используя strokeWidth & stroke атрибуты.

<Rect
    x={103}
    y={103}
    width={144}
    height={44}
    // here i need a border
    fill="#E2E6EA"
    draggable
    onDragStart={this.handleDragStart}
    onDragEnd={this.handleDragEnd}
    strokeWidth={1} // border width
    stroke="red" // border color
/>
...