[FIX] UIKit with only one block (#2022)
* [FIX] Message with only one block * [FIX] Update headers Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
8445bafad6
commit
91ff6e48d5
|
@ -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 }) => {
|
||||
|
|
Loading…
Reference in New Issue