diff --git a/__tests__/containers/UIKit/__snapshots__/UiKitModal.stories.storyshot b/__tests__/containers/UIKit/__snapshots__/UiKitModal.stories.storyshot index af85f1bde..745990127 100644 --- a/__tests__/containers/UIKit/__snapshots__/UiKitModal.stories.storyshot +++ b/__tests__/containers/UIKit/__snapshots__/UiKitModal.stories.storyshot @@ -14,6 +14,8 @@ exports[`Storyshots UIKit/UiKitModal Modal - Images 1`] = `"{\\"type\\":\\"RCTSc exports[`Storyshots UIKit/UiKitModal Modal - Input with error 1`] = `"{\\"type\\":\\"RCTScrollView\\",\\"props\\":{\\"style\\":[{\\"flex\\":1,\\"backgroundColor\\":\\"#fff\\"},{\\"paddingHorizontal\\":16}],\\"keyboardShouldPersistTaps\\":\\"always\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{},\\"children\\":null}]}"`; +exports[`Storyshots UIKit/UiKitModal Modal - Multi Select Input 1`] = `"{\\"type\\":\\"RCTScrollView\\",\\"props\\":{\\"style\\":[{\\"flex\\":1,\\"backgroundColor\\":\\"#fff\\"},{\\"paddingHorizontal\\":16}],\\"keyboardShouldPersistTaps\\":\\"always\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{},\\"children\\":null}]}"`; + exports[`Storyshots UIKit/UiKitModal Modal - Multilne with error 1`] = `"{\\"type\\":\\"RCTScrollView\\",\\"props\\":{\\"style\\":[{\\"flex\\":1,\\"backgroundColor\\":\\"#fff\\"},{\\"paddingHorizontal\\":16}],\\"keyboardShouldPersistTaps\\":\\"always\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{},\\"children\\":null}]}"`; exports[`Storyshots UIKit/UiKitModal Modal - Section and Accessories 1`] = `"{\\"type\\":\\"RCTScrollView\\",\\"props\\":{\\"style\\":[{\\"flex\\":1,\\"backgroundColor\\":\\"#fff\\"},{\\"paddingHorizontal\\":16}],\\"keyboardShouldPersistTaps\\":\\"always\\"},\\"children\\":[{\\"type\\":\\"View\\",\\"props\\":{},\\"children\\":null}]}"`; diff --git a/app/containers/UIKit/UiKitMessage.stories.tsx b/app/containers/UIKit/UiKitMessage.stories.tsx index 696732047..8b3a14ea2 100644 --- a/app/containers/UIKit/UiKitMessage.stories.tsx +++ b/app/containers/UIKit/UiKitMessage.stories.tsx @@ -252,6 +252,47 @@ export const SectionMultiSelect = () => emoji: true } } + }, + { + type: 'section', + text: { + type: 'mrkdwn', + text: 'Section + select with value undefined' + }, + accessory: { + type: 'multi_static_select', + appId: 'app-id', + blockId: 'block-id', + actionId: 'action-id', + initialValue: undefined, + options: [ + { + value: 'option_1', + text: { + type: 'plain_text', + text: 'lorem ipsum 🚀', + emoji: true + } + }, + { + value: 'option_2', + text: { + type: 'plain_text', + text: 'lorem ipsum 🚀', + emoji: true + } + } + ], + placeholder: { + type: 'plain_text', + text: 'Select an item' + }, + label: { + type: 'plain_text', + text: 'Label', + emoji: true + } + } } ]); SectionMultiSelect.storyName = 'Section + Multi Select'; diff --git a/app/containers/UIKit/UiKitModal.stories.tsx b/app/containers/UIKit/UiKitModal.stories.tsx index a4883e946..e6aa083a6 100644 --- a/app/containers/UIKit/UiKitModal.stories.tsx +++ b/app/containers/UIKit/UiKitModal.stories.tsx @@ -174,7 +174,12 @@ export const ModalFormInput = () => text: 'Set a date', emoji: true } - }, + } + ]); +ModalFormInput.storyName = 'Modal - Form Input'; + +export const ModalMultiSelect = () => + UiKitModal([ { type: 'input', element: { @@ -200,10 +205,48 @@ export const ModalFormInput = () => type: 'plain_text', text: 'Share with...', emoji: true + }, + hint: { + type: 'plain_text', + text: 'Initial Value Undefined', + emoji: true + } + }, + { + type: 'input', + element: { + type: 'multi_static_select', + initialValue: [1], + options: [ + { + text: { + type: 'plain_text', + text: 'John' + }, + value: 1 + }, + { + text: { + type: 'plain_text', + text: 'Dog' + }, + value: 2 + } + ] + }, + label: { + type: 'plain_text', + text: 'Share with...', + emoji: true + }, + hint: { + type: 'plain_text', + text: 'Initial Value as John', + emoji: true } } ]); -ModalFormInput.storyName = 'Modal - Form Input'; +ModalMultiSelect.storyName = 'Modal - Multi Select Input'; export const ModalFormTextArea = () => UiKitModal([ diff --git a/app/containers/UIKit/index.tsx b/app/containers/UIKit/index.tsx index d03efec1c..a21a32823 100644 --- a/app/containers/UIKit/index.tsx +++ b/app/containers/UIKit/index.tsx @@ -138,7 +138,7 @@ class MessageParser extends UiKitParserMessage { multiStaticSelect(element: IElement, context: BlockContext) { const [{ loading, value }, action] = useBlockContext(element, context); - const valueFiltered = element.options?.filter(option => value.includes(option.value)); + const valueFiltered = element?.options?.filter(option => value?.includes(option.value)); return ; }