fmoo / react-typeahead

Pure react-based typeahead and typeahead-tokenizer
ISC License
677 stars 232 forks source link

Can I use customClasses with styled components? #253

Open ZeroCho opened 6 years ago

ZeroCho commented 6 years ago
<StyledTypeahead
                id="brand"
                options={lower.brands}
                maxVisible={5}
                ref={(c) => { this.typeahead = c; }}
                onOptionSelected={this.onBrandSelected}
                onBlur={this.onBlur}
                onFocus={this.onFocus}
                onKeyDown={this.onKeyDown}
                placeholder={lower.fetchingBrand ? '브랜드 로딩중...' : '브랜드명을 입력하세요'}
                value={lower.brand}
                customClasses={{
                  input: cx('input', this.state.inputError === 'brand' && 'error', lower.brand && 'bold'),
                  results: cx('results'),
                }}
/>

I managed to use react-typeahead with styled-components by styled(Typeahead), but I don't know whether i can use styled-components with customClasses(input and results). Currently, I'm using CSS Modules(with classnames package) and I want to change to styled-components.

I'm thinking about using it with injectGlobal. Is this only way to achieve my goal?