Skip to content

Commit

Permalink
fix(module: modal): fix no actions would work error. (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guoyuanqiang authored and fisherspy committed Jan 8, 2019
1 parent dae0737 commit 25b7aec
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions components/modal/modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export class Modal extends PopupService {
const config = Object.assign({
title: title,
message: message,
footer: footer ? footer : [{ text: '纭畾' }],
actions: footer ? footer : [{ text: '纭畾' }],
footer: footer,
actions: footer,
platform: platform ? platform : 'ios'
});

Expand Down Expand Up @@ -140,9 +140,9 @@ export class Modal extends PopupService {
let actions;
if (typeof callbackOrActions === 'function') {
actions = [
{ text: '鍙栨秷' },
{ text: 'Cancel' },
{
text: '纭畾',
text: 'OK',
onPress: () => {
getArgs(this, callbackOrActions);
}
Expand All @@ -166,8 +166,8 @@ export class Modal extends PopupService {
title: title,
message: message,
type: type ? type : 'default',
footer: footer ? footer : [{ text: '纭畾' }],
actions: footer ? footer : [{ text: '纭畾' }],
footer: footer,
actions: footer,
platform: platform ? platform : 'ios'
});
const props = Modal._initConfig(config, options);
Expand All @@ -185,8 +185,8 @@ export class Modal extends PopupService {
const footer = getFooter(actions);

const config = Object.assign({
footer: footer ? footer : [{ text: '纭畾' }],
actions: footer ? footer : [{ text: '纭畾' }],
footer: footer,
actions: footer,
platform: platform ? platform : 'ios'
});
const props = Modal._initConfig(config, options);
Expand All @@ -199,7 +199,8 @@ export class Modal extends PopupService {
}

function getFooter(actions) {
return actions.map((button: Action) => {
let action = actions ? actions : [{ text: 'OK', onPress: () => {}}];
return action.map((button: Action) => {
const orginPress = button.onPress || function() {};
button.onPress = () => {
const res = orginPress();
Expand Down

0 comments on commit 25b7aec

Please sign in to comment.