Giter Club home page Giter Club logo

Comments (6)

raveclassic avatar raveclassic commented on June 2, 2024

Check the order of imports in the file where you render ThemeProvider. This common error happens because if you import App component which imports Button component after importing './theme-b/SuccessButton.scss' then default Button style will override styles from context. This is an expected behavior.

If the order is ok then please provide more info or please make a complete gist.

from react-css-themr.

idangozlan avatar idangozlan commented on June 2, 2024

Well, i'm not importing the App/Button at all, im using it as a children prop:

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { ThemeProvider } from 'react-css-themr';

import { theme as whiteTheme } from '../../theme/whiteTheme/index';

const currentTheme = { ...whiteTheme };

export default class App extends Component {
  static propTypes = {
    children: PropTypes.object.isRequired,
  };

  render() {
    return (
      <ThemeProvider theme={currentTheme}>
        <div>
          {this.props.children}
        </div>
      </ThemeProvider>
    );
  }
}

For this example, white theme is the style that should override the components' css

from react-css-themr.

raveclassic avatar raveclassic commented on June 2, 2024

@idangozlan What is the order of imports of both App and Button in host component? Could you please provide a minimal representational gist/repo? The problem is no doubt in the order of imports but the info provided is not enough to find the place of this error.

from react-css-themr.

idangozlan avatar idangozlan commented on June 2, 2024

Finally, it was happen because i've used the ThemeProvider by wrapping <App> component (according to the Readme.md), but since it's complex and isomorphic app, I had to define it one my client.js file and my server.js files, specific to my project, those files contains the rendering of the react-dom.

from react-css-themr.

austb25 avatar austb25 commented on June 2, 2024

@idangozlan I am having the same issue. Can you post your solution?

from react-css-themr.

idangozlan avatar idangozlan commented on June 2, 2024

I had to import part of the scss from routes files ( or route point), you can try also from the root App component, but it was important to do the import on the very first part of your app.

from react-css-themr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.