Skip to content

Instantly share code, notes, and snippets.

@f0rr0
Created September 7, 2017 12:45
Show Gist options
  • Save f0rr0/0488228d71e58ab92ce3d78375d40b91 to your computer and use it in GitHub Desktop.
Save f0rr0/0488228d71e58ab92ce3d78375d40b91 to your computer and use it in GitHub Desktop.
const statusBarMiddleware = ({ getState }) => next => (action) => {
if (!Object.values(NavigationActions).includes(action.type)) {
return next(action)
}
const currentScreen = getCurrentRouteName(getState().rootNavigation)
const result = next(action)
const nextScreen = getCurrentRouteName(getState().rootNavigation)
if (nextScreen !== currentScreen && Platform.OS === 'ios') {
setStyleForRoute(nextScreen)
}
return result
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment