Skip to content

Commit 171de1b

Browse files
committed
ver 1.1.6
1 parent 5400e81 commit 171de1b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ web: svg
99
## Getting started
1010

1111
`$ npm install react-native-clippathview --save`
12-
13-
### Mostly automatic installation
14-
1512
`$ react-native link react-native-clippathview`
1613

1714
### Yarn
@@ -56,6 +53,7 @@ import {ClipPathView , ClipPathViewH } from 'react-native-clippathview'
5653

5754
| Name | description | type | default |
5855
| --- | --- | --- | --- |
56+
| svgKey | Each view must have a different key | String | "" |
5957
| d | The shape, defined by a series of commands | String | "" |
6058
| viewBox | defines the position and dimension, in user space | Array[Number] (4) | undefined |
6159
| align | the aligment | String | xMidYMid |

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Constructor, NativeMethods, ViewProps } from "react-native";
33

44

55
interface ClipPathViewProps extends ViewProps {
6-
6+
svgKey:string // web
77
d:string
88
viewBox?:number[]
99
aspect?: 'meet' | 'slice' | 'none'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-native-clippathview",
33
"title": "React Native ClipPath",
4-
"version": "1.1.5",
4+
"version": "1.1.6",
55
"description": "ClipPath Android Web IOS",
66
"main": "index.js",
77
"files": [

src/ClipPathWeb.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ const ClipPathWeb = React.forwardRef((props,ref) =>{
107107
const myRef = ref || refAlt
108108

109109
const {
110+
111+
svgKey,
110112
d,
111113
viewBox,
112114
aspect,
@@ -165,6 +167,8 @@ const ClipPathWeb = React.forwardRef((props,ref) =>{
165167
return style
166168
},[style])
167169

170+
171+
const userKey = svgKey === undefined ? "" : svgKey
168172
const path = d === undefined ? "" : d
169173
const vb = viewBox === undefined ? [0,0,-1,-1] : viewBox
170174
const asp = aspect === undefined ? "meet" : aspect
@@ -311,15 +315,16 @@ const ClipPathWeb = React.forwardRef((props,ref) =>{
311315
}
312316
})
313317

318+
const keyClip = `clipPathViewjjfl${userKey}`
314319

315320
return(
316321
<>
317-
<div {...rest} ref={myRef} style={{...styleObject,clipPath:`${d.length > 0 ? 'url(#clipPathViewjjfl)' : ''}`, zIndex:zIndex}} >
322+
<div {...rest} ref={myRef} style={{...styleObject,clipPath:`${d.length > 0 ? `url(#${keyClip})` : ''}`, zIndex:zIndex}} >
318323

319324
</div>
320325
<svg style={{width:0,height:0}}>
321326
<defs>
322-
<clipPath id="clipPathViewjjfl"
327+
<clipPath id={keyClip}
323328
clipPathUnits="objectBoundingBox"
324329

325330
>

0 commit comments

Comments
 (0)