From a16e542bd8c2f3f359c09fd8bf6d62afee182749 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 13 Jun 2016 11:58:05 -0700 Subject: [PATCH] [fix] don't replace 'className' value --- src/apis/StyleSheet/__tests__/index-test.js | 10 ++++++++++ src/apis/StyleSheet/index.js | 8 ++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/apis/StyleSheet/__tests__/index-test.js b/src/apis/StyleSheet/__tests__/index-test.js index fa8de14a..0cbe800f 100644 --- a/src/apis/StyleSheet/__tests__/index-test.js +++ b/src/apis/StyleSheet/__tests__/index-test.js @@ -48,4 +48,14 @@ suite('apis/StyleSheet', () => { `.__style1{opacity:1;}` ) }) + + test('resolve', () => { + assert.deepEqual( + StyleSheet.resolve({ className: 'test', style: styles.root }), + { + className: 'test', + style: { opacity: 1 } + } + ) + }) }) diff --git a/src/apis/StyleSheet/index.js b/src/apis/StyleSheet/index.js index c17c80c1..a6eb6eed 100644 --- a/src/apis/StyleSheet/index.js +++ b/src/apis/StyleSheet/index.js @@ -56,8 +56,12 @@ const renderToString = () => { * Accepts React props and converts inline styles to single purpose classes * where possible. */ -const resolve = ({ style = {} }) => { - return StyleSheetRegistry.getStyleAsNativeProps(style, isRendered) +const resolve = ({ className, style = {} }) => { + const props = StyleSheetRegistry.getStyleAsNativeProps(style, isRendered); + return { + ...props, + className: className ? `${props.className} ${className}`.trim() : props.className + } } module.exports = {