Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props.edit is always false, even when set to true. #12

Open
PAK90 opened this issue Jan 21, 2017 · 7 comments
Open

Props.edit is always false, even when set to true. #12

PAK90 opened this issue Jan 21, 2017 · 7 comments

Comments

@PAK90
Copy link

PAK90 commented Jan 21, 2017

Weird bug; the only way I can set the 'edit' prop to true is by not including it in my settings object. If I include it, even when it's set to true, it appears as false. I think it's due to this line which overrides the value to 'false' when props.edit == true, since the typeof it is not undefined.

@ashishd751
Copy link

Yes , @PAK90 , i am facing a similar issue.
I want to dynamically set the edit flag, bt since the flag gets overridden , i am unable to do so.
Has anyone found a work-around for that ?
Or, has this bug been fixed ?

@knnemade99
Copy link

knnemade99 commented Apr 27, 2017

@PAK90 and @ashishd751
You can use property edit={undefined} for editing the react stars.
And property edit={false} or edit={true} for not editing the react stars.

So that you can change the edit functionality dynamically using edit property.

@raulfdm
Copy link

raulfdm commented Aug 23, 2017

@knnemade99 works as you said, but is it a bug, isn't it?

@ashishd751
Copy link

ashishd751 commented Aug 23, 2017 via email

@olegberman
Copy link
Contributor

Thank you - I will take a look soon.

@vaibhavvv9
Copy link

vaibhavvv9 commented Jul 7, 2021

<ReactStars size={40}
count={4}
value={rating}
edit={isEdit ? undefined : false}
onChange={handleRating}
/>
@knnemade99 I am trying to change edit conditionally using this way but it is not working. I have tried every permutation combination with undefined, true & false but it is still not working. Can you please help me ?

@knnemade99
Copy link

knnemade99 commented Jul 14, 2021

@vaibhavvv9
Try something like

const isEditProp = isEdit ? undefiend : true;

Then use above variable in following code

<ReactStars size={40}

count={4}
value={rating}
edit={isEditProp}
onChange={handleRating}
/>

In this way if isEdit is true, it will be editable and if isEdit is false, it wont be editable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants