Created
May 18, 2016 16:11
-
-
Save callmephilip/02084695e8911f1ae553591353a277f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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