Skip to content

Bug: Pseudo rules (:after) are incorrectly combined at runtime #231

@Soreine

Description

@Soreine

I think I have found a bug with how :after rules are combined. When we combine two styles declaring an :after rule, the subsequent call to css() will merge the styles incorrectly.

Minimal example:

const styleSheet = StyleSheet.create({
    greenSquare: {
        ':after': {
            display: 'block',
            content: '""',
            backgroundColor: '#3a3',
            width: 10,
            height: 10
        }
    },

    top: {
        ':after': {
            borderTop: '3px solid red'
        }
    },

    bottom: {
        ':after': {
            borderBottom: '3px solid red'
        }
    }
});

const Test = React.createClass({
    render() {
        return (
            <div>
                <div className={css(styleSheet.greenSquare, styleSheet.top)}>Top</div>
                <div className={css(styleSheet.greenSquare, styleSheet.bottom)}>Bottom</div>
            </div>
        );
    }
});

Renders:

screen shot 2017-03-22 at 17 19 01

As you can see, the second call css(styleSheet.greenSquare, styleSheet.bottom) incorrectly applies the style from stylesheet.top from the previous call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions