mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-19 13:35:11 +00:00
change circle radius percentage calculation
Change circle radius percentage calculation. Add example for percentage props for shape. Remove unused document ref
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
let percentReg = /^(\-?\d+(?:\.\d+)?)(%?)$/;
|
||||
export default function (percent) {
|
||||
let matched = percent.match(percentReg);
|
||||
if (!matched) {
|
||||
console.warn(`\`${percent}\` is not a valid number or percentage string.`);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return matched[2] ? matched[1] / 100 : +matched[1];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user