# SVG

React Native SVG 教學：

{% embed url="<https://github.com/react-native-svg/react-native-svg>" %}

> ```
> yarn add react-native-svg
> cd ios && pod install
> ```

## 範例：

```javascript
import React from 'react';

import {View, Dimensions} from 'react-native';
import Svg, {Path} from 'react-native-svg';

const WIDTH = Dimensions.get('screen').width;
const HEIGHT = Dimensions.get('screen').height;

const Login = () => {
  return (
    <View>
      <View style={{top: HEIGHT * 0.2}}>
        <Svg height={HEIGHT} width={WIDTH}>
          <Path
            d="M -116 358 C 87 -6 93 292 259 148 C 617 -105 400 610 524 939 H -84 C -155 637 -101 886 -137 447 Z" // put your path here
            fill="#6427d1"
          />
        </Svg>
      </View>
    </View>
  );
};

export default Login;

```

![](https://2356031413-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M0u4DAqfidGmTt67qrG%2F-MX5Et9UdVw9OF666o8d%2F-MX5FxZ7kOhdWbNlohU8%2F%E6%88%AA%E5%9C%96%202021-03-31%20%E4%B8%8A%E5%8D%8811.11.31.png?alt=media\&token=48866570-ffd1-4063-92d4-968cdf2edde5)

## 改路徑

貼到裡面，然後修改後貼回去

{% embed url="<https://yqnn.github.io/svg-path-editor/>" %}

## 在 SVG 裡面增加元素

記得使用:&#x20;

`position: absolute`

`top: ...`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://easonwang.gitbook.io/web_advance/react-native/svg.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
