From 815540fc28afaff7b59888a706234244b315806b Mon Sep 17 00:00:00 2001 From: Horcrux Date: Fri, 22 Jan 2016 00:08:07 +0800 Subject: [PATCH] Add path examples Add path examples --- Example/examples.js | 4 ++- Example/examples/Circle.js | 1 + Example/examples/Path.js | 55 ++++++++++++++++++++++++++++++++++++++ README.md | 4 +-- lib/fillFilter.js | 2 +- 5 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 Example/examples/Path.js diff --git a/Example/examples.js b/Example/examples.js index 1d1962ff..608f5cc1 100644 --- a/Example/examples.js +++ b/Example/examples.js @@ -5,6 +5,7 @@ import * as Ellipse from './examples/Ellipse'; import * as Line from './examples/Line'; import * as Polygon from './examples/Polygon'; import * as Polyline from './examples/Polyline'; +import * as Path from './examples/Path'; export { Svg, @@ -13,5 +14,6 @@ export { Ellipse, Line, Polygon, - Polyline + Polyline, + Path }; diff --git a/Example/examples/Circle.js b/Example/examples/Circle.js index 93c1bc84..5fd3ee84 100644 --- a/Example/examples/Circle.js +++ b/Example/examples/Circle.js @@ -36,6 +36,7 @@ class StrokeCircle extends Component{ r="45" stroke="purple" strokeWidth="2.5" + fill={null} /> ; } diff --git a/Example/examples/Path.js b/Example/examples/Path.js new file mode 100644 index 00000000..adae7521 --- /dev/null +++ b/Example/examples/Path.js @@ -0,0 +1,55 @@ +import React, { + Component +} from 'react-native'; + +import Svg, { + Path +} from 'react-native-art-svg'; + +class PathExample extends Component{ + static title = 'Path'; + render() { + return + + ; + } +} + +class UnclosedPath extends Component{ + static title = 'Unclosed paths'; + render() { + return + + ; + } +} + +const icon = + +; + +const samples = [PathExample, UnclosedPath]; + +export { + icon, + samples +} diff --git a/README.md b/README.md index 5ed6bfaf..431a718a 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ### react-native-art-svg -TODO: +TODO: 1. fill-rule:evenodd 2. gradients 3. text 4. other elements -5. animations https://github.com/maxwellito/vivus +5. animations https://github.com/maxwellito/vivus diff --git a/lib/fillFilter.js b/lib/fillFilter.js index a6fe6130..d0e78117 100644 --- a/lib/fillFilter.js +++ b/lib/fillFilter.js @@ -1,4 +1,4 @@ import rgba from './rgba'; export default function (props) { - return rgba(props.fill, props.fillOpacity); + return rgba(props.fill === undefined ? '#000' : props.fill, props.fillOpacity); }