Hello, I want to highlight the current active item on my Drawer, how can I get the current scene/route so I can highlight the corresponding item?
I tried Actions.currentRouter but it is undefined.
Thanks
If you use redux, maybe you can check this to get the this.props.route.key
.
If you are using the default reducer you can also get access to the current state and hence the route using:
const reducerCreate = params=>{
const defaultReducer = Reducer(params);
return (state, action)=>{
// The following is an example alternative implementation of Reducer.js .getCurrent(state)
var currentState = state;
if(currentState){
while (currentState.children){
currentState = currentState.children[currentState.index]
}
}
return defaultReducer(state, action);
}
};
Would be nice to add it to the docs of the drawer part
Most helpful comment
If you are using the default reducer you can also get access to the current state and hence the route using: