New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: composition is only allowed when selector is single :local class name not in ".raised", ".raised" is weird #1278
Comments
I also have this problem, under almost identical circumstances. |
same problem here. just adding a simple Button from docs example after using create-react-app, and getting this error. |
+1 Did a create-react-app command and then followed the docs to add a button. |
This helped me out: #1054 (comment) |
I can get around the error by importing the raw component.
However the problem I have now is no styles are applied to the button. I have the ThemeProvider configured w/ the generated theme.js from
Then I have a simple component as a test:
The button renders w/ no styles, but if clicked the ripple effect shows. I'm guessing the This may need to be another issue, but I've followed the same path as @mulyoved |
Ok I got this to work. All that was necessary was to change my import to be:
The initial error as reported by @mulyoved was caused by importing per the docs:
This imports a bundled module and includes CSS modules that don't play nice w/ create-react-app. Importing the default export directly from the module file includes the theme but not the CSS modules. My issue was caused by following the Raw Component import instructions in the README: https://github.com/react-toolbox/react-toolbox#raw-component This imports the component minus any theme functionality. I think the docs could be clearer on this so I'll create another issue. |
Update the sample commit code now look like that
No build error, so this is progress But button without style (also can see the ripple effect) |
@mulyoved remove the brackets, those pull in the named export which doesn't have theming.
Here's the relevant source from the component:
You can see how only the default export from the component file has the theme functionality. If you use the {} you end up pulling that named Button export which is just the factory w/ ripple. |
I'm still having an issue here. Using I followed the instructions on setting up postcss/webpack. Any ideas? |
Considering that theres some many people still having issues with this, maybe it would make sense to reopen it? :) |
I also have the same problem. I am using mozilla/neutrino for the setup. |
Still seeing this problem following the documentation from a create-react-app skeleton. |
Yes had the same issue following the docs, can you either FIX the code to match the docs or UPDATE the docs to match the code .... When you import as suggested (see below) in this issue - it has no errors, BUT no styles ...
import { RadioGroup, RadioButton } from 'react-toolbox/lib/radio';
and so on .... |
Finally I found solution. In my case webpack was configured to use css-modules only for So I just added react-toolbox into app styles pipeline and all stuff start working as expected in docs. // App styles
{
test: /\.css$/,
include: [
path.join(__dirname, 'src'),
+ path.join(__dirname, 'node_modules/react-toolbox'),
],
use: [
...,
{
loader: 'css-loader',
options: {
modules: true,
...
},
},
...
],
},
// Vendor styles should not be processed by css-modules
{
test: /\.css$/,
include: [path.join(__dirname, 'node_modules')],
+ exclude: [path.join(__dirname, 'node_modules/react-toolbox')],
use: [
...,
{
loader: 'css-loader',
options: {
modules: false,
...
},
},
...
],
}, Also be noticed that latest css-loader depends on fresh |
@gbiryukov Where is that file located? I don't see any App styles file to modify. |
@Remixt it is webpack config, not styles file. Usually it is located in project root and has name |
I know this is an old issue, but I though I'd post my solution here as well. Using the latest create-react-app and ejecting the app, I had to change my config that loads the css {
test: /\.css$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
+ modules: true,
},
},
],
}, |
Tried all of the above methods. The one @alexlapinski proposed helped me get some of styles and animations, but it still doesn't load all of them |
Followed instructions from
Used "Create react app"
using
Added
Added script
npm run toolbox
confirmed created correctly
Edit App.js
Add ThemeProvider
Run
npm run start
Get Error
See full repository that duplicates the problem https://github.com/mulyoved/toolbox-sample
The text was updated successfully, but these errors were encountered: