Re-export of useIsFocused from React Navigation.
Returns a boolean, true if the current screen is active.
import { useIsFocused } from 'one'
export default function ProfileScreen() {
const isFocused = useIsFocused()
return (
<View>
<Text>{isFocused ? 'Screen is focused' : 'Screen is not focused'}</Text>
</View>
)
}
Note: If you need to run side effects when a screen becomes focused rather than just checking focus state, consider using useFocusEffect instead.
Edit this page on GitHub.