我正在嘗試繪制一條帶有樣式的曲線,如下圖所示

我在 react-native-svg 中使用組件 Line 但只得到如下所示的結果

怎樣才能畫曲線?非常感謝 !
uj5u.com熱心網友回復:
使用react-native-svg,您可以定義Path代表曲線的組件。例如:
const SvgComponent = (props) => (
<Svg
viewBox="0 0 429 135"
fill="none"
{...props}
>
<Path
d="M9 7c157.135 213.709 340.14 89.046 412 0"
stroke="#000"
strokeWidth={20}
strokeDasharray="12 6"
/>
</Svg>
)
在這種情況下,我使用Figma創建了一條曲線。然后,我將 SVG 匯出,然后將其匯入SVGR Playround以將其轉換為上述代碼(盡管我做了一些小修改并將 and 更改width為heightprop viewbox)。
你可以在這個 Snack上看到它的實際效果
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/437432.html
