From b426fbb54173f181831e4772718d3baf64659c07 Mon Sep 17 00:00:00 2001 From: Mustafa Buyukcelebi Date: Tue, 19 Feb 2019 11:42:02 +0300 Subject: [PATCH] Fixed post dropdown issue --- .../dropdownButton/view/dropdownButtonView.js | 6 +++--- .../container/postDropdownContainer.js | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/dropdownButton/view/dropdownButtonView.js b/src/components/dropdownButton/view/dropdownButtonView.js index 9e360ee9a..bcb4613cf 100644 --- a/src/components/dropdownButton/view/dropdownButtonView.js +++ b/src/components/dropdownButton/view/dropdownButtonView.js @@ -61,7 +61,7 @@ const DropdownButtonView = ({ dropdownTextStyle={[dropdownTextStyle || styles.dropdownText]} dropdownTextHighlightStyle={styles.dropdownTextHighlight} options={options} - onSelect={e => onSelect && onSelect(e)} + onSelect={e => onSelect && onSelect(e, options[e])} defaultIndex={selectedOptionIndex} defaultValue={defaultText} renderSeparator={() => null} @@ -76,8 +76,8 @@ const DropdownButtonView = ({ name={!iconName ? 'arrow-drop-down' : iconName} /> - ) : isHasChildIcon && ( - + ) : ( + isHasChildIcon && )} {!children && !isHasChildIcon && ( diff --git a/src/components/postDropdown/container/postDropdownContainer.js b/src/components/postDropdown/container/postDropdownContainer.js index 263f65cc1..aeba8cb15 100644 --- a/src/components/postDropdown/container/postDropdownContainer.js +++ b/src/components/postDropdown/container/postDropdownContainer.js @@ -52,11 +52,11 @@ class PostDropdownContainer extends PureComponent { }; // Component Functions - _handleOnDropdownSelect = async (index) => { + _handleOnDropdownSelect = async (index, item) => { const { content, dispatch, intl } = this.props; - switch (index) { - case '0': + switch (item) { + case 'COPY LINK': await writeToClipboard(getPostUrl(content.url)); this.alertTimer = setTimeout(() => { dispatch( @@ -70,24 +70,24 @@ class PostDropdownContainer extends PureComponent { }, 300); break; - case '1': + case 'REBLOG': this.actionSheetTimer = setTimeout(() => { this.ActionSheet.show(); this.actionSheetTimer = 0; }, 100); break; - case '2': + case 'REPLY': this._replyNavigation(); break; - case '3': + case 'SHARE': this.shareTimer = setTimeout(() => { this._share(); this.shareTimer = 0; }, 500); break; - case '4': + case 'ADD TO BOOKMARKS': this._addToBookmarks(); break; @@ -106,7 +106,9 @@ class PostDropdownContainer extends PureComponent { }; _addToBookmarks = () => { - const { content, currentAccount, dispatch, intl } = this.props; + const { + content, currentAccount, dispatch, intl, + } = this.props; addBookmark(currentAccount.name, content.author, content.permlink) .then(() => { dispatch(