Skip to content

Commit

Permalink
Merge pull request #793 from alextkd/master
Browse files Browse the repository at this point in the history
[actions]: add support when dealing Scenes defined using array map
  • Loading branch information
aksonov committed Jun 9, 2016
2 parents 29a40a7 + a6d2174 commit b43b714
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Actions {
assert(key, 'unique key should be defined ');
assert(
reservedKeys.indexOf(key) === -1,
`'${key}' is not allowed as key name. Reserved keys: [${reservedKeys.join(', ')}]`,
`'${key}' is not allowed as key name. Reserved keys: [${reservedKeys.join(', ')}]`
);
const { children, component, ...staticProps } = root.props;
let type = root.props.type || (parentProps.tabs ? JUMP_ACTION : PUSH_ACTION);
Expand Down Expand Up @@ -97,9 +97,21 @@ class Actions {
...componentProps,
};
let list = children || [];
const normalized = [];
if (!(list instanceof Array)) {
list = [list];
}
list.forEach(item => {
if (item instanceof Array) {
item.forEach(it => {
normalized.push(it);
});
} else {
normalized.push(item);
}
});
list = normalized; // normalize the list of scenes

const condition = el => (!el.props.component && !el.props.children &&
(!el.props.type || el.props.type === REFRESH_ACTION));
// determine sub-states
Expand Down

0 comments on commit b43b714

Please sign in to comment.