Skip to content

Commit

Permalink
Fix SVG styles for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Dec 5, 2018
1 parent 8c4fdd8 commit 2fde0b6
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,13 +17,9 @@ export {
} from 'react-native-svg';

export const SVG = ( props ) => {
// We're using the react-native-classname-to-style plugin, so when a `className` prop is passed it gets converted to `style` here.
// Given it carries a string (as it was originally className) but an object is expected for `style`,
// we need to check whether `style` exists and is a string, and convert it to an object

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

Expand Down

0 comments on commit 2fde0b6

Please sign in to comment.