diff --git a/src/apis/StyleSheet/StyleRegistry.js b/src/apis/StyleSheet/StyleRegistry.js index 23226383..ef91d376 100644 --- a/src/apis/StyleSheet/StyleRegistry.js +++ b/src/apis/StyleSheet/StyleRegistry.js @@ -127,16 +127,20 @@ class StyleRegistry { if (className) { props.classList.push(className); } else { + if (!props.style) { + props.style = {}; + } // 4x slower render props.style[styleProp] = value; } } return props; - }, { classList: [], style: {} }); + }, { classList: [] }); - const style = prefixInlineStyles(props.style); props.className = classListToString(props.classList); - props.style = style; + if (props.style) { + props.style = prefixInlineStyles(props.style); + } return props; } diff --git a/src/apis/StyleSheet/__tests__/__snapshots__/StyleRegistry-test.js.snap b/src/apis/StyleSheet/__tests__/__snapshots__/StyleRegistry-test.js.snap index 6e32e3b1..6b75e698 100644 --- a/src/apis/StyleSheet/__tests__/__snapshots__/StyleRegistry-test.js.snap +++ b/src/apis/StyleSheet/__tests__/__snapshots__/StyleRegistry-test.js.snap @@ -17,7 +17,6 @@ Object { "rn-width-b8lwoo", ], "className": "rn-borderTopColor-1gxhl28 rn-borderRightColor-knoah9 rn-borderBottomColor-1ani3fp rn-borderLeftColor-ribj9x rn-borderTopWidth-13yce4e rn-borderRightWidth-fnigne rn-borderBottomWidth-ndvcnb rn-borderLeftWidth-gxnn5r rn-left-1tsx3h3 rn-pointerEvents-ah5dr5 rn-position-u8s1d rn-width-b8lwoo", - "style": Object {}, } `; @@ -38,7 +37,6 @@ Object { "rn-width-l0gwng", ], "className": "rn-borderTopColor-1gxhl28 rn-borderRightColor-knoah9 rn-borderBottomColor-1ani3fp rn-borderLeftColor-ribj9x rn-borderTopWidth-13yce4e rn-borderRightWidth-fnigne rn-borderBottomWidth-ndvcnb rn-borderLeftWidth-gxnn5r rn-left-1tsx3h3 rn-pointerEvents-ah5dr5 rn-position-u8s1d rn-width-l0gwng", - "style": Object {}, } `; @@ -59,7 +57,6 @@ Object { "rn-width-b8lwoo", ], "className": "rn-borderTopColor-1gxhl28 rn-borderRightColor-knoah9 rn-borderBottomColor-1ani3fp rn-borderLeftColor-ribj9x rn-borderTopWidth-13yce4e rn-borderRightWidth-fnigne rn-borderBottomWidth-ndvcnb rn-borderLeftWidth-gxnn5r rn-left-1tsx3h3 rn-pointerEvents-ah5dr5 rn-position-u8s1d rn-width-b8lwoo", - "style": Object {}, } `; diff --git a/src/components/ActivityIndicator/__tests__/__snapshots__/index-test.js.snap b/src/components/ActivityIndicator/__tests__/__snapshots__/index-test.js.snap index 80ac3394..f10f673c 100644 --- a/src/components/ActivityIndicator/__tests__/__snapshots__/index-test.js.snap +++ b/src/components/ActivityIndicator/__tests__/__snapshots__/index-test.js.snap @@ -6,11 +6,9 @@ exports[`components/ActivityIndicator default render 1`] = ` aria-valuemin="0" className="rn-alignItems-1awozwy rn-backgroundColor-wib322 rn-borderTopStyle-1efd50x rn-borderRightStyle-14skgim rn-borderBottomStyle-rull8r rn-borderLeftStyle-mm0ijv rn-borderTopWidth-13yce4e rn-borderRightWidth-fnigne rn-borderBottomWidth-ndvcnb rn-borderLeftWidth-gxnn5r rn-boxSizing-deolkf rn-color-homxoj rn-display-6koalj rn-flexShrink-1qe8dj5 rn-flexBasis-1mlwlqe rn-flexDirection-eqz5dr rn-font-1lw9tu2 rn-justifyContent-1777fci rn-listStyle-1ebb2ja rn-marginTop-1mnahxq rn-marginRight-61z16t rn-marginBottom-p1pxzi rn-marginLeft-11wrixw rn-minHeight-ifefl9 rn-minWidth-bcqeeo rn-paddingTop-wk8lta rn-paddingRight-9aemit rn-paddingBottom-1mdbw0j rn-paddingLeft-gy4na3 rn-position-bnwqim rn-textAlign-1ttztb7 rn-textDecoration-bauka4" role="progressbar" - style={Object {}} >
`; @@ -12,7 +11,6 @@ exports[`components/Image prop "accessibilityLabel" 1`] = `
`; @@ -20,14 +18,12 @@ exports[`components/Image prop "accessible" 1`] = `
`; exports[`components/Image prop "children" 1`] = `
`; @@ -68,7 +63,6 @@ exports[`components/Image prop "defaultSource" sets "height" and "width" styles
`; @@ -85,7 +79,6 @@ exports[`components/Image prop "defaultSource" sets background image when value
`; @@ -102,7 +95,6 @@ exports[`components/Image prop "defaultSource" sets background image when value
`; @@ -110,42 +102,36 @@ exports[`components/Image prop "defaultSource" sets background image when value exports[`components/Image prop "resizeMode" value "contain" 1`] = `
`; exports[`components/Image prop "resizeMode" value "cover" 1`] = `
`; exports[`components/Image prop "resizeMode" value "none" 1`] = `
`; exports[`components/Image prop "resizeMode" value "stretch" 1`] = `
`; exports[`components/Image prop "resizeMode" value "undefined" 1`] = `
`; exports[`components/Image prop "style" correctly supports "resizeMode" property 1`] = `
`; @@ -153,13 +139,11 @@ exports[`components/Image prop "testID" 1`] = `
`; exports[`components/Image sets correct accessibility role" 1`] = `
`; diff --git a/src/components/Switch/__tests__/__snapshots__/index-test.js.snap b/src/components/Switch/__tests__/__snapshots__/index-test.js.snap index 221e5be5..af84e18d 100644 --- a/src/components/Switch/__tests__/__snapshots__/index-test.js.snap +++ b/src/components/Switch/__tests__/__snapshots__/index-test.js.snap @@ -39,7 +39,6 @@ exports[`components/Switch disabled when "false" a default checkbox is rendered onBlur={[Function]} onChange={[Function]} onFocus={[Function]} - style={Object {}} type="checkbox" />
@@ -82,7 +81,6 @@ exports[`components/Switch disabled when "true" a disabled checkbox is rendered onBlur={[Function]} onChange={[Function]} onFocus={[Function]} - style={Object {}} type="checkbox" />
@@ -127,7 +125,6 @@ exports[`components/Switch value when "false" an unchecked checkbox is rendered onBlur={[Function]} onChange={[Function]} onFocus={[Function]} - style={Object {}} type="checkbox" />
@@ -173,7 +170,6 @@ exports[`components/Switch value when "true" a checked checkbox is rendered 1`] onBlur={[Function]} onChange={[Function]} onFocus={[Function]} - style={Object {}} type="checkbox" />
diff --git a/src/components/Text/__tests__/__snapshots__/index-test.js.snap b/src/components/Text/__tests__/__snapshots__/index-test.js.snap index 60eea1f5..56513255 100644 --- a/src/components/Text/__tests__/__snapshots__/index-test.js.snap +++ b/src/components/Text/__tests__/__snapshots__/index-test.js.snap @@ -15,7 +15,6 @@ exports[`components/Text prop "onPress" 1`] = ` dir="auto" onClick={[Function]} onKeyDown={[Function]} - style={Object {}} tabIndex={0} /> `; @@ -31,6 +30,5 @@ exports[`components/Text prop "selectable" 2`] = ` `; diff --git a/src/components/View/__tests__/__snapshots__/index-test.js.snap b/src/components/View/__tests__/__snapshots__/index-test.js.snap index 268bde1a..b321c25c 100644 --- a/src/components/View/__tests__/__snapshots__/index-test.js.snap +++ b/src/components/View/__tests__/__snapshots__/index-test.js.snap @@ -14,7 +14,6 @@ exports[`components/View prop "children" 1`] = ` exports[`components/View prop "pointerEvents" 1`] = `
`; @@ -28,7 +27,6 @@ exports[`components/View rendered element is a "span" when inside