From beb907b180cefb905ec0224dc31417be931d77b2 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 24 Apr 2017 13:21:27 -0700 Subject: [PATCH] Rename some variables in StyleRegistry --- src/apis/StyleSheet/StyleRegistry.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/apis/StyleSheet/StyleRegistry.js b/src/apis/StyleSheet/StyleRegistry.js index 58bdfe39..c4045d39 100644 --- a/src/apis/StyleSheet/StyleRegistry.js +++ b/src/apis/StyleSheet/StyleRegistry.js @@ -88,10 +88,10 @@ class StyleRegistry { * To determine the next style, some of the existing DOM state must be * converted back into React Native styles. */ - resolveStateful(rnStyleNext, domStyleProps) { + resolveStateful(rnStyleNext, { classList: domClassList, style: domStyle }) { // Convert the DOM classList back into a React Native form // Preserves unrecognized class names. - const rnStyleProps = domStyleProps.classList.reduce( + const { classList: rnClassList, style: rnStyle } = domClassList.reduce( (styleProps, className) => { const { prop, value } = this.styleManager.getDeclaration(className); if (prop) { @@ -106,8 +106,8 @@ class StyleRegistry { // DOM style may include vendor prefixes and properties set by other libraries. // Preserve it but transform back into React DOM style. - const rdomStyle = Object.keys(domStyleProps.style).reduce((acc, styleName) => { - const value = domStyleProps.style[styleName]; + const rdomStyle = Object.keys(domStyle).reduce((acc, styleName) => { + const value = domStyle[styleName]; if (value !== '') { const reactStyleName = vendorPrefixPattern.test(styleName) ? styleName.charAt(0).toUpperCase() + styleName.slice(1) @@ -119,11 +119,9 @@ class StyleRegistry { // Create next DOM style props from current and next RN styles const { classList: rdomClassListNext, style: rdomStyleNext } = this.resolve([ - rnStyleProps.style, + rnStyle, rnStyleNext ]); - // Add the current class names not managed by React Native - rdomClassListNext.push(...rnStyleProps.classList); // Next class names take priority over current inline styles const style = { ...rdomStyle }; rdomClassListNext.forEach(className => { @@ -134,7 +132,8 @@ class StyleRegistry { }); // Next inline styles take priority over current inline styles Object.assign(style, rdomStyleNext); - const className = classListToString(rdomClassListNext); + // Add the current class names not managed by React Native + const className = classListToString(rdomClassListNext.concat(rnClassList)); return { className, style }; }