d-a-n / react-native-multiple-choice

A cross-platform (iOS / Android) single and multiple-choice React Native component.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

use two multiple-choice in one page

kaola8246 opened this issue · comments

when use two multiple-choice in one page, one is setted to maxSelectedOptions=1 and other is setted to maxSelectedOptions =5 ,then the two multiple-choice both have maxSelectedOptions =5 actions , is there some setting issues?

I have make it work will by fix the bug, i add a new state of maxSelectedOptions, in the state pool,and init it,

commented

@kaola8246 Thanks for reporting and fixing this. Please make a pull request and I'm happy to merge it.

@d-a-n im sorry, i think i have not fix it , when i test it , i find it still not right , Could you give me some advise?

@d-a-n at last , i have fixed it , just change the line 22 just like this var tempSelectedOptions = []; if(this.props.selectedOptions) { tempSelectedOptions = this.props.selectedOptions.slice(0) } this.state = { dataSource: ds.cloneWithRows(this.props.options), selectedOptions: tempSelectedOptions, }; this will copy a new selectedOptions to the companent. then it been fixed

commented

@kaola8246 I can't reproduce this behavior. Can you share the code that is not working for you?

iphone_6_-_iphone_6___ios_9_2__13c75_