From cfc25c958dc31dc8adc60ecdd8f2c9d8e636d588 Mon Sep 17 00:00:00 2001 From: macintoshhelper Date: Thu, 2 Apr 2020 20:25:01 +0100 Subject: [PATCH 1/2] add new svg elements #8 --- src/core.android.js | 26 ++++++++++++++++++-------- src/core.ios.js | 26 ++++++++++++++++++-------- src/core.sketch.js | 26 ++++++++++++++++++-------- src/core.web.js | 5 +++++ 4 files changed, 59 insertions(+), 24 deletions(-) diff --git a/src/core.android.js b/src/core.android.js index a755639..077b4d8 100644 --- a/src/core.android.js +++ b/src/core.android.js @@ -2,37 +2,47 @@ import Svg, { Circle, + ClipPath, + Defs, Ellipse, G, - LinearGradient, - RadialGradient, + Image, Line, + LinearGradient, Path, + Pattern, Polygon, Polyline, + RadialGradient, Rect, + Stop, Symbol, Text, + TextPath, + TSpan, Use, - Defs, - Stop, } from 'react-native-svg'; module.exports = { Svg, Circle, + ClipPath, + Defs, Ellipse, G, - LinearGradient, - RadialGradient, + Image, Line, + LinearGradient, Path, + Pattern, Polygon, Polyline, + RadialGradient, Rect, + Stop, Symbol, Text, + TextPath, + TSpan, Use, - Defs, - Stop, }; diff --git a/src/core.ios.js b/src/core.ios.js index a755639..077b4d8 100644 --- a/src/core.ios.js +++ b/src/core.ios.js @@ -2,37 +2,47 @@ import Svg, { Circle, + ClipPath, + Defs, Ellipse, G, - LinearGradient, - RadialGradient, + Image, Line, + LinearGradient, Path, + Pattern, Polygon, Polyline, + RadialGradient, Rect, + Stop, Symbol, Text, + TextPath, + TSpan, Use, - Defs, - Stop, } from 'react-native-svg'; module.exports = { Svg, Circle, + ClipPath, + Defs, Ellipse, G, - LinearGradient, - RadialGradient, + Image, Line, + LinearGradient, Path, + Pattern, Polygon, Polyline, + RadialGradient, Rect, + Stop, Symbol, Text, + TextPath, + TSpan, Use, - Defs, - Stop, }; diff --git a/src/core.sketch.js b/src/core.sketch.js index 861ee40..3bbb42a 100644 --- a/src/core.sketch.js +++ b/src/core.sketch.js @@ -4,37 +4,47 @@ import { Svg } from 'react-sketchapp'; const { Circle, + ClipPath, + Defs, Ellipse, G, - LinearGradient, - RadialGradient, + Image, Line, + LinearGradient, Path, + Pattern, Polygon, Polyline, + RadialGradient, Rect, + Stop, Symbol, Text, + TextPath, + TSpan, Use, - Defs, - Stop, } = Svg module.exports = { Svg, Circle, + ClipPath, + Defs, Ellipse, G, - LinearGradient, - RadialGradient, + Image, Line, + LinearGradient, Path, + Pattern, Polygon, Polyline, + RadialGradient, Rect, + Stop, Symbol, Text, + TextPath, + TSpan, Use, - Defs, - Stop, }; diff --git a/src/core.web.js b/src/core.web.js index 0eb3141..9872131 100644 --- a/src/core.web.js +++ b/src/core.web.js @@ -3,17 +3,22 @@ import 'react-dom'; module.exports = { Svg: 'svg', Circle: 'circle', + ClipPath: 'clipPath', Ellipse: 'ellipse', G: 'g', + Image: 'image', LinearGradient: 'linearGradient', RadialGradient: 'radialGradient', Line: 'line', Path: 'path', + Pattern: 'pattern', Polygon: 'polygon', Polyline: 'polyline', Rect: 'rect', Symbol: 'symbol', Text: 'text', + TextPath: 'textPath', + TSpan: 'tspan', Use: 'use', Defs: 'defs', Stop: 'stop', From 4e451b5efd645b13d6e6afb7c8b87e338e9ff1c5 Mon Sep 17 00:00:00 2001 From: macintoshhelper Date: Thu, 2 Apr 2020 20:26:27 +0100 Subject: [PATCH 2/2] add basic docs to README --- README.md | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/README.md b/README.md index 25f0c63..2512403 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,84 @@ # react-primitives-svg Primitive React SVG Elements Across Targets + +## Prerequisites + +- Setup a `react-primitives` project + +## Getting Started + +Install with: + +```sh +npm i --save react-primitives-svg +``` + +Make sure your build resolver (e.g. Webpack) resolves the platform extension (such as `.web.js` or `.ios.js`) before `.js` files. + +e.g. + +webpack.config.js + +```js +module.exports = { + // ... + resolve: { + // ... + extensions: ['.web.jsx', '.web.js', '.jsx', '.js'] + // ... + } + //... +} +``` + +## Usage + +```jsx +import { View, StyleSheet } from 'react-primitives'; + +import { + Svg, + Circle, + ClipPath, + Ellipse, + G, + Image, + LinearGradient, + RadialGradient, + Line, + Path, + Pattern, + Polygon, + Polyline, + Rect, + Symbol, + Text, + TextPath, + TSpan, + Use, + Defs, + Stop, +} from 'react-primitives-svg'; + +const SvgExample = () => ( + + + + + +); + +export default SvgExample; +```