forked from Ivasoft/mattermost-mobile
Cancel button restored (#5725)
This commit is contained in:
@@ -113,7 +113,6 @@ export default class AtMention extends React.PureComponent {
|
||||
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
options: [actionText, cancelText],
|
||||
cancelButtonIndex: 1,
|
||||
}, (value) => {
|
||||
if (value !== 1) {
|
||||
this.handleCopyMention();
|
||||
|
||||
@@ -78,7 +78,6 @@ export default class MarkdownCodeBlock extends React.PureComponent {
|
||||
const actionText = formatMessage({id: 'mobile.markdown.code.copy_code', defaultMessage: 'Copy Code'});
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
options: [actionText, cancelText],
|
||||
cancelButtonIndex: 1,
|
||||
}, (value) => {
|
||||
if (value !== 1) {
|
||||
this.handleCopyCode();
|
||||
|
||||
@@ -151,7 +151,6 @@ export default class MarkdownImage extends ImageViewPort {
|
||||
const actionText = formatMessage({id: 'mobile.markdown.link.copy_url', defaultMessage: 'Copy URL'});
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
options: [actionText, cancelText],
|
||||
cancelButtonIndex: 1,
|
||||
}, (value) => {
|
||||
if (value !== 1) {
|
||||
this.handleLinkCopy();
|
||||
|
||||
@@ -137,7 +137,6 @@ export default class MarkdownLink extends PureComponent {
|
||||
const actionText = formatMessage({id: 'mobile.markdown.link.copy_url', defaultMessage: 'Copy URL'});
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
options: [actionText, cancelText],
|
||||
cancelButtonIndex: 1,
|
||||
}, (value) => {
|
||||
if (value !== 1) {
|
||||
this.handleLinkCopy();
|
||||
|
||||
@@ -213,7 +213,7 @@ export default class List extends PureComponent {
|
||||
const moreChannelsText = formatMessage({id: 'more_channels.title', defaultMessage: 'Browse for a Channel'});
|
||||
const newChannelText = formatMessage({id: 'mobile.create_channel', defaultMessage: 'Create a new Channel'});
|
||||
const newDirectChannelText = formatMessage({id: 'mobile.more_dms.title', defaultMessage: 'Add a Conversation'});
|
||||
const cancelText = formatMessage({id: 'mobile.post.cancel', defaultMessage: 'Cancel'});
|
||||
|
||||
const options = [];
|
||||
const actions = [];
|
||||
|
||||
@@ -229,20 +229,14 @@ export default class List extends PureComponent {
|
||||
|
||||
actions.push(this.goToDirectMessages);
|
||||
options.push({text: newDirectChannelText, icon: 'account-plus-outline'});
|
||||
options.push(cancelText);
|
||||
|
||||
const cancelButtonIndex = options.length - 1;
|
||||
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
anchor: this.combinedActionsRef?.current ? findNodeHandle(this.combinedActionsRef.current) : null,
|
||||
options,
|
||||
title: 'Add Channels',
|
||||
subtitle: `To the ${category.display_name} category`,
|
||||
cancelButtonIndex,
|
||||
}, (value) => {
|
||||
if (value !== cancelButtonIndex) {
|
||||
actions[value]();
|
||||
}
|
||||
actions[value]();
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ export default class ChannelInfoHeader extends React.PureComponent {
|
||||
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
options: [actionText, cancelText],
|
||||
cancelButtonIndex: 1,
|
||||
}, (value) => {
|
||||
if (value === 0) {
|
||||
this.handleCopy(text);
|
||||
|
||||
@@ -430,7 +430,6 @@ export default class MoreChannels extends PureComponent {
|
||||
|
||||
BottomSheet.showBottomSheetWithOptions({
|
||||
options,
|
||||
cancelButtonIndex: 3,
|
||||
title: titleText,
|
||||
}, (value) => {
|
||||
let typeOfChannels;
|
||||
|
||||
@@ -11,7 +11,13 @@ export default {
|
||||
callback(index);
|
||||
}
|
||||
|
||||
const items = options.options.splice(0, options.cancelButtonIndex).map((o: string | {icon: string; text: string}, index: any) => ({
|
||||
let items = options.options;
|
||||
|
||||
if (typeof options.cancelButtonIndex === 'number') {
|
||||
items = items.splice(0, options.cancelButtonIndex);
|
||||
}
|
||||
|
||||
items = items.map((o: string | {icon: string; text: string}, index: any) => ({
|
||||
action: () => itemAction(index),
|
||||
text: typeof o === 'string' ? o : o.text,
|
||||
icon: typeof o === 'string' ? null : o.icon,
|
||||
|
||||
Reference in New Issue
Block a user