Replies: 2 comments
-
@likeSo isn't this already achievable with |
Beta Was this translation helpful? Give feedback.
0 replies
-
@sandulat I tried use import React, { useEffect } from 'react';
import { StatusBar, StatusBarProps } from 'expo-status-bar';
import { useNavigation, usePathname } from 'expo-router';
const FocusAwareStatusBar = (props: StatusBarProps) => {
useEffect(() => {}, []);
const navigation = useNavigation();
const focused = navigation.isFocused();
const path = usePathname();
useEffect(() => {
console.log(
`Current page is focused: ${focused}, current page name: ${path}`
);
}, [focused]);
if (!focused) return null;
return <StatusBar {...props} />;
};
export default React.memo(FocusAwareStatusBar); But when I try push to my page ( # When back to the homepage
LOG Current page is focused: true, current page name: /
# These two: when pushing to /networking-logger page
LOG Current page is focused: true, current page name: /networking-logger
LOG Current page is focused: false, current page name: /networking-logger It seems that the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This hook is useful when you implement a
FocusAwareStatusBar
Beta Was this translation helpful? Give feedback.
All reactions