Can't style third party components using Glamorous

江枫思渺然 提交于 2019-12-11 19:31:44

问题


The documented way of using Glamorous to style third party components doesn't work. I have tried it with a few and will show a example.

In my style file:

import InfiniteCalendar from 'react-infinite-calendar'
export const Calendar = glamorous(InfiniteCalendar)({width:1200,height:330});

Usage:

import { Calendar } from '../../styles/style';
const theme = {
    accentColor: '#fe490d',
    floatingNav: { background: 'rgba(56, 87, 138, 0.94)', chevron: '#ff7b50', color: '#FFF' },
    headerColor: '#fe490d',
    selectionColor: '#ff5720',
    textColor: { active: '#FFF', default: '#333'},
    todayColor: '#ff7b50',
    weekdayColor: '#ff5720'
  };
<Calendar selected={this.state.startDate} 
theme={theme}
minDate={today} 
maxDate={new Date(new Date().setFullYear(new Date().getFullYear() + 1))} 
onSelect={(e) => this.selectDate(e)}/>

I took out the calendar properties of width={1200} height={330}

What actually occurs is that there are no errors but the calendar appears with every single default setting - the height and width are wrong, the theme is ignored, the max and min dates are wrong, etc. The Typescript object shown for Calendar is GlamorousComponent

What am I doing wrong here, I have followed the recommended method for this? Do I need to inject the properties in some different sort of way? It would be good to know how to do this because currently I can't use Glamorous for any third party component styling.

来源:https://stackoverflow.com/questions/54216560/cant-style-third-party-components-using-glamorous

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!