diff --git a/ReactNativeTodos/app/components/Lists.js b/ReactNativeTodos/app/components/Lists.js index fb0cc9b..8b4a410 100644 --- a/ReactNativeTodos/app/components/Lists.js +++ b/ReactNativeTodos/app/components/Lists.js @@ -27,7 +27,7 @@ let Lists = React.createClass({ }, handleMoreClick(list) { - let options = ["Make Private", "Delete List", "Cancel"]; + let options = ["Make Private", "Change List Name", "Delete List", "Cancel"]; if (list.userId) { options[0] = "Make Public"; @@ -35,16 +35,18 @@ let Lists = React.createClass({ ActionSheetIOS.showActionSheetWithOptions({ options: options, - cancelButtonIndex: 2, - destructiveButtonIndex: 1, + cancelButtonIndex: options.length - 1, + destructiveButtonIndex: options.length - 2, }, (buttonIndex) => { - if (buttonIndex === 1) { + if (buttonIndex === options.length - 2) { this.props.deleteList(list); } else if (list.userId && buttonIndex === 0) { this.props.changePublicity(list, false); } else if (buttonIndex === 0) { this.props.changePublicity(list, true); + } else if (buttonIndex === 1) { + this.props.changeListName(list); } }); }, diff --git a/ReactNativeTodos/app/components/ListsContainer.js b/ReactNativeTodos/app/components/ListsContainer.js index c85f45b..c9fd276 100644 --- a/ReactNativeTodos/app/components/ListsContainer.js +++ b/ReactNativeTodos/app/components/ListsContainer.js @@ -83,6 +83,21 @@ let ListsContainer = React.createClass({ ); }, + handleChangeListName(list) { + AlertIOS.prompt( + 'Change List Name', + list.name, + [ + {text: 'Cancel'}, + {text: 'Save', onPress: (name) => { + this.props.navigator.pop(); + let mod = {$set: {name: name}} + ddp.call('Lists.update', [list._id, mod]); + }}, + ] + ); + }, + render() { return ( ); }