Last active
July 6, 2020 13:28
-
-
Save mortocks/b89ab2ec538b4e5e5a374972c56d1681 to your computer and use it in GitHub Desktop.
Sets the status bar style on navigation through hooks.#react-native
This file contains hidden or 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 { useCallback } from 'react'; | |
import { StatusBar } from 'react-native'; | |
import { useFocusEffect } from '@react-navigation/native'; | |
/** | |
* Sets the status bar style on navigation through hooks | |
* @param { String } style The status bar style light-content dark-content | |
*/ | |
const useStatusBarStyle = style => { | |
useFocusEffect( | |
useCallback(() => { | |
StatusBar.setBarStyle(style); | |
}, []) | |
); | |
} | |
export default useStatusBarStyle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment