10 examples of 'react select disabled' in JavaScript

Every line of 'react select disabled' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
536selectDisabled: function selectDisabled() {
537 return this.disabled || (this.elForm || {}).disabled;
538},
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

58setDisabledState?(isDisabled: boolean): void {
59 this._disabled = isDisabled;
60}
229handleChose (event, index, disabled) {
230 if (disabled) {
231 event.stopPropagation()
232 return
233 }
234 let returnValue: any[] = []
235 if (this.props.multiple) {
236 event.stopPropagation()
237 if (this.mulOptionChosen.indexOf(index) === -1) {
238 this.mulOptionChosen.push(index)
239 this.setState({
240 optionChosen: this.mulOptionChosen,
241 selected : true
242 })
243 this.mulOptionChosen.forEach((item) => {
244 const child = this.propsSelectOption[item] || {}
245 const value = child.props.value
246 const label = child.props.label
247 returnValue = this.prepareReturnValue(returnValue, value, label)
248 })
249 }
250 } else {
251 const optionChosen: any[] = []
252 optionChosen.push(index)
253 this.setState({
254 optionChosen,
255 selected : true
256 })
257 let chosenSpan = ''
258 if (optionChosen.length > 0) {
259 const chosenIndex = optionChosen[0]
260 const propsChildren = this.props.children || []
261 const chosenChild = propsChildren[chosenIndex] || {label: ''}
262 chosenSpan = chosenChild.label || (chosenChild.props || {}).children || ''
263 }
264 if (this.props.filterable) {
265 this.setState({
266 inputValue: chosenSpan
267 })
268 }
269 optionChosen.forEach((item) => {
270 const child = this.propsSelectOption[item] || {}
271 const value = child.value
272 const label = child.label
273 returnValue = this.prepareReturnValue(returnValue, value, label)
274 })
275 }
276 this.props.onChange && this.props.onChange(returnValue)
277 return returnValue
278}
62set disabled(value) {
63 this._disabled = transform.booleanAttr(value);
64 this._reflectAttribute('disabled', this._disabled);
65
66 this.trigger('coral-select-item:_disabledchanged');
67}
128function isComponentDisabled(): boolean {
129 return Boolean(source_select_box.disabled);
130}
46public select(newValue: T) {
47 this.setState({ newValue, open: false }, () => this.props.onChange(newValue));
48}
179setDisabledState(disabled: boolean) {
180 this.formDisabled = disabled;
181}
184select(index: any, event?: any): void {
185 if (event) event.stopPropagation();
186 if (this.isMulti) this.selected = [...this.selected, this.filteredSelection[index]];
187 else {
188 if (this.selected) {
189 this.formatedSelection.push(this.selected);
190 this.filteredSelection.push(this.selected);
191 }
192 this.selected = this.filteredSelection[index];
193 this.active = false;
194 }
195
196 // TODO: Find a better option this is just a temp fix
197 this.formatedSelection.splice(this.formatedSelection.findIndex(item => this.filteredSelection[index][this.key] === item[this.key]), 1);
198 this.filteredSelection.splice(index, 1);
199
200 this.search = '';
201 this.propagateChange(this.selected);
202}
141select(ev) {
142 // onSelect callback
143 if (this.props.onSelect && ev.target.tagName === 'A') {
144 this.props.onSelect(ev.target.getAttribute('data-mui-value'));
145 }
146
147 // close menu
148 if (!ev.defaultPrevented) this.close();
149}
67static getDerivedStateFromProps(nextProps, prevState) {
68 if (nextProps.initial !== prevState.initial)
69 return {
70 value: nextProps.initial,
71 initial: nextProps.initial
72 };
73 return null;
74}

Related snippets