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 = {