Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Radium Not Prefixing #796

Closed
jwaldrip opened this issue Jul 26, 2016 · 1 comment
Closed

Radium Not Prefixing #796

jwaldrip opened this issue Jul 26, 2016 · 1 comment

Comments

@jwaldrip
Copy link

jwaldrip commented Jul 26, 2016

Radium doesn't seem to be prefixing my styles, what could I be doing wrong here?

import _ from 'lodash';
import Radium from 'radium';
import React from 'react';

const columnAnimations = _.times(9, () => ({
  animationName: Radium.keyframes({
    '0%': { transform: 'scale(1)', opacity: 1 },
    '50%': { transform: 'scale(0.5)', opacity: 0.5 },
    '100%': { transform: 'scale(1)', opacity: 1 }
  }, 'pulse'),

  animationIterationCount: 'infinite',
  animationDuration: `${0.5 + Math.random()}s`
}));

@Radium
export default class Loader extends React.Component {
  static defaultProps = {
    size: 20,
    spacing: 5,
    color: '#fff'
  }

  get styles() {
    const { size, spacing, style, color } = this.props;
    return {
      column: {
        display: 'inline-block',
        height: size,
        width: size,
        margin: spacing,
        backgroundColor: color,
        borderRadius: size / 5
      },
      row: {
        padding: 0,
        height: size + (spacing * 2)
      },
      component: {
        ...style,
        textAlign: 'center',
        width: spacing + ((spacing + size + spacing) * 3) + spacing,
        height: spacing + ((spacing + size + spacing) * 3) + spacing
      },
      loader: {
        padding: spacing
      }
    };
  }

  renderColumns(ri) {
    const { styles } = this;
    return _.times(3, ci => <div key={ci} style={{ ...styles.column, ...columnAnimations[(ri * 3) + ci] }}></div>);
  }

  renderRows() {
    const { styles } = this;
    return _.times(3, ri => <div key={ri} style={styles.row}>{this.renderColumns(ri)}</div>);
  }

  render() {
    const { styles } = this;
    return (
      <div style={styles.component}>
        <div style={styles.loader}>
          {this.renderRows()}
        </div>
        <div>
          {this.props.message}
        </div>
      </div>
    );
  }
}
@alexlande
Copy link
Contributor

This is a known issue when using Radium with React 15, unfortunately. See facebook/react#6467 (comment) for details. We're planning to replace inline styling with generated CSS to work around this (and other issues), see #788.

Closing this one because we've got a number of other tickets about it, but please chime in on #788 if you have any thoughts.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants