Comments (6)
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.
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.
@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.
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.
@idangozlan I am having the same issue. Can you post your solution?
from react-css-themr.
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)
- Receiving/passing ref HOT 7
- When using ExtractTextPlugin it break the app HOT 3
- Default theming example HOT 2
- Possible drop of support of using themr as decorator with TypeScript HOT 3
- Allow a theme composition function as option HOT 2
- Typescript compiler fails when using react css themr with error Default export of the module has or is using private name 'TReactCSSThemrTheme' HOT 3
- Backport switch to `prop-types` package to the v1 branch to add compat with react 16 HOT 5
- Publish a new version with React 16 on npm HOT 3
- Do context theme support tree shaking ?
- Context theming works when app is run but not working when app is built
- mismatch dependancy
- Themr with pure functions HOT 1
- Update to be react 16 compitable HOT 2
- how to override styling in default css for a themed component
- Has this project been abandoned? HOT 1
- Css selector with attribute not working
- Multiple class not working HOT 5
- [QUESTION] Move to Friends of React HOT 5
- Warning on console when using react v16.4 HOT 4
- React-css-themr worked perfectly locally but not worked when used it after publishing it and used it as component lib into other project HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-css-themr.