Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disable options in Select component (Settings API)

Hi, I'm working on my clockface settings and I need to disable some options in a select field.

 

I tried by filtering options and displaying only those ones are enabled, but due to the fact that the Select component manage its value using the index of the option and not his value (Link to docs), this cause a lot of problem:

 

TypeError: Cannot read property 'name' of undefined

 

 

I tried to crack down on the problem by changing manually the indexes or by using the onSelection method but the method is not documented anywhere and I decided to find another solution.

 

I tried different solutions, using renderItem to manually handle the selection, displaying only the enabled options, edit the payload and set manually the values. None of them seems to work.

 

So, someone know how I can disable some options, so the users can select them? Thanks

 

Something like this (Nothing is enabled, Weather and Battery are disabled):

Fitbit screenshot.PNG

Best Answer
0 Votes
1 REPLY 1

Hi, I met same problem now and I resolved this problem.

I hope you have resolved this problem, but I wrote the solution because other people may get same problem.

 

A part of code of sample code ( https://dev.fitbit.com/build/reference/settings-api/) has a mistake. 

label={`Selection`}

This code should be changed to `label="Selection"`. I don't know why but I guess jsx compiler may translate {`Selection`} to Selection.name according to the error message.

 

If this solution cannot resolve your problem. Could you please share a part of your code?

Thank you.

Best Answer