Skip to content

Commit

Permalink
Fix issue #2: antd Select cannot work when using Cron component
Browse files Browse the repository at this point in the history
  • Loading branch information
xrutayisire committed Nov 12, 2020
1 parent 15b8803 commit 866ba04
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/components/CustomSelect.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useMemo, useCallback, useEffect, useRef } from 'react'
import React, { useMemo, useCallback, useRef } from 'react'
import Select from 'antd/lib/select'

import { CustomSelectProps, Clicks } from '../types'
Expand All @@ -24,14 +24,6 @@ export default function CustomSelect(props: CustomSelectProps) {
...otherProps
} = props

useEffect(() => {
Array.from(
document.getElementsByClassName('ant-select-selection-search-input')
).forEach((element: Element) => {
element.setAttribute('readonly', 'readonly')
})
}, [])

const stringValue = useMemo(() => {
if (value && Array.isArray(value)) {
return value.map((value: number) => value.toString())
Expand Down Expand Up @@ -255,7 +247,9 @@ export default function CustomSelect(props: CustomSelectProps) {

return (
<Select
mode='tags'
// Use 'multiple' instead of 'tags‘ mode
// cf: Issue #2
mode='multiple'
allowClear={!readOnly}
virtual={false}
open={readOnly ? false : undefined}
Expand Down

0 comments on commit 866ba04

Please sign in to comment.