mattermost-mobile/app/utils/bottom_sheet/bottom_sheet.ts
Mattermost Build e57f144543
[MM-38683] Android Initialisation Bug + BottomSheet Correction (#5685) (#5699)
* Fixes various init bugs for android

* Ignores Type Error

* MM-38683: Removes 'cancel' button.

* MM-38683: Removes some 'hideCancel' props.

* Android bottom margin

* Update options modal style

Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
(cherry picked from commit b36dbf9b34)

Co-authored-by: Shaz Amjad <shaz.amjad@mattermost.com>
2021-09-28 11:35:05 -03:00

26 lines
887 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/* eslint-disable @typescript-eslint/no-explicit-any */
import {showModalOverCurrentContext} from '@actions/navigation';
export default {
showBottomSheetWithOptions: (options: any, callback: any) => {
function itemAction(index: any) {
callback(index);
}
const items = options.options.splice(0, options.cancelButtonIndex).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,
}));
showModalOverCurrentContext('OptionsModal', {
title: options.title || '',
items,
subtitle: options.subtitle,
});
},
};