Skip to content

Commit

Permalink
Pass props down to child components (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonnieWest authored and aksonov committed Feb 18, 2017
1 parent f28a26a commit 6526529
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/Reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ function inject(state, action, props, scenes) {
if (action.unmountScenes) {
resetHistoryStack(state.children[ind]);
}

state.children[ind] = getInitialState(
props,
scenes,
state.index,
action,
);

return { ...state, index: ind };
}
case ActionConst.REPLACE:
Expand Down
10 changes: 5 additions & 5 deletions test/Reducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,11 @@ describe('handling actions', () => {
expect(current.key).to.eq('0_hello_');
});

it('switches to a corret tab on JUMP', () => {
it('switches to a correct tab on JUMP', () => {
Actions.main();
Actions.hello();

expect(current.key).to.eq('0_hello_');
expect(current.key).to.eq('hello_0_hello_');
});
});

Expand Down Expand Up @@ -183,7 +183,7 @@ describe('passing props from actions', () => {
expect(current.customProp).to.eq(undefined);
});

it.skip('passes props for tab scenes', () => {
it('passes props for tab scenes', () => {
const scene = (
<Scene key="root" component={noop} tabs>
<Scene key="home" component={noop} />
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('passing props from actions', () => {
expect(current.anotherProp).to.eq(undefined);
});

it.skip('passes props for nested tab scenes', () => {
it('passes props for nested tab scenes', () => {
const scene = (
<Scene key="root" component={noop} tabs>
<Scene key="home" component={noop} />
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('passing props from actions', () => {
expect(current.anotherProp).to.eq(undefined);
});

it.skip('passes props for very nested tab scenes', () => {
it('passes props for very nested tab scenes', () => {
const scene = (
<Scene key="root" component={noop} tabs>
<Scene key="home" component={noop} />
Expand Down

0 comments on commit 6526529

Please sign in to comment.