Skip to content

Instantly share code, notes, and snippets.

@callmephilip
Created May 18, 2016 16:11
Show Gist options
  • Save callmephilip/02084695e8911f1ae553591353a277f7 to your computer and use it in GitHub Desktop.
Save callmephilip/02084695e8911f1ae553591353a277f7 to your computer and use it in GitHub Desktop.
import ReactNative from 'react-native';
const { NavigationExperimental } = ReactNative;
const { Reducer: NavigationReducer } = NavigationExperimental;
const feedNavigation = NavigationReducer.StackReducer({
getPushedReducerForAction: (action) => {
if (action.type === 'push') {
return (state) => (state || action.route);
}
return null;
},
initialState: {
key: 'feed',
index: 0,
children: [
{
key: 'list',
title: 'Items'
},
],
},
});
module.exports = (state, action) => {
if (action.scope && action.scope !== 'feed') {
return state;
} else {
return feedNavigation(state, action);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment