hectahertz / react-native-material-dialog

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

Bug on not selectedIndex press ok #16

Closed Angelk90 closed 7 years ago

Angelk90 commented 7 years ago

If no item is selected, then press the ok key, the app restarts every time. One possible solution could be that in:

   OnOk = {() => this.props.onOk ({
           SelectedItem: this
           .state
           .Rows [this.state.selectedIndex]
         })}

You must check the value of this.state.selectedIndex guy:

  onOk={() =>
if(this.state.selectedIndex ) != undefined) 
 this.props.onOk({
          selectedItem: this
          .state
          .rows[this.state.selectedIndex],
        }))}

He could not try it again.

hectahertz commented 7 years ago

For a radio button a value should always be selected, and being a controlled component I'd rather leave this logic out of here, feel free to reopen to discuss further about this!