[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
|
blocks, id: mid, rid, blockAction
|
||||||
}) => {
|
}) => {
|
||||||
if (blocks && blocks.length > 0) {
|
if (blocks && blocks.length > 0) {
|
||||||
const [, secondBlock] = blocks;
|
const appId = blocks[0]?.appId || '';
|
||||||
const { appId = '' } = secondBlock;
|
|
||||||
return React.createElement(
|
return React.createElement(
|
||||||
messageBlockWithContext({
|
messageBlockWithContext({
|
||||||
action: async({ actionId, value, blockId }) => {
|
action: async({ actionId, value, blockId }) => {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ModalBlockView extends React.Component {
|
||||||
return {
|
return {
|
||||||
title: textParser([title]),
|
title: textParser([title]),
|
||||||
...themedHeader(theme),
|
...themedHeader(theme),
|
||||||
headerLeft: (
|
headerLeft: close ? (
|
||||||
<CustomHeaderButtons>
|
<CustomHeaderButtons>
|
||||||
<Item
|
<Item
|
||||||
title={textParser([close.text])}
|
title={textParser([close.text])}
|
||||||
|
@ -76,8 +76,8 @@ class ModalBlockView extends React.Component {
|
||||||
testID='close-modal-uikit'
|
testID='close-modal-uikit'
|
||||||
/>
|
/>
|
||||||
</CustomHeaderButtons>
|
</CustomHeaderButtons>
|
||||||
),
|
) : null,
|
||||||
headerRight: (
|
headerRight: submit ? (
|
||||||
<CustomHeaderButtons>
|
<CustomHeaderButtons>
|
||||||
<Item
|
<Item
|
||||||
title={textParser([submit.text])}
|
title={textParser([submit.text])}
|
||||||
|
@ -86,7 +86,7 @@ class ModalBlockView extends React.Component {
|
||||||
testID='submit-modal-uikit'
|
testID='submit-modal-uikit'
|
||||||
/>
|
/>
|
||||||
</CustomHeaderButtons>
|
</CustomHeaderButtons>
|
||||||
)
|
) : null
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class ModalBlockView extends React.Component {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
const oldData = prevProps.navigation.getParam('data', {});
|
const oldData = prevProps.navigation.getParam('data', {});
|
||||||
const newData = navigation.getParam('data', {});
|
const newData = navigation.getParam('data', {});
|
||||||
if (!isEqual(oldData, newData)) {
|
if (oldData.viewId !== newData.viewId) {
|
||||||
navigation.push('ModalBlockView', { data: newData });
|
navigation.push('ModalBlockView', { data: newData });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,12 +148,14 @@ class ModalBlockView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleUpdate = ({ type, ...data }) => {
|
handleUpdate = ({ type, ...data }) => {
|
||||||
|
const { navigation } = this.props;
|
||||||
if ([MODAL_ACTIONS.ERRORS].includes(type)) {
|
if ([MODAL_ACTIONS.ERRORS].includes(type)) {
|
||||||
const { errors } = data;
|
const { errors } = data;
|
||||||
this.setState({ errors });
|
this.setState({ errors });
|
||||||
} else {
|
} else {
|
||||||
this.setState({ data });
|
this.setState({ data });
|
||||||
}
|
}
|
||||||
|
navigation.setParams({ data });
|
||||||
};
|
};
|
||||||
|
|
||||||
cancel = async({ closeModal }) => {
|
cancel = async({ closeModal }) => {
|
||||||
|
|
Loading…
Reference in New Issue