React-native-router-flux: Get the current navigator stack

Created on 11 Aug 2016  Â·  6Comments  Â·  Source: aksonov/react-native-router-flux

Is there any possibility to print the navigator stack with all the routes which were pushed?

Most helpful comment

reviewing the code, I think the stack depth should be index, right?
For some reason it stays on 0 for me, even when I push other scenes on top of it... only the number inside the key changes... wierd?

All 6 comments

I also have the same problem.

any ideas on how to access this?

Check docs about ‘redux’ integration. You could see entire stack in your custom reducer.

On 02 Sep 2016, at 18:09, Oscar Franco [email protected] wrote:

any ideas on how to access this?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub https://github.com/aksonov/react-native-router-flux/issues/1045#issuecomment-244418544, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQpcSTXxCxqnOSGAmuKFOKBZr9uJYlLks5qmEpUgaJpZM4JhpaO.

screenshot 2016-09-02 22 50 21

I can see that the stack depth is represented inside scene.key
But other than parsing the data myself to determine stack depth, I cannot see anything in the docs about it...

reviewing the code, I think the stack depth should be index, right?
For some reason it stays on 0 for me, even when I push other scenes on top of it... only the number inside the key changes... wierd?

my implementation to detemine stackDepth in my reducer:

import { ActionConst } from 'react-native-router-flux';

const initialState = {
    scene: {},
    stackDepth: 0
};

export default function routes(state = initialState, action = {}) {
    switch (action.type) {
        // focus action is dispatched when a new screen comes into focus
        case ActionConst.FOCUS:
            var stackDepth = parseInt(action.scene.key.replace(action.scene.sceneKey,"").replace("_",""));
            return {
                ...state,
                scene: action.scene,
                stackDepth: stackDepth
            };

        // ...other actions

        default:
            return state;
    }
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

sreejithr picture sreejithr  Â·  3Comments

rafaelcorreiapoli picture rafaelcorreiapoli  Â·  3Comments

booboothefool picture booboothefool  Â·  3Comments

VictorK1902 picture VictorK1902  Â·  3Comments

wootwoot1234 picture wootwoot1234  Â·  3Comments