Skip to content

Commit

Permalink
[actions]: add support when dealing with array upon Scenes defined in…
Browse files Browse the repository at this point in the history
…to render method
  • Loading branch information
alextkd committed Jun 8, 2016
1 parent 9565ff0 commit 5d0c37d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions 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 @@ -96,10 +96,22 @@ class Actions {
...staticProps,
...componentProps,
};
let list = children || [];
let list = children || [],
normalized = [];
if (!(list instanceof Array)) {
list = [list];
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 5d0c37d

Please sign in to comment.