mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-06 07:06:11 +00:00
fix style attribute space (#1639)
When the svg code has some blank in style attribute,like this style="white-space: pre; " it was throw an error Cannot read property 'trim' of undefined.
This commit is contained in:
@@ -205,7 +205,7 @@ export type Styles = { [property: string]: string };
|
||||
|
||||
export function getStyle(string: string): Styles {
|
||||
const style: Styles = {};
|
||||
const declarations = string.split(';');
|
||||
const declarations = string.split(';').filter(v => v.trim());
|
||||
const { length } = declarations;
|
||||
for (let i = 0; i < length; i++) {
|
||||
const declaration = declarations[i];
|
||||
|
||||
Reference in New Issue
Block a user