我可以使用样式化的组件来设置响应通知的样式吗?
Can I use styled components to style react-notifications?
我在项目中使用了样式化组件,并且刚刚添加了反应通知。当我尝试使用样式化组件来设置我的 NotificationContainer 及其后代的样式时。相反,我得到了一个未设置样式的基础 NotificationContainer。是我弄错了,还是 react-notifications 根本不兼容?
import React, { Component } from 'react'
import {NotificationContainer, NotificationManager} from 'react-notifications';
import styled from "styled-components";
const StyledNotificationContainer = styled(NotificationContainer)`
background-color: orange;
`
export default class Example extends Component{
render(){
return (
<StyledNotificationContainer />
)
}
componentDidMount(){
NotificationManager.info('Example')
}
}
所以,styled-components docs says that you can style any third party component using it as long as this components can consume className
props (this is how styled is doing it's magic). react-notification docs says that NotificationContainer
accepts only two props, and none of them is className .
你不能使用它是不兼容。
我在项目中使用了样式化组件,并且刚刚添加了反应通知。当我尝试使用样式化组件来设置我的 NotificationContainer 及其后代的样式时。相反,我得到了一个未设置样式的基础 NotificationContainer。是我弄错了,还是 react-notifications 根本不兼容?
import React, { Component } from 'react'
import {NotificationContainer, NotificationManager} from 'react-notifications';
import styled from "styled-components";
const StyledNotificationContainer = styled(NotificationContainer)`
background-color: orange;
`
export default class Example extends Component{
render(){
return (
<StyledNotificationContainer />
)
}
componentDidMount(){
NotificationManager.info('Example')
}
}
所以,styled-components docs says that you can style any third party component using it as long as this components can consume className
props (this is how styled is doing it's magic). react-notification docs says that NotificationContainer
accepts only two props, and none of them is className .
你不能使用它是不兼容。