Created
October 23, 2020 09:16
-
-
Save tpjnorton/1cc9b95e1216aca748539eda05866b7e to your computer and use it in GitHub Desktop.
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 { useEffect, useCallback } from 'react'; | |
import { StatusBar } from 'react-native'; | |
import { useFocusEffect } from '@react-navigation/native' | |
const useStatusBar = ({ style, backgroundColor, translucent, hidden }) => { | |
useFocusEffect( | |
useCallback(() => { | |
style && StatusBar.setBarStyle(style, true); | |
backgroundColor && StatusBar.setBackgroundColor(backgroundColor, true); | |
translucent && StatusBar.setTranslucent(translucent); | |
hidden && StatusBar.setHidden(hidden); | |
}, []) | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment