Skip to content
Snippets Groups Projects
Unverified Commit 91ff6e48 authored by Djorkaeff Alexandre's avatar Djorkaeff Alexandre Committed by GitHub
Browse files

[FIX] UIKit with only one block (#2022)


* [FIX] Message with only one block

* [FIX] Update headers

Co-authored-by: default avatarDiego Mello <diegolmello@gmail.com>
parent 8445bafa
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,7 @@ const Blocks = React.memo(({
blocks, id: mid, rid, blockAction
}) => {
if (blocks && blocks.length > 0) {
const [, secondBlock] = blocks;
const { appId = '' } = secondBlock;
const appId = blocks[0]?.appId || '';
return React.createElement(
messageBlockWithContext({
action: async({ actionId, value, blockId }) => {
......
......@@ -67,7 +67,7 @@ class ModalBlockView extends React.Component {
return {
title: textParser([title]),
...themedHeader(theme),
headerLeft: (
headerLeft: close ? (
<CustomHeaderButtons>
<Item
title={textParser([close.text])}
......@@ -76,8 +76,8 @@ class ModalBlockView extends React.Component {
testID='close-modal-uikit'
/>
</CustomHeaderButtons>
),
headerRight: (
) : null,
headerRight: submit ? (
<CustomHeaderButtons>
<Item
title={textParser([submit.text])}
......@@ -86,7 +86,7 @@ class ModalBlockView extends React.Component {
testID='submit-modal-uikit'
/>
</CustomHeaderButtons>
)
) : null
};
}
......@@ -136,7 +136,7 @@ class ModalBlockView extends React.Component {
const { navigation } = this.props;
const oldData = prevProps.navigation.getParam('data', {});
const newData = navigation.getParam('data', {});
if (!isEqual(oldData, newData)) {
if (oldData.viewId !== newData.viewId) {
navigation.push('ModalBlockView', { data: newData });
}
}
......@@ -148,12 +148,14 @@ class ModalBlockView extends React.Component {
}
handleUpdate = ({ type, ...data }) => {
const { navigation } = this.props;
if ([MODAL_ACTIONS.ERRORS].includes(type)) {
const { errors } = data;
this.setState({ errors });
} else {
this.setState({ data });
}
navigation.setParams({ data });
};
cancel = async({ closeModal }) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment