Skip to content

Commit

Permalink
Simplify condition since className is always a string
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Dec 6, 2018
1 parent 2fde0b6 commit 55474f9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/components/src/primitives/svg/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ export {
} from 'react-native-svg';

export const SVG = ( props ) => {
let styleValues = {};
if ( typeof props.className === 'string' ) {
const oneStyle = props.className.split( ' ' ).map( ( element ) => styles[ element ] ).filter( Boolean );
styleValues = Object.assign( styleValues, ...oneStyle );
}

const stylesFromClasses = ( props.className || '' ).split( ' ' ).map( ( element ) => styles[ element ] ).filter( Boolean );
const styleValues = Object.assign( {}, props.style, ...stylesFromClasses );
const safeProps = { ...props, style: styleValues };

return (
Expand Down

0 comments on commit 55474f9

Please sign in to comment.