hectahertz / react-native-material-dialog

Material design dialogs for React Native 💬
MIT License
141 stars 55 forks source link

SinglePickerMaterialDialog | Selected item not getting saved #55

Closed sjenit closed 5 years ago

sjenit commented 5 years ago

After selecting an Item in SinglePickerMaterialDialog and pressing "OK" the dialog box disappears. If we open the SinglePickerMaterialDialog again, it shows the first item selected by default instead of last selected item.

Tried changing the same through state as well but it's not working.

In below example, we have passed hardcoded object as "selectedItem". Still it is picking up the 1st object (with key=0) as default selected item.

SinglePickerMaterialDialog colorAccent = '#FD8000' title = { 'Choose Filter Option' } scrolled items = { [{ key: 0, label: 'Assigned to me123' }, { key: 1, label: 'Priority' }, { key: 2, label: 'Unassigned' }, { key: 3, label: 'Everything' }, ] } visible = { this.state.scrolledSinglePickerVisible } selectedItem = { { key: 3, label: 'Everything' } }

onCancel = { () => this.setState({ scrolledSinglePickerVisible: false }) } onOk = { result => { this.setState({ scrolledSinglePickerVisible: false }, () => {}); } } />